After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 754854 - unexpected background color in tray icon
unexpected background color in tray icon
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-09-10 22:38 UTC by Alberts Muktupāvels
Modified: 2015-09-11 16:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtktrayicon-x11.c: fix background color (1.50 KB, patch)
2015-09-10 22:38 UTC, Alberts Muktupāvels
none Details | Review
gtkplug.c: remove draw function, not needed (2.11 KB, patch)
2015-09-11 09:56 UTC, Alberts Muktupāvels
committed Details | Review
Image with problem (7.14 KB, image/png)
2015-09-11 10:13 UTC, Alberts Muktupāvels
  Details
Image after patch (9.13 KB, image/png)
2015-09-11 10:13 UTC, Alberts Muktupāvels
  Details

Description Alberts Muktupāvels 2015-09-10 22:38:15 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.
Comment 1 Benjamin Otte (Company) 2015-09-11 00:55:10 UTC
(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?
Comment 2 Alberts Muktupāvels 2015-09-11 09:56:01 UTC
Created attachment 311124 [details] [review]
gtkplug.c: remove draw function, not needed

Background will be rendered by parent class - GtkWindow.
Comment 3 Alberts Muktupāvels 2015-09-11 10:08:36 UTC
(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.
Comment 4 Alberts Muktupāvels 2015-09-11 10:13:12 UTC
Created attachment 311128 [details]
Image with problem

Language (LA) icon has no padding so there is no vertical stripes.
Comment 5 Alberts Muktupāvels 2015-09-11 10:13:46 UTC
Created attachment 311129 [details]
Image after patch
Comment 6 Benjamin Otte (Company) 2015-09-11 15:49:39 UTC
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?
Comment 7 Alberts Muktupāvels 2015-09-11 15:53:49 UTC
Yes, this is enough. Thanks!