Package: pidgin
Version: 2.10.10-1.1
Severity: minor
Tags: patch

Dear Maintainer,
I believe there is still an issue with the sizing of the Pidgin tray icon.

I am using a Debian Jessie/testing with a KDE desktop.

When I start Pidgin by "alt+f2" - pidgin - enter,
then the tray icon first is drawn with a regular size but immediately
it resizes, so there is only the upper left corner of the symbol visible.

When I start it from a konsole window it is regular sized (but not always).

When I start it from a konsole window with more tabbed consoles and
immediately change to another tab by "shift+cursor left" then the tray
icon is also with the wrong size.

(Please see attached png, upper part shows with too big icon, lower part is
right.)

----------------

I traced it down to the last ConfigureNotify X event
received in gdk_event_translate (gdkevents-x11.c, see attached patch).

With the logging in this case activated I get following logging (when starting
"pidgin -d"):

Icon regular sized:
  (19:41:03) Gdk: configure notify:       window: 73400381  x,y: 0 0      w,h:
200 200  b-w: 0  above: 0   ovr: 0
  (19:41:03) Gdk: configure notify:       window: 73400381  x,y: 0 0      w,h:
24 24  b-w: 0  above: 0     ovr: 0
  (19:41:03) Gdk: configure notify:       window: 73400381  x,y: 0 0      w,h:
22 22  b-w: 0  above: 0     ovr: 0

Icon wrong sized:
  (19:41:47) Gdk: configure notify:       window: 73400381  x,y: 0 0      w,h:
24 24  b-w: 0  above: 0     ovr: 0
  (19:41:47) Gdk: configure notify:       window: 73400381  x,y: 0 0      w,h:
22 22  b-w: 0  above: 0     ovr: 0
  (19:41:47) Gdk: configure notify:       window: 73400381  x,y: 0 0      w,h:
48 48  b-w: 0  above: 0     ovr: 0

So I think this issue has to do with some timing and ordering of focus losses.

----------------

Observing the tray icon with "xwininfo -all" and clicking on the tray icon.
There one can see that the parent still has a size of 24x24 but the child got
now a size of 48x48.

Icon regular sized:
  xwininfo: Window id: 0x1e000d5 "plasma-desktop"

    Root window id: 0x295 (the root window) (has no name)
    Parent window id: 0x1c00151 (has no name)
       4 children:
       0x1f6e38e (has no name): ()  24x24+1300+9  +1300+993
          1 child:
          0x5c0003d "Pidgin": ("Pidgin" "Pidgin")  22x22+0+0  +1300+993
             1 child:
             0x5c0003e (has no name): ()  1x1+-1+-1  +1299+992

Icon wrong sized:
  xwininfo: Window id: 0x1e000d5 "plasma-desktop"

    Root window id: 0x295 (the root window) (has no name)
    Parent window id: 0x1c00151 (has no name)
       4 children:
       0x1f68225 (has no name): ()  24x24+1300+9  +1300+993
          1 child:
          0x5c0003d "Pidgin": ("Pidgin" "Pidgin")  48x48+0+0  +1300+993
             1 child:
             0x5c0003e (has no name): ()  1x1+-1+-1  +1299+992

-----------------

An ugly workaround would be to compare sizes of the 2 XWindows and in
case do a resize on it (see attached patch)

-----------------

Some references which seem to have the same issue:
  https://developer.pidgin.im/ticket/2466#comment:31
  https://developer.pidgin.im/ticket/12414
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468232

-----------------

I am first filing the bug with the pidgin package but I am not sure
if it should be against libgtk2.0-0.

Probably someone could give me some hints how to go further from here.

Kind regards,
Bernhard



-- System Information:
Debian Release: jessie/sid
  APT prefers testing-updates
  APT policy: (990, 'testing-updates'), (990, 'testing'), (500, 
'testing-proposed-updates')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages pidgin depends on:
ii  gconf2                      3.2.6-3
ii  libatk1.0-0                 2.14.0-1
ii  libc6                       2.19-13
ii  libcairo2                   1.14.0-2.1
ii  libdbus-1-3                 1.8.12-1
ii  libdbus-glib-1-2            0.102-1
ii  libfontconfig1              2.11.0-6.3
ii  libfreetype6                2.5.2-2
ii  libgadu3                    1:1.12.0-5
ii  libgdk-pixbuf2.0-0          2.31.1-2+b1
ii  libglib2.0-0                2.42.0-2
ii  libgstreamer0.10-0          0.10.36-1.5
ii  libgtk2.0-0                 2.24.25-1
ii  libgtkspell0                2.0.16-1.1
ii  libice6                     2:1.0.9-1
ii  libpango-1.0-0              1.36.8-2
ii  libpangocairo-1.0-0         1.36.8-2
ii  libpangoft2-1.0-0           1.36.8-2
ii  libpurple0                  2.10.10-1.1
ii  libsm6                      2:1.2.2-1
ii  libx11-6                    2:1.6.2-3
ii  libxml2                     2.9.1+dfsg1-4
ii  libxss1                     1:1.2.2-1
ii  perl-base [perlapi-5.20.1]  5.20.1-3
ii  pidgin-data                 2.10.10-1.1

