Skip to content

Commit

Permalink
fullscreen: remove Linux menubar workaround
Browse files Browse the repository at this point in the history
It appears this is causing issues 1) on recent Ubuntu 22.04 and also 20.04 with the defaut window
manager, as well as 2) with (unofficial) window manager extensions that enable the so-called 'global menu'
(menubar is integrated in the desktop's top bar) after toggling fullscreen, e.g. when switching skins
while in fullscreen mode:
* 1) 2) menubar hotkeys not working anymore
* 2) menubar is not restored in the title bar but in the windwo itself
  • Loading branch information
ronso0 committed Feb 11, 2023
1 parent 78f4eb1 commit 7e58af7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
35 changes: 26 additions & 9 deletions src/mixxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ MixxxMainWindow::MixxxMainWindow(QApplication* pApp, const CmdlineArgs& args)
m_toolTipsCfg(mixxx::TooltipsPreference::TOOLTIPS_ON),
m_runtime_timer("MixxxMainWindow::runtime"),
m_cmdLineArgs(args),
#ifdef __LINUX__
m_recreateMenubarOnFullscreenToggle(false),
#endif
m_pTouchShift(nullptr) {
m_runtime_timer.start();
mixxx::Time::start();
Expand Down Expand Up @@ -213,6 +216,18 @@ MixxxMainWindow::MixxxMainWindow(QApplication* pApp, const CmdlineArgs& args)
initializeKeyboard();
installEventFilter(m_pKeyboard);

#ifdef __LINUX__
// If true this will recreate and reconnect the mainmenu bar when toggling
// fullscreen in order to fix
// "No menu bar with ubuntu unity in full screen mode"
// https://github.com/mixxxdj/mixxx/issues/6072 (bugs #885890 and #1076789).
// Before touching anything here, please read those bugs.
// 'unity' seems to be the only affectde desktop environment
// Alternative global menus work without this currently, e.g. vala-panel-appmenu
m_recreateMenubarOnFullscreenToggle =
QString::fromLocal8Bit(qgetenv("XDG_SESSION_DESKTOP")) == "unity";
#endif

// Menubar depends on translations.
mixxx::Translations::initializeTranslations(
m_pSettingsManager->settings(), pApp, args.getLocale());
Expand Down Expand Up @@ -1426,23 +1441,25 @@ void MixxxMainWindow::slotViewFullScreen(bool toggle) {
if (isFullScreen() == toggle) {
return;
}
qInfo() << " ~" << m_recreateMenubarOnFullscreenToggle;

if (toggle) {
showFullScreen();
#ifdef __LINUX__
// Fix for "No menu bar with ubuntu unity in full screen mode" Bug
// #885890 and Bug #1076789. Before touching anything here, please read
// those bugs.
createMenuBar();
connectMenuBar();
if (m_pMenuBar->isNativeMenuBar()) {
m_pMenuBar->setNativeMenuBar(false);
if (m_recreateMenubarOnFullscreenToggle) {
createMenuBar();
connectMenuBar();
if (m_pMenuBar->isNativeMenuBar()) {
m_pMenuBar->setNativeMenuBar(false);
}
}
#endif
} else {
#ifdef __LINUX__
createMenuBar();
connectMenuBar();
if (m_recreateMenubarOnFullscreenToggle) {
createMenuBar();
connectMenuBar();
}
#endif
showNormal();
}
Expand Down
4 changes: 4 additions & 0 deletions src/mixxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ class MixxxMainWindow : public QMainWindow {

const CmdlineArgs& m_cmdLineArgs;

#ifdef __LINUX__
bool m_recreateMenubarOnFullscreenToggle;
#endif

ControlPushButton* m_pTouchShift;
mixxx::ScreenSaverPreference m_inhibitScreensaver;

Expand Down

0 comments on commit 7e58af7

Please sign in to comment.