button: Use gdk_window_new_input()

This commit is contained in:
Benjamin Otte 2016-10-17 20:13:46 +02:00
parent d22e5e69d9
commit 31b5ba5bad

View File

@ -1181,34 +1181,23 @@ gtk_button_realize (GtkWidget *widget)
GtkButtonPrivate *priv = button->priv;
GtkAllocation allocation;
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
gtk_widget_get_allocation (widget, &allocation);
gtk_widget_set_realized (widget, TRUE);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_ONLY;
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_TOUCH_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y;
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
priv->event_window = gdk_window_new (window,
&attributes, attributes_mask);
priv->event_window = gdk_window_new_input (window,
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_TOUCH_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
&allocation);
gtk_widget_register_window (widget, priv->event_window);
}