Versions of packages pidgin recommends:
ii  gstreamer0.10-plugins-base  0.10.36-2
ii  gstreamer0.10-plugins-good  0.10.31-3+nmu4+b1

Versions of packages pidgin suggests:
ii  libsqlite3-0  3.8.7.1-1

-- no debconf information
--- gtk+2.0-2.24.25.orig/gdk/x11/gdkevents-x11.c
+++ gtk+2.0-2.24.25/gdk/x11/gdkevents-x11.c
@@ -1840,8 +1840,8 @@ gdk_event_translate (GdkDisplay *display
       break;
       
     case ConfigureNotify:
-      GDK_NOTE (EVENTS,
-		g_message ("configure notify:\twindow: %ld  x,y: %d %d	w,h: %d %d  b-w: %d  above: %ld	 ovr: %d%s",
+      /*GDK_NOTE (EVENTS,*/
+        g_warning ("configure notify:\twindow: %ld  x,y: %d %d	w,h: %d %d  b-w: %d  above: %ld	 ovr: %d%s",
 			   xevent->xconfigure.window,
 			   xevent->xconfigure.x,
 			   xevent->xconfigure.y,
@@ -1856,7 +1856,7 @@ gdk_event_translate (GdkDisplay *display
 			   ? " (discarding child)"
 			   : xevent->xconfigure.event != xevent->xconfigure.window
 			   ? " (discarding substructure)"
-			   : ""));
+               : ""/*)*/);
       if (window && GDK_WINDOW_TYPE (window) == GDK_WINDOW_ROOT)
         { 
 	  window_private->width = xevent->xconfigure.width;
Description: Detect a too big tray icon and resize to the parents size
Author: Bernhard Übelacker <bernha...@vr-web.de>

--- pidgin-2.10.10.orig/pidgin/gtkdocklet-gtk.c
+++ pidgin-2.10.10/pidgin/gtkdocklet-gtk.c
@@ -164,6 +164,58 @@ docklet_gtk_status_update_icon(PurpleSta
 	if (connecting)
 		icon_name = PIDGIN_STOCK_TRAY_CONNECT;
 
+    {
+#ifdef GDK_WINDOWING_X11
+        Window xwindow_docklet = gtk_status_icon_get_x11_window_id(docklet);
+        if (xwindow_docklet) {
+
+            GdkDisplay *display;
+            display = gdk_display_get_default();
+            if (display) {
+
+                Window root;
+                Window parent;
+                Window *children = NULL;
+                guint nchildren;
+                if (XQueryTree(GDK_DISPLAY_XDISPLAY(display), xwindow_docklet, &root, &parent, &children, &nchildren)) {
+
+                    XWindowAttributes parent_attr;
+                    if (XGetWindowAttributes(GDK_DISPLAY_XDISPLAY(display), parent, &parent_attr)) {
+                        XWindowAttributes docklet_attr;
+                        if (XGetWindowAttributes(GDK_DISPLAY_XDISPLAY(display), xwindow_docklet, &docklet_attr)) {
+                            if (parent_attr.width != docklet_attr.width) {
+                                g_warning("docklet_gtk_status_update_icon: parent_attr.width=%d != docklet_attr.width=%d", parent_attr.width, docklet_attr.width);
+                                //if (parent_attr.width == 24 && docklet_attr.width == 48) {
+                                if (parent_attr.width < docklet_attr.width) {
+                                    if (XMoveResizeWindow(GDK_DISPLAY_XDISPLAY(display), xwindow_docklet, docklet_attr.x, docklet_attr.y, parent_attr.width, parent_attr.height)) {
+                                        g_warning("docklet_gtk_status_update_icon: XMoveResizeWindow probably succeeded");
+                                    } else {
+                                        g_warning("docklet_gtk_status_update_icon: XMoveResizeWindow failed");
+                                    }
+                                }
+                            } else {
+                                g_warning("docklet_gtk_status_update_icon: size seems ok");
+                            }
+                        } else {
+                            g_warning("docklet_gtk_status_update_icon: XGetWindowAttributes for child failed");
+                        }
+                    } else {
+                        g_warning("docklet_gtk_status_update_icon: XGetWindowAttributes for parent failed");
+                    }
+                } else {
+                    g_warning("docklet_gtk_status_update_icon: XQueryTree failed");
+                }
+                if (children)
+                    XFree(children);
+            } else {
+                g_warning("docklet_gtk_status_update_icon: gdk_display_get_default failed");
+            }
+        } else {
+            g_warning("docklet_gtk_status_update_icon: gtk_status_icon_get_x11_window_id returned 0");
+        }
+#endif
+    }
+
 	if (icon_name) {
 		gtk_status_icon_set_from_icon_name(docklet, icon_name);
 	}

Reply via email to