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

panel-toplevel: add position css class #828

Merged
merged 1 commit into from
Jun 29, 2018
Merged

Conversation

raveit65
Copy link
Member

This makes it possible to add theme settings for fixing
#617
#344
#193

An example css for Menta and other light themes which can be used in
~.config/gtk-3.0/gtk.css

.mate-panel-menu-bar.horizontal.top > grid {
    border-style: outset;
    border-width: 0px 0px 1px 0px;
    border-color: rgba(0, 0, 0, 0.23);
}

.mate-panel-menu-bar.horizontal.bottom > grid {
    border-style: outset;
    border-width: 1px 0px 0px 0px;
    border-color: rgba(0, 0, 0, 0.23);
}

.mate-panel-menu-bar.vertical.left > grid {
    border-style: outset;
    border-width: 0px 1px 0px 0px;
    border-color: rgba(0, 0, 0, 0.23);
}

.mate-panel-menu-bar.vertical.right > grid {
    border-style: outset;
    border-width: 0px 0px 0px 1px;
    border-color: rgba(0, 0, 0, 0.23);
}

@muktupavels
Copy link
Contributor

Your CSS is misleading... If I would read this CSS then I would think that this will affect only menu bar applet. Why toplevel has these classes?

@lukefromdc
Copy link
Member

Deleted previous comment as timeline was wrong

@raveit65
Copy link
Member Author

Complete css selector i much longer.
PanelToplevel.horizontal.top.background.mate-panel-menu-bar.gnome-panel-menu-bar.mate-custom-panel-background > grid {}

mate-panel-menu-bar.gnome-panel-menu-bar was added in the past for some reasons.
I only added the new position css classes.

@lukefromdc
Copy link
Member

Years ago (MATE 1.9/1.10 era), when I first started working with mate-panel and GTK3, I found that the main menu from the menubar would follow .mate-panel-menu-bar menu while all other menus followed only the GTK theme default. Thus, I added that style class to the toplevel windows of all the other menus, so they would all follow the same theme as the default menubar's main menu. I then made use of that in my UbuntuStudio_Legacy theme. During the GTK 1.20 transition, the comments in the code now in question show there were issues with getting the system background reapplied, and the same style class was applied there. I am NOT sure about this, but I think it may have been somewhere on the toplevel even before then, as this was enough to make the panel respond to the existing themes at the time when deselecting a user selected background.

Anyway, that now leaves us with the single style class .mate-panel-menu-bar used too widely. One possible way of refactoring this would be to shorten it just to .mate-panel but still applying the older .mate-panel-menu-bar style class to the panel menu bar itself(the main menu bar applet). Themes could then be backward compatable by listing both style classes with the use of .mate-panel-menu-bar outside the menubar applet deprecated.

Changes for such a refactor would be needed in mate-panel, mate-applets, mate-settings-daemon, mate-power-manager, mate-polkit, and all themes. Users would need to change the themes at the same time (or before if backward compatable) as all of these, so at least it would have to be for 3.22 and at that time theme names could advance to 3.24 as GTK also is doing so.

@raveit65
Copy link
Member Author

I think gnome-panel-menu-bar was added to support older and now outdated gnome themes like Adwaita.
Outdated because gnome themes don't style any application explicit any more.
What we can do is to rename css names to be consistent to gnome-panel.
Eg. PanelToplevel --> panel-toplevel.
But this is independent from PR.

@raveit65
Copy link
Member Author

But more important is that i wasn't able to use a box-shadow in css.
It works only if i use inset

.mate-panel-menu-bar.horizontal.top > grid {
    box-shadow: inset  0px  1px shade (@theme_selected_bg_color, 1.3);
}
inset  0px  1px shade (@theme_selected_bg_color, 1.3),  -->top
inset  1px  0px shade (@theme_selected_bg_color, 1.3), --> left
inset -1px  0px shade (@theme_selected_bg_color, 1.3),  --> right
inset  0px -1px shade (@theme_selected_bg_color, 1.3);  --> bottom

@lukefromdc
Maybe you are more luckier than me.

@lukefromdc lukefromdc self-requested a review June 29, 2018 18:53
Copy link
Member

@lukefromdc lukefromdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, and the style classes show up in GtkInspector. Will merge as any refactoring is a separate PR

@lukefromdc
Copy link
Member

Not sure how big a window the panel toplevel actually uses, but if the window is the same size as the panel than there is no place to render a box shadow. I am not an expert on box shadows, but maybe inset renders over the contents and the rest outside the contents and there is no window space there to draw them?

@lukefromdc
Copy link
Member

The whole _GTK_FRAME_EXTENTS issue in window managers is about rendering the extra space around CSD windows to handle box shadows. The panel is an undecorated window, I don't see any .csd style class applied, so I'm wondering if it gets _GTK_FRAME_EXTENTS of zero px and can't render shadows. A GtkMenu's window cannot be accessed from GtkInspector but those I know act like CSD windows, which is why I had to force transparency on them when the _GTK_FRAME_EXTENTS issue in older compiz version caused them to render in RGB rather than RGBA. Had the toplevel also had this issue, shadows would have worked in Marco with and only with compositing, but transparency of the panel in a system theme would have been impossible with any compiz version except recent compiz-reloaded or the gtk-frame-extents branches.

The only place I ever saw shadows with someone's test branch of mate-panel to support them was rendered underneath a transparent panel rather than outside its borders.

@lukefromdc lukefromdc merged commit c4aedbd into master Jun 29, 2018
@lukefromdc lukefromdc deleted the orientation-style-classes branch June 29, 2018 19:14
@lukefromdc
Copy link
Member

Merged the PR as the style classes work and will allow borders to work and if we ever fix the window issue to allow box shadows will would need this anyway

@raveit65
Copy link
Member Author

In gtk+-2 versions the shadow was outside, that is what users blame us.
I tried to add other shadow settings from themes, eg from CSD windows settings
box-shadow: 0 0 0 1px @wm_border, 0 2px 8px 3px @wm_shadow;
But for some reasons it works only with inset here.
Maybe this is a sign for a more general problem.
@muktupavels
Does shadows works with gnome-panel?

@raveit65
Copy link
Member Author

I will cherry-pick that to 1.20 branch.

@muktupavels
Copy link
Contributor

Grid is same (?) size as window/toplevel, probably clipped away, but no idea... Maybe something else...

To get outset shadow for panel you probably should do that on panel-toplevel decoration, but again I don't know requirements that must be met to get it working. Toplevel should be ARGB window, it must have allocated more height so there is extra space for shadow. This space probably should be set in _GTK_FRAME_EXTENTS / gdk_window_set_shadow_width:
https://developer.gnome.org/gdk3/stable/gdk3-Windows.html#gdk-window-set-shadow-width

Then you must deal with turning on/off compisiting manager, otherwise shadow area will be black when composting manager is off...

No, gnome-panel does not have shadow.

@raveit65
Copy link
Member Author

Yeah, i noticed panel-toplevel decoration in gtk3-inspector, but it still ignore any shadow setting.
Well, for the moment using an outset border-style looks OK for me with Menta themes.

@raveit65
Copy link
Member Author

Grid is same (?) size as window/toplevel, probably clipped away

I think so, for some reasons only grid accept a border or shadow. PanelToplevel or PanelFrame don't accept that.....

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

Successfully merging this pull request may close these issues.

None yet

3 participants