Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTK+ 3.18/20/22: indicator-applet-complete doesn't follow panel's bg color #17

Closed
monsta opened this issue Jul 8, 2016 · 41 comments
Closed

Comments

@monsta
Copy link
Contributor

monsta commented Jul 8, 2016

Originally reported at https://bugs.launchpad.net/bugs/1598159:

If you change the color of the panel (in my case it's more Transparent) the Indicator Applet Complete 1.14.1 doesn't change the background color (will use the system theme)

Indeed, I can reproduce it in Ubuntu 16.10 which has GTK+3 build of MATE 1.14 now.
Here's how indicator-sound and indicator-messages look with transparent panel and TraditionalGreen theme:

indicator-background

@raveit65 @lukefromdc @dnk @XRevan86
Guys, I need some help with this. I know that probably only @XRevan86 might be able to test this applet... but maybe you guys have some ideas that I could try.

So far, I've tried not to use some deprecated stuff in GTK+3 build (see 0c50584). Also I've tried to use the applet as the second argument of mate_panel_applet_set_background_widget function (like it's done in all other applets):

diff --git a/src/applet-main.c b/src/applet-main.c
index 1e00863..a274f64 100644
--- a/src/applet-main.c
+++ b/src/applet-main.c
@@ -1038,7 +1038,7 @@ applet_fill_cb (MatePanelApplet * applet, const gchar * iid G_GNUC_UNUSED,
                gtk_widget_show(item);
        } else {
                gtk_container_add(GTK_CONTAINER(applet), menubar);
-               mate_panel_applet_set_background_widget(applet, menubar);
+               mate_panel_applet_set_background_widget(applet, GTK_WIDGET(applet));
                gtk_widget_show(menubar);
        }

None of this helped. I still can't make it follow panel's bg color. 😕

@monsta
Copy link
Contributor Author

monsta commented Jul 8, 2016

I also noticed that when no indicators are present, the label which tells us about it follows panel's bg color just fine. It can be reproduced by adding indicator-applet-appmenu applet to the panel while indicator-appmenu package isn't installed. It looks like this (see the leftmost applet):

indicator-nothing-background

In the code the label is set as the bg widget, nothing special:

    if (indicators_loaded == 0) {
        /* A label to allow for click through */
        GtkWidget * item = gtk_label_new(_("No Indicators"));
#if GTK_CHECK_VERSION(3, 0, 0)
        mate_panel_applet_set_background_widget(applet, item);
#endif
        gtk_container_add(GTK_CONTAINER(applet), item);
        gtk_widget_show(item);
    } else {
        gtk_container_add(GTK_CONTAINER(applet), menubar);
        mate_panel_applet_set_background_widget(applet, menubar);
        gtk_widget_show(menubar);
    }

So I don't get it why it works for a label but not for a menubar...

@lukefromdc
Copy link
Member

I've not been able to make indicator-applet work at all on my Debian setup,
though the version tested was an old one. I had been wondering if it would
render indicator menus following the panel menu theme so as not to require
every tray applet that could be replaced by an indicator to support panel
menu themes.

On 7/8/2016 at 5:01 AM, "monsta" notifications@github.com wrote:

I also noticed that when no indicators are present, the label
which tells us about it follows panel's bg color just fine. It can
be reproduced by adding indicator-applet-appmenu applet to
the panel while indicator-appmenu package isn't installed.
It looks like this (see the leftmost applet):

![indicator-nothing-
background](https://cloud.githubusercontent.com/assets/5138986/1668
2405/92da5028-450b-11e6-9805-7714814b1d65.png)

In the code the label is set as the bg widget, nothing special:

  if (indicators_loaded == 0) {
      /* A label to allow for click through */
      GtkWidget * item = gtk_label_new(_("No Indicators"));
#if GTK_CHECK_VERSION(3, 0, 0)
      mate_panel_applet_set_background_widget(applet, item);
#endif
      gtk_container_add(GTK_CONTAINER(applet), item);
      gtk_widget_show(item);
  } else {
      gtk_container_add(GTK_CONTAINER(applet), menubar);
      mate_panel_applet_set_background_widget(applet, menubar);
      gtk_widget_show(menubar);
  }

So I don't get it why it works for a label but not for a menubar...


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/mate-desktop/mate-indicator-
applet/issues/17#issuecomment-231310530

@lukefromdc
Copy link
Member

lukefromdc commented Jul 8, 2016

Which GTK 3 version is this? There were radical changes in custom background code forced by the GTK 3.20 transition that were also applied to GTK 3.18 builds as they reduced the applet crash problem. There were problems with backgrounds turning transparent which were a GtkPlug issue and required new code to put them in windows which then could be themed. This had to be used together with the code that moved the panel background handling to the toplevel to get consistant alpha values on transparent backgrounds.

If this applet and only this applet is mismatching custom panel backgrounds, it makes me wonder if it missed some code changes. Were any parts of the libmate-panel-applet code duplicated in this applet rather than dynamically linked perhaps?

As I said I've got no way to test this but I there is the possbility this is fallout from the panel background fixes forced by GTK 3.20. Current Ubuntu 16.04 LTS uses 3.18-and so does the alpha Yakkety version. This means the new panel code would be used. If you were to build the panel and applet against an older version of Ubuntu and try again you could rule these code changes in or out. If the same issue comes up with GTK 3.16 or 3.14 the panel BG code changes are not the problem as they are only applied to GTK 3.18 or later builds. If this makes the differennce the panel BG code changes are the issue and some part of that didn't make it to this applet or is being improperly used. I haven't seen or heard of any other applet acting like this and tested a bunch of them while I was working on that panel code. Unfortunately indicator-applet doesn't work at all on my Debian setup as no indicators can be found even if installed.

@ghost
Copy link

ghost commented Jul 8, 2016

I thought I'd chime in regarding this bug. It doesn't only seem to affect indicator-applet, but (in my case at least) window buttons and the clock.

@lukefromdc
Copy link
Member

Window buttons and clock have never acted like that on my systems.

On 7/8/2016 at 6:51 PM, "easdbe" notifications@github.com wrote:

I thought I'd chime in regarding this bug. It doesn't only seem to
affect indicator-applet, but (in my case at least) window buttons
and the clock.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/mate-desktop/mate-indicator-
applet/issues/17#issuecomment-231491245

@monsta
Copy link
Contributor Author

monsta commented Jul 13, 2016

This is with GTK+ 3.18 which is currently in Ubuntu 16.10. Only this applet behaves like that, and - see the code I quoted in my comment above - only when menubar widget is used. It's all good when a simple GtkLabel is packed and displayed (see the screenshot in that comment as well).

That menubar widget is a GtkMenuBar in which some items are packed, it can be seen in entry_added function in src/applet-main.c.

@monsta
Copy link
Contributor Author

monsta commented Jul 13, 2016

AFAIK, no parts of libmate-panel-applet code are duplicated here. It's all done like in all the other panel applets, we only call mate_panel_applet_set_background_widget function from the library, that's all.

@lukefromdc
Copy link
Member

Looks like this problem was inherited from GNOME. From comments under
the original bug report https://bugs.launchpad.net/ubuntu-mate/+bug/1598159

"Ok, so it's also broken in the original indicator-applet (for gnome-panel).
That explains why it happens here even though I've adapted all their GTK+3 migration changes..."

On 7/13/2016 at 11:30 AM, "monsta" notifications@github.com wrote:

This is with GTK+ 3.18 which is currently in Ubuntu 16.10. Only
this applet behaves like that, and - see the code I quoted in my
comment above - only when menubar widget is used. It's all
good when a simple label is packed and displayed (see the
screenshot in that comment as well).

That menubar widget is a GtkMenuBar in which some items are
packed, it can be seen in entry_added function in

src/applet-main.c.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/mate-desktop/mate-indicator-
applet/issues/17#issuecomment-232392560

@monsta
Copy link
Contributor Author

monsta commented Jul 15, 2016

Yes, that's my comment there 😄

Indeed, the original indicator-applet running with gnome-panel 3.18 in gnome-flashback session (same system, Ubuntu 16.10) has the same issue.

@albertsmuktupavels: maybe you could give a hint about this please?

@muktupavels
Copy link

  1. indicator-applet depends on ubuntu patches/changes in gtk+ that is not available in upstream gtk+. So that applet will not work in debian or other distributions unless they add needed patches.

  2. I can make indicator-applet transparent by modifying Ambiance theme. At least Ambiance is setting background color and/or image on too many things. So probably first thing is to check themes?

@lukefromdc
Copy link
Member

If the applet can be made transparent by modifying a theme, that means
it could be made theme-independent by hardcoding that same transparency
code into a cssprovider in the applet itself. I can't write that because I can't
test it though. So long as you are getting the panel bg underneath and not
the desktop background (the old GtkPlug hole issue that could still affect
GTK 3.16 and earlier builds) this should work.

On 7/15/2016 at 9:29 AM, "Alberts Muktupāvels" notifications@github.com wrote:

  1. indicator-applet depends on ubuntu patches/changes in gtk+ that
    is not available in upstream gtk+. So that applet will not work in
    debian or other distributions unless they add needed patches.

  2. I can make indicator-applet transparent by modifying Ambiance
    theme. At least Ambiance is setting background color and/or image
    on too many things. So probably first thing is to check themes?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/mate-desktop/mate-indicator-
applet/issues/17#issuecomment-232950769

@monsta
Copy link
Contributor Author

monsta commented Aug 18, 2016

Ok guys, you might be right about the themes...

A few days ago Ubuntu 16.10 finally got GTK+ 3.20, and suddenly, I have transparent background in the indicators. Even though I did not rebuild mate-panel and mate-indicator-applet (they're still built against GTK+ 3.18), it works. Not with all themes though.

It works with almost all themes from mate-themes package, except for two "Traditional" ones.
Also I've tested it with two themes that are shipped with Ubuntu MATE. With Radiant-MATE it works, with Ambiant-MATE it doesn't.

Radiant-MATE:
mia-radiant

Menta:
mia-menta

Ambiant-MATE:
mia-ambiant

TraditionalGreen:
mia-tradgreen

@monsta
Copy link
Contributor Author

monsta commented Aug 19, 2016

Hmm... rebuilding both panel and indicator applet against 3.20 changed absolutely nothing. 😕

@muktupavels
Copy link

Indicator applet use GtkMenuBar. Most likely both themes set background color on menubar.

https://code.launchpad.net/~albertsmuktupavels/ubuntu-themes/gnome-panel-3-20/+merge/302349
This is what I did for gnome-panel.

@monsta monsta changed the title GTK+3: indicator-applet-complete doesn't follow panel's bg color GTK+ 3.18: indicator-applet-complete doesn't follow panel's bg color Oct 6, 2016
@monsta
Copy link
Contributor Author

monsta commented Oct 6, 2016

Themes issue for 3.20 is now tracked at https://github.com/flexiondotorg/ubuntu-mate-themes/issues/39. I'll leave this one open since we're going to stumble upon it in Mint 18.1 which has 3.18.9.

@raveit65
Copy link
Member

raveit65 commented Oct 6, 2016

/* mate-indicator-applet */
/* needed for a transparent panel */
#fast-user-switch-applet > #fast-user-switch-menubar {
    background-color: transparent;
}

Fixes the issue, or more general in gtk+-3.18 syntax.
.mate-panel-menu-bar .menubar {}
Honestly, using the style class '.menubar' is the real culprit, because this is set in every theme and complete useless here.
This is an applet with a menu but not a menubar ;)

@lukefromdc
Copy link
Member

In my own theme, .mate-panel-menu-bar menubar{} (GTK3.20 syntax) is only used to deliberately override the use of .mate-panel.menu.bar to set to overall panel background, so as not to also set it again on the main menubar or similar applets.

This sort of thing thus seems to come and go, at least GTK3 will now be stable and themes can thus also stabilize. Although I can't test the indicator applet, to get all applets to respect panel transparency in my own theme required deliberate attention to detail, the old UbuntuStudio-Legacy GTK2 theme did NOT leave all applets properly showing the panel background.

If something causes problems in themes that do not refer to MATE at all, there is always the option of hardcoding it transparent as well.

@monsta
Copy link
Contributor Author

monsta commented Apr 30, 2017

Testing with 3.18... Weird. Mint-X doesn't have this issue even though there are no "fast-user-switch" things in css files. At the same time, all mate-themes have this issue...

@raveit65
Copy link
Member

@monsta
Does this help with our themes?

/* mate-indicator-applet */
/* needed for a transparent panel */
#fast-user-switch-applet > #fast-user-switch-menubar {
    background-color: transparent;
}

