iconview: Use gdk_window_new_child()

This commit is contained in:
Benjamin Otte 2016-10-18 00:20:02 +02:00
parent 9127e49f45
commit 3fc32511b5

View File

@ -1267,48 +1267,32 @@ gtk_icon_view_realize (GtkWidget *widget)
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
GtkAllocation allocation;
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
gtk_widget_set_realized (widget, TRUE);
gtk_widget_get_allocation (widget, &allocation);
/* Make the main, clipping window */
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_OUTPUT;
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y;
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
GDK_VISIBILITY_NOTIFY_MASK,
&allocation);
gtk_widget_set_window (widget, window);
gtk_widget_register_window (widget, window);
gtk_widget_get_allocation (widget, &allocation);
/* Make the window for the icon view */
attributes.x = 0;
attributes.y = 0;
attributes.width = MAX (icon_view->priv->width, allocation.width);
attributes.height = MAX (icon_view->priv->height, allocation.height);
attributes.event_mask = (GDK_SCROLL_MASK |
GDK_SMOOTH_SCROLL_MASK |
GDK_POINTER_MOTION_MASK |
GDK_LEAVE_NOTIFY_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK) |
gtk_widget_get_events (widget);
icon_view->priv->bin_window = gdk_window_new (window,
&attributes, attributes_mask);
icon_view->priv->bin_window = gdk_window_new_child (window,
gtk_widget_get_events (widget)
| GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK
| GDK_POINTER_MOTION_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_KEY_PRESS_MASK
| GDK_KEY_RELEASE_MASK,
&(GdkRectangle) { 0, 0,
MAX (icon_view->priv->width, allocation.width),
MAX (icon_view->priv->height, allocation.height)});
gtk_widget_register_window (widget, icon_view->priv->bin_window);
gdk_window_show (icon_view->priv->bin_window);
}