[gtk+] scrolledwindow: Fix calls to gdk_window_move_resize()



commit a9a59ac55e01333f8e72ac8807eb6d4c9a9f5017
Author: Tristan Van Berkom <tristan vanberkom codethink co uk>
Date:   Fri Jun 10 21:16:53 2016 +0900

    scrolledwindow: Fix calls to gdk_window_move_resize()
    
    This is a bit of fallout from 34feba1, now that we resolve
    the has_indicators value earlier than realize, it becomes
    possible to call gdk_window_move_resize() before realization.
    
    Just added the appropriate checks.

 gtk/gtkscrolledwindow.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 7d149ae..df7302c 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1710,11 +1710,12 @@ gtk_scrolled_window_allocate (GtkCssGadget        *gadget,
                                               &child_allocation);
       if (priv->use_indicators)
         {
-          gdk_window_move_resize (priv->hindicator.window,
-                                  child_allocation.x,
-                                  child_allocation.y,
-                                  child_allocation.width,
-                                  child_allocation.height);
+         if (gtk_widget_get_realized (widget))
+           gdk_window_move_resize (priv->hindicator.window,
+                                   child_allocation.x,
+                                   child_allocation.y,
+                                   child_allocation.width,
+                                   child_allocation.height);
           child_allocation.x = 0;
           child_allocation.y = 0;
         }
@@ -1729,11 +1730,12 @@ gtk_scrolled_window_allocate (GtkCssGadget        *gadget,
                                               &child_allocation);
       if (priv->use_indicators)
         {
-          gdk_window_move_resize (priv->vindicator.window,
-                                  child_allocation.x,
-                                  child_allocation.y,
-                                  child_allocation.width,
-                                  child_allocation.height);
+         if (gtk_widget_get_realized (widget))
+           gdk_window_move_resize (priv->vindicator.window,
+                                   child_allocation.x,
+                                   child_allocation.y,
+                                   child_allocation.width,
+                                   child_allocation.height);
           child_allocation.x = 0;
           child_allocation.y = 0;
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]