style: Handle sections in submenus

If a menu item in a submenu is part of a section, it should have
rounded bottom corners if both the item and the section are the
last child of its respective parent.

To express that, add a new .popup-menu-section class and use that
to undo/redo the rounding for items inside a section.

It would be possible to do without a new class with a selector like

 > StBoxLayout > .popup-menu-item:last-child:hover,
 :last-child > .popup-menu-item:last-child:hover

but that's hardly better with its heavy reliance on implementation
details.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4940

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2126>
This commit is contained in:
Florian Müllner 2022-01-25 15:47:23 +01:00 committed by Marge Bot
parent 1cee7e6760
commit c256ca443e
2 changed files with 9 additions and 0 deletions

View File

@ -139,6 +139,13 @@
border-radius: 0 0 $base_border_radius $base_border_radius; border-radius: 0 0 $base_border_radius $base_border_radius;
} }
} }
.popup-menu-section {
.popup-menu-item:last-child:hover { border-radius: 0 }
&:last-child .popup-menu-item:last-child:hover {
border-radius: 0 0 $base_border_radius $base_border_radius;
}
}
} }
// container for radio and check boxes // container for radio and check boxes

View File

@ -1165,6 +1165,8 @@ var PopupMenuSection = class extends PopupMenuBase {
this.actor = this.box; this.actor = this.box;
this.actor._delegate = this; this.actor._delegate = this;
this.isOpen = true; this.isOpen = true;
this.actor.add_style_class_name('popup-menu-section');
} }
// deliberately ignore any attempt to open() or close(), but emit the // deliberately ignore any attempt to open() or close(), but emit the