static void gtk_attractor_view_realize(GtkWidget *widget) { GdkWindowAttr attributes; guint attributes_mask; g_return_if_fail(widget != NULL); g_return_if_fail(GTK_IS_ATTRACTOR_VIEW(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;//W; attributes.height = widget->allocation.height;//H; 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); }
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 _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 = DT_PIXEL_APPLY_DPI(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 gint _gail_combo_button_release (gpointer data) { GtkCombo *combo; GtkWidget *action_widget; GdkEvent tmp_event; GDK_THREADS_ENTER (); combo = GTK_COMBO (data); if (combo->current_button == 0) { GDK_THREADS_LEAVE (); return FALSE; } tmp_event.button.type = GDK_BUTTON_RELEASE; tmp_event.button.button = 1; tmp_event.button.window = combo->list->window; tmp_event.button.time = GDK_CURRENT_TIME; gdk_window_set_user_data (combo->list->window, combo->button); action_widget = combo->list; gtk_widget_event (action_widget, &tmp_event); GDK_THREADS_LEAVE (); return FALSE; }
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 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); }
static void hildon_color_chooser_realize (GtkWidget *widget) { HildonColorChooserPrivate *priv = HILDON_COLOR_CHOOSER_GET_PRIVATE (widget); g_assert (priv); GdkWindowAttr attributes; gint attributes_mask; attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_ONLY; attributes.window_type = GDK_WINDOW_CHILD; attributes.event_mask = gtk_widget_get_events (widget) | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_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_WMCLASS; priv->event_window = gdk_window_new (widget->parent->window, &attributes, attributes_mask); gdk_window_set_user_data (priv->event_window, widget); GTK_WIDGET_CLASS (parent_class)->realize (widget); }
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 gd_notification_realize (GtkWidget *widget) { GdNotification *notification = GD_NOTIFICATION (widget); GdNotificationPrivate *priv = notification->priv; GtkBin *bin = GTK_BIN (widget); GtkAllocation allocation; 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); gdk_window_show (priv->bin_window); }
static void browwidgetgtk_realize( GtkWidget *widget) { GdkWindowAttr attr; gint attr_mask; BrowWidgetGtk *brow; g_return_if_fail (widget != NULL); g_return_if_fail (IS_BROWWIDGETGTK( widget)); GTK_WIDGET_SET_FLAGS( widget, GTK_REALIZED); brow = BROWWIDGETGTK( widget); attr.x = widget->allocation.x; attr.y = widget->allocation.y; attr.width = widget->allocation.width; attr.height = widget->allocation.height; attr.wclass = GDK_INPUT_OUTPUT; attr.window_type = GDK_WINDOW_CHILD; attr.event_mask = gtk_widget_get_events( widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK; attr.visual = gtk_widget_get_visual( widget); attr.colormap = gtk_widget_get_colormap( widget); attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget->window = gdk_window_new( widget->parent->window, &attr, attr_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_WIDGET_SET_FLAGS( widget, GTK_CAN_FOCUS); if ( brow->is_navigator) { if ( !brow->brow_ctx) { BrowWidgetGtk *main_brow = (BrowWidgetGtk *) brow->main_brow_widget; brow->brow_ctx = main_brow->brow_ctx; brow->draw_ctx = main_brow->draw_ctx; ((FlowDrawGtk *)brow->draw_ctx)->init_nav( widget, brow->brow_ctx); } } else { if ( !brow->brow_ctx) { brow->draw_ctx = new FlowDrawGtk( widget, &brow->brow_ctx, brow_init_proc, brow->client_data, flow_eCtxType_Brow); } } }
static void gtk_form_unrealize(GtkWidget *widget) { GList *tmp_list; GtkForm *form; g_return_if_fail(GTK_IS_FORM(widget)); form = GTK_FORM(widget); tmp_list = form->children; gdk_window_set_user_data(form->bin_window, NULL); gdk_window_destroy(form->bin_window); form->bin_window = NULL; while (tmp_list) { GtkFormChild *child = tmp_list->data; if (child->window != NULL) { g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), FUNC2GENERIC(gtk_form_child_map), child); g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), FUNC2GENERIC(gtk_form_child_unmap), child); gdk_window_set_user_data(child->window, NULL); gdk_window_destroy(child->window); child->window = NULL; } tmp_list = tmp_list->next; } #if GTK_CHECK_VERSION(3,0,0) if (GTK_WIDGET_CLASS (gtk_form_parent_class)->unrealize) (* GTK_WIDGET_CLASS (gtk_form_parent_class)->unrealize) (widget); #else if (GTK_WIDGET_CLASS (parent_class)->unrealize) (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); #endif }
static void nullify_widget_pointers (gpointer data, GObject *widget) { MozDrawingarea *drawingarea = data; #ifdef DEBUG gpointer user_data; /* This function may get called twice before widget is destroyed, so the user_data may have already been nullified. */ gdk_window_get_user_data(drawingarea->inner_window, &user_data); if (user_data && widget && user_data != widget) g_critical("user_data does not match widget"); #endif gdk_window_set_user_data(drawingarea->inner_window, NULL); gdk_window_set_user_data(drawingarea->clip_window, NULL); }
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 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 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 gwy_color_axis_realize(GtkWidget *widget) { GwyColorAxis *axis; GdkWindowAttr attributes; gint attributes_mask; GtkStyle *s; gwy_debug(""); g_return_if_fail(widget != NULL); g_return_if_fail(GWY_IS_COLOR_AXIS(widget)); GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); axis = GWY_COLOR_AXIS(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 | 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; 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); /*set backgroun for white forever*/ s = gtk_style_copy(widget->style); s->bg_gc[0] = s->bg_gc[1] = s->bg_gc[2] = s->bg_gc[3] = s->bg_gc[4] = widget->style->white_gc; s->bg[0] = s->bg[1] = s->bg[2] = s->bg[3] = s->bg[4] = widget->style->white; gtk_style_set_background(s, widget->window, GTK_STATE_NORMAL); /*compute axis*/ gwy_color_axis_update(axis); }
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); }
void moz_drawingarea_create_windows (MozDrawingarea *drawingarea, GdkWindow *parent, GtkWidget *widget) { 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.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); attributes.window_type = GDK_WINDOW_CHILD; 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); /* 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); }
static void anjuta_tabber_unrealize (GtkWidget *widget) { AnjutaTabber* tabber = ANJUTA_TABBER (widget); gdk_window_set_user_data (tabber->priv->event_window, NULL); gdk_window_destroy (tabber->priv->event_window); tabber->priv->event_window = NULL; GTK_WIDGET_CLASS (anjuta_tabber_parent_class)->unrealize (widget); }
static void destroy_drag_window (GtkToolItem *toolitem) { if (toolitem->priv->drag_window) { gdk_window_set_user_data (toolitem->priv->drag_window, NULL); gdk_window_destroy (toolitem->priv->drag_window); toolitem->priv->drag_window = NULL; } }
static void gd_tagged_entry_tag_unrealize (GdTaggedEntryTag *tag) { if (tag->window == NULL) return; gdk_window_set_user_data (tag->window, NULL); gdk_window_destroy (tag->window); tag->window = NULL; }
static void gtk_rotated_bin_unrealize (GtkWidget *widget) { GtkRotatedBin *bin = GTK_ROTATED_BIN (widget); gdk_window_set_user_data (bin->offscreen_window, NULL); gdk_window_destroy (bin->offscreen_window); bin->offscreen_window = NULL; GTK_WIDGET_CLASS (gtk_rotated_bin_parent_class)->unrealize (widget); }
void gimp_overlay_child_unrealize (GimpOverlayBox *box, GimpOverlayChild *child) { g_return_if_fail (GIMP_IS_OVERLAY_BOX (box)); g_return_if_fail (child != NULL); gdk_window_set_user_data (child->window, NULL); gdk_window_destroy (child->window); child->window = NULL; }
static void gtk_mirror_bin_unrealize (GtkWidget *widget) { GtkMirrorBin *bin = GTK_MIRROR_BIN (widget); gdk_window_set_user_data (bin->offscreen_window, NULL); gdk_window_destroy (bin->offscreen_window); bin->offscreen_window = NULL; GTK_WIDGET_CLASS (gtk_mirror_bin_parent_class)->unrealize (widget); }
static void xmr_label_unrealize(GtkWidget *widget) { if (gtk_widget_get_window(widget)) { gdk_window_set_user_data(gtk_widget_get_window(widget), NULL); gdk_window_destroy(gtk_widget_get_window(widget)); gtk_widget_set_window(widget, NULL); } }
static void gtk_form_unrealize(GtkWidget *widget) { GList *tmp_list; GtkForm *form; g_return_if_fail(GTK_IS_FORM(widget)); form = GTK_FORM(widget); tmp_list = form->children; gdk_window_set_user_data(form->bin_window, NULL); gdk_window_destroy(form->bin_window); form->bin_window = NULL; while (tmp_list) { GtkFormChild *child = tmp_list->data; if (child->window != NULL) { gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), GTK_SIGNAL_FUNC(gtk_form_child_map), child); gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), GTK_SIGNAL_FUNC(gtk_form_child_unmap), child); gdk_window_set_user_data(child->window, NULL); gdk_window_destroy(child->window); child->window = NULL; } tmp_list = tmp_list->next; } if (GTK_WIDGET_CLASS (parent_class)->unrealize) (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); }
static void gd_notification_unrealize (GtkWidget *widget) { GdNotification *notification = GD_NOTIFICATION (widget); GdNotificationPrivate *priv = notification->priv; gdk_window_set_user_data (priv->bin_window, NULL); gdk_window_destroy (priv->bin_window); priv->bin_window = NULL; GTK_WIDGET_CLASS (gd_notification_parent_class)->unrealize (widget); }
static void gtk_sys_menu_unrealize (GtkWidget *widget) { GtkSysMenuPrivate *priv = GTK_SYS_MENU(widget)->priv; gdk_window_set_user_data (priv->event_window, NULL); gdk_window_destroy (priv->event_window); priv->event_window = NULL; g_free (priv->childindex); priv->childindex = NULL; g_list_free_full (priv->children, g_free); priv->children = NULL; GTK_WIDGET_CLASS(gtk_sys_menu_parent_class)->unrealize (widget); }
/* from GtkMenu sources */ static void menu_grab_transfer_window_destroy (MenuStart * menu) { GdkWindow *window = g_object_get_data (G_OBJECT (menu), "gtk-menu-transfer-window"); if (window) { gdk_window_set_user_data (window, NULL); gdk_window_destroy (window); g_object_set_data (G_OBJECT (menu), "gtk-menu-transfer-window", NULL); } }
static void gtk_hex_entry_realize (GtkWidget *widget) { GtkHexEntry *hex_entry; GtkRequisition requisition; GdkWindowAttr attributes; gint attributes_mask; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_HEX_ENTRY (widget)); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); hex_entry = GTK_HEX_ENTRY (widget); gtk_widget_get_child_requisition (widget, &requisition); attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = requisition.width; attributes.height = requisition.height; 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.cursor = hex_entry->cursor = gdk_cursor_new (GDK_XTERM); attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP | GDK_WA_CURSOR; widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (widget->window, hex_entry); widget->style = gtk_style_attach (widget->style, widget->window); gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]); gdk_window_set_back_pixmap (widget->window, NULL, TRUE); gdk_color_alloc (gtk_widget_get_colormap (widget),&hex_entry->cursor_color); hex_entry->gc = gdk_gc_new (widget->window); gdk_gc_set_foreground (hex_entry->gc,&hex_entry->cursor_color); }