[Goodies-commits] r3749 - ristretto/trunk/src

Stephan Arts stephan at xfce.org
Mon Dec 24 10:11:45 CET 2007


Author: stephan
Date: 2007-12-24 09:11:44 +0000 (Mon, 24 Dec 2007)
New Revision: 3749

Modified:
   ristretto/trunk/src/thumbnail_bar.c
Log:
Fix the expose function for the thumbnail bar (finally)



Modified: ristretto/trunk/src/thumbnail_bar.c
===================================================================
--- ristretto/trunk/src/thumbnail_bar.c	2007-12-24 00:57:03 UTC (rev 3748)
+++ ristretto/trunk/src/thumbnail_bar.c	2007-12-24 09:11:44 UTC (rev 3749)
@@ -304,8 +304,8 @@
     n_ex->type = ex->type;
     n_ex->window = ex->window;
     n_ex->send_event = ex->send_event;
-    n_ex->area.x = GTK_WIDGET(bar)->allocation.x;
-    n_ex->area.y = GTK_WIDGET(bar)->allocation.y;
+    n_ex->area.x = ex->area.x;
+    n_ex->area.y = ex->area.y;
     n_ex->area.width = ex->area.width;
     n_ex->area.height = ex->area.height;
     n_ex->count = ex->count;
@@ -317,39 +317,76 @@
             switch (bar->priv->orientation)
             {
                 case GTK_ORIENTATION_HORIZONTAL:
-                    if ((GTK_WIDGET(bar)->allocation.x + (GTK_WIDGET(bar)->allocation.width)) <
-                        (GTK_WIDGET(iter->data)->allocation.x + GTK_WIDGET(iter->data)->allocation.width))
+                    /* why are these widgets not filtered out with the GTK_WIDGET_VISIBLE macro?*/
+                    if (GTK_WIDGET(iter->data)->allocation.x > (GTK_WIDGET(bar)->allocation.x + GTK_WIDGET(bar)->allocation.width))
+                        break;
+                    if ((GTK_WIDGET(iter->data)->allocation.x + GTK_WIDGET(iter->data)->allocation.width) <= (GTK_WIDGET(bar)->allocation.x))
+                        break;
+
+                    /* first (partially) visible thumbnail */
+                    if (( GTK_WIDGET(iter->data)->allocation.x - GTK_WIDGET(bar)->allocation.x) < 0)
                     {
-                        n_ex->area.x = GTK_WIDGET(iter->data)->allocation.x;
-                        n_ex->area.width = (GTK_WIDGET(bar)->allocation.x + GTK_WIDGET(bar)->allocation.width) - n_ex->area.x;
+                        n_ex->area.x = GTK_WIDGET(bar)->allocation.x;
+                        n_ex->area.width = GTK_WIDGET(iter->data)->allocation.width - (GTK_WIDGET(bar)->allocation.x - GTK_WIDGET(bar)->allocation.x);
                     }
                     else
                     {
-                        n_ex->area.x = GTK_WIDGET(bar)->allocation.x;
-                        n_ex->area.width = ex->area.width;
+                        /* last (partially) visible thumbnail */
+                        if ((GTK_WIDGET(bar)->allocation.x + (GTK_WIDGET(bar)->allocation.width)) <
+                            (GTK_WIDGET(iter->data)->allocation.x + GTK_WIDGET(iter->data)->allocation.width))
+                        {
+                            n_ex->area.x = GTK_WIDGET(iter->data)->allocation.x;
+                            n_ex->area.width = GTK_WIDGET(bar)->allocation.x + GTK_WIDGET(bar)->allocation.width - n_ex->area.x;
+                        }
+                        else
+                        {
+                            /* everything in between */
+                            n_ex->area.x = GTK_WIDGET(iter->data)->allocation.x;
+                            n_ex->area.width = GTK_WIDGET(iter->data)->allocation.width;
+                        }
+
                     }
+                    if (n_ex->region)
+                        gdk_region_destroy(n_ex->region);
+                    n_ex->region = gdk_region_rectangle(&(n_ex->area));
+                    gtk_container_propagate_expose(GTK_CONTAINER(widget), GTK_WIDGET(iter->data), n_ex);
                     break;
-                    break;
                 case GTK_ORIENTATION_VERTICAL:
-                    if ((GTK_WIDGET(bar)->allocation.y + GTK_WIDGET(bar)->allocation.height) <
-                        (GTK_WIDGET(iter->data)->allocation.y + GTK_WIDGET(iter->data)->allocation.height))
+                    /* why are these widgets not filtered out with the GTK_WIDGET_VISIBLE macro?*/
+                    if (GTK_WIDGET(iter->data)->allocation.y > (GTK_WIDGET(bar)->allocation.y + GTK_WIDGET(bar)->allocation.height))
+                        break;
+                    if ((GTK_WIDGET(iter->data)->allocation.y + GTK_WIDGET(iter->data)->allocation.height) <= (GTK_WIDGET(bar)->allocation.y))
+                        break;
+
+                    /* first (partially) visible thumbnail */
+                    if (( GTK_WIDGET(iter->data)->allocation.y - GTK_WIDGET(bar)->allocation.y) < 0)
                     {
-                        n_ex->area.y = GTK_WIDGET(iter->data)->allocation.y;
-                        n_ex->area.height = (GTK_WIDGET(bar)->allocation.y + GTK_WIDGET(bar)->allocation.height) - n_ex->area.y;
-                        g_debug("%d:%d", (GTK_WIDGET(bar)->allocation.y + GTK_WIDGET(bar)->allocation.height),GTK_WIDGET(iter->data)->allocation.y + GTK_WIDGET(iter->data)->allocation.height);
+                        n_ex->area.y = GTK_WIDGET(bar)->allocation.y;
+                        n_ex->area.height = GTK_WIDGET(iter->data)->allocation.height - (GTK_WIDGET(bar)->allocation.y - GTK_WIDGET(bar)->allocation.y);
                     }
                     else
                     {
-                        n_ex->area.y = GTK_WIDGET(bar)->allocation.y;
-                        n_ex->area.height = ex->area.height;
-                        g_debug("B");
+                        /* last (partially) visible thumbnail */
+                        if ((GTK_WIDGET(bar)->allocation.y + (GTK_WIDGET(bar)->allocation.height)) <
+                            (GTK_WIDGET(iter->data)->allocation.y + GTK_WIDGET(iter->data)->allocation.height))
+                        {
+                            n_ex->area.y = GTK_WIDGET(iter->data)->allocation.y;
+                            n_ex->area.height = GTK_WIDGET(bar)->allocation.y + GTK_WIDGET(bar)->allocation.height - n_ex->area.y;
+                        }
+                        else
+                        {
+                            /* everything in between */
+                            n_ex->area.y = GTK_WIDGET(iter->data)->allocation.y;
+                            n_ex->area.height = GTK_WIDGET(iter->data)->allocation.height;
+                        }
+
                     }
+                    if (n_ex->region)
+                        gdk_region_destroy(n_ex->region);
+                    n_ex->region = gdk_region_rectangle(&(n_ex->area));
+                    gtk_container_propagate_expose(GTK_CONTAINER(widget), GTK_WIDGET(iter->data), n_ex);
                     break;
             }
-            if (n_ex->region)
-                gdk_region_destroy(n_ex->region);
-            n_ex->region = gdk_region_rectangle(&(n_ex->area));
-            gtk_container_propagate_expose(GTK_CONTAINER(widget), GTK_WIDGET(iter->data), n_ex);
         }
         iter = g_slist_next(iter);
     }




More information about the Goodies-commits mailing list