Commit 3d4cd4db authored by Alexander Larsson's avatar Alexander Larsson

Add gtk_widget_(un)register_window

This replaces the previously hardcoded calls to gdk_window_set_user_data,
and also lets us track which windows are a part of a widget. Old code
should continue working as is, but new features that require the
windows may not work perfectly.

We need this for the transparent widget support to work, as we need
to specially mark the windows of child widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
parent 4d3c77f9
...@@ -3839,6 +3839,7 @@ gtk_widget_queue_resize ...@@ -3839,6 +3839,7 @@ gtk_widget_queue_resize
gtk_widget_queue_resize_no_redraw gtk_widget_queue_resize_no_redraw
gtk_widget_realize gtk_widget_realize
gtk_widget_region_intersect gtk_widget_region_intersect
gtk_widget_register_window
gtk_widget_remove_accelerator gtk_widget_remove_accelerator
gtk_widget_remove_mnemonic_label gtk_widget_remove_mnemonic_label
gtk_widget_render_icon gtk_widget_render_icon
...@@ -3909,6 +3910,7 @@ gtk_widget_trigger_tooltip_query ...@@ -3909,6 +3910,7 @@ gtk_widget_trigger_tooltip_query
gtk_widget_unmap gtk_widget_unmap
gtk_widget_unparent gtk_widget_unparent
gtk_widget_unrealize gtk_widget_unrealize
gtk_widget_unregister_window
gtk_widget_unset_state_flags gtk_widget_unset_state_flags
gtk_widget_insert_action_group gtk_widget_insert_action_group
#ifdef GDK_WINDOWING_WIN32 #ifdef GDK_WINDOWING_WIN32
......
...@@ -1420,7 +1420,7 @@ gtk_button_realize (GtkWidget *widget) ...@@ -1420,7 +1420,7 @@ gtk_button_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (window, priv->event_window = gdk_window_new (window,
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, button); gtk_widget_register_window (widget, priv->event_window);
} }
static void static void
...@@ -1434,7 +1434,7 @@ gtk_button_unrealize (GtkWidget *widget) ...@@ -1434,7 +1434,7 @@ gtk_button_unrealize (GtkWidget *widget)
if (priv->event_window) if (priv->event_window)
{ {
gdk_window_set_user_data (priv->event_window, NULL); gtk_widget_unregister_window (widget, priv->event_window);
gdk_window_destroy (priv->event_window); gdk_window_destroy (priv->event_window);
priv->event_window = NULL; priv->event_window = NULL;
} }
......
...@@ -1593,7 +1593,7 @@ calendar_realize_arrows (GtkCalendar *calendar) ...@@ -1593,7 +1593,7 @@ calendar_realize_arrows (GtkCalendar *calendar)
&attributes, &attributes,
attributes_mask); attributes_mask);
gdk_window_set_user_data (priv->arrow_win[i], widget); gtk_widget_register_window (widget, priv->arrow_win[i]);
} }
priv->arrow_prelight = 0x0; priv->arrow_prelight = 0x0;
} }
...@@ -1614,7 +1614,7 @@ calendar_unrealize_arrows (GtkCalendar *calendar) ...@@ -1614,7 +1614,7 @@ calendar_unrealize_arrows (GtkCalendar *calendar)
{ {
if (priv->arrow_win[i]) if (priv->arrow_win[i])
{ {
gdk_window_set_user_data (priv->arrow_win[i], NULL); gtk_widget_unregister_window (GTK_WIDGET (calendar), priv->arrow_win[i]);
gdk_window_destroy (priv->arrow_win[i]); gdk_window_destroy (priv->arrow_win[i]);
priv->arrow_win[i] = NULL; priv->arrow_win[i] = NULL;
} }
...@@ -1704,7 +1704,7 @@ gtk_calendar_realize (GtkWidget *widget) ...@@ -1704,7 +1704,7 @@ gtk_calendar_realize (GtkWidget *widget)
priv->main_win = gdk_window_new (gtk_widget_get_window (widget), priv->main_win = gdk_window_new (gtk_widget_get_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (priv->main_win, widget); gtk_widget_register_window (widget, priv->main_win);
calendar_realize_arrows (GTK_CALENDAR (widget)); calendar_realize_arrows (GTK_CALENDAR (widget));
} }
...@@ -1718,7 +1718,7 @@ gtk_calendar_unrealize (GtkWidget *widget) ...@@ -1718,7 +1718,7 @@ gtk_calendar_unrealize (GtkWidget *widget)
if (priv->main_win) if (priv->main_win)
{ {
gdk_window_set_user_data (priv->main_win, NULL); gtk_widget_unregister_window (widget, priv->main_win);
gdk_window_destroy (priv->main_win); gdk_window_destroy (priv->main_win);
priv->main_win = NULL; priv->main_win = NULL;
} }
......
...@@ -628,7 +628,7 @@ swatch_realize (GtkWidget *widget) ...@@ -628,7 +628,7 @@ swatch_realize (GtkWidget *widget)
swatch->priv->event_window = swatch->priv->event_window =
gdk_window_new (window, gdk_window_new (window,
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (swatch->priv->event_window, widget); gtk_widget_register_window (widget, swatch->priv->event_window);
} }
static void static void
...@@ -638,7 +638,7 @@ swatch_unrealize (GtkWidget *widget) ...@@ -638,7 +638,7 @@ swatch_unrealize (GtkWidget *widget)
if (swatch->priv->event_window) if (swatch->priv->event_window)
{ {
gdk_window_set_user_data (swatch->priv->event_window, NULL); gtk_widget_unregister_window (widget, swatch->priv->event_window);
gdk_window_destroy (swatch->priv->event_window); gdk_window_destroy (swatch->priv->event_window);
swatch->priv->event_window = NULL; swatch->priv->event_window = NULL;
} }
......
...@@ -194,7 +194,7 @@ gtk_drawing_area_realize (GtkWidget *widget) ...@@ -194,7 +194,7 @@ gtk_drawing_area_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget), window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (window, darea); gtk_widget_register_window (widget, window);
gtk_widget_set_window (widget, window); gtk_widget_set_window (widget, window);
gtk_style_context_set_background (gtk_widget_get_style_context (widget), gtk_style_context_set_background (gtk_widget_get_style_context (widget),
......
...@@ -2973,7 +2973,7 @@ realize_icon_info (GtkWidget *widget, ...@@ -2973,7 +2973,7 @@ realize_icon_info (GtkWidget *widget,
icon_info->window = gdk_window_new (gtk_widget_get_window (widget), icon_info->window = gdk_window_new (gtk_widget_get_window (widget),
&attributes, &attributes,
attributes_mask); attributes_mask);
gdk_window_set_user_data (icon_info->window, widget); gtk_widget_register_window (widget, icon_info->window);
gtk_widget_queue_resize (widget); gtk_widget_queue_resize (widget);
} }
...@@ -3100,7 +3100,7 @@ gtk_entry_realize (GtkWidget *widget) ...@@ -3100,7 +3100,7 @@ gtk_entry_realize (GtkWidget *widget)
&attributes, &attributes,
attributes_mask); attributes_mask);
gdk_window_set_user_data (priv->text_area, entry); gtk_widget_register_window (widget, priv->text_area);
if (attributes_mask & GDK_WA_CURSOR) if (attributes_mask & GDK_WA_CURSOR)
g_object_unref (attributes.cursor); g_object_unref (attributes.cursor);
...@@ -3145,7 +3145,7 @@ gtk_entry_unrealize (GtkWidget *widget) ...@@ -3145,7 +3145,7 @@ gtk_entry_unrealize (GtkWidget *widget)
if (priv->text_area) if (priv->text_area)
{ {
gdk_window_set_user_data (priv->text_area, NULL); gtk_widget_unregister_window (widget, priv->text_area);
gdk_window_destroy (priv->text_area); gdk_window_destroy (priv->text_area);
priv->text_area = NULL; priv->text_area = NULL;
} }
......
...@@ -429,7 +429,7 @@ gtk_event_box_realize (GtkWidget *widget) ...@@ -429,7 +429,7 @@ gtk_event_box_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget), window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gtk_widget_set_window (widget, window); gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget); gtk_widget_register_window (widget, window);
} }
else else
{ {
...@@ -448,7 +448,7 @@ gtk_event_box_realize (GtkWidget *widget) ...@@ -448,7 +448,7 @@ gtk_event_box_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (window, priv->event_window = gdk_window_new (window,
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, widget); gtk_widget_register_window (widget, priv->event_window);
} }
if (visible_window) if (visible_window)
...@@ -462,7 +462,7 @@ gtk_event_box_unrealize (GtkWidget *widget) ...@@ -462,7 +462,7 @@ gtk_event_box_unrealize (GtkWidget *widget)
if (priv->event_window != NULL) if (priv->event_window != NULL)
{ {
gdk_window_set_user_data (priv->event_window, NULL); gtk_widget_unregister_window (widget, priv->event_window);
gdk_window_destroy (priv->event_window); gdk_window_destroy (priv->event_window);
priv->event_window = NULL; priv->event_window = NULL;
} }
......
...@@ -577,7 +577,7 @@ gtk_expander_realize (GtkWidget *widget) ...@@ -577,7 +577,7 @@ gtk_expander_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget), priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, widget); gtk_widget_register_window (widget, priv->event_window);
} }
static void static void
...@@ -587,7 +587,7 @@ gtk_expander_unrealize (GtkWidget *widget) ...@@ -587,7 +587,7 @@ gtk_expander_unrealize (GtkWidget *widget)
if (priv->event_window) if (priv->event_window)
{ {
gdk_window_set_user_data (priv->event_window, NULL); gtk_widget_unregister_window (widget, priv->event_window);
gdk_window_destroy (priv->event_window); gdk_window_destroy (priv->event_window);
priv->event_window = NULL; priv->event_window = NULL;
} }
......
...@@ -379,7 +379,7 @@ gtk_fixed_realize (GtkWidget *widget) ...@@ -379,7 +379,7 @@ gtk_fixed_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget), window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gtk_widget_set_window (widget, window); gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget); gtk_widget_register_window (widget, window);
gtk_style_context_set_background (gtk_widget_get_style_context (widget), gtk_style_context_set_background (gtk_widget_get_style_context (widget),
window); window);
......
...@@ -1301,7 +1301,7 @@ gtk_icon_view_realize (GtkWidget *widget) ...@@ -1301,7 +1301,7 @@ gtk_icon_view_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget), window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gtk_widget_set_window (widget, window); gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget); gtk_widget_register_window (widget, window);
gtk_widget_get_allocation (widget, &allocation); gtk_widget_get_allocation (widget, &allocation);
...@@ -1322,7 +1322,7 @@ gtk_icon_view_realize (GtkWidget *widget) ...@@ -1322,7 +1322,7 @@ gtk_icon_view_realize (GtkWidget *widget)
icon_view->priv->bin_window = gdk_window_new (window, icon_view->priv->bin_window = gdk_window_new (window,
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (icon_view->priv->bin_window, widget); gtk_widget_register_window (widget, icon_view->priv->bin_window);
context = gtk_widget_get_style_context (widget); context = gtk_widget_get_style_context (widget);
gtk_style_context_set_background (context, icon_view->priv->bin_window); gtk_style_context_set_background (context, icon_view->priv->bin_window);
...@@ -1338,7 +1338,7 @@ gtk_icon_view_unrealize (GtkWidget *widget) ...@@ -1338,7 +1338,7 @@ gtk_icon_view_unrealize (GtkWidget *widget)
icon_view = GTK_ICON_VIEW (widget); icon_view = GTK_ICON_VIEW (widget);
gdk_window_set_user_data (icon_view->priv->bin_window, NULL); gtk_widget_unregister_window (widget, icon_view->priv->bin_window);
gdk_window_destroy (icon_view->priv->bin_window); gdk_window_destroy (icon_view->priv->bin_window);
icon_view->priv->bin_window = NULL; icon_view->priv->bin_window = NULL;
......
...@@ -260,7 +260,7 @@ gtk_invisible_realize (GtkWidget *widget) ...@@ -260,7 +260,7 @@ gtk_invisible_realize (GtkWidget *widget)
window = gdk_window_new (parent, &attributes, attributes_mask); window = gdk_window_new (parent, &attributes, attributes_mask);
gtk_widget_set_window (widget, window); gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget); gtk_widget_register_window (widget, window);
} }
static void static void
......
...@@ -4982,7 +4982,7 @@ gtk_label_create_window (GtkLabel *label) ...@@ -4982,7 +4982,7 @@ gtk_label_create_window (GtkLabel *label)
priv->select_info->window = gdk_window_new (gtk_widget_get_window (widget), priv->select_info->window = gdk_window_new (gtk_widget_get_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (priv->select_info->window, widget); gtk_widget_register_window (widget, priv->select_info->window);
if (attributes_mask & GDK_WA_CURSOR) if (attributes_mask & GDK_WA_CURSOR)
g_object_unref (attributes.cursor); g_object_unref (attributes.cursor);
...@@ -4998,7 +4998,7 @@ gtk_label_destroy_window (GtkLabel *label) ...@@ -4998,7 +4998,7 @@ gtk_label_destroy_window (GtkLabel *label)
if (priv->select_info->window == NULL) if (priv->select_info->window == NULL)
return; return;
gdk_window_set_user_data (priv->select_info->window, NULL); gtk_widget_unregister_window (GTK_WIDGET (label), priv->select_info->window);
gdk_window_destroy (priv->select_info->window); gdk_window_destroy (priv->select_info->window);
priv->select_info->window = NULL; priv->select_info->window = NULL;
} }
......
...@@ -885,7 +885,7 @@ gtk_layout_realize (GtkWidget *widget) ...@@ -885,7 +885,7 @@ gtk_layout_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget), window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gtk_widget_set_window (widget, window); gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget); gtk_widget_register_window (widget, window);
gtk_widget_get_allocation (widget, &allocation); gtk_widget_get_allocation (widget, &allocation);
...@@ -899,7 +899,7 @@ gtk_layout_realize (GtkWidget *widget) ...@@ -899,7 +899,7 @@ gtk_layout_realize (GtkWidget *widget)
priv->bin_window = gdk_window_new (window, priv->bin_window = gdk_window_new (window,
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (priv->bin_window, widget); gtk_widget_register_window (widget, priv->bin_window);
gtk_style_context_set_background (gtk_widget_get_style_context (widget), priv->bin_window); gtk_style_context_set_background (gtk_widget_get_style_context (widget), priv->bin_window);
tmp_list = priv->children; tmp_list = priv->children;
...@@ -958,7 +958,7 @@ gtk_layout_unrealize (GtkWidget *widget) ...@@ -958,7 +958,7 @@ gtk_layout_unrealize (GtkWidget *widget)
GtkLayout *layout = GTK_LAYOUT (widget); GtkLayout *layout = GTK_LAYOUT (widget);
GtkLayoutPrivate *priv = layout->priv; GtkLayoutPrivate *priv = layout->priv;
gdk_window_set_user_data (priv->bin_window, NULL); gtk_widget_unregister_window (widget, priv->bin_window);
gdk_window_destroy (priv->bin_window); gdk_window_destroy (priv->bin_window);
priv->bin_window = NULL; priv->bin_window = NULL;
......
...@@ -2551,7 +2551,7 @@ gtk_menu_realize (GtkWidget *widget) ...@@ -2551,7 +2551,7 @@ gtk_menu_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget), window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gtk_widget_set_window (widget, window); gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget); gtk_widget_register_window (widget, window);
get_menu_padding (widget, &padding); get_menu_padding (widget, &padding);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
...@@ -2576,7 +2576,7 @@ gtk_menu_realize (GtkWidget *widget) ...@@ -2576,7 +2576,7 @@ gtk_menu_realize (GtkWidget *widget)
priv->view_window = gdk_window_new (window, priv->view_window = gdk_window_new (window,
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (priv->view_window, menu); gtk_widget_register_window (widget, priv->view_window);
gtk_widget_get_allocation (widget, &allocation); gtk_widget_get_allocation (widget, &allocation);
...@@ -2592,7 +2592,7 @@ gtk_menu_realize (GtkWidget *widget) ...@@ -2592,7 +2592,7 @@ gtk_menu_realize (GtkWidget *widget)
priv->bin_window = gdk_window_new (priv->view_window, priv->bin_window = gdk_window_new (priv->view_window,
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (priv->bin_window, menu); gtk_widget_register_window (widget, priv->bin_window);
children = GTK_MENU_SHELL (menu)->priv->children; children = GTK_MENU_SHELL (menu)->priv->children;
while (children) while (children)
...@@ -2648,7 +2648,7 @@ menu_grab_transfer_window_get (GtkMenu *menu) ...@@ -2648,7 +2648,7 @@ menu_grab_transfer_window_get (GtkMenu *menu)
window = gdk_window_new (gtk_widget_get_root_window (GTK_WIDGET (menu)), window = gdk_window_new (gtk_widget_get_root_window (GTK_WIDGET (menu)),
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (window, menu); gtk_widget_register_window (GTK_WIDGET (menu), window);
gdk_window_show (window); gdk_window_show (window);
...@@ -2664,7 +2664,7 @@ menu_grab_transfer_window_destroy (GtkMenu *menu) ...@@ -2664,7 +2664,7 @@ menu_grab_transfer_window_destroy (GtkMenu *menu)
GdkWindow *window = g_object_get_data (G_OBJECT (menu), "gtk-menu-transfer-window"); GdkWindow *window = g_object_get_data (G_OBJECT (menu), "gtk-menu-transfer-window");
if (window) if (window)
{ {
gdk_window_set_user_data (window, NULL); gtk_widget_unregister_window (GTK_WIDGET (menu), window);
gdk_window_destroy (window); gdk_window_destroy (window);
g_object_set_data (G_OBJECT (menu), I_("gtk-menu-transfer-window"), NULL); g_object_set_data (G_OBJECT (menu), I_("gtk-menu-transfer-window"), NULL);
} }
...@@ -2678,11 +2678,11 @@ gtk_menu_unrealize (GtkWidget *widget) ...@@ -2678,11 +2678,11 @@ gtk_menu_unrealize (GtkWidget *widget)
menu_grab_transfer_window_destroy (menu); menu_grab_transfer_window_destroy (menu);
gdk_window_set_user_data (priv->view_window, NULL); gtk_widget_unregister_window (widget, priv->view_window);
gdk_window_destroy (priv->view_window); gdk_window_destroy (priv->view_window);
priv->view_window = NULL; priv->view_window = NULL;
gdk_window_set_user_data (priv->bin_window, NULL); gtk_widget_unregister_window (widget, priv->bin_window);
gdk_window_destroy (priv->bin_window); gdk_window_destroy (priv->bin_window);
priv->bin_window = NULL; priv->bin_window = NULL;
......
...@@ -1566,7 +1566,7 @@ gtk_menu_item_realize (GtkWidget *widget) ...@@ -1566,7 +1566,7 @@ gtk_menu_item_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget), priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, widget); gtk_widget_register_window (widget, priv->event_window);
} }
static void static void
...@@ -1575,7 +1575,7 @@ gtk_menu_item_unrealize (GtkWidget *widget) ...@@ -1575,7 +1575,7 @@ gtk_menu_item_unrealize (GtkWidget *widget)
GtkMenuItem *menu_item = GTK_MENU_ITEM (widget); GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
GtkMenuItemPrivate *priv = menu_item->priv; GtkMenuItemPrivate *priv = menu_item->priv;
gdk_window_set_user_data (priv->event_window, NULL); gtk_widget_unregister_window (widget, priv->event_window);
gdk_window_destroy (priv->event_window); gdk_window_destroy (priv->event_window);
priv->event_window = NULL; priv->event_window = NULL;
......
...@@ -649,7 +649,7 @@ gtk_menu_shell_realize (GtkWidget *widget) ...@@ -649,7 +649,7 @@ gtk_menu_shell_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget), window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gtk_widget_set_window (widget, window); gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget); gtk_widget_register_window (widget, window);
context = gtk_widget_get_style_context (widget); context = gtk_widget_get_style_context (widget);
gtk_style_context_set_background (context, window); gtk_style_context_set_background (context, window);
......
...@@ -397,7 +397,7 @@ gtk_misc_realize (GtkWidget *widget) ...@@ -397,7 +397,7 @@ gtk_misc_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gtk_widget_set_window (widget, window); gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget); gtk_widget_register_window (widget, window);
gdk_window_set_background_pattern (window, NULL); gdk_window_set_background_pattern (window, NULL);
} }
} }
......
...@@ -1908,7 +1908,7 @@ gtk_notebook_realize (GtkWidget *widget) ...@@ -1908,7 +1908,7 @@ gtk_notebook_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget), priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, notebook); gtk_widget_register_window (widget, priv->event_window);
} }
static void static void
...@@ -1917,13 +1917,13 @@ gtk_notebook_unrealize (GtkWidget *widget) ...@@ -1917,13 +1917,13 @@ gtk_notebook_unrealize (GtkWidget *widget)
GtkNotebook *notebook = GTK_NOTEBOOK (widget); GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkNotebookPrivate *priv = notebook->priv; GtkNotebookPrivate *priv = notebook->priv;
gdk_window_set_user_data (priv->event_window, NULL); gtk_widget_unregister_window (widget, priv->event_window);
gdk_window_destroy (priv->event_window); gdk_window_destroy (priv->event_window);
priv->event_window = NULL; priv->event_window = NULL;
if (priv->drag_window) if (priv->drag_window)
{ {
gdk_window_set_user_data (priv->drag_window, NULL); gtk_widget_unregister_window (widget, priv->drag_window);
gdk_window_destroy (priv->drag_window); gdk_window_destroy (priv->drag_window);
priv->drag_window = NULL; priv->drag_window = NULL;
} }
...@@ -3126,7 +3126,7 @@ show_drag_window (GtkNotebook *notebook, ...@@ -3126,7 +3126,7 @@ show_drag_window (GtkNotebook *notebook,
priv->drag_window = gdk_window_new (gtk_widget_get_parent_window (widget), priv->drag_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, &attributes,
attributes_mask); attributes_mask);
gdk_window_set_user_data (priv->drag_window, widget); gtk_widget_register_window (widget, priv->drag_window);
gdk_window_set_background_rgba (priv->drag_window, &transparent); gdk_window_set_background_rgba (priv->drag_window, &transparent);
} }
......
...@@ -183,7 +183,7 @@ gtk_offscreen_window_realize (GtkWidget *widget) ...@@ -183,7 +183,7 @@ gtk_offscreen_window_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget), window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gtk_widget_set_window (widget, window); gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget); gtk_widget_register_window (widget, window);
child = gtk_bin_get_child (bin); child = gtk_bin_get_child (bin);
if (child) if (child)
......
...@@ -105,7 +105,7 @@ gtk_overlay_create_child_window (GtkOverlay *overlay, ...@@ -105,7 +105,7 @@ gtk_overlay_create_child_window (GtkOverlay *overlay,
window = gdk_window_new (gtk_widget_get_window (widget), window = gdk_window_new (gtk_widget_get_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (window, overlay); gtk_widget_register_window (widget, window);
gtk_style_context_set_background (gtk_widget_get_style_context (widget), window); gtk_style_context_set_background (gtk_widget_get_style_context (widget), window);
gtk_widget_set_parent_window (child, window); gtk_widget_set_parent_window (child, window);
...@@ -443,7 +443,7 @@ gtk_overlay_unrealize (GtkWidget *widget) ...@@ -443,7 +443,7 @@ gtk_overlay_unrealize (GtkWidget *widget)
child = children->data; child = children->data;
gtk_widget_set_parent_window (child->widget, NULL); gtk_widget_set_parent_window (child->widget, NULL);
gdk_window_set_user_data (child->window, NULL); gtk_widget_unregister_window (widget, child->window);
gdk_window_destroy (child->window); gdk_window_destroy (child->window);
child->window = NULL; child->window = NULL;
} }
...@@ -539,7 +539,7 @@ gtk_overlay_remove (GtkContainer *container, ...@@ -539,7 +539,7 @@ gtk_overlay_remove (GtkContainer *container,
{ {
if (child->window != NULL) if (child->window != NULL)
{ {
gdk_window_set_user_data (child->window, NULL); gtk_widget_unregister_window (GTK_WIDGET (container), child->window);
gdk_window_destroy (child->window); gdk_window_destroy (child->window);
} }
......
...@@ -1320,7 +1320,7 @@ gtk_paned_create_child_window (GtkPaned *paned, ...@@ -1320,7 +1320,7 @@ gtk_paned_create_child_window (GtkPaned *paned,
window = gdk_window_new (gtk_widget_get_window (widget), window = gdk_window_new (gtk_widget_get_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (window, paned); gtk_widget_register_window (widget, window);
gtk_style_context_set_background (gtk_widget_get_style_context (widget), window); gtk_style_context_set_background (gtk_widget_get_style_context (widget), window);
if (child) if (child)
...@@ -1366,7 +1366,7 @@ gtk_paned_realize (GtkWidget *widget) ...@@ -1366,7 +1366,7 @@ gtk_paned_realize (GtkWidget *widget)
priv->handle = gdk_window_new (window, priv->handle = gdk_window_new (window,
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (priv->handle, paned); gtk_widget_register_window (widget, priv->handle);
if (attributes_mask & GDK_WA_CURSOR) if (attributes_mask & GDK_WA_CURSOR)
g_object_unref (attributes.cursor); g_object_unref (attributes.cursor);
...@@ -1382,19 +1382,19 @@ gtk_paned_unrealize (GtkWidget *widget) ...@@ -1382,19 +1382,19 @@ gtk_paned_unrealize (GtkWidget *widget)
if (priv->child2) if (priv->child2)
gtk_widget_set_parent_window (priv->child2, NULL); gtk_widget_set_parent_window (priv->child2, NULL);
gdk_window_set_user_data (priv->child2_window, NULL); gtk_widget_unregister_window (widget, priv->child2_window);
gdk_window_destroy (priv->child2_window); gdk_window_destroy (priv->child2_window);
priv->child2_window = NULL; priv->child2_window = NULL;
if (priv->child1) if (priv->child1)
gtk_widget_set_parent_window (priv->child1, NULL); gtk_widget_set_parent_window (priv->child1, NULL);
gdk_window_set_user_data (priv->child1_window, NULL); gtk_widget_unregister_window (widget, priv->child1_window);
gdk_window_destroy (priv->child1_window); gdk_window_destroy (priv->child1_window);
priv->child1_window = NULL; priv->child1_window = NULL;
if (priv->handle) if (priv->handle)
{ {
gdk_window_set_user_data (priv->handle, NULL); gtk_widget_unregister_window (widget, priv->handle);
gdk_window_destroy (priv->handle); gdk_window_destroy (priv->handle);
priv->handle = NULL; priv->handle = NULL;
} }
......