Add this to the end of mate-application.css.

@monsta
Copy link
Contributor Author

monsta commented May 1, 2017

Hmm I thought it was already committed... anyway, I added this to Menta and TraditionalGreen, and nothing changed.
I'm more curious about what in Mint-X could fix it.

@raveit65
Copy link
Member

raveit65 commented May 1, 2017

I'm more curious about what in Mint-X could fix it.

Without looking into the code i would say they don't set 'menubar' in there css.
But i can reproduce this only with Trad themes in 17.14, we need to eliminate a background image too.

/* mate-indicator-applet */
/* needed for a transparent panel */
#fast-user-switch-applet > #fast-user-switch-menubar {
    background-color: transparent;
    background-image: none;
}

But why this applet draw his own background?
It should simply be transparent and use the bg from panel.

@monsta
Copy link
Contributor Author

monsta commented May 2, 2017

Yeah now it works 👍

Well, the code looks like it should use bg from panel (see code snippets in the first post above). Apparently something goes wrong there.

@raveit65
Copy link
Member

raveit65 commented May 2, 2017

I added this to all branches.
mate-desktop/mate-themes@45f23d6

@monsta monsta changed the title GTK+ 3.18: indicator-applet-complete doesn't follow panel's bg color GTK+ 3.18/20/22: indicator-applet-complete doesn't follow panel's bg color Aug 9, 2017
@sc0w
Copy link
Member

