diff src/statusicon/si_ui.c @ 455:f001b217c88b trunk

[svn] - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
author giacomo
date Wed, 17 Jan 2007 08:46:53 -0800
parents 6c1c03111db4
children 2e0b55117302
line wrap: on
line diff
--- a/src/statusicon/si_ui.c	Wed Jan 17 08:27:05 2007 -0800
+++ b/src/statusicon/si_ui.c	Wed Jan 17 08:46:53 2007 -0800
@@ -201,6 +201,17 @@
 {
   GdkPixbuf *si_pixbuf, *si_scaled_pixbuf;
   gint size = GPOINTER_TO_INT(g_object_get_data( G_OBJECT(image) , "size" ));
+  static gchar *wmname = NULL;
+
+  /* sometimes, KDE won't give the correct size-allocation; workaround this */
+  if ( wmname == NULL )
+  {
+    GdkScreen *screen = gdk_screen_get_default();
+    if ( screen != NULL )
+      wmname = (gchar*)gdk_x11_screen_get_window_manager_name( screen );
+  }
+  else if ( ( size > 22 ) && ( !strcmp("KWin",wmname) ) )
+    size = 22;
 
   si_pixbuf = gdk_pixbuf_new_from_xpm_data( (const char**)si_xpm );
   si_scaled_pixbuf = gdk_pixbuf_scale_simple( si_pixbuf , size , size , GDK_INTERP_BILINEAR );