Skip to content

Commit

Permalink
menubar: add hint/example how window managers differ wrt the menubar
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Feb 11, 2024
1 parent 8f3ebeb commit 2c56fe4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/widget/wmainmenubar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,15 @@ void WMainMenuBar::onFullScreenStateChange(bool fullscreen) {
void WMainMenuBar::connectMenuToSlotShowMenuBar(const QMenu* pMenu) {
// If a menu hotkey like Alt+F(ile) is pressed while the menubar is hidden,
// show the menubar and open the requested menu. See showMenuBar() for details.

// NOTE(ronso0) Test with xfwm4 and other window managers if you change this
// code or think you found alternative ways to toggle the menubar!
// In Gnome for example, when highlighting (pressed Alt only) or activating
// menus (Alt combos), the menubar receives focusIn events (even while it is
// hidden), and focusOut events respectively when closing menus. Hence we
// could simply show/hide the menubar in QMenuBar::focusInEvent() and focusoutEvent().
// However, with xfwm4 for example, menus are activated directly, i.e. the
// menubar doesn't receive focus change events.
connect(pMenu,
&QMenu::aboutToShow,
this,
Expand Down

0 comments on commit 2c56fe4

Please sign in to comment.