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

Stephan Arts stephan at xfce.org
Mon Aug 13 13:36:34 CEST 2007


Author: stephan
Date: 2007-08-13 11:36:34 +0000 (Mon, 13 Aug 2007)
New Revision: 2994

Modified:
   ristretto/trunk/src/thumbnail_viewer.c
Log:
Fix screen-flikker of thumbnail-viewer and a cache-bug



Modified: ristretto/trunk/src/thumbnail_viewer.c
===================================================================
--- ristretto/trunk/src/thumbnail_viewer.c	2007-08-13 11:13:31 UTC (rev 2993)
+++ ristretto/trunk/src/thumbnail_viewer.c	2007-08-13 11:36:34 UTC (rev 2994)
@@ -255,16 +255,31 @@
                         &(widget->style->bg[GTK_STATE_NORMAL]));
     
     gint i;
-    gdk_window_clear(widget->window);
     gint begin = viewer->priv->offset / viewer->priv->dimension;
     gint end = 0;
     switch (viewer->priv->orientation)
     {
         case GTK_ORIENTATION_HORIZONTAL:
             end = widget->allocation.width / viewer->priv->dimension + begin;
+            if (widget->allocation.width > (end - begin) * viewer->priv->dimension)
+            {
+                gdk_window_clear_area(widget->window, 
+                                        16 + widget->allocation.width - viewer->priv->offset, 
+                                        0,
+                                        widget->allocation.width - viewer->priv->offset - 16,
+                                        widget->allocation.height);
+            }
             break;
         case GTK_ORIENTATION_VERTICAL:
             end = widget->allocation.height / viewer->priv->dimension + begin;
+            if (widget->allocation.height > (end - begin) * viewer->priv->dimension)
+            {
+                gdk_window_clear_area(widget->window, 
+                                        0,
+                                        16 + widget->allocation.height - viewer->priv->offset, 
+                                        widget->allocation.width,
+                                        widget->allocation.height - viewer->priv->offset - 16);
+            }
             break;
     }
     GdkPixmap *pixmap = NULL;
@@ -575,12 +590,15 @@
     if ((nr == cache->begin) || (nr == cache->end))
     {
         GdkPixbuf *pixbuf = g_slist_nth_data(cache->pixmaps, nr - cache->begin);
-        g_object_unref(pixbuf);
-        cache->pixmaps = g_slist_remove(cache->pixmaps, pixbuf);
-        if (nr == cache->begin)
-            cache->begin++;
-        else
-            cache->end--;
+        if (pixbuf)
+        {
+            g_object_unref(pixbuf);
+            cache->pixmaps = g_slist_remove(cache->pixmaps, pixbuf);
+            if (nr == cache->begin)
+                cache->begin++;
+            else
+                cache->end--;
+        }
     }
     return TRUE;   
 }




More information about the Goodies-commits mailing list