# HG changeset patch # User ib # Date 1308073877 0 # Node ID 140525bcc32fd641ea12cf6203929aca39db3dfc # Parent b32fcc18c9b498a840df1e36422cec67c6040e5b Fix GUI icon bug. The GUI icon did not display properly but showed up with various distortions. The reason was the icon mask which hadn't been put to the X server yet when used. The icon itself was okay, but is rendered now in a way that doesn't need a drawable which spares creating a GTK window and destroying it right after. The locally used GDK variables have been moved inside the function where they are needed. Patch with grateful support by Steaphan Greene, sgreene cs.binghamton edu. This closes Bugzilla #582. diff -r b32fcc18c9b4 -r 140525bcc32f gui/mplayer/widgets.c --- a/gui/mplayer/widgets.c Tue Jun 14 14:48:52 2011 +0000 +++ b/gui/mplayer/widgets.c Tue Jun 14 17:51:17 2011 +0000 @@ -69,8 +69,6 @@ // --- init & close gtk -static GdkPixmap * gdkIcon; -static GdkBitmap * gdkIconMask; Pixmap guiIcon; Pixmap guiIconMask; @@ -78,6 +76,8 @@ { int argc = 0; char *arg[3], **argv = arg; + GdkPixmap *gdkIcon; + GdkBitmap *gdkIconMask; arg[argc++] = GMPlayer; @@ -94,19 +94,14 @@ gtk_init( &argc, &argv ); // gdk_set_use_xshm( TRUE ); - { - GtkWidget * win; - win=gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gdkIcon=gdk_pixmap_colormap_create_from_xpm_d( NULL,gdk_colormap_get_system(),&gdkIconMask,NULL,(gchar **) mplayer_xpm ); - if ( !gdkIcon ) - gdkIcon=gdk_pixmap_colormap_create_from_xpm_d( win->window,gdk_colormap_get_system(),&gdkIconMask,&win->style->bg[GTK_STATE_NORMAL],(gchar **) mplayer_xpm ); + // start up GTK which realizes the pixmaps + gtk_main_iteration_do(FALSE); guiIcon=GDK_PIXMAP_XID( gdkIcon ); guiIconMask=GDK_PIXMAP_XID( gdkIconMask ); - gtk_widget_destroy( win ); - } - gtkInitialized=1; }