sc0w commented Nov 21, 2017

@raveit65
Copy link
Member

@monsta
Do you want to fix it in code?
Or should i claim the bounty as i fixed it in our and mate-ubuntu themes?

@lukefromdc
Copy link
Member

If its fixed by theming rather than hardcoding the necessary elements, it's not fixed in non-MATE themes a user might install.

@monsta
Copy link
Contributor Author

monsta commented Nov 22, 2017

If the question is just bounty, you can claim it 😄
I just would like to fix this in the code. Might be some hardcoding yes... or rather, some default setting that a theme could override.

@raveit65
Copy link
Member

raveit65 commented Nov 22, 2017

Well, the bounty is from mate-desktop itself, maybe someone like to remove the menubar style class from applet, this should fix the issue.
Edit: see my comment
#17 (comment)

@lukefromdc
Copy link
Member

The style class should stay on the menus popped up from the applet, or a mismatch will result in any theme that sets a mate-panel menu theme different from the overall GTK theme. Not a big deal to me as I use the tray's own SNI support rather than this applet. Speaking of that, what is in this applet that is not duplicated by the tray's native SNI support at this time?

@lukefromdc
Copy link
Member

lukefromdc commented Nov 22, 2017

Clarification: the mate-panel-menu-bar style class needs to be on the menus popped up from the applet or on any parent widget to them, and when on an applet itself should make the applet look exactly the same as the main menu bar. That is, any lack of transparency on this applet that is not also a problem on the main menu bar has more to it. Use of the overall style class menubar rather than mate-panel-menu-bar , on the other hand, could cause exactly this problem and would NOT fix such a menu mismatch. EDIT: Removing it sounds like a good idea

