changeset 33526:140525bcc32f

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.
author ib
date Tue, 14 Jun 2011 17:51:17 +0000
parents b32fcc18c9b4
children 9f0812ccc421
files gui/mplayer/widgets.c
diffstat 1 files changed, 5 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }