gtk: Chain up in realize()

... instead of copy/paste from gtk_widget_real_realize.
This commit is contained in:
Benjamin Otte 2016-11-02 07:16:08 +01:00
parent b0a5e8764c
commit 32a5729d18
10 changed files with 22 additions and 70 deletions

View File

@ -776,17 +776,12 @@ gtk_button_realize (GtkWidget *widget)
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
GtkAllocation allocation;
GdkWindow *window;
GTK_WIDGET_CLASS (gtk_button_parent_class)->realize (widget);
gtk_widget_get_allocation (widget, &allocation);
gtk_widget_set_realized (widget, TRUE);
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
priv->event_window = gdk_window_new_input (window,
priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK

View File

@ -452,16 +452,10 @@ swatch_realize (GtkWidget *widget)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
GtkAllocation allocation;
GdkWindow *window;
gtk_widget_get_allocation (widget, &allocation);
gtk_widget_set_realized (widget, TRUE);
GTK_WIDGET_CLASS (gtk_color_swatch_parent_class)->realize (widget);
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
swatch->priv->event_window = gdk_window_new_input (window,
swatch->priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK

View File

@ -534,17 +534,14 @@ gtk_expander_realize (GtkWidget *widget)
{
GtkAllocation allocation;
GtkExpanderPrivate *priv;
GdkWindow *window;
priv = GTK_EXPANDER (widget)->priv;
GTK_WIDGET_CLASS (gtk_expander_parent_class)->realize (widget);
gtk_widget_get_allocation (widget, &allocation);
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
priv->event_window = gdk_window_new_input (gtk_widget_get_parent_window (widget),
priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
@ -554,7 +551,6 @@ gtk_expander_realize (GtkWidget *widget)
gtk_widget_register_window (widget, priv->event_window);
gtk_gesture_set_window (priv->multipress_gesture, priv->event_window);
gtk_widget_set_realized (widget, TRUE);
}
static void

View File

@ -1229,17 +1229,12 @@ gtk_menu_item_realize (GtkWidget *widget)
GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
GtkMenuItemPrivate *priv = menu_item->priv;
GtkAllocation allocation;
GdkWindow *window;
gtk_widget_set_realized (widget, TRUE);
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
GTK_WIDGET_CLASS (gtk_menu_item_parent_class)->realize (widget);
gtk_widget_get_allocation (widget, &allocation);
priv->event_window = gdk_window_new_input (gtk_widget_get_parent_window (widget),
priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK

View File

@ -1818,18 +1818,13 @@ gtk_notebook_realize (GtkWidget *widget)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkNotebookPrivate *priv = notebook->priv;
GdkWindow *window;
GdkRectangle event_window_pos;
gtk_widget_set_realized (widget, TRUE);
GTK_WIDGET_CLASS (gtk_notebook_parent_class)->realize (widget);
gtk_css_gadget_get_border_allocation (priv->header_gadget, &event_window_pos, NULL);
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
priv->event_window = gdk_window_new_input (gtk_widget_get_parent_window (widget),
priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK

View File

@ -1566,15 +1566,10 @@ gtk_paned_realize (GtkWidget *widget)
{
GtkPaned *paned = GTK_PANED (widget);
GtkPanedPrivate *priv = paned->priv;
GdkWindow *window;
gtk_widget_set_realized (widget, TRUE);
GTK_WIDGET_CLASS (gtk_paned_parent_class)->realize (widget);
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
priv->handle = gdk_window_new_input (window,
priv->handle = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK

View File

@ -460,20 +460,14 @@ gtk_path_bar_unmap (GtkWidget *widget)
static void
gtk_path_bar_realize (GtkWidget *widget)
{
GtkPathBar *path_bar;
GtkPathBar *path_bar = GTK_PATH_BAR (widget);
GtkAllocation allocation;
GdkWindow *window;
gtk_widget_set_realized (widget, TRUE);
path_bar = GTK_PATH_BAR (widget);
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->realize (widget);
gtk_widget_get_allocation (widget, &allocation);
path_bar->priv->event_window = gdk_window_new_input (gtk_widget_get_parent_window (widget),
path_bar->priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_SCROLL_MASK,
&allocation);

View File

@ -332,8 +332,7 @@ gtk_stack_realize (GtkWidget *widget)
GList *l;
gint event_mask;
gtk_widget_set_realized (widget, TRUE);
gtk_widget_set_window (widget, g_object_ref (gtk_widget_get_parent_window (widget)));
GTK_WIDGET_CLASS (gtk_stack_parent_class)->realize (widget);
gtk_css_gadget_get_content_allocation (priv->gadget, &allocation, NULL);

View File

@ -773,17 +773,12 @@ gtk_toolbar_realize (GtkWidget *widget)
GtkAllocation allocation;
GtkToolbar *toolbar = GTK_TOOLBAR (widget);
GtkToolbarPrivate *priv = toolbar->priv;
GdkWindow *window;
gtk_widget_set_realized (widget, TRUE);
GTK_WIDGET_CLASS (gtk_toolbar_parent_class)->realize (widget);
gtk_widget_get_allocation (widget, &allocation);
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
priv->event_window = gdk_window_new_input (gtk_widget_get_parent_window (widget),
priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK

View File

@ -336,15 +336,9 @@ create_drag_window (GtkToolItem *toolitem)
static void
gtk_tool_item_realize (GtkWidget *widget)
{
GtkToolItem *toolitem;
GdkWindow *window;
GtkToolItem *toolitem = GTK_TOOL_ITEM (widget);
toolitem = GTK_TOOL_ITEM (widget);
gtk_widget_set_realized (widget, TRUE);
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
GTK_WIDGET_CLASS (gtk_tool_item_parent_class)->realize (widget);
if (toolitem->priv->use_drag_window)
create_drag_window(toolitem);