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
gtk_widget_queue_resize_no_redraw
gtk_widget_realize
gtk_widget_region_intersect
gtk_widget_register_window
gtk_widget_remove_accelerator
gtk_widget_remove_mnemonic_label
gtk_widget_render_icon
......@@ -3909,6 +3910,7 @@ gtk_widget_trigger_tooltip_query
gtk_widget_unmap
gtk_widget_unparent
gtk_widget_unrealize
gtk_widget_unregister_window
gtk_widget_unset_state_flags
gtk_widget_insert_action_group
#ifdef GDK_WINDOWING_WIN32
......
......@@ -1420,7 +1420,7 @@ gtk_button_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (window,
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, button);
gtk_widget_register_window (widget, priv->event_window);
}
static void
......@@ -1434,7 +1434,7 @@ gtk_button_unrealize (GtkWidget *widget)
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);
priv->event_window = NULL;
}
......
......@@ -1593,7 +1593,7 @@ calendar_realize_arrows (GtkCalendar *calendar)
&attributes,
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;
}
......@@ -1614,7 +1614,7 @@ calendar_unrealize_arrows (GtkCalendar *calendar)
{
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]);
priv->arrow_win[i] = NULL;
}
......@@ -1704,7 +1704,7 @@ gtk_calendar_realize (GtkWidget *widget)
priv->main_win = gdk_window_new (gtk_widget_get_window (widget),
&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));
}
......@@ -1718,7 +1718,7 @@ gtk_calendar_unrealize (GtkWidget *widget)
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);
priv->main_win = NULL;
}
......
......@@ -628,7 +628,7 @@ swatch_realize (GtkWidget *widget)
swatch->priv->event_window =
gdk_window_new (window,
&attributes, attributes_mask);
gdk_window_set_user_data (swatch->priv->event_window, widget);
gtk_widget_register_window (widget, swatch->priv->event_window);
}
static void
......@@ -638,7 +638,7 @@ swatch_unrealize (GtkWidget *widget)
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);
swatch->priv->event_window = NULL;
}
......
......@@ -194,7 +194,7 @@ gtk_drawing_area_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (window, darea);
gtk_widget_register_window (widget, window);
gtk_widget_set_window (widget, window);
gtk_style_context_set_background (gtk_widget_get_style_context (widget),
......
......@@ -2973,7 +2973,7 @@ realize_icon_info (GtkWidget *widget,
icon_info->window = gdk_window_new (gtk_widget_get_window (widget),
&attributes,
attributes_mask);
gdk_window_set_user_data (icon_info->window, widget);
gtk_widget_register_window (widget, icon_info->window);
gtk_widget_queue_resize (widget);
}
......@@ -3100,7 +3100,7 @@ gtk_entry_realize (GtkWidget *widget)
&attributes,
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)
g_object_unref (attributes.cursor);
......@@ -3145,7 +3145,7 @@ gtk_entry_unrealize (GtkWidget *widget)
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);
priv->text_area = NULL;
}
......
......@@ -429,7 +429,7 @@ gtk_event_box_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget);
gtk_widget_register_window (widget, window);
}
else
{
......@@ -448,7 +448,7 @@ gtk_event_box_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (window,
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, widget);
gtk_widget_register_window (widget, priv->event_window);
}
if (visible_window)
......@@ -462,7 +462,7 @@ gtk_event_box_unrealize (GtkWidget *widget)
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);
priv->event_window = NULL;
}
......
......@@ -577,7 +577,7 @@ gtk_expander_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, widget);
gtk_widget_register_window (widget, priv->event_window);
}
static void
......@@ -587,7 +587,7 @@ gtk_expander_unrealize (GtkWidget *widget)
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);
priv->event_window = NULL;
}
......
......@@ -379,7 +379,7 @@ gtk_fixed_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
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),
window);
......
......@@ -1301,7 +1301,7 @@ gtk_icon_view_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
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);
......@@ -1322,7 +1322,7 @@ gtk_icon_view_realize (GtkWidget *widget)
icon_view->priv->bin_window = gdk_window_new (window,
&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);
gtk_style_context_set_background (context, icon_view->priv->bin_window);
......@@ -1338,7 +1338,7 @@ gtk_icon_view_unrealize (GtkWidget *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);
icon_view->priv->bin_window = NULL;
......
......@@ -260,7 +260,7 @@ gtk_invisible_realize (GtkWidget *widget)
window = gdk_window_new (parent, &attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget);
gtk_widget_register_window (widget, window);
}
static void
......
......@@ -4982,7 +4982,7 @@ gtk_label_create_window (GtkLabel *label)
priv->select_info->window = gdk_window_new (gtk_widget_get_window (widget),
&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)
g_object_unref (attributes.cursor);
......@@ -4998,7 +4998,7 @@ gtk_label_destroy_window (GtkLabel *label)
if (priv->select_info->window == NULL)
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);
priv->select_info->window = NULL;
}
......
......@@ -885,7 +885,7 @@ gtk_layout_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
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);
......@@ -899,7 +899,7 @@ gtk_layout_realize (GtkWidget *widget)
priv->bin_window = gdk_window_new (window,
&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);
tmp_list = priv->children;
......@@ -958,7 +958,7 @@ gtk_layout_unrealize (GtkWidget *widget)
GtkLayout *layout = GTK_LAYOUT (widget);
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);
priv->bin_window = NULL;
......
......@@ -2551,7 +2551,7 @@ gtk_menu_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget);
gtk_widget_register_window (widget, window);
get_menu_padding (widget, &padding);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
......@@ -2576,7 +2576,7 @@ gtk_menu_realize (GtkWidget *widget)
priv->view_window = gdk_window_new (window,
&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);
......@@ -2592,7 +2592,7 @@ gtk_menu_realize (GtkWidget *widget)
priv->bin_window = gdk_window_new (priv->view_window,
&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;
while (children)
......@@ -2648,7 +2648,7 @@ menu_grab_transfer_window_get (GtkMenu *menu)
window = gdk_window_new (gtk_widget_get_root_window (GTK_WIDGET (menu)),
&attributes, attributes_mask);
gdk_window_set_user_data (window, menu);
gtk_widget_register_window (GTK_WIDGET (menu), window);
gdk_window_show (window);
......@@ -2664,7 +2664,7 @@ menu_grab_transfer_window_destroy (GtkMenu *menu)
GdkWindow *window = g_object_get_data (G_OBJECT (menu), "gtk-menu-transfer-window");
if (window)
{
gdk_window_set_user_data (window, NULL);
gtk_widget_unregister_window (GTK_WIDGET (menu), window);
gdk_window_destroy (window);
g_object_set_data (G_OBJECT (menu), I_("gtk-menu-transfer-window"), NULL);
}
......@@ -2678,11 +2678,11 @@ gtk_menu_unrealize (GtkWidget *widget)
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);
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);
priv->bin_window = NULL;
......
......@@ -1566,7 +1566,7 @@ gtk_menu_item_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, widget);
gtk_widget_register_window (widget, priv->event_window);
}
static void
......@@ -1575,7 +1575,7 @@ gtk_menu_item_unrealize (GtkWidget *widget)
GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
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);
priv->event_window = NULL;
......
......@@ -649,7 +649,7 @@ gtk_menu_shell_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
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);
gtk_style_context_set_background (context, window);
......
......@@ -397,7 +397,7 @@ gtk_misc_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
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);
}
}
......
......@@ -1908,7 +1908,7 @@ gtk_notebook_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, notebook);
gtk_widget_register_window (widget, priv->event_window);
}
static void
......@@ -1917,13 +1917,13 @@ gtk_notebook_unrealize (GtkWidget *widget)
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
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);
priv->event_window = NULL;
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);
priv->drag_window = NULL;
}
......@@ -3126,7 +3126,7 @@ show_drag_window (GtkNotebook *notebook,
priv->drag_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes,
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);
}
......
......@@ -183,7 +183,7 @@ gtk_offscreen_window_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
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);
if (child)
......
......@@ -105,7 +105,7 @@ gtk_overlay_create_child_window (GtkOverlay *overlay,
window = gdk_window_new (gtk_widget_get_window (widget),
&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_widget_set_parent_window (child, window);
......@@ -443,7 +443,7 @@ gtk_overlay_unrealize (GtkWidget *widget)
child = children->data;
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);
child->window = NULL;
}
......@@ -539,7 +539,7 @@ gtk_overlay_remove (GtkContainer *container,
{
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);
}
......
......@@ -1320,7 +1320,7 @@ gtk_paned_create_child_window (GtkPaned *paned,
window = gdk_window_new (gtk_widget_get_window (widget),
&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);
if (child)
......@@ -1366,7 +1366,7 @@ gtk_paned_realize (GtkWidget *widget)
priv->handle = gdk_window_new (window,
&attributes, attributes_mask);
gdk_window_set_user_data (priv->handle, paned);
gtk_widget_register_window (widget, priv->handle);
if (attributes_mask & GDK_WA_CURSOR)
g_object_unref (attributes.cursor);
......@@ -1382,19 +1382,19 @@ gtk_paned_unrealize (GtkWidget *widget)
if (priv->child2)
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);
priv->child2_window = NULL;
if (priv->child1)
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);
priv->child1_window = NULL;
if (priv->handle)
{
gdk_window_set_user_data (priv->handle, NULL);
gtk_widget_unregister_window (widget, priv->handle);
gdk_window_destroy (priv->handle);
priv->handle = NULL;
}
......
......@@ -472,7 +472,7 @@ gtk_path_bar_realize (GtkWidget *widget)
path_bar->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (path_bar->event_window, widget);
gtk_widget_register_window (widget, path_bar->event_window);
}
static void
......@@ -482,7 +482,7 @@ gtk_path_bar_unrealize (GtkWidget *widget)
path_bar = GTK_PATH_BAR (widget);
gdk_window_set_user_data (path_bar->event_window, NULL);
gtk_widget_unregister_window (widget, path_bar->event_window);
gdk_window_destroy (path_bar->event_window);
path_bar->event_window = NULL;
......
......@@ -677,7 +677,7 @@ gtk_plug_unrealize (GtkWidget *widget)
if (priv->socket_window != NULL)
{
gdk_window_set_user_data (priv->socket_window, NULL);
gtk_widget_unregister_window (widget, priv->socket_window);
g_object_unref (priv->socket_window);
priv->socket_window = NULL;
......@@ -879,7 +879,7 @@ gtk_plug_filter_func (GdkXEvent *gdk_xevent,
{
GtkWidget *widget = GTK_WIDGET (plug);
gdk_window_set_user_data (priv->socket_window, NULL);
gtk_widget_unregister_window (widget, priv->socket_window);
g_object_unref (priv->socket_window);
priv->socket_window = NULL;
......@@ -1088,7 +1088,7 @@ gtk_plug_realize (GtkWidget *widget)
gtk_widget_set_window (widget, gdk_window);
}
gdk_window_set_user_data (gdk_window, window);
gtk_widget_register_window (widget, gdk_window);
gtk_style_context_set_background (gtk_widget_get_style_context (widget),
gdk_window);
......
......@@ -1738,7 +1738,7 @@ gtk_range_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, range);
gtk_widget_register_window (widget, priv->event_window);
}
static void
......@@ -1749,7 +1749,7 @@ gtk_range_unrealize (GtkWidget *widget)
gtk_range_remove_step_timer (range);
gdk_window_set_user_data (priv->event_window, NULL);
gtk_widget_unregister_window (widget, priv->event_window);
gdk_window_destroy (priv->event_window);
priv->event_window = NULL;
......
......@@ -3392,7 +3392,7 @@ gtk_scrolled_window_realize (GtkWidget *widget)
scrolled_window->priv->overshoot_window =
gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (scrolled_window->priv->overshoot_window, widget);
gtk_widget_register_window (widget, scrolled_window->priv->overshoot_window);
child_widget = gtk_bin_get_child (GTK_BIN (widget));
......@@ -3408,7 +3408,7 @@ gtk_scrolled_window_unrealize (GtkWidget *widget)
{
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
gdk_window_set_user_data (scrolled_window->priv->overshoot_window, NULL);
gtk_widget_unregister_window (widget, scrolled_window->priv->overshoot_window);
gdk_window_destroy (scrolled_window->priv->overshoot_window);
scrolled_window->priv->overshoot_window = NULL;
......
......@@ -304,7 +304,7 @@ gtk_separator_tool_item_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, widget);
gtk_widget_register_window (widget, priv->event_window);
}
static void
......@@ -315,7 +315,7 @@ gtk_separator_tool_item_unrealize (GtkWidget *widget)
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);
priv->event_window = NULL;
}
......
......@@ -404,7 +404,7 @@ gtk_socket_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, socket);
gtk_widget_register_window (widget, window);
gtk_style_context_set_background (gtk_widget_get_style_context (widget),
window);
......
......@@ -1034,7 +1034,7 @@ gtk_spin_button_realize (GtkWidget *widget)
priv->down_panel = gdk_window_new (gtk_widget_get_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (priv->down_panel, widget);
gtk_widget_register_window (widget, priv->down_panel);
/* create the right panel window */
attributes.x = up_allocation.x;
......@@ -1044,7 +1044,7 @@ gtk_spin_button_realize (GtkWidget *widget)
priv->up_panel = gdk_window_new (gtk_widget_get_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (priv->up_panel, widget);
gtk_widget_register_window (widget, priv->up_panel);
return_val = FALSE;
g_signal_emit (spin_button, spinbutton_signals[OUTPUT], 0, &return_val);
......@@ -1064,14 +1064,14 @@ gtk_spin_button_unrealize (GtkWidget *widget)
if (priv->down_panel)
{
gdk_window_set_user_data (priv->down_panel, NULL);
gtk_widget_unregister_window (widget, priv->down_panel);
gdk_window_destroy (priv->down_panel);
priv->down_panel = NULL;
}
if (priv->up_panel)
{
gdk_window_set_user_data (priv->up_panel, NULL);
gtk_widget_unregister_window (widget, priv->up_panel);
gdk_window_destroy (priv->up_panel);
priv->up_panel = NULL;
}
......
......@@ -458,7 +458,7 @@ gtk_switch_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (parent_window,
&attributes,
attributes_mask);
gdk_window_set_user_data (priv->event_window, widget);
gtk_widget_register_window (widget, priv->event_window);
}
static void
......@@ -468,7 +468,7 @@ gtk_switch_unrealize (GtkWidget *widget)
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);
priv->event_window = NULL;
}
......
......@@ -197,7 +197,7 @@ _gtk_text_handle_create_window (GtkTextHandle *handle,
window = gdk_window_new (gtk_widget_get_root_window (priv->parent),
&attributes, mask);
gdk_window_set_user_data (window, priv->parent);
gtk_widget_register_window (priv->parent, window);
gdk_window_set_background_rgba (window, &bg);
_gtk_text_handle_update_shape (handle, window, pos);
......@@ -304,6 +304,7 @@ _gtk_text_handle_update_window (GtkTextHandle *handle,
width / 2, 0, &x, &y);
}
gtk_widget_unregister_window (priv->parent, handle_window->window);
gdk_window_destroy (handle_window->window);
/* Create new window and apply old state */
......
......@@ -4094,7 +4094,7 @@ gtk_text_view_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
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);
......@@ -8748,7 +8748,7 @@ text_window_realize (GtkTextWindow *win,
&attributes, attributes_mask);
gdk_window_show (win->window);
gdk_window_set_user_data (win->window, win->widget);
gtk_widget_register_window (win->widget, win->window);
gdk_window_lower (win->window);
attributes.x = 0;
......@@ -8770,7 +8770,7 @@ text_window_realize (GtkTextWindow *win,
attributes_mask);
gdk_window_show (win->bin_window);
gdk_window_set_user_data (win->bin_window, win->widget);
gtk_widget_register_window (win->widget, win->bin_window);
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
......@@ -8821,8 +8821,8 @@ text_window_unrealize (GtkTextWindow *win)
NULL);
}
gdk_window_set_user_data (win->window, NULL);
gdk_window_set_user_data (win->bin_window, NULL);
gtk_widget_unregister_window (win->widget, win->window);
gtk_widget_unregister_window (win->widget, win->bin_window);
gdk_window_destroy (win->bin_window);
gdk_window_destroy (win->window);
win->window = NULL;
......
......@@ -844,7 +844,7 @@ gtk_toolbar_realize (GtkWidget *widget)
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, toolbar);
gtk_widget_register_window (widget, priv->event_window);
}
static void
......@@ -855,7 +855,7 @@ gtk_toolbar_unrealize (GtkWidget *widget)
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);
priv->event_window = NULL;
}
......
......@@ -432,7 +432,7 @@ create_drag_window (GtkToolItem *toolitem)