Having never worked on this applet (could not make it work when I tried, not on ubuntu), I have never worked on it so I would not have applied mate-panel-menu-bar to get menus to match those created by the main menu bar when the theme sets

 .mate-panel-menu-bar menu{
}

@monsta
Copy link
Contributor Author

monsta commented Nov 26, 2017

Speaking of that, what is in this applet that is not duplicated by the tray's native SNI support at this time?

This applet is just a container for indicator-application, indicator-sound and other kinds of indicators. Only indicator-application has functionality available in tray's SNI support.

@monsta
Copy link
Contributor Author

monsta commented Nov 26, 2017

What can be removed from the code? The only style-related thing I found is:

gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar");

But removing it doesn't fix the issue. It only makes the issue appear for the themes where it was fixed previously (e.g. TraditionalGreen).

@lukefromdc
Copy link
Member

OK, this looks like the fix is to either apply .mate-panel-menu-bar to the applet so it will always match the styling of the main menu bar (which is normally transparent), or to hardcode the background transparent. The former is probably the way to go as it also ensure consistant menus, but I cannot test this as I am not on Ubuntu and my last attempt to build and run this failed. Otherwise I would take care of this myself.

@monsta
Copy link
Contributor Author

monsta commented Nov 27, 2017

I also wonder why mate_panel_applet_set_background_widget works for a label but not for the actual indicator, as I mentioned in #17 (comment) above.

