static void gtk_revealer_real_realize (GtkWidget *widget) { GtkRevealer *revealer = GTK_REVEALER (widget); GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); GtkAllocation allocation; GdkWindowAttr attributes = { 0 }; GdkWindowAttributesType attributes_mask; GtkAllocation child_allocation; GtkWidget *child; GtkStyleContext *context; GtkRevealerTransitionType transition; gtk_widget_set_realized (widget, TRUE); gtk_widget_get_allocation (widget, &allocation); attributes.x = allocation.x; attributes.y = allocation.y; attributes.width = allocation.width; attributes.height = allocation.height; attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK; attributes_mask = (GDK_WA_X | GDK_WA_Y) | GDK_WA_VISUAL; priv->view_window = gdk_window_new (gtk_widget_get_parent_window ((GtkWidget*) revealer), &attributes, attributes_mask); gtk_widget_set_window (widget, priv->view_window); gtk_widget_register_window (widget, priv->view_window); gtk_revealer_get_child_allocation (revealer, &allocation, &child_allocation); attributes.x = 0; attributes.y = 0; attributes.width = child_allocation.width; attributes.height = child_allocation.height; transition = effective_transition (revealer); if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN) attributes.y = allocation.height - child_allocation.height; else if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT) attributes.x = allocation.width - child_allocation.width; priv->bin_window = gdk_window_new (priv->view_window, &attributes, attributes_mask); gtk_widget_register_window (widget, priv->bin_window); child = gtk_bin_get_child (GTK_BIN (revealer)); if (child != NULL) gtk_widget_set_parent_window (child, priv->bin_window); context = gtk_widget_get_style_context (widget); gtk_style_context_set_background (context, priv->view_window); gtk_style_context_set_background (context, priv->bin_window); gdk_window_show (priv->bin_window); }
static void gd_stack_realize (GtkWidget *widget) { GdStack *stack = GD_STACK (widget); GdStackPrivate *priv = stack->priv; GtkAllocation allocation; GdkWindowAttr attributes = { 0 }; GdkWindowAttributesType attributes_mask; GdStackChildInfo *info; GList *l; gtk_widget_set_realized (widget, TRUE); gtk_widget_get_allocation (widget, &allocation); attributes.x = allocation.x; attributes.y = allocation.y; attributes.width = allocation.width; attributes.height = allocation.height; attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK; attributes_mask = (GDK_WA_X | GDK_WA_Y) | GDK_WA_VISUAL; priv->view_window = gdk_window_new (gtk_widget_get_parent_window ((GtkWidget*) stack), &attributes, attributes_mask); gtk_widget_set_window (widget, priv->view_window); gtk_widget_register_window (widget, priv->view_window); attributes.x = get_bin_window_x (stack, &allocation); attributes.y = 0; attributes.width = allocation.width; attributes.height = allocation.height; priv->bin_window = gdk_window_new (priv->view_window, &attributes, attributes_mask); gtk_widget_register_window (widget, priv->bin_window); for (l = priv->children; l != NULL; l = l->next) { info = l->data; gtk_widget_set_parent_window (info->widget, priv->bin_window); } gdk_window_show (priv->bin_window); }
static void swatch_realize (GtkWidget *widget) { GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget); 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_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_TOUCH_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); swatch->priv->event_window = gdk_window_new (window, &attributes, attributes_mask); gtk_widget_register_window (widget, swatch->priv->event_window); }
static void pnl_dock_revealer_realize (GtkWidget *widget) { PnlDockRevealer *self = (PnlDockRevealer *)widget; PnlDockRevealerPrivate *priv = pnl_dock_revealer_get_instance_private (self); GdkWindowAttr attributes = { 0 }; GdkWindow *parent; GtkAllocation alloc; gint attributes_mask = 0; g_assert (PNL_IS_DOCK_REVEALER (widget)); gtk_widget_get_allocation (GTK_WIDGET (self), &alloc); gtk_widget_set_realized (GTK_WIDGET (self), TRUE); parent = gtk_widget_get_parent_window (GTK_WIDGET (self)); attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (GTK_WIDGET (self)); attributes.x = alloc.x; attributes.y = alloc.y; attributes.width = alloc.width; attributes.height = alloc.height; attributes.event_mask = 0; attributes_mask = (GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL); priv->window = gdk_window_new (parent, &attributes, attributes_mask); gtk_widget_set_window (GTK_WIDGET (self), priv->window); gtk_widget_register_window (GTK_WIDGET (self), priv->window); }
static GdkWindow * gstyle_slidein_create_child_window (GstyleSlidein *self) { GtkWidget *widget = GTK_WIDGET (self); GtkAllocation parent_alloc; GtkAllocation child_alloc; GdkWindow *window; GdkWindowAttr attributes; gint attributes_mask; gtk_widget_get_allocation (GTK_WIDGET (self), &parent_alloc); gstyle_slidein_compute_child_allocation (self, parent_alloc, &child_alloc); attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.width = child_alloc.width; attributes.height = child_alloc.height; attributes.x = child_alloc.x; attributes.y = child_alloc.y; attributes.visual = gtk_widget_get_visual (widget); attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; attributes.event_mask = gtk_widget_get_events (widget); window = gdk_window_new (gtk_widget_get_window (widget), &attributes, attributes_mask); gtk_widget_register_window (widget, window); gtk_widget_set_parent_window (self->overlay_child, window); return window; }
static GdkWindow * gb_slider_create_child_window (GbSlider *self, GbSliderChild *child) { GtkWidget *widget = (GtkWidget *)self; GdkWindow *window; GtkAllocation allocation; GdkWindowAttr attributes; gint attributes_mask; g_assert (GB_IS_SLIDER (self)); g_assert (child != NULL); gb_slider_compute_child_allocation (self, child, &allocation, NULL); attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.width = allocation.width; attributes.height = allocation.height; attributes.x = allocation.x; attributes.y = allocation.y; attributes.visual = gtk_widget_get_visual (widget); attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK; window = gdk_window_new (gtk_widget_get_window (widget), &attributes, attributes_mask); gtk_widget_register_window (widget, window); gtk_widget_set_parent_window (child->widget, window); return window; }
static void gstyle_color_widget_realize (GtkWidget *widget) { GtkAllocation allocation; GdkWindow *window; GdkWindowAttr attributes = {0}; g_assert (GTK_IS_WIDGET (widget)); gtk_widget_get_allocation (widget, &allocation); gtk_widget_set_realized (widget, TRUE); attributes.x = allocation.x; attributes.y = allocation.y; attributes.width = allocation.width; attributes.height = allocation.height; attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.event_mask = gtk_widget_get_events (widget) | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK; window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL); gtk_widget_set_window (widget, g_object_ref (window)); gtk_widget_register_window (widget, window); gdk_window_show (window); }
static void gtk_switch_realize (GtkWidget *widget) { GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv; GdkWindow *parent_window; GtkAllocation allocation; gtk_widget_set_realized (widget, TRUE); parent_window = gtk_widget_get_parent_window (widget); gtk_widget_set_window (widget, parent_window); g_object_ref (parent_window); gtk_widget_get_allocation (widget, &allocation); priv->event_window = gdk_window_new_input (parent_window, gtk_widget_get_events (widget) | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK | GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK, &allocation); gtk_widget_register_window (widget, priv->event_window); }
static void bytes_view_realize(GtkWidget *widget) { BytesView *bv; GdkWindowAttr attributes; GtkAllocation allocation; GdkWindow *win; #if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext *context; #endif _gtk_widget_set_realized_true(widget); bv = BYTES_VIEW(widget); gtk_widget_get_allocation(widget, &allocation); 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.visual = gtk_widget_get_visual(widget); attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK; #if !GTK_CHECK_VERSION(3, 0, 0) attributes.colormap = gtk_widget_get_colormap(widget); win = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP); #else win = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL); #endif gtk_widget_set_window(widget, win); #if GTK_CHECK_VERSION(3, 8, 0) gtk_widget_register_window(widget, win); #else gdk_window_set_user_data(win, widget); #endif #if !GTK_CHECK_VERSION(3, 0, 0) /* XXX, check */ gdk_window_set_back_pixmap(win, NULL, FALSE); #endif #if GTK_CHECK_VERSION(3, 0, 0) context = gtk_widget_get_style_context(widget); gtk_style_context_add_class(context, GTK_STYLE_CLASS_VIEW); /* gtk_style_context_add_class(context, GTK_STYLE_CLASS_ENTRY); */ #elif GTK_CHECK_VERSION(2, 20, 0) gtk_widget_style_attach(widget); #else widget->style = gtk_style_attach(widget->style, win); #endif bytes_view_ensure_layout(bv); }
static void sc_line_realize(GtkWidget*widget) { SCLine*line=SC_LINE(widget); GdkWindow*event_window; GdkWindow*parent_window; GdkWindowAttr attributes; gint attributes_mask; GtkAllocation allocation; gtk_widget_get_allocation(widget,&allocation); gtk_widget_set_realized(widget,TRUE); parent_window=gtk_widget_get_parent_window(widget); GTK_WIDGET_CLASS(sc_line_parent_class)->realize(widget); attributes.x=allocation.x; attributes.y=allocation.y; attributes.width=allocation.width; attributes.height=allocation.height; attributes.window_type=GDK_WINDOW_CHILD; attributes.wclass=GDK_INPUT_ONLY; attributes.event_mask=gtk_widget_get_events(widget)| GDK_POINTER_MOTION_MASK| GDK_BUTTON_PRESS_MASK| GDK_BUTTON_RELEASE_MASK; attributes.cursor=gdk_cursor_new(GDK_PENCIL); attributes_mask=GDK_WA_X|GDK_WA_Y|GDK_WA_CURSOR; event_window=gdk_window_new(parent_window,&attributes,attributes_mask); g_object_unref(attributes.cursor); gtk_widget_register_window(widget,event_window); line->event_window=event_window; }
static void sc_shape_realize(GtkWidget*widget) { SCShape*shape=SC_SHAPE(widget); GdkWindow*event_window; GdkWindow*parent_window; GdkWindowAttr attributes; gint attributes_mask; GtkAllocation allocation; gtk_widget_get_allocation(widget,&allocation); gtk_widget_set_realized(widget,TRUE); parent_window=gtk_widget_get_parent_window(widget); GTK_WIDGET_CLASS(sc_shape_parent_class)->realize(widget); attributes.x=allocation.x; attributes.y=allocation.y; attributes.width=allocation.width; attributes.height=allocation.height; attributes.window_type=GDK_WINDOW_CHILD; attributes.wclass=GDK_INPUT_ONLY; attributes.event_mask=gtk_widget_get_events(widget)| GDK_POINTER_MOTION_MASK| GDK_BUTTON_PRESS_MASK| GDK_BUTTON_RELEASE_MASK; attributes_mask=GDK_WA_X|GDK_WA_Y; event_window=gdk_window_new(parent_window,&attributes,attributes_mask); gtk_widget_register_window(widget,event_window); shape->event_window=event_window; }
static void gcal_event_widget_realize (GtkWidget *widget) { GcalEventWidget *self; GdkWindowAttr attributes; GtkAllocation allocation; GdkWindow *parent_window; GdkCursor *pointer_cursor; gint attributes_mask; self = GCAL_EVENT_WIDGET (widget); gtk_widget_set_realized (widget, TRUE); parent_window = gtk_widget_get_parent_window (widget); gtk_widget_set_window (widget, parent_window); g_object_ref (parent_window); gtk_widget_get_allocation (widget, &allocation); attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_ONLY; attributes.x = allocation.x; attributes.y = allocation.y; attributes.width = allocation.width; attributes.height = allocation.height; attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_SMOOTH_SCROLL_MASK | GDK_SCROLL_MASK); attributes_mask = GDK_WA_X | GDK_WA_Y; self->event_window = gdk_window_new (parent_window, &attributes, attributes_mask); gtk_widget_register_window (widget, self->event_window); gdk_window_show (self->event_window); pointer_cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_HAND1); gdk_window_set_cursor (self->event_window, pointer_cursor); }
static void gtk_button_realize (GtkWidget *widget) { GtkButton *button = GTK_BUTTON (widget); GtkButtonPrivate *priv = button->priv; GtkAllocation allocation; GTK_WIDGET_CLASS (gtk_button_parent_class)->realize (widget); gtk_widget_get_allocation (widget, &allocation); 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 | GDK_TOUCH_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK, &allocation); gtk_widget_register_window (widget, priv->event_window); }
static void photos_zoom_controls_realize (GtkWidget *widget) { GdkVisual *visual; g_autoptr (GdkWindow) window = NULL; GdkWindow *parent_window; GdkWindowAttr attributes; GtkAllocation allocation; gint attributes_mask; gtk_widget_set_realized (widget, TRUE); attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); gtk_widget_get_allocation (widget, &allocation); attributes.x = allocation.x; attributes.y = allocation.y; attributes.width = allocation.width; attributes.height = allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; visual = gtk_widget_get_visual (widget); attributes.visual = visual; attributes.window_type = GDK_WINDOW_CHILD; attributes_mask = GDK_WA_VISUAL | GDK_WA_X | GDK_WA_Y; parent_window = gtk_widget_get_parent_window (widget); window = gdk_window_new (parent_window, &attributes, attributes_mask); gtk_widget_set_window (widget, g_object_ref (window)); gtk_widget_register_window (widget, window); }
static void gtk_switch_realize (GtkWidget *widget) { GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv; GdkWindow *parent_window; GdkWindowAttr attributes; gint attributes_mask; GtkAllocation allocation; gtk_widget_set_realized (widget, TRUE); parent_window = gtk_widget_get_parent_window (widget); gtk_widget_set_window (widget, parent_window); g_object_ref (parent_window); gtk_widget_get_allocation (widget, &allocation); attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_ONLY; attributes.x = allocation.x; attributes.y = allocation.y; attributes.width = allocation.width; attributes.height = allocation.height; attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); attributes_mask = GDK_WA_X | GDK_WA_Y; priv->event_window = gdk_window_new (parent_window, &attributes, attributes_mask); gtk_widget_register_window (widget, priv->event_window); }
static void deepin_workspace_overview_realize (GtkWidget *widget) { DeepinWorkspaceOverview *self = DEEPIN_WORKSPACE_OVERVIEW (widget); DeepinWorkspaceOverviewPrivate *priv = self->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_ENTER_NOTIFY_MASK | GDK_EXPOSURE_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); gtk_widget_register_window (widget, priv->event_window); gdk_window_lower(priv->event_window); }
static void gtk_revealer_real_realize (GtkWidget *widget) { GtkRevealer *revealer = GTK_REVEALER (widget); GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); GtkAllocation allocation; GdkWindowAttr attributes = { 0 }; GdkWindowAttributesType attributes_mask; GtkAllocation child_allocation; GtkWidget *child; GtkRevealerTransitionType transition; GtkBorder padding; gtk_widget_set_realized (widget, TRUE); gtk_widget_get_allocation (widget, &allocation); attributes.x = allocation.x; attributes.y = allocation.y; attributes.width = allocation.width; attributes.height = allocation.height; attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.event_mask = gtk_widget_get_events (widget); attributes_mask = (GDK_WA_X | GDK_WA_Y) | GDK_WA_VISUAL; priv->view_window = gdk_window_new (gtk_widget_get_parent_window ((GtkWidget*) revealer), &attributes, attributes_mask); gtk_widget_set_window (widget, priv->view_window); gtk_widget_register_window (widget, priv->view_window); gtk_revealer_get_child_allocation (revealer, &allocation, &child_allocation); gtk_revealer_get_padding (revealer, &padding); attributes.x = 0; attributes.y = 0; attributes.width = child_allocation.width; attributes.height = child_allocation.height; /* See explanation on gtk_revealer_real_size_allocate */ transition = effective_transition (revealer); if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN) { attributes.y = allocation.height - child_allocation.height - padding.bottom; attributes.x = padding.left; } else if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT) { attributes.y = padding.top; attributes.x = allocation.width - child_allocation.width - padding.right; } else { attributes.y = padding.top; attributes.x = padding.left; } priv->bin_window = gdk_window_new (priv->view_window, &attributes, attributes_mask); gtk_widget_register_window (widget, priv->bin_window); child = gtk_bin_get_child (GTK_BIN (revealer)); if (child != NULL) gtk_widget_set_parent_window (child, priv->bin_window); gdk_window_show (priv->bin_window); }