bool wxApp::OnInitGui() { if ( !wxAppBase::OnInitGui() ) return false; #ifndef __WXGTK3__ // if this is a wxGLApp (derived from wxApp), and we've already // chosen a specific visual, then derive the GdkVisual from that if ( GetXVisualInfo() ) { GdkVisual* vis = gtk_widget_get_default_visual(); GdkColormap *colormap = gdk_colormap_new( vis, FALSE ); gtk_widget_set_default_colormap( colormap ); } else { // On some machines, the default visual is just 256 colours, so // we make sure we get the best. This can sometimes be wasteful. if (m_useBestVisual) { if (m_forceTrueColour) { GdkVisual* visual = gdk_visual_get_best_with_both( 24, GDK_VISUAL_TRUE_COLOR ); if (!visual) { wxLogError(wxT("Unable to initialize TrueColor visual.")); return false; } GdkColormap *colormap = gdk_colormap_new( visual, FALSE ); gtk_widget_set_default_colormap( colormap ); } else { if (gdk_visual_get_best() != gdk_visual_get_system()) { GdkVisual* visual = gdk_visual_get_best(); GdkColormap *colormap = gdk_colormap_new( visual, FALSE ); gtk_widget_set_default_colormap( colormap ); } } } } #endif #if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 if ( !GetHildonProgram() ) { wxLogError(_("Unable to initialize Hildon program")); return false; } #endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 return true; }
/** * ppg_ruler_realize: * @widget: (in): A #PpgRuler. * * Handle the "realize" event for the widget. * * Returns: None. * Side effects: None. */ static void ppg_ruler_realize (GtkWidget *widget) { PpgRuler *ruler = (PpgRuler *)widget; PpgRulerPrivate *priv; GdkColormap *colormap; GdkVisual *visual; g_return_if_fail(PPG_IS_RULER(ruler)); priv = ruler->priv; GTK_WIDGET_CLASS(ppg_ruler_parent_class)->realize(widget); gtk_widget_queue_resize(widget); /* * Create pixmap for arrow. */ if (priv->arrow) { g_object_unref(priv->arrow); } priv->arrow = gdk_pixmap_new(NULL, ARROW_SIZE, ARROW_SIZE, 32); visual = gdk_visual_get_best_with_depth(32); colormap = gdk_colormap_new(visual, FALSE); gdk_drawable_set_colormap(priv->arrow, colormap); }
static gboolean parent_set_hook(GSignalInvocationHint*, guint, const GValue* param_values, void* data) { wxGLCanvas* win = (wxGLCanvas*)data; if (g_value_peek_pointer(¶m_values[0]) == win->m_wxwindow) { const XVisualInfo* xvi = win->GetXVisualInfo(); GdkVisual* visual = gtk_widget_get_visual(win->m_wxwindow); if (GDK_VISUAL_XVISUAL(visual)->visualid != xvi->visualid) { GdkScreen* screen = gtk_widget_get_screen(win->m_wxwindow); visual = gdk_x11_screen_lookup_visual(screen, xvi->visualid); #ifdef __WXGTK3__ gtk_widget_set_visual(win->m_wxwindow, visual); #else GdkColormap* colormap = gdk_colormap_new(visual, false); gtk_widget_set_colormap(win->m_wxwindow, colormap); g_object_unref(colormap); #endif } // remove hook return false; } return true; }
static GdkColormap * gdk_gl_config_setup_colormap (GdkScreen *screen, PIXELFORMATDESCRIPTOR *pfd, gboolean is_rgba) { GDK_GL_NOTE_FUNC_PRIVATE (); if (is_rgba) { /* * For RGBA mode. */ /* System default colormap. */ GDK_GL_NOTE (MISC, g_message (" -- Colormap: system default")); return g_object_ref (G_OBJECT (gdk_screen_get_system_colormap (screen))); } else { /* * For color index mode. */ /* New private colormap. */ GDK_GL_NOTE (MISC, g_message (" -- Colormap: new allocated writable")); return gdk_colormap_new (gdk_screen_get_system_visual (screen), TRUE); } /* not reached */ return NULL; }
void gtk_gui_alloc_resources() { GdkColormap *map; gui_colour_normal.red = gui_colour_normal.green = gui_colour_normal.blue = 0; gui_colour_changed.red = gui_colour_changed.green = 64*256; gui_colour_changed.blue = 154*256; gui_colour_error.red = 65535; gui_colour_error.green = gui_colour_error.blue = 64*256; gui_colour_pc.red = 32*256; gui_colour_pc.green = 170*256; gui_colour_pc.blue = 52*256; gui_colour_warn = gui_colour_changed; gui_colour_trace.red = 156*256; gui_colour_trace.green = 78*256; gui_colour_trace.blue = 201*256; gui_colour_debug = gui_colour_pc; gui_colour_break.red = 65535; gui_colour_break.green = gui_colour_break.blue = 192*256; gui_colour_temp_break.red = gui_colour_temp_break.green = 128*256; gui_colour_temp_break.blue = 32*256; gui_colour_white.red = gui_colour_white.green = gui_colour_white.blue = 65535; map = gdk_colormap_new(gdk_visual_get_best(), TRUE); gdk_colormap_alloc_color(map, &gui_colour_normal, TRUE, TRUE); gdk_colormap_alloc_color(map, &gui_colour_changed, TRUE, TRUE); gdk_colormap_alloc_color(map, &gui_colour_error, TRUE, TRUE); gdk_colormap_alloc_color(map, &gui_colour_warn, TRUE, TRUE); gdk_colormap_alloc_color(map, &gui_colour_pc, TRUE, TRUE); gdk_colormap_alloc_color(map, &gui_colour_debug, TRUE, TRUE); gdk_colormap_alloc_color(map, &gui_colour_trace, TRUE, TRUE); gdk_colormap_alloc_color(map, &gui_colour_break, TRUE, TRUE); gdk_colormap_alloc_color(map, &gui_colour_temp_break, TRUE, TRUE); gdk_colormap_alloc_color(map, &gui_colour_white, TRUE, TRUE); gui_fixed_font = pango_font_description_from_string("Courier 10"); }
static gboolean parent_set_hook(GSignalInvocationHint*, guint, const GValue* param_values, void* data) { wxGLCanvas* win = (wxGLCanvas*)data; if (g_value_peek_pointer(¶m_values[0]) == win->m_wxwindow) { const XVisualInfo* xvi = (XVisualInfo*)win->m_vi; GdkVisual* visual = gtk_widget_get_visual(win->m_wxwindow); if (GDK_VISUAL_XVISUAL(visual)->visualid != xvi->visualid) { #if GTK_CHECK_VERSION(2, 2, 0) if (gtk_check_version(2, 2, 0) == NULL) { GdkScreen* screen = gtk_widget_get_screen(win->m_wxwindow); visual = gdk_x11_screen_lookup_visual(screen, xvi->visualid); } else #endif { visual = gdkx_visual_get(xvi->visualid); } GdkColormap* colormap = gdk_colormap_new(visual, false); gtk_widget_set_colormap(win->m_wxwindow, colormap); g_object_unref(colormap); } // remove hook return false; } return true; }
/** * ppg_ruler_size_allocate: * @ruler: (in): A #PpgRuler. * * Handle the "size-allocate" for the #GtkWidget. The pixmap for the * background is created and drawn if necessary. * * Returns: None. * Side effects: None. */ static void ppg_ruler_size_allocate (GtkWidget *widget, GtkAllocation *alloc) { PpgRuler *ruler = (PpgRuler *)widget; PpgRulerPrivate *priv; GdkColormap *colormap; GdkVisual *visual; g_return_if_fail(PPG_IS_RULER(ruler)); priv = ruler->priv; GTK_WIDGET_CLASS(ppg_ruler_parent_class)->size_allocate(widget, alloc); if (priv->ruler) { g_object_unref(priv->ruler); } priv->ruler = gdk_pixmap_new(NULL, alloc->width, alloc->height, 32); visual = gdk_visual_get_best_with_depth(32); colormap = gdk_colormap_new(visual, FALSE); gdk_drawable_set_colormap(priv->ruler, colormap); if (GTK_WIDGET_DRAWABLE(widget)) { ppg_ruler_draw_ruler(ruler); } }
static VALUE rg_initialize(VALUE self, VALUE visual, VALUE allocate) { GdkColormap *cmap = gdk_colormap_new(GDK_VISUAL(RVAL2GOBJ(visual)), RVAL2CBOOL(allocate)); G_INITIALIZE(self, cmap); return Qnil; }
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); } }
/*# @class GdkColormap @brief The GdkColormap structure is used to describe an allocated or unallocated color. @param visual a GdkVisual. @param allocate if true, the newly created colormap will be a private colormap, and all colors in it will be allocated for the applications use. @prop size For pseudo-color colormaps, the number of colors in the colormap. @prop colors An array containing the current values in the colormap. This can be used to map from pixel values back to RGB values. This is only meaningful for pseudo-color colormaps. */ FALCON_FUNC Colormap::init( VMARG ) { Item* i_vis = vm->param( 0 ); Item* i_allocate = vm->param( 1 ); #ifndef NO_PARAMETER_CHECK if ( !i_vis || !i_vis->isObject() || !IS_DERIVED( i_vis, GdkVisual ) || !i_allocate || !i_allocate->isBoolean() ) throw_inv_params( "GdkVisual,B" ); #endif MYSELF; self->setObject( gdk_colormap_new( GET_VISUAL( *i_vis ), (gboolean) i_allocate->asBoolean() ) ); }
/** Initialize color access (gdk) and set up default colors. */ void color_init(void) { if (!_color_initialized) { GdkVisual *visual = gtk_widget_get_default_visual(); colormap = gdk_colormap_new (visual, FALSE); _color_initialized = TRUE; color_convert(&color_black, &color_gdk_black); color_convert(&color_white, &color_gdk_white); } }
void iupgtkPushVisualAndColormap(void* visual, void* colormap) { GdkColormap* gdk_colormap; GdkVisual *gdk_visual = gdkx_visual_get(XVisualIDFromVisual((Visual*)visual)); if (colormap) gdk_colormap = gdk_x11_colormap_foreign_new(gdk_visual, (Colormap)colormap); else gdk_colormap = gdk_colormap_new(gdk_visual, FALSE); gtk_widget_push_colormap(gdk_colormap); /* gtk_widget_push_visual is now deprecated */ }
void iupgtkPushVisualAndColormap(void* visual, void* colormap) { #if GTK_CHECK_VERSION(3, 0, 0) (void)visual; (void)colormap; #else GdkColormap* gdk_colormap; GdkVisual *gdk_visual = gdk_visual_get_best(); gdk_colormap = gdk_colormap_new(gdk_visual, FALSE); gtk_widget_push_colormap(gdk_colormap); /* gtk_widget_push_visual is now deprecated */ #endif }
static GdkColormap * get_best_colormap_for_screen (GdkScreen *screen) { GdkColormap *colormap; GdkVisual *visual; g_return_val_if_fail (screen != NULL, NULL); visual = get_best_visual (); colormap = NULL; if (visual != NULL) { colormap = gdk_colormap_new (visual, FALSE); } return colormap; }
/* allocate a color from the color map */ gboolean get_color(GdkColor *new_color) { GdkVisual *pv; if (!our_cmap) { if (!gdk_colormap_alloc_color (sys_cmap, new_color, FALSE, TRUE)) { pv = gdk_visual_get_best(); if (!(our_cmap = gdk_colormap_new(pv, TRUE))) { simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, "Could not create new colormap"); } } else return (TRUE); } return (gdk_colormap_alloc_color(our_cmap, new_color, FALSE, TRUE)); }
static void gtku_gl_drawing_area_init (GtkuGLDrawingArea * self) { GtkuGLDrawingAreaPrivate * priv = GTKU_GL_DRAWING_AREA_GET_PRIVATE (self); gtk_widget_set_double_buffered (GTK_WIDGET (self), FALSE); priv->dpy = NULL; priv->visual = NULL; priv->context = NULL; #ifdef USE_VBLANK priv->vblank_watch = 0; priv->pipe[0] = -1; priv->thread = 0; priv->quit_thread = 0; priv->swap_requested = 0; #endif XVisualInfo * vinfo = glXChooseVisual (GDK_DISPLAY (), GDK_SCREEN_XNUMBER (gdk_screen_get_default ()), attr_list); if (!vinfo) { fprintf (stderr, "Preferred visual not found, using default...\n"); return; } VisualID desired_id = vinfo->visualid; XFree (vinfo); GList * visuals = gdk_list_visuals (); GList * vis; for (vis = visuals; vis; vis = vis->next) { Visual * xv = GDK_VISUAL_XVISUAL (vis->data); if (XVisualIDFromVisual (xv) == desired_id) { GdkColormap * colormap = gdk_colormap_new (vis->data, FALSE); gtk_widget_set_colormap (GTK_WIDGET (self), colormap); g_object_unref (G_OBJECT (colormap)); break; } } g_list_free (visuals); }
static void cdpalette(cdCtxCanvas *ctxcanvas, int n, const long int *palette, int mode) { int i; GdkColor clr; if (mode == CD_FORCE) { /* if was POLITE then allocates own palette */ if (ctxcanvas->colormap == gdk_gc_get_colormap(ctxcanvas->gc)) ctxcanvas->colormap = gdk_colormap_new(ctxcanvas->vis, FALSE); /* allocate all the palette colors to the CD */ for (i = 0; i < n; i++) { clr = cdColorToGdk(palette[i]); gdk_colormap_alloc_color(ctxcanvas->colormap, &clr, FALSE, FALSE); } /* set directly on the drawable */ gdk_drawable_set_colormap(ctxcanvas->wnd, ctxcanvas->colormap); } else { /* if was FORCE, remove the own palette */ if (ctxcanvas->colormap != gdk_gc_get_colormap(ctxcanvas->gc)) { g_object_unref(ctxcanvas->colormap); ctxcanvas->colormap = gdk_gc_get_colormap(ctxcanvas->gc); } /* if POLITE then just try to allocate all the colors of the palette */ for (i = 0; i < n; i++) { clr = cdColorToGdk(palette[i]); gdk_colormap_alloc_color(ctxcanvas->colormap, &clr, FALSE, TRUE); } } }
void iupgtkPushVisualAndColormap(void* visual, void* colormap) { #if GTK_CHECK_VERSION(3, 0, 0) (void)visual; (void)colormap; #else GdkColormap* gdk_colormap; #if GTK_CHECK_VERSION(2, 24, 0) GdkScreen* screen = gdk_screen_get_default(); GdkVisual* gdk_visual = gdk_x11_screen_lookup_visual(screen, XVisualIDFromVisual((Visual*)visual)); #else GdkVisual* gdk_visual = gdkx_visual_get(XVisualIDFromVisual((Visual*)visual)); #endif if (colormap) gdk_colormap = gdk_x11_colormap_foreign_new(gdk_visual, (Colormap)colormap); else gdk_colormap = gdk_colormap_new(gdk_visual, FALSE); gtk_widget_push_colormap(gdk_colormap); /* gtk_widget_push_visual is now deprecated */ #endif }
GdkPixbuf* gwy_graph_export_pixmap(GwyGraph *graph, G_GNUC_UNUSED gboolean export_title, G_GNUC_UNUSED gboolean export_axis, G_GNUC_UNUSED gboolean export_labels) { GdkColor color = { 0, 65535, 65535, 65535 }; GdkPixbuf *pixbuf; GdkColormap *cmap; GdkGC *gc; GdkVisual *visual; GdkPixmap *pixmap; PangoLayout *layout; PangoContext *context; gint width, height, topheight, bottomheight, rightwidth, leftwidth; gint labelx, labely, labelw, labelh; width = (GTK_WIDGET(graph))->allocation.width; height = (GTK_WIDGET(graph))->allocation.height; topheight = (GTK_WIDGET(graph->axis[GTK_POS_TOP]))->allocation.height; bottomheight = (GTK_WIDGET(graph->axis[GTK_POS_BOTTOM]))->allocation.height; leftwidth = (GTK_WIDGET(graph->axis[GTK_POS_LEFT]))->allocation.width; rightwidth = (GTK_WIDGET(graph->axis[GTK_POS_RIGHT]))->allocation.width; labelx = (GTK_WIDGET(graph->area->lab))->allocation.x + leftwidth; labely = (GTK_WIDGET(graph->area->lab))->allocation.y + topheight; labelw = (GWY_GRAPH_LABEL(graph->area->lab))->reqwidth; labelh = (GWY_GRAPH_LABEL(graph->area->lab))->reqheight; visual = gdk_visual_get_best(); cmap = gdk_colormap_new(visual, FALSE); pixmap = gdk_pixmap_new(NULL, width, height, visual->depth); gdk_drawable_set_colormap(pixmap, cmap); gc = gdk_gc_new(pixmap); gdk_gc_set_colormap(gc, cmap); gdk_gc_set_rgb_fg_color(gc, &color); gdk_draw_rectangle(pixmap, gc, TRUE, 0, 0, width, height); gwy_graph_area_draw_on_drawable(graph->area, pixmap, gc, leftwidth, topheight, width - leftwidth - rightwidth, height - topheight - bottomheight); /* Draw axes */ gwy_axis_draw_on_drawable(graph->axis[GTK_POS_TOP], pixmap, gc, leftwidth, 0, width - leftwidth - rightwidth, topheight); gwy_axis_draw_on_drawable(graph->axis[GTK_POS_BOTTOM], pixmap, gc, leftwidth, height - bottomheight, width - leftwidth - rightwidth, bottomheight); gwy_axis_draw_on_drawable(graph->axis[GTK_POS_LEFT], pixmap, gc, 0, topheight, leftwidth, height - topheight - bottomheight); gwy_axis_draw_on_drawable(graph->axis[GTK_POS_RIGHT], pixmap, gc, width - rightwidth, topheight, rightwidth, height - topheight - bottomheight); context = gdk_pango_context_get_for_screen(gdk_screen_get_default()); pango_context_set_font_description(context, graph->area->lab->font_desc); layout = pango_layout_new(context); gwy_graph_label_draw_on_drawable(graph->area->lab, pixmap, gc, layout, labelx, labely, labelw, labelh); pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, cmap, 0, 0, 0, 0, -1, -1); g_object_unref(pixmap); g_object_unref(layout); g_object_unref(context); g_object_unref(gc); g_object_unref(cmap); return pixbuf; }
bool wxGLCanvas::Create( wxWindow *parent, const wxGLContext *shared, const wxGLCanvas *shared_context_of, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name, int *attribList, const wxPalette& palette) { m_sharedContext = (wxGLContext*)shared; // const_cast m_sharedContextOf = (wxGLCanvas*)shared_context_of; // const_cast m_glContext = (wxGLContext*) NULL; m_exposed = false; m_noExpose = true; m_nativeSizeEvent = true; m_fbc = NULL; m_vi = NULL; // to be sure the glx version is known wxGLCanvas::QueryGLXVersion(); if (wxGLCanvas::GetGLXVersion() >= 13) { // GLX >= 1.3 uses a GLXFBConfig GLXFBConfig * fbc = NULL; if (wxTheApp->m_glFBCInfo != NULL) { fbc = (GLXFBConfig *) wxTheApp->m_glFBCInfo; m_canFreeFBC = false; // owned by wxTheApp - don't free upon destruction } else { fbc = (GLXFBConfig *) wxGLCanvas::ChooseGLFBC(attribList); m_canFreeFBC = true; } m_fbc = fbc; // save for later use wxCHECK_MSG( m_fbc, false, _T("required FBConfig couldn't be found") ); } XVisualInfo *vi = NULL; if (wxTheApp->m_glVisualInfo != NULL) { vi = (XVisualInfo *)wxTheApp->m_glVisualInfo; m_canFreeVi = false; // owned by wxTheApp - don't free upon destruction } else { if (wxGLCanvas::GetGLXVersion() >= 13) // GLX >= 1.3 vi = glXGetVisualFromFBConfig(GDK_DISPLAY(), m_fbc[0]); else // GLX <= 1.2 vi = (XVisualInfo *) ChooseGLVisual(attribList); m_canFreeVi = true; } m_vi = vi; // save for later use wxCHECK_MSG( m_vi, false, _T("required visual couldn't be found") ); GdkVisual *visual; GdkColormap *colormap; // MR: This needs a fix for lower gtk+ versions too. Might need to rethink logic (FIXME) #if 0 if (!gtk_check_version(2,2,0)) { wxWindow::Create( parent, id, pos, size, style, name ); m_glWidget = m_wxwindow; GdkScreen *screen = gtk_widget_get_screen( m_glWidget ); colormap = gdk_screen_get_default_colormap(screen); visual = gdk_colormap_get_visual(colormap); if (GDK_VISUAL_XVISUAL(visual)->visualid != vi->visualid) { visual = gdk_x11_screen_lookup_visual( screen, vi->visualid ); colormap = gdk_colormap_new(visual, FALSE); } gtk_widget_set_colormap( m_glWidget, colormap ); } else #endif { visual = gdkx_visual_get( vi->visualid ); colormap = gdk_colormap_new( visual, TRUE ); gtk_widget_push_colormap( colormap ); gtk_widget_push_visual( visual ); wxWindow::Create( parent, id, pos, size, style, name ); m_glWidget = m_wxwindow; } gtk_pizza_set_clear( GTK_PIZZA(m_wxwindow), FALSE ); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize", GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this ); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "map", GTK_SIGNAL_FUNC(gtk_glwindow_map_callback), (gpointer) this ); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", GTK_SIGNAL_FUNC(gtk_glwindow_expose_callback), (gpointer)this ); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", GTK_SIGNAL_FUNC(gtk_glwindow_draw_callback), (gpointer)this ); gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_glcanvas_size_callback), (gpointer)this ); gtk_widget_pop_visual(); gtk_widget_pop_colormap(); // 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 ); if (GTK_WIDGET_MAPPED(m_wxwindow)) gtk_glwindow_map_callback( m_wxwindow, this ); return true; }
bool wxGLCanvas::Create( wxWindow *parent, const wxGLContext *shared, const wxGLCanvas *shared_context_of, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name, int *attribList, const wxPalette& palette) { m_sharedContext = (wxGLContext*)shared; // const_cast m_sharedContextOf = (wxGLCanvas*)shared_context_of; // const_cast m_glContext = (wxGLContext*) NULL; m_exposed = FALSE; m_noExpose = TRUE; m_nativeSizeEvent = TRUE; m_fbc = NULL; m_vi = NULL; // to be sure the glx version is known wxGLCanvas::QueryGLXVersion(); if (wxGLCanvas::GetGLXVersion() >= 13) { // GLX >= 1.3 uses a GLXFBConfig GLXFBConfig * fbc = NULL; if (wxTheApp->m_glFBCInfo != NULL) { fbc = (GLXFBConfig *) wxTheApp->m_glFBCInfo; m_canFreeFBC = FALSE; // owned by wxTheApp - don't free upon destruction } else { fbc = (GLXFBConfig *) wxGLCanvas::ChooseGLFBC(attribList); m_canFreeFBC = TRUE; } m_fbc = fbc; // save for later use wxCHECK_MSG( m_fbc, FALSE, _T("required FBConfig couldn't be found") ); } XVisualInfo *vi = NULL; if (wxTheApp->m_glVisualInfo != NULL) { vi = (XVisualInfo *)wxTheApp->m_glVisualInfo; m_canFreeVi = FALSE; // owned by wxTheApp - don't free upon destruction } else { if (wxGLCanvas::GetGLXVersion() >= 13) // GLX >= 1.3 vi = glXGetVisualFromFBConfig(GDK_DISPLAY(), m_fbc[0]); else // GLX <= 1.2 vi = (XVisualInfo *) ChooseGLVisual(attribList); m_canFreeVi = TRUE; } m_vi = vi; // save for later use wxCHECK_MSG( m_vi, FALSE, _T("required visual couldn't be found") ); GdkVisual *visual = gdkx_visual_get( vi->visualid ); GdkColormap *colormap = gdk_colormap_new( visual, TRUE ); gtk_widget_push_colormap( colormap ); gtk_widget_push_visual( visual ); wxWindow::Create( parent, id, pos, size, style, name ); m_glWidget = m_wxwindow; #ifdef __WXGTK20__ gtk_widget_set_double_buffered( m_glWidget, FALSE ); #endif gtk_pizza_set_clear( GTK_PIZZA(m_wxwindow), FALSE ); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize", GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this ); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "map", GTK_SIGNAL_FUNC(gtk_glwindow_map_callback), (gpointer) this ); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", GTK_SIGNAL_FUNC(gtk_glwindow_expose_callback), (gpointer)this ); #ifndef __WXGTK20__ gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", GTK_SIGNAL_FUNC(gtk_glwindow_draw_callback), (gpointer)this ); #endif gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_glcanvas_size_callback), (gpointer)this ); gtk_widget_pop_visual(); gtk_widget_pop_colormap(); // 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 ); if (GTK_WIDGET_MAPPED(m_wxwindow)) gtk_glwindow_map_callback( m_wxwindow, this ); return TRUE; }
GtkWidget * na_tray_child_new (GdkScreen *screen, Window icon_window) { XWindowAttributes window_attributes; Display *xdisplay; NaTrayChild *child; GdkVisual *visual; gboolean visual_has_alpha; GdkColormap *colormap; gboolean new_colormap; int red_prec, green_prec, blue_prec, depth; int result; g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); g_return_val_if_fail (icon_window != None, NULL); xdisplay = GDK_SCREEN_XDISPLAY (screen); /* We need to determine the visual of the window we are embedding and create * the socket in the same visual. */ gdk_error_trap_push (); result = XGetWindowAttributes (xdisplay, icon_window, &window_attributes); gdk_error_trap_pop (); if (!result) /* Window already gone */ return NULL; visual = gdk_x11_screen_lookup_visual (screen, window_attributes.visual->visualid); if (!visual) /* Icon window is on another screen? */ return NULL; new_colormap = FALSE; if (visual == gdk_screen_get_rgb_visual (screen)) colormap = gdk_screen_get_rgb_colormap (screen); else if (visual == gdk_screen_get_rgba_visual (screen)) colormap = gdk_screen_get_rgba_colormap (screen); else if (visual == gdk_screen_get_system_visual (screen)) colormap = gdk_screen_get_system_colormap (screen); else { colormap = gdk_colormap_new (visual, FALSE); new_colormap = TRUE; } child = g_object_new (NA_TYPE_TRAY_CHILD, NULL); child->icon_window = icon_window; gtk_widget_set_colormap (GTK_WIDGET (child), colormap); /* We have alpha if the visual has something other than red, green, * and blue */ gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec); gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec); gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec); depth = gdk_visual_get_depth (visual); visual_has_alpha = red_prec + blue_prec + green_prec < depth; child->has_alpha = (visual_has_alpha && gdk_display_supports_composite (gdk_screen_get_display (screen))); child->composited = child->has_alpha; if (new_colormap) g_object_unref (colormap); return GTK_WIDGET (child); }
bool wxGLCanvas::Create(wxWindow *parent, const wxGLAttributes& dispAttrs, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name, const wxPalette& palette) { m_noExpose = true; m_nativeSizeEvent = true; if ( !InitVisual(dispAttrs) ) return false; GdkVisual *visual = gdkx_visual_get( GetXVisualInfo()->visualid ); GdkColormap *colormap = gdk_colormap_new( visual, TRUE ); gtk_widget_push_colormap( colormap ); gtk_widget_push_visual( visual ); wxWindow::Create( parent, id, pos, size, style, name ); m_glWidget = m_wxwindow; gtk_pizza_set_clear( GTK_PIZZA(m_wxwindow), FALSE ); #if WXWIN_COMPATIBILITY_2_8 gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize", GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this); #endif // WXWIN_COMPATIBILITY_2_8 gtk_signal_connect( GTK_OBJECT(m_wxwindow), "map", GTK_SIGNAL_FUNC(gtk_glwindow_map_callback), (gpointer) this); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", GTK_SIGNAL_FUNC(gtk_glwindow_expose_callback), (gpointer) this); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", GTK_SIGNAL_FUNC(gtk_glwindow_draw_callback), (gpointer) this); gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_glcanvas_size_callback), (gpointer) this); gtk_widget_pop_visual(); gtk_widget_pop_colormap(); #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; }
int main(int argc, char *argv[]) { // GtkWidget *window; GtkWidget *fixed; GtkWidget *area; // gtk_init(&argc, &argv); // Window window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "gui"); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_container_set_border_width(GTK_CONTAINER(window), 0); gtk_window_set_default_size(GTK_WINDOW(window), width, height); printf("window ok\n"); // layout fixed = gtk_fixed_new(); gtk_container_add(GTK_CONTAINER(window), fixed); printf("fixed ok\n"); // Image GList *visuals = gdk_list_visuals(); void tst(gpointer data, gpointer udata) { if (((GdkVisual*)data)->depth == 32) printf("visual :\n\ttype = %d\n\ttype = %d\n\tdepth = %d\n\tbits/rgb = %d\n\torder = %d\n\tred = %08X\n\tgreen = %08X\n\tblue = %08X\n" , ((GdkVisual*)data)->type , ((GdkVisual*)data)->colormap_size , ((GdkVisual*)data)->depth , ((GdkVisual*)data)->bits_per_rgb , ((GdkVisual*)data)->byte_order , ((GdkVisual*)data)->red_mask , ((GdkVisual*)data)->green_mask , ((GdkVisual*)data)->blue_mask ); } g_list_foreach(visuals, &tst, NULL); GdkVisual *visu = gdk_visual_get_best_with_depth(32); ximg = gdk_image_new(GDK_IMAGE_SHARED, visu, width, height); printf("GdkImage : bytes/pix = %d, linesize = %d, bits/pix = %d ; type %d (mem = %p)\n" , ximg->bpp, ximg->bpl, ximg->bits_per_pixel , ximg->type, ximg->mem ); // GdkPixbufAnimation //gtk_image_set_from_pixbuf // GdkColormap *dcm = gdk_colormap_new(visu, FALSE); // drawing area area = gtk_drawing_area_new(); gdk_drawable_set_colormap(window, dcm); gdk_drawable_set_colormap(area, dcm); gtk_drawing_area_size(GTK_DRAWING_AREA(area), width, height); printf("area ok\n"); // gtk_fixed_put(GTK_FIXED(fixed), area, 0, 0); printf("fixed ok\n"); // bgra_alloc650(&bgra, width, height); bgra_origin650(&bgra, +width/2, +height/2); bgra_scale650(&bgra, 1, -1); printf("bgra alloc ok\n"); maj(); printf("bgra maj done, still (%p <- %p)\n", ximg->mem, bgra.data); // // Ximg // memcpy(ximg->mem, bgra.data, bgra.size); // printf("mcpy done\n"); // Pixmap GdkColor bg; GdkColor fg; fg.pixel = 0xff000000; fg.red = 0; fg.green = 0; fg.blue = 0; bg.pixel = 0xff000000; bg.red = 0; bg.green = 0; bg.blue = 0; pixmap = gdk_pixmap_create_from_data( GTK_WINDOW(window) , bgra.data , width , height , 32 , &fg , &bg ); // img = gdk_pixbuf_new_from_data( // (guchar*)bgra.data // , GDK_COLORSPACE_RGB // , TRUE // , 8 // , width // , height // , width << 2 // , &pbd, NULL // ); // printf("PixBuf new ok\n"); // // Image // frame = gtk_image_new_from_pixbuf(img); //// frame = gtimg; // gtk_fixed_put(GTK_FIXED(fixed), frame, 0, 0); // printf("fixed ok\n"); // Events g_signal_connect(area, "expose-event", G_CALLBACK (on_expose_event), NULL); // g_signal_connect(frame, "expose-event", G_CALLBACK (on_expose_event), NULL); g_signal_connect(window, "delete-event", G_CALLBACK (delete_event), NULL); g_signal_connect(window, "destroy", G_CALLBACK (destroy), NULL); printf("signals ok\n"); // Show // gtk_widget_show(area); gtk_widget_show(fixed); gtk_widget_show_all(window); printf("show ok\n"); // Timer g_timeout_add(500, (GSourceFunc)time_handler, (gpointer)area); printf("timer ok\n"); gtk_main(); return 0; }
Window meta_ui_create_frame_window (MetaUI *ui, Display *xdisplay, Visual *xvisual, gint x, gint y, gint width, gint height, gint screen_no) { GdkDisplay *display = gdk_x11_lookup_xdisplay (xdisplay); GdkScreen *screen = gdk_display_get_screen (display, screen_no); GdkWindowAttr attrs; gint attributes_mask; GdkWindow *window; GdkVisual *visual; #if !GTK_CHECK_VERSION (3, 0, 0) GdkColormap *cmap = gdk_screen_get_default_colormap (screen); #endif /* Default depth/visual handles clients with weird visuals; they can * always be children of the root depth/visual obviously, but * e.g. DRI games can't be children of a parent that has the same * visual as the client. */ if (!xvisual) visual = gdk_screen_get_system_visual (screen); else { visual = gdk_x11_screen_lookup_visual (screen, XVisualIDFromVisual (xvisual)); #if !GTK_CHECK_VERSION (3, 0, 0) cmap = gdk_colormap_new (visual, FALSE); #endif } attrs.title = NULL; /* frame.c is going to replace the event mask immediately, but * we still have to set it here to let GDK know what it is. */ attrs.event_mask = GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK; attrs.x = x; attrs.y = y; attrs.wclass = GDK_INPUT_OUTPUT; attrs.visual = visual; #if !GTK_CHECK_VERSION (3, 0, 0) attrs.colormap = cmap; #endif attrs.window_type = GDK_WINDOW_CHILD; attrs.cursor = NULL; attrs.wmclass_name = NULL; attrs.wmclass_class = NULL; attrs.override_redirect = FALSE; attrs.width = width; attrs.height = height; #if GTK_CHECK_VERSION (3, 0, 0) attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; #else attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; #endif window = gdk_window_new (gdk_screen_get_root_window(screen), &attrs, attributes_mask); gdk_window_resize (window, width, height); meta_frames_manage_window (ui->frames, GDK_WINDOW_XID (window), window); return GDK_WINDOW_XID (window); }
static GdkPixbuf* drawtheme_calc_alpha (MCThemeDrawInfo &p_info) { GdkPixbuf *t_pb_black; GdkPixbuf *t_pb_white; GdkPixmap *t_black ; GdkPixmap *t_white ; GdkColormap *cm ; GdkVisual *best_vis ; uint4 t_w ; uint4 t_h ; t_w = p_info.drect.width ; t_h = p_info.drect.height ; // MM-2013-11-06: [[ Bug 11360 ]] Make sure we take into account the screen depth when creating pixmaps. uint4 t_screen_depth; t_screen_depth = ((MCScreenDC*) MCscreen) -> getdepth(); // Create two new pixmaps t_black = gdk_pixmap_new(NULL, t_w, t_h, t_screen_depth); t_white = gdk_pixmap_new(NULL, t_w, t_h, t_screen_depth); // We need to attach a colourmap to the Drawables in GDK best_vis = gdk_visual_get_best_with_depth(t_screen_depth); if (best_vis == NULL) return NULL; cm = gdk_colormap_new(best_vis, FALSE) ; gdk_drawable_set_colormap(t_black, cm); gdk_drawable_set_colormap(t_white, cm); // Render solid black into one and white into the other. fill_gdk_drawable(t_black, cm, 0, 0, 0, t_w, t_h); fill_gdk_drawable(t_white, cm, 65535, 65535, 65535, t_w, t_h); MCThemeDrawInfo t_info; t_info = p_info; moz_gtk_widget_paint ( p_info.moztype, t_white , &t_info.drect, &t_info.cliprect, &t_info.state, t_info.flags ) ; t_info = p_info; moz_gtk_widget_paint ( p_info.moztype, t_black , &t_info.drect, &t_info.cliprect, &t_info.state, t_info.flags ) ; gdk_flush(); // Convert the server-side pixmaps into client-side pixbufs. The black // pixbuf will need to have an alpha channel so that we can fill it in. t_pb_black = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, t_w, t_h); if (t_pb_black == NULL) return NULL; t_pb_white = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, t_w, t_h); if (t_pb_white == NULL) return NULL; t_pb_black = gdk_pixbuf_get_from_drawable(t_pb_black, t_black, NULL, 0, 0, 0, 0, t_w, t_h); if (t_pb_black == NULL) return NULL; t_pb_white = gdk_pixbuf_get_from_drawable(t_pb_white, t_white, NULL, 0, 0, 0, 0, t_w, t_h); if (t_pb_white == NULL) return NULL; // Calculate the alpha from these two bitmaps --- the t_bm_black image now has full ARGB // Note that this also frees the t_pb_white pixbuf calc_alpha_from_pixbufs(t_pb_black, t_pb_white); // clean up. g_object_unref(t_black); g_object_unref(t_white); g_object_unref(cm); return t_pb_black; }
static XImage * drawtheme_calc_alpha ( MCThemeDrawInfo &p_info) { XImage *t_bm_black ; XImage *t_bm_white ; GdkPixmap *t_black ; GdkPixmap *t_white ; GdkColormap *cm ; GdkVisual *best_vis ; uint4 t_w ; uint4 t_h ; t_w = p_info.drect.width ; t_h = p_info.drect.height ; // MM-2013-11-06: [[ Bug 11360 ]] Make sure we take into account the screen depth when creating pixmaps. uint4 t_screen_depth; t_screen_depth = ((MCScreenDC*) MCscreen) -> getdepth(); // Create two new pixmaps t_black = gdk_pixmap_new( NULL, t_w, t_h, t_screen_depth); t_white = gdk_pixmap_new( NULL, t_w, t_h, t_screen_depth); // We need to attach a colourmap to the Drawables in GDK best_vis = gdk_visual_get_best_with_depth(t_screen_depth); cm = gdk_colormap_new( best_vis , False ) ; gdk_drawable_set_colormap( t_black, cm); gdk_drawable_set_colormap( t_white, cm); //gdk_flush(); // Render solid black into one and white into the other. //black_and_white_masks ( gdk_x11_drawable_get_xid( t_black ) , gdk_x11_drawable_get_xid(t_white)); fill_gdk_drawable(t_black, cm, 0, 0, 0, t_w, t_h); fill_gdk_drawable(t_white, cm, 65535, 65535, 65535, t_w, t_h); MCThemeDrawInfo t_info; t_info = p_info; moz_gtk_widget_paint ( p_info.moztype, t_white , &t_info.drect, &t_info.cliprect, &t_info.state, t_info.flags ) ; t_info = p_info; moz_gtk_widget_paint ( p_info.moztype, t_black , &t_info.drect, &t_info.cliprect, &t_info.state, t_info.flags ) ; gdk_flush(); // Get the byte data for each of these pixmaps t_bm_black = ((MCScreenDC*)MCscreen) -> getimage ( gdk_x11_drawable_get_xid(t_black), 0, 0, t_w, t_h, False ) ; t_bm_white = ((MCScreenDC*)MCscreen) -> getimage ( gdk_x11_drawable_get_xid(t_white), 0, 0, t_w, t_h, False ) ; // Calculate the alpha from these two bitmaps --- the t_bm_black image now has full ARGB calc_alpha_from_bitmaps ( t_bm_black, t_bm_white ) ; // clean up. g_object_unref( t_black ) ; g_object_unref( t_white ) ; g_object_unref( cm ) ; return ( t_bm_black ) ; }
int main(int argc, char *argv[]) { GtkWidget *window; GtkWidget *box; GdkColor color; XWMHints mywmhints; GtkWidget *main_button; GdkPixmap *main_button_pixmap; GdkBitmap *main_button_mask; GtkWidget *main_button_box; GtkWidget *color_menu; GtkWidget *item; GtkWidget *label; GtkWidget *color_box; GtkWidget *hbox; GdkColor gcolor; char *wmstickynotes_dir = NULL; gboolean use_default_dir = TRUE; int option_index = 0; int i = 0; struct option long_options[] = { {"directory", required_argument, 0, 'd'}, {"version", no_argument, 0, 'v'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; for( i = getopt_long(argc, argv, "d:vh", long_options, &option_index); i >= 0; i = getopt_long(argc, argv, "d:vh", long_options, &option_index) ) { switch(i) { case 'd': wmstickynotes_dir = optarg; use_default_dir = FALSE; break; case 'v': printf("%s\n", PACKAGE_STRING); printf("Copyright (C) 2009 %s\n", PACKAGE_BUGREPORT); return 0; case 'h': usage(); return 0; default: usage(); return 1; } } umask(077); if(use_default_dir) { wmstickynotes_dir = calloc( strlen(default_wmstickynotes_dir) + strlen(getenv("HOME")) + 2, sizeof(char)); strcpy(wmstickynotes_dir, getenv("HOME")); strcat(wmstickynotes_dir, "/"); strcat(wmstickynotes_dir, default_wmstickynotes_dir); } if(chdir(wmstickynotes_dir)) { if(errno == ENOENT) { if(mkdir(wmstickynotes_dir, 0777)) { fprintf(stderr, "Couldn't make directory: %s\n", wmstickynotes_dir); exit(1); } if(chdir(wmstickynotes_dir)) { fprintf(stderr, "Couldn't change to directory: %s\n", wmstickynotes_dir); exit(1); } } else { fprintf(stderr, "Couldn't change to directory: %s\n", wmstickynotes_dir); exit(1); } } if(use_default_dir) free(wmstickynotes_dir); gtk_init(&argc, &argv); colormap = gdk_colormap_new(gdk_visual_get_system(), TRUE); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(window), 64, 64); box = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER (window), box); gdk_color_parse ("#fafafa", &color); gtk_widget_modify_bg(box, GTK_STATE_NORMAL, &color); main_button_pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL, colormap, &main_button_mask, NULL, wmstickynotes_xpm); main_button = gtk_image_new_from_pixmap(main_button_pixmap, main_button_mask); main_button_box = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(main_button_box), main_button); gtk_container_add(GTK_CONTAINER(box), main_button_box); color_menu = gtk_menu_new(); for(i=0; i < num_color_schemes; i++) { item = gtk_menu_item_new(); label = gtk_label_new(color_schemes[i].name); color_box = gtk_event_box_new(); gtk_widget_set_size_request(color_box, 15, -1); hbox = gtk_hbox_new(FALSE, 4); gdk_color_parse(color_schemes[i].top, &gcolor); gtk_widget_modify_bg(color_box, GTK_STATE_NORMAL, &gcolor); gtk_widget_modify_bg(color_box, GTK_STATE_PRELIGHT, &gcolor); gtk_container_add(GTK_CONTAINER(item), hbox); gtk_box_pack_start(GTK_BOX(hbox), color_box, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); gtk_menu_shell_append(GTK_MENU_SHELL(color_menu), item); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(new_note_from_menu), &color_schemes[i]); } gtk_widget_show_all(GTK_WIDGET(color_menu)); gtk_widget_show_all(window); mywmhints.initial_state = WithdrawnState; mywmhints.icon_window = GDK_WINDOW_XWINDOW(box->window); mywmhints.icon_x = 0; mywmhints.icon_y = 0; mywmhints.window_group = GDK_WINDOW_XWINDOW(window->window); mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint; XSetWMHints(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(window->window), &mywmhints); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(main_button_box), "button-press-event", G_CALLBACK(main_button_pressed), color_menu); read_old_notes(); gtk_main(); return 0; }