[MPlayer-cvslog] r33614 - trunk/gui/mplayer/widgets.c

ib subversion at mplayerhq.hu
Tue Jun 14 19:51:17 CEST 2011


Author: ib
Date: Tue Jun 14 19:51:17 2011
New Revision: 33614

Log:
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.

Modified:
   trunk/gui/mplayer/widgets.c

Modified: trunk/gui/mplayer/widgets.c
==============================================================================
--- trunk/gui/mplayer/widgets.c	Tue Jun 14 16:48:52 2011	(r33613)
+++ trunk/gui/mplayer/widgets.c	Tue Jun 14 19:51:17 2011	(r33614)
@@ -69,8 +69,6 @@ int gtkInitialized = 0;
 
 // --- init & close gtk
 
-static GdkPixmap * gdkIcon;
-static GdkBitmap * gdkIconMask;
 Pixmap	    guiIcon;
 Pixmap	    guiIconMask;
 
@@ -78,6 +76,8 @@ void gtkInit( void )
 {
  int argc = 0;
  char *arg[3], **argv = arg;
+ GdkPixmap *gdkIcon;
+ GdkBitmap *gdkIconMask;
 
  arg[argc++] = GMPlayer;
 
@@ -94,19 +94,14 @@ void gtkInit( void )
  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;
 }
 


More information about the MPlayer-cvslog mailing list