mate-desktop / mate-panel

MATE panel
https://mate-desktop.org
GNU General Public License v2.0
184 stars 115 forks source link

[1.16] Notification area icons disappears when apply a background image to the panel #585

Closed caringi closed 7 years ago

caringi commented 7 years ago

When I try to set a background image for a panel, if this panel has a notification area, all their icons disappears. mate_panel_problem_before_background mate_panel_problem_after_background

lukefromdc commented 7 years ago

What version of mate-panel, and is it built with GTK2 or GTK3? If GTK3, what GTK3 version? MATE 1.18 always uses GTK3, and some distros such as Ubuntu and Debian build MATE 1.16 with GTK3. MATE 1.14 and earlier is almost always supplied built with GTK2 by distros.

Also, what kind of image? I can set a png or jpg image and never get this, the notification area icons show up fine on my panel. I have compiled mate locally with GTK3 all the way back to 1.10 and never seen this, but if this is with GTK2 that is why.

caringi commented 7 years ago

I'm using MATE shipped with Fedora 25 (1.16.2). It's using GTK3 (3.22.15):

$ ldd /usr/bin/mate-panel|grep libgtk
    libgtk-3.so.0 => /lib64/libgtk-3.so.0 (0x00007fce1f570000)

$ pkg-config --modversion gtk+-3.0
3.22.15

