]> spindle.queued.net Git - midori/commitdiff
Use allocation accessor in KatzeScrolled
authorChristian Dywan <christian@twotoasts.de>
Fri, 19 Feb 2010 15:46:45 +0000 (16:46 +0100)
committerChristian Dywan <christian@twotoasts.de>
Fri, 19 Feb 2010 15:48:02 +0000 (16:48 +0100)
katze/katze-scrolled.c

index c695fa05d9a2ad422571a3732aa5148a492df6f9..3fc64f525414cd038b2b1213c78b8e66a2fe0836 100644 (file)
@@ -27,6 +27,7 @@
 #endif
 #if !GTK_CHECK_VERSION (2, 18, 0)
     #define gtk_widget_set_window(wdgt, wndw) wdgt->window = wndw
+    #define gtk_widget_get_allocation (wdgt, alloc) *alloc = wdgt->allocation
 #endif
 
 #define DEFAULT_INTERVAL 50
@@ -320,6 +321,7 @@ adjust_scrollbar (KatzeScrolled* scrolled,
     gint x, y;
     gint size;
     double position;
+    GtkAllocation allocation;
     GtkWidget* window;
 
     page_size = gtk_adjustment_get_page_size (adjustment);
@@ -333,8 +335,9 @@ adjust_scrollbar (KatzeScrolled* scrolled,
         return FALSE;
     }
 
+    gtk_widget_get_allocation (widget, &allocation);
     size = page_size / (upper - lower)
-        * (horizontal ? widget->allocation.height : widget->allocation.width);
+        * (horizontal ? allocation.height : allocation.width);
     if (size != *previous_size)
     {
         *previous_size = size;
@@ -363,13 +366,13 @@ adjust_scrollbar (KatzeScrolled* scrolled,
     if (horizontal)
     {
         gtk_widget_translate_coordinates (widget, window,
-            widget->allocation.width - 20, position * widget->allocation.height, &x, &y);
+            allocation.width - 20, position * allocation.height, &x, &y);
         gdk_window_move (scrollbar_window, x, y);
     }
     else
     {
         gtk_widget_translate_coordinates (widget, window,
-            position * widget->allocation.width, widget->allocation.height - 20, &x, &y);
+            position * allocation.width, allocation.height - 20, &x, &y);
         gdk_window_move (scrollbar_window, x, y);
     }