static void sexy_icon_entry_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { g_return_if_fail(SEXY_IS_ICON_ENTRY(widget)); g_return_if_fail(allocation != NULL); widget->allocation = *allocation; GTK_WIDGET_CLASS(parent_class)->size_allocate(widget, allocation); if (GTK_WIDGET_REALIZED(widget)) place_windows(SEXY_ICON_ENTRY(widget), allocation); }
void on_button_prefs_close_clicked(GtkButton *unused_button, gpointer unused_udata) { (void) unused_button; (void) unused_udata; g_return_if_fail(gui_dlg_prefs()); g_return_if_fail(GTK_WIDGET_REALIZED(gui_dlg_prefs())); g_return_if_fail(GTK_WIDGET_VISIBLE(gui_dlg_prefs())); gui_save_window(gui_dlg_prefs(), PROP_PREFS_DLG_COORDS); gtk_widget_hide(gui_dlg_prefs()); }
/* When widget is exposed it's contents are redrawn. */ static gint draw(GtkWidget *widget, GdkEventExpose *event) { static gint i = 0; i++; if (!GTK_IS_WIDGET(widget)) return TRUE; if(!GTK_WIDGET_REALIZED(widget)) return TRUE; /* Draw only last expose. */ if (event->count > 0) return FALSE; redraw(widget,NULL); return FALSE; }
static void gtk_redraw_frame_toolbars (struct frame *f) { /* There are certain startup paths that lead to update_EmacsFrame in faces.c being called before a new frame is fully initialized. In particular before we have actually mapped it. That routine can call this one. So, we need to make sure that the frame is actually ready before we try and draw all over it. */ if (GTK_WIDGET_REALIZED (FRAME_GTK_TEXT_WIDGET (f))) gtk_redraw_exposed_toolbars (f, 0, 0, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f)); }
static void git_source_view_on_adj_changed (GtkAdjustment *adj, GitSourceView *sview) { GitSourceViewPrivate *priv = sview->priv; if (priv->hadjustment) priv->x_offset = priv->hadjustment->value; if (priv->vadjustment) priv->y_offset = priv->vadjustment->value; if (GTK_WIDGET_REALIZED (GTK_WIDGET (sview))) gdk_window_invalidate_rect (GTK_WIDGET (sview)->window, NULL, FALSE); }
static void make_transient(ALLEGRO_DISPLAY *display, GtkWidget *window) { /* Set the current display window (if any) as the parent of the dialog. */ #ifdef ALLEGRO_WITH_XWINDOWS ALLEGRO_DISPLAY_XGLX *glx = (void *)display; if (glx) { if (!GTK_WIDGET_REALIZED(window)) g_signal_connect(window, "realize", G_CALLBACK(realized), (void *)glx); else really_make_transient(window, glx); } #endif }
static gboolean ui_update(Bubblemon *base) { int w, h, i; const bubblemon_picture_t *bubblePic; bubblemon_color_t *pixel; guchar *p; GdkGC *gc; GtkWidget *draw_area = base->draw_area; if((draw_area == NULL) || !GTK_WIDGET_REALIZED(draw_area) || !GTK_WIDGET_DRAWABLE(draw_area) || base->width <= 0) { return TRUE; } bubblePic = bubblemon_getPicture(base->bubblemon); if ((bubblePic == NULL) || (bubblePic->width == 0) || (bubblePic->pixels == 0)) { return TRUE; } w = bubblePic->width; h = bubblePic->height; gc = gdk_gc_new(draw_area->window); p = base->rgb_buffer; pixel = bubblePic->pixels; for(i = 0; i < w * h; i++) { *(p++) = pixel->components.r; *(p++) = pixel->components.g; *(p++) = pixel->components.b; pixel++; } gdk_draw_rgb_image(draw_area->window, gc, 0, 0, base->width, base->height, GDK_RGB_DITHER_NORMAL, base->rgb_buffer, w * 3); gdk_gc_destroy(gc); return TRUE; }
void ensure_buddy_pix (GtkWidget *window, int n) { int width, height; GdkGC *white_gc; int pri; int sec; if (!buddy_pix[1].pix) /* not initialized */ return; if (n < 0 || n > 9 || buddy_pix[n].pix) return; sec = ((n & 0x04) != 0)? 0x04 : 0x02; pri = n & ~sec; ensure_buddy_pix (window, pri); if (!pri || !sec) return; if (!GTK_WIDGET_REALIZED (window)) gtk_widget_realize (window); gdk_window_get_size (buddy_pix[1].pix, &width, &height); buddy_pix[n].pix = gdk_pixmap_new (window->window, width, height, -1); buddy_pix[n].mask = gdk_pixmap_new (window->window, width, height, 1); white_gc = window->style->white_gc; if (!masks_gc) { masks_gc = gdk_gc_new (buddy_pix[n].mask); gdk_gc_set_exposures (masks_gc, FALSE); } gdk_gc_set_foreground (masks_gc, &window->style->white); gdk_draw_pixmap (buddy_pix[n].pix, white_gc, buddy_pix[pri].pix, 0, 0, 0, 0, width, height); gdk_draw_pixmap (buddy_pix[n].mask, masks_gc, buddy_pix[pri].mask, 0, 0, 0, 0, width, height); gdk_gc_set_clip_mask (white_gc, buddy_pix[sec].mask); gdk_draw_pixmap (buddy_pix[n].pix, white_gc, buddy_pix[sec].pix, 0, 0, 0, 0, width, height); gdk_gc_set_clip_mask (white_gc, NULL); gdk_gc_set_clip_mask (masks_gc, buddy_pix[sec].mask); gdk_draw_rectangle (buddy_pix[n].mask, masks_gc, TRUE, 0, 0, width, height); gdk_gc_set_clip_mask (masks_gc, NULL); }
static void thunar_sbr_number_renamer_update (ThunarSbrNumberRenamer *number_renamer) { gboolean invalid = TRUE; GdkColor back; GdkColor text; gchar *endp; /* check whether "start" is valid for the "mode" */ if (number_renamer->mode < THUNAR_SBR_NUMBER_MODE_ABC) { /* "start" must be a positive number */ strtoul (number_renamer->start, &endp, 10); invalid = (endp <= number_renamer->start || *endp != '\0'); } else if (number_renamer->mode == THUNAR_SBR_NUMBER_MODE_ABC) { /* "start" property must be 'a', 'b', 'c', etc. */ invalid = (strlen (number_renamer->start) != 1 || g_ascii_tolower (*number_renamer->start) < 'a' || g_ascii_tolower (*number_renamer->start) > 'z'); } /* check if the start entry is realized */ if (GTK_WIDGET_REALIZED (number_renamer->start_entry)) { /* check if the "start" value is valid */ if (G_UNLIKELY (invalid)) { /* if GTK+ wouldn't be that stupid with style properties and * type plugins, this would be themable, but unfortunately * GTK+ is totally broken, and so it's hardcoded. */ gdk_color_parse ("#ff6666", &back); gdk_color_parse ("White", &text); /* setup a red background/text color to indicate the error */ gtk_widget_modify_base (number_renamer->start_entry, GTK_STATE_NORMAL, &back); gtk_widget_modify_text (number_renamer->start_entry, GTK_STATE_NORMAL, &text); } else { /* reset background/text color */ gtk_widget_modify_base (number_renamer->start_entry, GTK_STATE_NORMAL, NULL); gtk_widget_modify_text (number_renamer->start_entry, GTK_STATE_NORMAL, NULL); } } /* notify everybody that we have a new state */ thunarx_renamer_changed (THUNARX_RENAMER (number_renamer)); }
static void calf_keyboard_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { // CalfKeyboard *self = CALF_KEYBOARD(widget); g_assert(CALF_IS_KEYBOARD(widget)); widget->allocation = *allocation; widget->allocation.width = widget->requisition.width; if (GTK_WIDGET_REALIZED(widget)) gdk_window_move_resize(widget->window, allocation->x + (allocation->width - widget->allocation.width) / 2, allocation->y, widget->allocation.width, allocation->height ); }
void gv_tool_set_cursor(GvTool *tool, gint cursor_type) { if (tool->cursor != NULL) gdk_cursor_destroy(tool->cursor); tool->cursor = gdk_cursor_new(cursor_type); if ((tool->view != NULL) && (GTK_WIDGET_REALIZED(GTK_WIDGET(tool->view)))) { gdk_window_set_cursor(GTK_WIDGET(tool->view)->window, tool->cursor); } }
static gboolean matenu_global_menu_item_sync_monitor_num (MatenuGlobalMenuItem* self) { gboolean result = FALSE; GdkScreen* screen; g_return_val_if_fail (self != NULL, FALSE); screen = _g_object_ref0 (gtk_widget_get_screen ((GtkWidget*) self)); if (GTK_WIDGET_REALIZED ((GtkWidget*) self)) { matenu_monitor_set_monitor_num (self->priv->active_window_monitor, gdk_screen_get_monitor_at_window (screen, ((GtkWidget*) self)->window)); } else { matenu_monitor_set_monitor_num (self->priv->active_window_monitor, -1); } result = FALSE; _g_object_unref0 (screen); return result; }
static void gtk_mng_view_size_allocate (GtkWidget * widget, GtkAllocation * allocation) { FUNCTION_ENTRY(); g_return_if_fail (IS_GTK_MNG_VIEW (widget)); g_return_if_fail (allocation != NULL); if (GTK_WIDGET_REALIZED (widget)) gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height); }
void gtk_moz_embed_open_stream(GtkMozEmbed *embed, const char *base_uri, const char *mime_type) { EmbedPrivate *embedPrivate; g_return_if_fail (embed != NULL); g_return_if_fail (GTK_IS_MOZ_EMBED(embed)); g_return_if_fail (GTK_WIDGET_REALIZED(GTK_WIDGET(embed))); embedPrivate = (EmbedPrivate *)embed->data; embedPrivate->OpenStream(base_uri, mime_type); }
static void gtk_check_item_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GtkCheckItem *check_item; GtkToggleButton *toggle_button; GtkButton *button; GtkAllocation child_allocation; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_CHECK_ITEM (widget)); g_return_if_fail (allocation != NULL); check_item = GTK_CHECK_ITEM (widget); toggle_button = GTK_TOGGLE_BUTTON (widget); if (toggle_button->draw_indicator) { widget->allocation = *allocation; if (GTK_WIDGET_REALIZED (widget)) gdk_window_move_resize (toggle_button->event_window, allocation->x, allocation->y, allocation->width, allocation->height); button = GTK_BUTTON (widget); if (GTK_BIN (button)->child && GTK_WIDGET_VISIBLE (GTK_BIN (button)->child)) { child_allocation.x = (GTK_CONTAINER (widget)->border_width + CHECK_ITEM_CLASS (widget)->indicator_size + CHECK_ITEM_CLASS (widget)->indicator_spacing * 3 + 1 + widget->allocation.x); child_allocation.y = GTK_CONTAINER (widget)->border_width + 1 + widget->allocation.y; child_allocation.width = MAX (1, allocation->width - (GTK_CONTAINER (widget)->border_width + CHECK_ITEM_CLASS (widget)->indicator_size + CHECK_ITEM_CLASS (widget)->indicator_spacing * 3 + 1) - GTK_CONTAINER (widget)->border_width - 1); child_allocation.height = MAX (1, allocation->height - (GTK_CONTAINER (widget)->border_width + 1) * 2); gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation); } } else { if (GTK_WIDGET_CLASS (parent_class)->size_allocate) (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation); } }
static void update_child_count (TrayData *data) { guint n_children = 0; char text[64]; if (!GTK_WIDGET_REALIZED (data->window)) return; gtk_container_foreach (GTK_CONTAINER (data->box), (GtkCallback) do_add, &n_children); g_snprintf (text, sizeof (text), "%u icons", n_children); gtk_label_set_text (data->count_label, text); }
static void gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child) { if (child->window != NULL) return; /* been there, done that */ if (GTK_WIDGET_NO_WINDOW(child->widget)) { GtkWidget *widget; GdkWindowAttr attributes; gint attributes_mask; widget = GTK_WIDGET(form); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = child->x; attributes.y = child->y; attributes.width = child->widget->requisition.width; attributes.height = child->widget->requisition.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual(widget); attributes.colormap = gtk_widget_get_colormap(widget); attributes.event_mask = GDK_EXPOSURE_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; child->window = gdk_window_new(form->bin_window, &attributes, attributes_mask); gdk_window_set_user_data(child->window, widget); gtk_style_set_background(widget->style, child->window, GTK_STATE_NORMAL); gtk_widget_set_parent_window(child->widget, child->window); gtk_form_set_static_gravity(child->window, TRUE); /* * Install signal handlers to map/unmap child->window * alongside with the actual widget. */ gtk_signal_connect(GTK_OBJECT(child->widget), "map", GTK_SIGNAL_FUNC(>k_form_child_map), child); gtk_signal_connect(GTK_OBJECT(child->widget), "unmap", GTK_SIGNAL_FUNC(>k_form_child_unmap), child); } else if (!GTK_WIDGET_REALIZED(child->widget)) { gtk_widget_set_parent_window(child->widget, form->bin_window); } }
static gboolean vf_thumb_next(ViewFile *vf) { FileData *fd = NULL; #if GTK_CHECK_VERSION(2,20,0) if (!gtk_widget_get_realized(vf->listview)) #else if (!GTK_WIDGET_REALIZED(vf->listview)) #endif { vf_thumb_status(vf, 0.0, NULL); return FALSE; } switch (vf->type) { case FILEVIEW_LIST: fd = vflist_thumb_next_fd(vf); break; case FILEVIEW_ICON: fd = vficon_thumb_next_fd(vf); break; } if (!fd) { /* done */ vf_thumb_cleanup(vf); return FALSE; } vf->thumbs_filedata = fd; thumb_loader_free(vf->thumbs_loader); vf->thumbs_loader = thumb_loader_new(options->thumbnails.max_width, options->thumbnails.max_height); thumb_loader_set_callbacks(vf->thumbs_loader, vf_thumb_done_cb, vf_thumb_error_cb, NULL, vf); if (!thumb_loader_start(vf->thumbs_loader, fd)) { /* set icon to unknown, continue */ DEBUG_1("thumb loader start failed %s", fd->path); vf_thumb_do(vf, fd); return TRUE; } return FALSE; }
void gtk_anim_label_set_text(GtkAnimLabel * anim_label, const gchar * txt ) { g_return_if_fail(anim_label != NULL); g_return_if_fail(GTK_IS_ANIM_LABEL(anim_label)); if (anim_label->txt) { g_free(anim_label->txt); anim_label->txt = NULL; } if ((txt == NULL) || (strlen(txt) <= 0)) return; if (txt != NULL) anim_label->txt = g_strdup(txt); if (anim_label->auto_reset) anim_label->pos_x = 0; if ((!anim_label->timer) && (anim_label->delay_sec > 0)) anim_label->timer = g_timer_new(); else if (anim_label->delay_sec > 0) g_timer_start(anim_label->timer); if (anim_label->layout) { g_object_unref(G_OBJECT(anim_label->layout)); anim_label->layout = NULL; } if (anim_label->pixmap) { g_object_unref(G_OBJECT(anim_label->pixmap)); anim_label->pixmap = NULL; } anim_label_create_layout(anim_label, (anim_label->txt) ? anim_label->txt : ""); if (!anim_label->pixmap && GTK_WIDGET_REALIZED(GTK_WIDGET(anim_label))) { anim_label_create_pixmap(anim_label); } gtk_widget_queue_resize(GTK_WIDGET(anim_label)); }
/** * gimp_window_get_native: * @window: a #GtkWindow * * This function is used to pass a window handle to plug-ins so that * they can set their dialog windows transient to the parent window. * * Return value: a native window handle of the window's #GdkWindow or 0 * if the window isn't realized yet */ GdkNativeWindow gimp_window_get_native (GtkWindow *window) { g_return_val_if_fail (GTK_IS_WINDOW (window), 0); #ifdef GDK_NATIVE_WINDOW_POINTER #ifdef __GNUC__ #warning gimp_window_get_native() unimplementable for the target windowing system #endif return (GdkNativeWindow)0; #endif #ifdef GDK_WINDOWING_WIN32 if (window && GTK_WIDGET_REALIZED (window)) return (GdkNativeWindow)GDK_WINDOW_HWND (GTK_WIDGET (window)->window); #endif #ifdef GDK_WINDOWING_X11 if (window && GTK_WIDGET_REALIZED (window)) return GDK_WINDOW_XID (GTK_WIDGET (window)->window); #endif return (GdkNativeWindow)0; }
static void selectcolor_size_allocate(GtkWidget* widget, GtkAllocation* allocation) { g_return_if_fail(widget != NULL); g_return_if_fail(IS_SELECT_COLOR(widget)); g_return_if_fail(allocation != NULL); widget->allocation = *allocation; if (GTK_WIDGET_REALIZED(widget)) { gdk_window_move_resize(widget->window, allocation->x, allocation->y, allocation->width, allocation->height); } }
static void gtk_cpu_size_allocate(GtkWidget * widget, GtkAllocation * allocation) { g_return_if_fail(widget != NULL); g_return_if_fail(GTK_IS_CPU(widget)); g_return_if_fail(allocation != NULL); widget->allocation = *allocation; if (GTK_WIDGET_REALIZED(widget)) { gdk_window_move_resize(widget->window, allocation->x, allocation->y, allocation->width, allocation->height); } }
void gtk_clist_set_column_title(GtkCList *clist, gint column, const gchar *title) { HWND hWnd; if (column < 0 || column >= clist->cols) return; g_free(clist->coldata[column].title); clist->coldata[column].title = g_strdup(title); if (GTK_WIDGET_REALIZED(GTK_WIDGET(clist))) { hWnd = GTK_WIDGET(clist)->hWnd; InvalidateRect(hWnd, NULL, FALSE); UpdateWindow(hWnd); } }
static void piano_keyboard_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { /* XXX: Are these two needed? */ g_return_if_fail(widget != NULL); g_return_if_fail(allocation != NULL); widget->allocation = *allocation; recompute_dimensions(PIANO_KEYBOARD(widget)); if (GTK_WIDGET_REALIZED(widget)) { gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height); } }
static void gtk_xournal_size_allocate(GtkWidget * widget, GtkAllocation * allocation) { g_return_if_fail(widget != NULL); g_return_if_fail(GTK_IS_XOURNAL(widget)); g_return_if_fail(allocation != NULL); widget->allocation = *allocation; if (GTK_WIDGET_REALIZED(widget)) { gdk_window_move_resize(widget->window, allocation->x, allocation->y, allocation->width, allocation->height); } GtkXournal * xournal = GTK_XOURNAL(widget); xournal->layout->setSize(allocation->width, allocation->height); }
gboolean on_dlg_prefs_delete_event(GtkWidget *unused_widget, GdkEvent *unused_event, gpointer unused_udata) { (void) unused_widget; (void) unused_event; (void) unused_udata; g_return_val_if_fail(gui_dlg_prefs(), TRUE); g_return_val_if_fail(GTK_WIDGET_REALIZED(gui_dlg_prefs()), TRUE); g_return_val_if_fail(GTK_WIDGET_VISIBLE(gui_dlg_prefs()), TRUE); gtk_widget_hide(gui_dlg_prefs()); return TRUE; }
void tweet_canvas_set_border_width (TweetCanvas *canvas, guint border_width) { g_return_if_fail (TWEET_IS_CANVAS (canvas)); if (canvas->border_width != border_width) { canvas->border_width = border_width; g_object_notify (G_OBJECT (canvas), "border-width"); if (GTK_WIDGET_REALIZED (canvas)) gtk_widget_queue_resize (GTK_WIDGET (canvas)); } }
bool wxGLCanvas::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name, const int *attribList, const wxPalette& WXUNUSED_UNLESS_DEBUG(palette)) { wxASSERT_MSG( !palette.IsOk(), _T("palettes not supported") ); m_exposed = false; m_noExpose = true; m_nativeSizeEvent = true; if ( !InitVisual(attribList) ) return false; // watch for the "parent-set" signal on m_wxwindow so we can set colormap // before m_wxwindow is realized (which will occur before // wxWindow::Create() returns if parent is already visible) unsigned sig_id = g_signal_lookup("parent-set", GTK_TYPE_WIDGET); g_signal_add_emission_hook(sig_id, 0, parent_set_hook, this, NULL); wxWindow::Create( parent, id, pos, size, style, name ); gtk_widget_set_double_buffered(m_wxwindow, false); #if WXWIN_COMPATIBILITY_2_8 g_signal_connect(m_wxwindow, "realize", G_CALLBACK(gtk_glwindow_realized_callback), this); #endif // WXWIN_COMPATIBILITY_2_8 g_signal_connect(m_wxwindow, "map", G_CALLBACK(gtk_glwindow_map_callback), this); g_signal_connect(m_wxwindow, "expose_event", G_CALLBACK(gtk_glwindow_expose_callback), this); g_signal_connect(m_widget, "size_allocate", G_CALLBACK(gtk_glcanvas_size_callback), this); #if WXWIN_COMPATIBILITY_2_8 // if our parent window is already visible, we had been realized before we // connected to the "realize" signal and hence our m_glContext hasn't been // initialized yet and we have to do it now if (GTK_WIDGET_REALIZED(m_wxwindow)) gtk_glwindow_realized_callback( m_wxwindow, this ); #endif // WXWIN_COMPATIBILITY_2_8 if (GTK_WIDGET_MAPPED(m_wxwindow)) gtk_glwindow_map_callback( m_wxwindow, this ); return true; }
static void blursk_playback_stop(void) { if (config.fullscreen_revert) { #if HAVE_XV xv_end(); #endif if (can_fullscreen) xmms_fullscreen_cleanup(blursk_window); fullscreen_method = NULL; } if(GTK_WIDGET_REALIZED(area)) gdk_window_clear(area->window); }
static void custom_widget_apply(GtkPrintOperation *prt, GtkWidget *font_dialog, gpointer user_data) { gchar *font = NULL; #if GTK_CHECK_VERSION(2,20,0) if(gtk_widget_get_realized(font_dialog)) #else if(GTK_WIDGET_REALIZED(font_dialog)) #endif font = gtk_font_selection_get_font_name(GTK_FONT_SELECTION(font_dialog)); Trace("Selected font: \"%s\"",font); if(font) g_object_set_data_full(G_OBJECT(prt),"3270FontName",font,g_free); }