GNOME Bugzilla – Bug 107146
Panel sends incorrect background pixmap to applets.
Last modified: 2015-03-24 13:00:35 UTC
In panel-background.c, the Drawable id (pixmap_xid) sent to an applet is for background->window, which would seem correct - but the problem is that the areas of the window that are covered by other widgets (such as the applet itself) are not correct, and seem to be random data. The result is that the pixmap returned from both the "change_background" signal and panel_applet_get_background() is unusable. A second, related problem is that the change_background signal is only generated when the background preferences for the panel are changed. It should also be sent when the applet is moved and/or resized.
Created attachment 14715 [details] [review] Fixes the pixmap image sent to applets in change_background signal.
Added a patch that fixes this bug. It creates a secondary pixmap that is used as a mirror of the panel background. This pixmap is what is used for the applets background. On size_allocate signal for an applet-frame, the change_background signal is sent if the background settings result in an image. This is needed for correct backgrounds in startup and moving/sizing applets. The only possible problem is when using more than one display, as the change to panel-applet.c is simply using the default display for the pixmap_foreign* calls. This patch is needed for applets with 'true' transparency, like those on gqapplets.sf.net, which are being ported to GNOME 2.2 from 1.4.
Added PATCH keyword, apparently someone loves patches :)
John: thanks for the patch - it looks along the right track, I'll review it properly soon.
John: we already have a backing store pixmap for the background which the applet could copy from so the patch for panel-background.c should be as simple as: @@ -813,15 +813,13 @@ panel_background_make_string (PanelBackg char *retval = NULL; if (background->type == PANEL_BACK_IMAGE || - (background->type == PANEL_BACK_COLOR && background->has_alpha) || - (background->type == PANEL_BACK_NONE && background->default_pixmap)) { + (background->type == PANEL_BACK_COLOR && background->has_alpha)) { GdkNativeWindow pixmap_xid; - if (!background->window) + if (!background->pixmap) return NULL; - pixmap_xid = gdk_x11_drawable_get_xid ( - GDK_DRAWABLE (background->window)); + pixmap_xid = gdk_x11_drawable_get_xid (GDK_DRAWABLE (background->pixmap)); retval = g_strdup_printf ("pixmap:%d,%d,%d", pixmap_xid, x, y); i.e. send the XID of background->pixmap rather than background->window. Note that for PANEL_BACK_NONE, we shouldn't send anything to the applet ... it should just respect GtkRcStyle. I had a quick go at making this work for the clock applet without success. Could you possible do a new version of your patch with the change I recommend to panel-background.c and also a patch to get it working for the clock applet so we can test it. It'd be much appreciated.
I too tried simply using background->pixmap with no success. Also the patch addresses image tiling: the background->pixmap can be smaller than the window, which then will not work with the x,y offset coordinates of the applet (the resulting area may be outside the pixmap). For the panel, the pixmap is set to the background->window with gdk_window_set_back_pixmap, which will tile the pixmap for the panel window automatically. The created copy in my patch accounts for tiling the pixmap if necessary. I see no way around this as the applet is supposed to be given a pixmap for the exact part of the panel it covers. The clock applet cannot simply gdk_window_set_back_pixap the pixmap onto applet->window, not sure exactly how to fix it. I have attached a small clock applet debugging patch you can use that displays the pixmap sent to the applet in a small window. It is against gen_util applet clock.c. At least with this, the panel side of the background signals can be tested :)
Created attachment 14883 [details] [review] gen_util clock debug window for pixmap backgrounds
Thanks for that John. You're right about the tiling problem, though I think we'll just tile client side because that's what we do if the image has an alpha channel. I too did the little debug window thing for the clock applet, but couldn't actually figure out how to get the background working :-)
*** Bug 107759 has been marked as a duplicate of this bug. ***
Is this any closed to being resolved?
Ping? Is anyone working on this atm?
Debugging Information: (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... 0x405ae669 in __wait4 () from /lib/i686/libc.so.6
+ Trace 41052
See patch in bug #107617.
This is fixed (thanks John: parts of the fix are coming from your patch). See bug #107617. There's one problem left, though: applets keep coming back to a coloured background instead of using the pixmap.