@monsta
Copy link
Contributor Author

monsta commented Nov 29, 2017

@lukefromdc: I've adapted indicator-application for Debian, it's in my repo.

It includes debian folder, so you can build .deb with dpkg-buildpackage tool.

I've enabled autostarting in MATE so that it would automatically load into mate-indicator-applet. You can disable it the usual way, via mate-session-properties.

To make the applet actually show something, just run some app with appindicator support. To avoid any conflicts, it's better to disable tray's SNI support first.

@lukefromdc
Copy link
Member

I was able to build and install mate-indicator-applet, and (from https://github.com/monsta/indicator-application ) indicator-application and with some fiddleing get my indicators into them. I found that I was unable to duplicate the non-transparent background issue however, in any theme including Adwaita. It just plain worked fine. I've got GTK 3.22.26 and mate-panel from current git master, if that's any indicator so to speak.

@monsta
Copy link
Contributor Author

monsta commented Nov 29, 2017

Remove this part from mate-applications.css:

/* mate-indicator-applet */
/* needed for a transparent panel */
#fast-user-switch-applet > #fast-user-switch-menubar {
    background-color: transparent;
    background-image: none;
}

However, I don't know why the problem isn't reproducible with Adwaita, while it doesn't have any specific theming for this applet. 😕

@lukefromdc
Copy link
Member

I don't have that in my theme either and didn't see the problem there

@monsta
Copy link
Contributor Author

monsta commented Nov 30, 2017

I've tested this modification with TraditionalGreen theme.

@raveit65
Copy link
Member

I assume that the fix in themes is enough as nobody try to add a general fix in code.
Feel free to re-open it if you don't agree.

@simurgh9
Copy link

simurgh9 commented May 3, 2021

I just had this issue and it was very frustrating to figure out where to even put that CSS. Someone should definitely add the general fix. BTW the CSS bellow goes here ~/.config/gtk-3.0/gtk.css.

/* mate-indicator-applet */
/* needed for a transparent panel */
#fast-user-switch-applet > #fast-user-switch-menubar {
    background-color: transparent;
    background-image: none;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants