[gtk+/gtk-3-22] Expander: Don’t set event_window over whole widget



commit 18a6c5c4c68bd4eec99a4e0659b769f0b3ad42e0
Author: Daniel Boles <dboles src gnome org>
Date:   Tue Aug 29 11:24:19 2017 +0100

    Expander: Don’t set event_window over whole widget
    
    realize() gave the event_window the allocation of the whole widget. This
    was wrong; it should be that of the title_gadget, as in size_allocate().
    
    This broke expanders in which :expanded is TRUE before showing: Input
    over the entire widget was sent to the title, making the child unable to
    receive it. Clicking the child unexpectedly collapsed it. Once expanded
    again, things fixed themselves as size_allocate() fixed the event_window
    alloc. So, queuing a reallocate or resize after show() was a workaround.
    
    Fix by giving event_window the allocation of the title_gadget, to match
    what size_allocate() does. That is symmetrical and just plain correct.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774134

 gtk/gtkexpander.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index 89f7582..609899d 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -602,7 +602,7 @@ gtk_expander_destroy (GtkWidget *widget)
 static void
 gtk_expander_realize (GtkWidget *widget)
 {
-  GtkAllocation allocation;
+  GtkAllocation title_allocation;
   GtkExpanderPrivate *priv;
   GdkWindow *window;
   GdkWindowAttr attributes;
@@ -610,13 +610,13 @@ gtk_expander_realize (GtkWidget *widget)
 
   priv = GTK_EXPANDER (widget)->priv;
 
-  gtk_widget_get_allocation (widget, &allocation);
+  gtk_css_gadget_get_border_allocation (priv->title_gadget, &title_allocation, NULL);
 
   attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.x = allocation.x;
-  attributes.y = allocation.y;
-  attributes.width = allocation.width;
-  attributes.height = allocation.height;
+  attributes.x = title_allocation.x;
+  attributes.y = title_allocation.y;
+  attributes.width = title_allocation.width;
+  attributes.height = title_allocation.height;
   attributes.wclass = GDK_INPUT_ONLY;
   attributes.event_mask = gtk_widget_get_events (widget)
                           | GDK_BUTTON_PRESS_MASK


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