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
This commit is contained in:
Daniel Boles
2017-08-29 11:24:19 +01:00
parent a827e92226
commit 18a6c5c4c6

View File

@@ -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