The image is in png format, I'm sending it attached, but it happens with all the images that I've tried (doesn't matter the image format)...

I have been using different versions of MATE in different systems in the last years and never seen this behavior before.

panel_background1

lukefromdc commented 7 years ago

I just tested your image, tray icons worked fine for me, using GTK 3.22.15 on Debian Unstable. I've never seen this, can't duplicate it. Can one of the other Fedora users here test this?

monsta commented 7 years ago

@raveit65 please check if it happens in your Fedora versions :slightly_smiling_face:

raveit65 commented 7 years ago

I can confirm that with

[rave@f25 ~]$ rpm -qa mate-panel
mate-panel-1.16.2-2.fc25.x86_64

But not with

[rave@f26 ~]$ rpm -qa mate-panel
mate-panel-1.18.2-3.fc26.x86_64

mate-panel-1.16.2-2.fc25.x86_64 use only one commit from @monsta http://pkgs.fedoraproject.org/cgit/rpms/mate-panel.git/tree/mate-panel.spec?h=f25#n40 (fix-crash-when-some-.desktop-file-has-empty-Icon). So this shouldn't be related. I think we need to backport more na-tray fixes from master, on the other side i will upgrade f25 to 1.18.x in a few weeks when f26 is released ;-) After that upgrade debian is the only distro which have to use 1.16.x with mate gtk3 builds, ....sadly. @monsta Can you please test this with debian?

raveit65 commented 7 years ago

Btw. The icons in na-tray are there (physical), i see tooltips and context menus of them.

monsta commented 7 years ago

Confirmed in Debian Testing with mate-panel 1.16.2 and GTK+ 3.22.11. The icons are invisible but clickable, and tooltips still work too.

monsta commented 7 years ago

Looks like GTK+ 3.22 only issue. I can't reproduce it with the same mate-panel version and GTK+ 3.20.9 in Ubuntu 16.10.

raveit65 commented 7 years ago

Not sure if this is gtk+- related, as f26 with gtk3-3.22.15-2.fc26.x86_64 and mate-panel from master don't have this issue. But with f25 + gtk3-3.22.15-2.fc25.x86_64 + mate-panel-1.16.2-2.fc25.x86_64 the issue is reproducible.

lukefromdc commented 7 years ago

Could this require a specfic version of glib with gtk 3.22 to reproduce, or of some other library?

monsta commented 7 years ago

Not sure, but you'll need mate-panel 1.16 to reproduce it.

lukefromdc commented 7 years ago

I never once saw this in mate-panel 1.16, and all my builds of it used GTK 3.22. I have never, ever seen this

lukefromdc commented 7 years ago

Just tested with mate-panel 1.16.2 plus the last commit in the branch(GTK+3: fix crash when some .desktop file has empty Icon field), and the icons in the tray remained visible. Still can't duplicate on Debian Unstable but my gtk and giib builds are local builds.

Wonder if maybe some particular item in the tray triggers this? What icons are normally "showing" when this occurs? I have the xrandr applet icon, the volume control, and my customized nm-applet including the panel menu support. Also the audacious tray icon if audacious is running.

caringi commented 7 years ago

@lukefromdc I usually have:

But I'm skeptical about this problem being triggered by some particular item.

monsta commented 7 years ago

It doesn't matter, I can reproduce it with just volume control and nm-applet.

Maybe it's only reproducible in a VM?

raveit65 commented 7 years ago

Maybe it's only reproducible in a VM?

Indeed, on bare metal + f25 + nvidia + [rave@mother ~]$ rpm -qa gtk3 gtk3-3.22.15-2.fc25.x86_64 [rave@mother ~]$ rpm -qa mate-panel mate-panel-1.16.2-2.fc25.x86_64 The issue isn't reproducible here, icons of applets are there in na-tray. @caringi Do you use a VM?

caringi commented 7 years ago

@raveit65 nop...

I'm reproducing the problem on bare metal: f25 + intel

$ lshw -C display
WARNING: you should run this program as super-user.
  *-display                 
       description: VGA compatible controller
       product: HD Graphics 520
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 07
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:126 memory:f0000000-f0ffffff memory:e0000000-efffffff ioport:e000(size=64) memory:c0000-dffff
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.

$ rpm -qa gtk3
gtk3-3.22.15-2.fc25.x86_64

$ rpm -qa mate-panel
mate-panel-1.16.2-2.fc25.x86_64
lukefromdc commented 7 years ago

Would be very odd for this to be video driver dependant, though I did get video driver caused corruption of some panel items a year or two ago on Intel Atom pine trail, which is now poorly supported by drivers. Still, they showed up, they just rendered wrong. Don't see any other likely hardware issues.

monsta commented 7 years ago

Unfortunately, I only have 1.16 in a couple of VMs, so I can't compare... but even if I had it on baremetal, I only have nvidia cards.

mokkurkalve commented 7 years ago

This have been the issue on x86_64 Arch Linux all the time since Arch switched to Mate 1.18 and started compile Mate against GTK3. All icons in systray becomes invisible when I try to apply the PNG image that worked nice with Mate 1.16/GTK2. As noted they are still there but completely invisible. Currently I have mate-panel 1.18.3 compiled against GTK3 version 3.22.15 and glib2 version 2.52.2+9+g3245eba16. mate-desktop version are 1.18.0. This is a physical laptop with intel graphics.

lukefromdc commented 7 years ago

Someone who can reproduce this might be able to find the culprit by starting with 1.16 and applying 1.18 commits one at a time, sort of the inverse of a normal bisect.

Michael-AU commented 7 years ago

I reported a similar issue against mate-panel 1.16.2-1 to Debian a little while back but Stretch is in complete freeze now so they haven't done anything. Anyway, if you apply any transparency to the panel the notification area icons disappear. It doesn't matter what theme is being used, it doesn't matter what icons are being used what matters is if you change the panel background or apply transparency.

monsta commented 7 years ago

This is getting complicated. I looked at another VM with Debian Testing which has MATE built from git master (instead of stock 1.16). Guess what, it's reproducible there.

monsta commented 7 years ago

Resizing or restarting the panel makes the icons visible. Apparently there's some refresh missing somewhere.

raveit65 commented 7 years ago

Resizing or restarting the panel makes the icons visible.

Indeed this works, but starting the panel with session start makes the icons invisible. Btw. with Centos7 VM and MATE compiledwith gtk3 i can't reproduce the issue. [rave@localhost ~]$ rpm -qa gtk3 gtk3-3.14.13-20.el7_3.1.x86_64 [rave@localhost ~]$ rpm -qa mate-panel mate-panel-1.18.3-1.el7.centos.x86_64

monsta commented 7 years ago

I was only able to reproduce it with GTK+ 3.22...

caringi commented 7 years ago

Today my F25 received an update with MATE 1.18...

$ rpm -qa mate-panel
mate-panel-1.18.3-1.fc25.x86_64

Seems that the problem persists...

Actually the behaviour has changed a bit, now only part (as far as I can tell: always the same ones) of the icons disappears...

mate_panel_1_18_problem_before_background

mate_panel_1_18_problem_after_background

Fusion-Icon, Bluetooth, Firewall-applet and GoldenDict are never affected.

monsta commented 7 years ago

Ah right. We have StatusNotifier support in 1.18, and these icons aren't affected. I'm not surprised - SNI is handled in a different part of code.

lukefromdc commented 7 years ago

I can now confirm this too, after recent changes in Debian Unstable. Restarting the panel will bring them back. This is limited to a bg image selected from the panel-prefs dialog,newly-supported bg images in the GTK theme (https://github.com/mate-desktop/mate-panel/commit/a1445bc208e22260c27ce67ad4ebce6040ff5a3c made those work) are not affected

Rollback tests showed that my locally build GTK 3.22.16 and glib 2.53.3 were not to blame. There is a suggestion that the entire bg image code be rewritten around the far simpler code I've got working for images in the GTK theme, which never cover the tray icons in my current tests. One disadvantage of so doing is there is a bug in Cairo that causes an extreme stretch of small image to not render all pixels and this gradually get more and more transparent with great amounts of stretch (more than about 5-1).

Also, usr set images will tile (not stretch) if they are very short, maybe that is a better way of handling theme backgrounds as well? In GTK itself "repeat" is the default, and a repeat of a 1px sample gives a perfect smooth background image bar.

lukefromdc commented 7 years ago

Worse yet, I just found the entire code block that is supposed to scale user selected background images no longer seems to work, if you set an image that matches your panel height, it does not scale but either is cropped or a section is left uncovered. Lots of rework needed here. There are internal variables to set image fit, stretch, or rotate. Rotate works for a vertical panel, but whatever sets the "fit" or "stretch" variables seems to be missing. Nothing in dconf-editor or the panel prefs dialog, I think there used to be.

lukefromdc commented 7 years ago

Here's the code for reading how a user set image is supposeds to be handled as to fix/stretch/rotate, in panel-profile.c:


    if (!strcmp (key, "type")) {
        PanelBackgroundType  background_type;
        background_type = g_settings_get_enum (settings, key);
        panel_background_set_type (background, background_type);
        panel_toplevel_update_edges (toplevel);
    } else if (!strcmp (key, "color")) {
        GdkRGBA color;
        gchar *str;
        str = g_settings_get_string (settings, key);
        if (gdk_rgba_parse (&color, str))
            panel_background_set_color (background, &color);
        g_free (str);
    } else if (!strcmp (key, "image")) {
        gchar *value = g_settings_get_string (settings, key);
        panel_background_set_image (background, value);
        g_free (value);
    } else if (!strcmp (key, "fit")) {
        panel_background_set_fit (background,
                      g_settings_get_boolean (settings, key));
    } else if (!strcmp (key, "stretch")) {
        panel_background_set_stretch (background,
                          g_settings_get_boolean (settings, key));
    } else if (!strcmp (key, "rotate")) {
        panel_background_set_rotate (background,
                         g_settings_get_boolean (settings, key));
    }

I see nothing in dconf-editor nor in the panel-prefs dialog for rotate, fit, or stretch, so these go to defaults. That seems to be fit and rotate, meaning the image does rotate to fit vertical panels but never stretches or shrinks to fit the panel. This breaks layouts like Ubuntu MATE Mutiny.

Meanwhile I'm also looking at the tray with icons "covered" and found that if the image is transparent they still are not there. They are either covered by the copied image of the desktop (which is an exact size match) or never rendered at all, not sure which. They can be clicked on, even though they are not actually displayed.

raveit65 commented 7 years ago

They can be clicked on, even though they are not actually displayed.

This sounds like an issue with SNI-Support, maybe...... Did you try to disable SNI-Support via gsettings from the other PR?

lukefromdc commented 7 years ago

I just tested this with SNI support turned off, no difference at all. I also found another interesting thing: if compositing is turned off, a custom panel color with transparency will also make the tray icons disappear, while a solid color wiil not. If compositing is used the icons are always shown with a color background.

monsta commented 7 years ago

It's reproducible in 1.16 too, so SNI support shouldn't affect it as it appeared only in 1.18.

monsta commented 7 years ago

The mentioned fit/stretch/rotate keys are per-toplevel keys, dconf-editor doesn't show them unless they have some non-default value. There's the same problem with per-applet keys (except for stickynotes applet which has its own schema outside of org.mate.panel namespace). I can only see the default values in data/org.mate.panel.toplevel.gschema.xml.in file.

lukefromdc commented 7 years ago

That means most GUI dependent user have no way to reset those values, as they are not in the panel preferences dialog. I think they were at one time but I am not sure. They don't got a non-default value if a user can't change them, so don't show up in dconf-editor. Since a user can't change them in panel-prefs they don't get changed at all. This allows a distro to ship a changed value for something like Ubuntu-Mate Mutiny but that's about it. An image background will fit if it is done the way it was sometimes done in GTK2: a 1px wide, full height file that when tiles gives the background all the way across

lukefromdc commented 7 years ago

Just found that the "stretch" option works fine with a manually edited schema.

I think what is happening with the disappearing icons is this: the compositing path copies the desktop background, as does the image path.

for an image, the code below in panel-background.c picks up the desktop background and seems to be the only difference in the rendering code for the noncomposited case:

if(!gdk_window_check_composited_wm(background->window)){
        cairo_set_source_rgb (cr, 1, 1, 1);
        cairo_paint (cr);

        gdk_cairo_set_source_pixbuf (cr, background->desktop, 0, 0);
        cairo_rectangle (cr, 0, 0, width, height);
        cairo_fill (cr);
    }

For a color with an alpha a similar trick is used.

Wonder if this is just enough slower to cause it to paint after the tray icons have already been painted? I've already found the desktop shows OVER tray icons that are still clickable if a transparent color or image background is used without compositing.

Tray icons are unique in that they come from programs external to mate-panel and are not panel applet icons either.

lukefromdc commented 7 years ago

Working on backgrounds again, found the entire image_details_dialog section of panel-properties-dialog.ui is present and unused, already found the gsettings values work if the schema is edited. Was this dialog lost or never properly implemented?

lukefromdc commented 7 years ago

I just found that the icons only disappear if the panel size is 28px high or smaller. They keep showing at 29px or larger.

lukefromdc commented 7 years ago

Also in na-tray-child.c na_tray_child_realize replacing gdk_window_set_composited (window, child->composited); with gdk_window_set_composited (window, FALSE); will kill the tray background entirely (showing the desktop with compositing) and show the icon regardless of panel size.

Removing all of

 if (child->has_alpha)
    {
      /* We have real transparency with an ARGB visual and the Composite
       * extension. */

      /* Set a transparent background */
      cairo_pattern_t *transparent = cairo_pattern_create_rgba (0, 0, 0, 0);
      gdk_window_set_background_pattern (window, transparent);
      gdk_window_set_composited (window, TRUE);
      cairo_pattern_destroy (transparent);

      child->parent_relative_bg = FALSE;
    }
  else 

in the same function will also force the icons to appear except for sometimes being slow to redraw on changing panel size.  For some odd reason, just replacing gdk_window_set_background_pattern (window, transparent); with gdk_window_set_background_pattern (window, NULL); from the function beneath does not force the icons to appear
lukefromdc commented 7 years ago

Found a fix: forcing a relative bg by replacing child->parent_relative_bg = FALSE; with child->parent_relative_bg = TRUE; will force the icons to appear, included it in https://github.com/mate-desktop/mate-panel/issues/607 along with my fix for vertical panels with an image bg in the GTK theme. Feel free to cherrypick if you want to merge the fix for this first, they affect completely different files.

lukefromdc commented 7 years ago

I finally traced the offending function using child->parent_relative_bg to a force-redraw function that only worked if it was set to TRUE and changed that to work unconditionally. That works too. In a small number of panel restarts it is still possible for the icons to not come up until something forces a redraw (like moving the panel or changing its height) but most of the time this works

raveit65 commented 7 years ago

@caringi Can you please test this scratch build ? https://koji.fedoraproject.org/koji/taskinfo?taskID=20381480 With fixes from pull reguest.

lukefromdc commented 7 years ago

Should be mostly fixed with https://github.com/mate-desktop/mate-panel/commit/ab786fa5282be8169b9c94d258cc57d07944ed13 Leaving this open in case any problems remain, as I had occasional instances of the panel starting with the tray icons hidden but almost all the time (in fact ALL the time the last couple days) they have worked

mokkurkalve commented 7 years ago

@lukefromdc Seems to fix the issue for me. Thanx! ( mate-panel 1.18.3 and gtk3 3.22.16 on Arch Linux current )

caringi commented 7 years ago

@raveit65 tested... It's working as expected. Thanks!

monsta commented 7 years ago

Need to test with older GTK+3 versions just in case, to make sure nothing wrong happens there with this change.

lukefromdc commented 7 years ago

Just tested with all of the supported GTK versions back to 3.14, behavior and appearance seems to be the same in all of them.

To do this test, first ensure caja, mate-terminal, and anything else you may need are already open as many won't launch when GTK is rolled back. Mate-search tool seems to work with any version so it will be available, BTW Next, roll back libwnck to version 3.14, then install the test GTK version. Mine are all built as single packages for easy interchange. Having done this, recompile and reinstall mate-desktop, then do the same with mate-panel and restart the panel. Repeat with each GTK version to be tested, libwnck 3.14 can stay as it works with all of them.

When done, reinstall your normal GTK version, your normal libwnck, mate-desktop, and mate-panel versions. Be sure to do this before killing your session-or you won't be able to start any GTK3 based session. Unless you have a QT or GTK2 based session, recovery from that is from the console. Consider having a VT open and already on the directory with the packages in it.

monsta commented 7 years ago

It's ok, I have several installations of various Debian/Ubuntu/Mint releases with various GTK+3 versions :slightly_smiling_face:

So far, it looks alright with GTK+ 3.18 (Mint 18.2, based on Ubuntu 16.04).

raveit65 commented 7 years ago

Ok, closing.