static void anjuta_tabber_realize (GtkWidget *widget) { GdkWindow* window; GdkWindowAttr attributes; GtkAllocation allocation; AnjutaTabber* tabber = ANJUTA_TABBER (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_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.event_mask |= (GDK_BUTTON_PRESS_MASK); tabber->priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, GDK_WA_X | GDK_WA_Y); gdk_window_set_user_data (tabber->priv->event_window, tabber); }
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 _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_realized(widget, TRUE); GtkAllocation allocation; gtk_widget_get_allocation(widget, &allocation); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = allocation.x; attributes.y = 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; gtk_widget_set_window(widget, gdk_window_new( gtk_widget_get_parent_window (widget), & attributes, attributes_mask )); gdk_window_set_user_data(gtk_widget_get_window(widget), widget); gtk_widget_set_style(widget, gtk_style_attach(gtk_widget_get_style(widget), gtk_widget_get_window(widget))); gtk_style_set_background(gtk_widget_get_style(widget), gtk_widget_get_window(widget), GTK_STATE_NORMAL); }
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 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 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 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 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 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 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 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 _slider_realize(GtkWidget *widget) { g_return_if_fail(widget != NULL); g_return_if_fail(DTGTK_IS_SLIDER(widget)); GdkWindowAttr attributes; guint attributes_mask; GtkWidgetClass* klass = GTK_WIDGET_CLASS (_slider_parent_class); if (klass->realize) klass->realize (widget); gtk_widget_set_realized(widget, TRUE); GtkAllocation allocation; gtk_widget_get_allocation(widget, &allocation); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = allocation.x; attributes.y = allocation.y; attributes.width = 100; attributes.height = DTGTK_SLIDER_CONTROL_MIN_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; gtk_widget_set_window(widget, gdk_window_new( gtk_widget_get_parent_window (gtk_widget_get_parent(widget)),& attributes, attributes_mask)); gdk_window_set_user_data(gtk_widget_get_window(widget), widget); gtk_widget_set_style(widget, gtk_style_attach(gtk_widget_get_style(widget), gtk_widget_get_window(widget))); gtk_style_set_background(gtk_widget_get_style(widget), gtk_widget_get_window(widget), GTK_STATE_NORMAL); }
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 cvImageWidget_realize (GtkWidget *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_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 | 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 gb_slider_realize (GtkWidget *widget) { GbSlider *self = (GbSlider *)widget; GbSliderPrivate *priv = gb_slider_get_instance_private (self); GdkWindow *window; gsize i; g_assert (GB_IS_SLIDER (self)); gtk_widget_set_realized (widget, TRUE); window = gtk_widget_get_parent_window (widget); gtk_widget_set_window (widget, window); g_object_ref (window); for (i = 0; i < priv->children->len; i++) { GbSliderChild *child; child = g_ptr_array_index (priv->children, i); if (child->window == NULL) child->window = gb_slider_create_child_window (self, child); } }
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 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); #if !GTK_CHECK_VERSION(3, 0, 0) gtk_widget_set_style(widget, gtk_style_attach(gtk_widget_get_style(widget), window)); #endif /* * 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); }
void moz_container_realize (GtkWidget *widget) { GdkWindowAttr attributes; gint attributes_mask = 0; MozContainer *container; GtkAllocation allocation; g_return_if_fail(IS_MOZ_CONTAINER(widget)); container = MOZ_CONTAINER(widget); gtk_widget_set_realized(widget, TRUE); /* create the shell window */ attributes.event_mask = (gtk_widget_get_events (widget) | 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 | #ifdef MOZ_PLATFORM_MAEMO GDK_POINTER_MOTION_HINT_MASK | #endif GDK_POINTER_MOTION_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; attributes.visual = gtk_widget_get_visual (widget); #if defined(MOZ_WIDGET_GTK2) attributes.colormap = gtk_widget_get_colormap (widget); #endif attributes.window_type = GDK_WINDOW_CHILD; attributes_mask |= GDK_WA_VISUAL | GDK_WA_X | GDK_WA_Y; #if defined(MOZ_WIDGET_GTK2) attributes_mask |= GDK_WA_COLORMAP; #endif gtk_widget_set_window(widget, gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask)); /* printf("widget->window is %p\n", (void *)widget->window); */ gdk_window_set_user_data (gtk_widget_get_window(widget), container); #if defined(MOZ_WIDGET_GTK2) widget->style = gtk_style_attach (widget->style, widget->window); #endif /* TODO GTK3? */ #if defined(MOZ_WIDGET_GTK2) /* set the back pixmap to None so that you don't end up with the gtk default which is BlackPixel */ gdk_window_set_back_pixmap (widget->window, NULL, FALSE); #endif }
static void gtk_sys_menu_realize (GtkWidget *widget) { GtkAllocation allocation; GdkWindow *parent_window; GdkWindowAttr attributes; gint attributes_mask; GtkSysMenuPrivate *priv = GTK_SYS_MENU(widget)->priv; 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_ONLY; attributes.event_mask = gtk_widget_get_events (widget) | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_FOCUS_CHANGE_MASK | GDK_LEAVE_NOTIFY_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y; parent_window = gtk_widget_get_parent_window (widget); g_object_ref (parent_window); gtk_widget_set_window (widget, parent_window); priv->event_window = gdk_window_new (parent_window, &attributes, attributes_mask); gdk_window_set_user_data (priv->event_window, widget); /* * 使用指针数组,加快item定位速度 */ GList *item; int i = 0; int w; priv->amount = g_list_length (priv->children); priv->childindex = (GtkSysMenuItem **)g_malloc(priv->amount * sizeof (GtkSysMenuItem *)); for (item = priv->children; item; item = item->next, i++) { priv->childindex[i] = (GtkSysMenuItem *)(item->data); (*priv->childindex[i]).y = i * SYS_MENU_ITEM_HEIGHT; (*priv->childindex[i]).x = 15; (*priv->childindex[i]).layout = gtk_widget_create_pango_layout (widget, (*priv->childindex[i]).text); pango_layout_get_pixel_size ((*priv->childindex[i]).layout, &w, NULL); priv->allocation.width = MAX (priv->allocation.width, w); priv->selected = (*priv->childindex[i]).selected ? i : priv->selected; } priv->allocation.width += 30; }
static void ddb_tabstrip_realize (GtkWidget *widget) { DdbTabStrip *darea = DDB_TABSTRIP (widget); GdkWindowAttr attributes; gint attributes_mask; if (!gtk_widget_get_has_window (widget)) { GTK_WIDGET_CLASS (ddb_tabstrip_parent_class)->realize (widget); } else { gtk_widget_set_realized (widget, TRUE); attributes.window_type = GDK_WINDOW_CHILD; GtkAllocation a; gtk_widget_get_allocation (widget, &a); attributes.x = a.x; attributes.y = a.y; attributes.width = a.width; attributes.height = a.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); #if !GTK_CHECK_VERSION(3,0,0) attributes.colormap = gtk_widget_get_colormap (widget); #endif attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; #if !GTK_CHECK_VERSION(3,0,0) attributes_mask |= GDK_WA_COLORMAP; #endif GdkWindow *window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gtk_widget_set_window(widget, window); gdk_window_set_user_data (gtk_widget_get_window(widget), darea); #if !GTK_CHECK_VERSION(3,0,0) widget->style = gtk_style_attach (widget->style, widget->window); gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); #else gtk_style_context_set_background (gtk_widget_get_style_context (widget), window); #endif } ddb_tabstrip_send_configure (DDB_TABSTRIP (widget)); GtkTargetEntry entry = { .target = TARGET_PLAYITEMS, .flags = GTK_TARGET_SAME_APP, .info = TARGET_SAMEWIDGET }; gtk_drag_dest_set (widget, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, &entry, 1, GDK_ACTION_COPY | GDK_ACTION_MOVE); gtk_drag_dest_add_uri_targets (widget); gtk_drag_dest_set_track_motion (widget, TRUE); }
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 gstyle_slidein_realize (GtkWidget *widget) { GstyleSlidein *self = (GstyleSlidein *)widget; g_assert (GSTYLE_IS_SLIDEIN (self)); GTK_WIDGET_CLASS (gstyle_slidein_parent_class)->realize (widget); gtk_widget_set_realized (widget, TRUE); if (self->overlay_child != NULL && self->overlay_window == NULL) self->overlay_window = gstyle_slidein_create_child_window (self); }
void ags_indicator_realize(GtkWidget *widget) { AgsIndicator *indicator; GdkWindowAttr attributes; gint attributes_mask; gint buttons_width; gint border_left, border_top; g_return_if_fail (widget != NULL); g_return_if_fail (AGS_IS_INDICATOR (widget)); indicator = AGS_INDICATOR(widget); gtk_widget_set_realized (widget, TRUE); /* */ 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_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; attributes.window_type = GDK_WINDOW_CHILD; 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); attributes.event_mask |= (GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (widget->window, indicator); widget->style = gtk_style_attach (widget->style, widget->window); gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); gtk_widget_queue_resize (widget); }
static void gtk_expander_realize (GtkWidget *widget) { GtkExpanderPrivate *priv; GdkWindowAttr attributes; gint attributes_mask; gint border_width; GdkRectangle expander_rect; gint label_height; priv = GTK_EXPANDER (widget)->priv; gtk_widget_set_realized (widget, TRUE); border_width = GTK_CONTAINER (widget)->border_width; get_expander_bounds (GTK_EXPANDER (widget), &expander_rect); if (priv->label_widget && gtk_widget_get_visible (priv->label_widget)) { GtkRequisition label_requisition; gtk_widget_get_child_requisition (priv->label_widget, &label_requisition); label_height = label_requisition.height; } else label_height = 0; attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x + border_width; attributes.y = widget->allocation.y + border_width; attributes.width = MAX (widget->allocation.width - 2 * border_width, 1); attributes.height = MAX (expander_rect.height, label_height - 2 * border_width); attributes.wclass = GDK_INPUT_ONLY; attributes.event_mask = gtk_widget_get_events (widget) | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y; widget->window = gtk_widget_get_parent_window (widget); g_object_ref (widget->window); priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (priv->event_window, widget); widget->style = gtk_style_attach (widget->style, widget->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 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 gtk_tool_item_realize (GtkWidget *widget) { GtkToolItem *toolitem; toolitem = GTK_TOOL_ITEM (widget); gtk_widget_set_realized (widget, TRUE); widget->window = gtk_widget_get_parent_window (widget); g_object_ref (widget->window); if (toolitem->priv->use_drag_window) create_drag_window(toolitem); widget->style = gtk_style_attach (widget->style, widget->window); }
void moz_container_realize (GtkWidget *widget) { GdkWindow *parent = gtk_widget_get_parent_window (widget); GdkWindow *window; gtk_widget_set_realized(widget, TRUE); if (gtk_widget_get_has_window (widget)) { GdkWindowAttr attributes; gint attributes_mask = GDK_WA_VISUAL | GDK_WA_X | GDK_WA_Y; GtkAllocation allocation; gtk_widget_get_allocation (widget, &allocation); attributes.event_mask = gtk_widget_get_events (widget); 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.window_type = GDK_WINDOW_CHILD; #if (MOZ_WIDGET_GTK == 2) attributes.colormap = gtk_widget_get_colormap (widget); attributes_mask |= GDK_WA_COLORMAP; #endif window = gdk_window_new (parent, &attributes, attributes_mask); gdk_window_set_user_data (window, widget); #if (MOZ_WIDGET_GTK == 2) /* TODO GTK3? */ /* set the back pixmap to None so that you don't end up with the gtk default which is BlackPixel */ gdk_window_set_back_pixmap (window, NULL, FALSE); #endif } else { window = parent; g_object_ref (window); } gtk_widget_set_window (widget, window); #if (MOZ_WIDGET_GTK == 2) widget->style = gtk_style_attach (widget->style, widget->window); #endif }
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); }