GNOME Bugzilla – Bug 754854
unexpected background color in tray icon
Last modified: 2015-09-11 16:31:20 UTC
Created attachment 311103 [details] [review] gtktrayicon-x11.c: fix background color gtk_tray_icon_draw first clears background to transparent or uses parent-relative pixmap as background. Then using parent class GtkPlug draw function will replace/redraw background. This is problem when someone tries to use tray icon on transparent background and in same time uses _NET_SYSTEM_TRAY_PADDING other than 0. Then padding part is not transparent.
(a) Drawing the backgorund in GtkPlug seems wrong. It will be drawn twice, once by gtk_plug_draw() and once by gtk_window_draw(). (b) The margin set by gtk_widget_set_margin() is defined as being outside of the drawn area of a widget, so it should never be drawn by GTK. If it gets drawn, then some widget is doing something wrong. (c) GtkWindow sets the "background" style class, which indicates "Please draw a background for this widget" to the theme. I suppose GtkStatusIcon wants to unset that style class. And a last question: Did you try with 3.16 or also 3.17.x? Because we removed our usage of gtk_style_context_set_background() which might have fixed this problem already?
Created attachment 311124 [details] [review] gtkplug.c: remove draw function, not needed Background will be rendered by parent class - GtkWindow.
(In reply to Benjamin Otte (Company) from comment #1) > (a) Drawing the backgorund in GtkPlug seems wrong. It will be drawn twice, > once by gtk_plug_draw() and once by gtk_window_draw(). Added new patch that removes draw function in GtkPlug. > (b) The margin set by gtk_widget_set_margin() is defined as being outside of > the drawn area of a widget, so it should never be drawn by GTK. If it gets > drawn, then some widget is doing something wrong. I think this is not problem. Margin in set on image widget and it does not draw in margin area. Problem was with GtkTrayIcon widget. It first makes it transparent then GtkPlug rendered background again - margin was just area where this rendered background was visible. > (c) GtkWindow sets the "background" style class, which indicates "Please > draw a background for this widget" to the theme. I suppose GtkStatusIcon > wants to unset that style class. After new patch it looks like no extra patches are needed. GtkTrayIcon sets app paintable TRUE. So GtkWindow will not draw background. > And a last question: Did you try with 3.16 or also 3.17.x? Because we > removed our usage of gtk_style_context_set_background() which might have > fixed this problem already? Only with 3.17.x. I build full GNOME with JHBuild.
Created attachment 311128 [details] Image with problem Language (LA) icon has no padding so there is no vertical stripes.
Created attachment 311129 [details] Image after patch
Comment on attachment 311124 [details] [review] gtkplug.c: remove draw function, not needed I committed this patch. Is this enough to make things work again or is the border still there with this patch applied?
Yes, this is enough. Thanks!