static void ViewOvBoxRealize(GtkWidget *widget) // IN { ViewOvBox *that; ViewOvBoxPrivate *priv; GdkWindowAttr attributes; gint mask; GtkAllocation allocation; GdkWindow *window; gtk_widget_set_realized (widget, TRUE); that = VIEW_OV_BOX(widget); priv = that->priv; 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; mask = GDK_WA_VISUAL | GDK_WA_X | GDK_WA_Y; gtk_widget_get_allocation(widget, &allocation); attributes.x = allocation.x; attributes.y = allocation.y; attributes.width = allocation.width; attributes.height = allocation.height; window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, mask); gtk_widget_set_window(widget, window); gdk_window_set_user_data(window, that); /* * The order in which we create the children X window matters: the child * created last is stacked on top. --hpreg */ ViewOvBoxGetUnderGeometry(that, &attributes.x, &attributes.y, &attributes.width, &attributes.height); priv->underWin = gdk_window_new(window, &attributes, mask); gdk_window_set_user_data(priv->underWin, that); if (priv->under) { gtk_widget_set_parent_window(priv->under, priv->underWin); } gdk_window_show(priv->underWin); ViewOvBoxGetOverGeometry(that, &attributes.x, &attributes.y, &attributes.width, &attributes.height); priv->overWin = gdk_window_new(window, &attributes, mask); gdk_window_set_user_data(priv->overWin, that); if (priv->over) { gtk_widget_set_parent_window(priv->over, priv->overWin); } gdk_window_show(priv->overWin); ViewOvBoxSetBackground(that); }
static void gtk_form_realize(GtkWidget *widget) { GList *tmp_list; GtkForm *form; GdkWindowAttr attributes; gint attributes_mask; g_return_if_fail(GTK_IS_FORM(widget)); form = GTK_FORM(widget); GTK_WIDGET_SET_FLAGS(form, GTK_REALIZED); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual(widget); attributes.colormap = gtk_widget_get_colormap(widget); attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); gdk_window_set_user_data(widget->window, widget); attributes.x = 0; attributes.y = 0; attributes.event_mask = gtk_widget_get_events(widget); form->bin_window = gdk_window_new(widget->window, &attributes, attributes_mask); gdk_window_set_user_data(form->bin_window, widget); gtk_form_set_static_gravity(form->bin_window, TRUE); widget->style = gtk_style_attach(widget->style, widget->window); gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); gtk_style_set_background(widget->style, form->bin_window, GTK_STATE_NORMAL); gdk_window_add_filter(widget->window, gtk_form_main_filter, form); gdk_window_add_filter(form->bin_window, gtk_form_filter, form); for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) { GtkFormChild *child = tmp_list->data; gtk_form_attach_child_window(form, child); if (GTK_WIDGET_VISIBLE(child->widget)) gtk_form_realize_child(form, child); } }
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); gdk_window_set_user_data(win, widget); #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); }
void moz_drawingarea_create_windows (MozDrawingarea *drawingarea, GdkWindow *parent, GtkWidget *widget, GdkVisual *visual) { GdkWindowAttr attributes; gint attributes_mask = 0; /* create the clipping window */ attributes.event_mask = 0; attributes.x = 0; attributes.y = 0; attributes.width = 1; attributes.height = 1; attributes.wclass = GDK_INPUT_OUTPUT; attributes.window_type = GDK_WINDOW_CHILD; if (!visual) { attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); } else { attributes.visual = visual; attributes.colormap = gdk_colormap_new(visual, 0); } attributes_mask |= GDK_WA_VISUAL | GDK_WA_COLORMAP | GDK_WA_X | GDK_WA_Y; drawingarea->clip_window = gdk_window_new (parent, &attributes, attributes_mask); gdk_window_set_user_data(drawingarea->clip_window, widget); /* set the default pixmap to None so that you don't end up with the gtk default which is BlackPixel. */ gdk_window_set_back_pixmap(drawingarea->clip_window, NULL, FALSE); attributes.event_mask = (GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK); /* create the inner window */ drawingarea->inner_window = gdk_window_new (drawingarea->clip_window, &attributes, attributes_mask); gdk_window_set_user_data(drawingarea->inner_window, widget); g_object_weak_ref(G_OBJECT(widget), nullify_widget_pointers, drawingarea); /* set the default pixmap to None so that you don't end up with the gtk default which is BlackPixel. */ gdk_window_set_back_pixmap(drawingarea->inner_window, NULL, FALSE); if (visual) { g_object_unref(attributes.colormap); } }
static void gtk_notification_realize (GtkWidget *widget) { GtkNotification *notification = GTK_NOTIFICATION (widget); GtkNotificationPrivate *priv = notification->priv; GtkBin *bin = GTK_BIN (widget); GtkAllocation allocation; GtkStyleContext *context; GtkWidget *child; GdkWindow *window; GdkWindowAttr attributes; gint attributes_mask; 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 = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; 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, notification); attributes.x = 0; attributes.y = attributes.height + priv->animate_y; attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_VISIBILITY_NOTIFY_MASK; priv->bin_window = gdk_window_new (window, &attributes, attributes_mask); gdk_window_set_user_data (priv->bin_window, notification); child = gtk_bin_get_child (bin); if (child) gtk_widget_set_parent_window (child, priv->bin_window); gtk_widget_set_parent_window (priv->close_button, priv->bin_window); context = gtk_widget_get_style_context (widget); gtk_style_context_set_background (context, 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 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 void _gradient_slider_realize(GtkWidget *widget) { GdkWindowAttr attributes; guint attributes_mask; g_return_if_fail(widget != NULL); g_return_if_fail(DTGTK_IS_GRADIENT_SLIDER(widget)); GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = 100; attributes.height = 17; attributes.wclass = GDK_INPUT_OUTPUT; attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_POINTER_MOTION_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y; widget->window = gdk_window_new( gtk_widget_get_parent_window (widget), & attributes, attributes_mask ); gdk_window_set_user_data(widget->window, widget); widget->style = gtk_style_attach(widget->style, widget->window); gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); }
static void hand_display_realize (GtkWidget *widget) { GdkWindowAttr attributes; gint attributes_mask; g_return_if_fail (widget != NULL); g_return_if_fail (IS_HAND_DISPLAY (widget)); gtk_widget_set_realized (widget, TRUE); GtkAllocation allocation; 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; attributes.window_type = GDK_WINDOW_CHILD; attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; GdkWindow *window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gtk_widget_set_window (widget, window); gtk_widget_style_attach (widget); gdk_window_set_user_data (window, widget); gtk_style_set_background (gtk_widget_get_style (widget), window, GTK_STATE_ACTIVE); }
static void gtk_experiment_transcript_realize(GtkWidget *widget) { GdkWindowAttr attributes; gint attributes_mask; gtk_widget_set_realized(widget, TRUE); attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.window_type = GDK_WINDOW_CHILD; attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK; attributes.visual = gtk_widget_get_visual(widget); attributes.colormap = gtk_widget_get_colormap(widget); gtk_widget_set_has_window(widget, TRUE); attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); widget->style = gtk_style_attach(widget->style, widget->window); gdk_window_set_user_data(widget->window, widget); gtk_style_set_background(widget->style, widget->window, GTK_STATE_ACTIVE); gtk_experiment_transcript_reconfigure(GTK_EXPERIMENT_TRANSCRIPT(widget)); }
static void create_drag_window (GtkToolItem *toolitem) { GtkWidget *widget; GdkWindowAttr attributes; gint attributes_mask, border_width; g_return_if_fail (toolitem->priv->use_drag_window == TRUE); widget = GTK_WIDGET (toolitem); border_width = GTK_CONTAINER (toolitem)->border_width; attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x + border_width; attributes.y = widget->allocation.y + border_width; attributes.width = widget->allocation.width - border_width * 2; attributes.height = widget->allocation.height - border_width * 2; attributes.wclass = GDK_INPUT_ONLY; attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); attributes_mask = GDK_WA_X | GDK_WA_Y; toolitem->priv->drag_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (toolitem->priv->drag_window, toolitem); }
static void scope_realize(GtkWidget *widget) { Scope *scope; GdkWindowAttr attributes; gint attributes_mask; GdkGCValues gc_values; GtkAllocation allocation; GdkWindow *window; GtkStyle *style; g_return_if_fail(widget != NULL); g_return_if_fail(IS_SCOPE(widget)); scope = SCOPE(widget); gtk_widget_set_realized(widget, TRUE); 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.colormap = gtk_widget_get_colormap(widget); attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; gtk_widget_set_has_window(widget, TRUE); 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, scope); gtk_widget_style_attach(widget); style = gtk_widget_get_style(widget); gtk_style_set_background(style, window, GTK_STATE_NORMAL); /* gc's if necessary */ if (!gdk_colormap_alloc_color(style->colormap, &scope->tracecol, FALSE, TRUE)) g_warning("unable to allocate color: ( %d %d %d )", scope->tracecol.red, scope->tracecol.green, scope->tracecol.blue); gc_values.foreground = scope->tracecol; scope->trace_gc = gtk_gc_get(style->depth, style->colormap, &gc_values, GDK_GC_FOREGROUND); if (!gdk_colormap_alloc_color(style->colormap, &scope->gridcol, FALSE, TRUE)) g_warning("unable to allocate color: ( %d %d %d )", scope->gridcol.red, scope->gridcol.green, scope->gridcol.blue); gc_values.foreground = scope->gridcol; scope->grid_gc = gtk_gc_get(style->depth, style->colormap, &gc_values, GDK_GC_FOREGROUND); /* create backing store */ scope->pixmap = gdk_pixmap_new(window, SCOPE_WIDTH, SCOPE_HEIGHT, -1); scope_send_configure(SCOPE(widget)); }
static void cvImageWidget_realize (GtkWidget *widget) { CvImageWidget *image_widget; GdkWindowAttr attributes; gint attributes_mask; //printf("cvImageWidget_realize\n"); g_return_if_fail (widget != NULL); g_return_if_fail (CV_IS_IMAGE_WIDGET (widget)); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); image_widget = CV_IMAGE_WIDGET (widget); attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.window_type = GDK_WINDOW_CHILD; attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask); widget->style = gtk_style_attach (widget->style, widget->window); gdk_window_set_user_data (widget->window, widget); gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE); }
static void git_source_view_realize (GtkWidget *widget) { GdkWindowAttr attribs; GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); memset (&attribs, 0, sizeof (attribs)); attribs.x = widget->allocation.x; attribs.y = widget->allocation.y; attribs.width = widget->allocation.width; attribs.height = widget->allocation.height; attribs.wclass = GDK_INPUT_OUTPUT; attribs.window_type = GDK_WINDOW_CHILD; attribs.visual = gtk_widget_get_visual (widget); attribs.colormap = gtk_widget_get_colormap (widget); attribs.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK; widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attribs, GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP); gdk_window_set_user_data (widget->window, widget); widget->style = gtk_style_attach (widget->style, widget->window); gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]); git_source_view_calculate_line_height (GIT_SOURCE_VIEW (widget)); }
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 moz_web_view_realize(GtkWidget *widget) { g_return_if_fail(widget != NULL); g_return_if_fail(MOZ_IS_WEB_VIEW(widget)); MozWebView *view = MOZ_WEB_VIEW(widget); GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); GdkWindowAttr attributes; gint attributes_mask; attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual(widget); attributes.colormap = gtk_widget_get_colormap(widget); attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); gdk_window_set_user_data(widget->window, view); gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); widget->style = gtk_style_attach (widget->style, widget->window); }
static void gimp_ruler_realize (GtkWidget *widget) { GimpRuler *ruler = GIMP_RULER (widget); GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler); GtkAllocation allocation; GdkWindowAttr attributes; gint attributes_mask; GTK_WIDGET_CLASS (gimp_ruler_parent_class)->realize (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_ONLY; attributes.event_mask = (gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK); attributes_mask = GDK_WA_X | GDK_WA_Y; priv->input_window = gdk_window_new (gtk_widget_get_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (priv->input_window, ruler); gimp_ruler_make_pixmap (ruler); }
static void create_window (GsdLocatePointerData *data, GdkScreen *screen) { GdkColormap *colormap; GdkVisual *visual; GdkWindowAttr attributes; colormap = gdk_screen_get_rgba_colormap (screen); visual = gdk_screen_get_rgba_visual (screen); if (!colormap) { colormap = gdk_screen_get_rgb_colormap (screen); visual = gdk_screen_get_rgb_visual (screen); } attributes.window_type = GDK_WINDOW_TEMP; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = visual; attributes.colormap = colormap; attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK; attributes.width = 1; attributes.height = 1; data->window = gdk_window_new (gdk_screen_get_root_window (screen), &attributes, GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP); gdk_window_set_user_data (data->window, data->widget); }
static void create_window (CsdLocatePointerData *data, GdkScreen *screen) { GdkVisual *visual; GdkWindowAttr attributes; gint attributes_mask; visual = gdk_screen_get_rgba_visual (screen); if (visual == NULL) visual = gdk_screen_get_system_visual (screen); attributes_mask = GDK_WA_X | GDK_WA_Y; if (visual != NULL) attributes_mask = attributes_mask | GDK_WA_VISUAL; attributes.window_type = GDK_WINDOW_TEMP; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = visual; attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK; attributes.width = 1; attributes.height = 1; data->window = gdk_window_new (gdk_screen_get_root_window (screen), &attributes, attributes_mask); gdk_window_set_user_data (data->window, data->widget); }
static void polygon_view_realize (GtkWidget *widget) { GdkWindowAttr attributes; GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); attributes.event_mask = gtk_widget_get_events (widget) | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK | GDK_EXPOSURE_MASK; widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP); gdk_window_set_user_data (widget->window, widget); widget->style = gtk_style_attach (widget->style, widget->window); gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); }
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 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 uni_image_view_realize (GtkWidget * widget) { UniImageView *view = UNI_IMAGE_VIEW (widget); gtk_widget_set_realized(widget, TRUE); GdkWindowAttr attrs; attrs.window_type = GDK_WINDOW_CHILD; attrs.x = widget->allocation.x; attrs.y = widget->allocation.y; attrs.width = widget->allocation.width; attrs.height = widget->allocation.height; attrs.wclass = GDK_INPUT_OUTPUT; attrs.visual = gtk_widget_get_visual (widget); attrs.colormap = gtk_widget_get_colormap (widget); attrs.event_mask = (gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK); int attr_mask = (GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP); GdkWindow *parent = gtk_widget_get_parent_window (widget); widget->window = gdk_window_new (parent, &attrs, attr_mask); gdk_window_set_user_data (widget->window, view); widget->style = gtk_style_attach (widget->style, widget->window); gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); view->void_cursor = gdk_cursor_new (GDK_ARROW); }
static void gtk_xournal_realize(GtkWidget* widget) { GdkWindowAttr attributes; guint attributes_mask; g_return_if_fail(widget != NULL); g_return_if_fail(GTK_IS_XOURNAL(widget)); GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y; widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &widget->style->dark[GTK_STATE_NORMAL]); gdk_window_set_user_data(widget->window, widget); widget->style = gtk_style_attach(widget->style, widget->window); gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); gtk_xournal_update_xevent(widget); }
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; }
/* Called when the widget is realized. This usually happens when you call * gtk_widget_show() on the widget. */ static void lcd_realize (GtkWidget *widget) { Lcd *lcd; GdkWindowAttr attributes; gint attr_mask; g_return_if_fail (widget != NULL); g_return_if_fail (IS_LCD (widget)); /* Set the GTK_REALIZED flag so it is marked as realized. */ GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); lcd = LCD (widget); /* Create a new GtkWindowAttr object that will hold info about the GdkWindow. */ attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.window_type = GDK_WINDOW_CHILD; attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= (GDK_EXPOSURE_MASK); attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); /* Create a new GdkWindow for the widget. */ attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget->window = gdk_window_new (widget->parent->window, &attributes, attr_mask); gdk_window_set_user_data (widget->window, lcd); /* Attach a style to the GdkWindow and draw a background color. */ widget->style = gtk_style_attach (widget->style, widget->window); gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); gdk_window_show (widget->window); }
static void rc_ui_scrollable_label_realize(GtkWidget *widget) { RCUiScrollableLabel *label; GdkWindowAttr attributes; GtkAllocation allocation; GdkWindow *window, *parent; gint attr_mask; GtkStyleContext *context; g_return_if_fail(widget!=NULL); g_return_if_fail(RC_UI_IS_SCROLLABLE_LABEL(widget)); label = RC_UI_SCROLLABLE_LABEL(widget); 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.wclass = GDK_INPUT_OUTPUT; attributes.window_type = GDK_WINDOW_CHILD; attributes.event_mask = gtk_widget_get_events(widget); attributes.event_mask |= (GDK_EXPOSURE_MASK); attributes.visual = gtk_widget_get_visual(widget); attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; gtk_widget_set_has_window(widget, TRUE); parent = gtk_widget_get_parent_window(widget); window = gdk_window_new(parent, &attributes, attr_mask); gtk_widget_set_window(widget, window); gdk_window_set_user_data(window, label); gdk_window_set_background_pattern(window, NULL); context = gtk_widget_get_style_context(widget); gtk_style_context_set_background(context, window); gdk_window_show(window); }
static void cc_timezone_map_realize (GtkWidget *widget) { GdkWindowAttr attr = { 0, }; GtkAllocation allocation; GdkCursor *cursor; GdkWindow *window; gtk_widget_get_allocation (widget, &allocation); gtk_widget_set_realized (widget, TRUE); attr.window_type = GDK_WINDOW_CHILD; attr.wclass = GDK_INPUT_OUTPUT; attr.width = allocation.width; attr.height = allocation.height; attr.x = allocation.x; attr.y = allocation.y; attr.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK; window = gdk_window_new (gtk_widget_get_parent_window (widget), &attr, GDK_WA_X | GDK_WA_Y); cursor = gdk_cursor_new (GDK_HAND2); gdk_window_set_cursor (window, cursor); gdk_window_set_user_data (window, widget); gtk_widget_set_window (widget, window); }
static void selectcolor_realize(GtkWidget *widget) { GdkWindowAttr attributes; guint attributes_mask; g_return_if_fail(widget != NULL); g_return_if_fail(IS_SELECT_COLOR(widget)); GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y; widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); gdk_window_set_user_data(widget->window, widget); widget->style = gtk_style_attach(widget->style, widget->window); gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); GtkWidget * parent = gtk_widget_get_parent(widget); widget->window = parent->window; }
static void gimp_view_realize (GtkWidget *widget) { GimpView *view = GIMP_VIEW (widget); GtkAllocation allocation; GdkWindowAttr attributes; gint attributes_mask; GTK_WIDGET_CLASS (parent_class)->realize (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_ONLY; attributes.event_mask = gtk_widget_get_events (widget); attributes_mask = GDK_WA_X | GDK_WA_Y; view->event_window = gdk_window_new (gtk_widget_get_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (view->event_window, view); }