From 0c65b7f58445862fd068b090a0526bc802759b2b Mon Sep 17 00:00:00 2001 From: ronso0 Date: Wed, 3 May 2023 10:55:50 +0200 Subject: [PATCH] WIP/FIX Debug fullscreen & menubar toggle --- src/mixxxmainwindow.cpp | 4 ++++ src/widget/wmainmenubar.cpp | 17 +++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/mixxxmainwindow.cpp b/src/mixxxmainwindow.cpp index 15017af9cc2c..3fd989e3e8ad 100644 --- a/src/mixxxmainwindow.cpp +++ b/src/mixxxmainwindow.cpp @@ -1264,6 +1264,7 @@ bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) { } } else if (event->type() == QEvent::WindowStateChange) { #ifndef __APPLE__ + qWarning() << "$ WindowStateChange:" << windowState(); if (windowState() == m_prevState) { // Ignore no-op. This happens if another window is raised above // MixxxMianWindow, e.g. DlgPeferences. In such a case event->oldState() @@ -1281,6 +1282,8 @@ bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) { const bool isFullScreenNow = windowState() & Qt::WindowFullScreen; if ((isFullScreenNow && !wasFullScreen) || (!isFullScreenNow && wasFullScreen)) { + qWarning() << "$ fullscreen changed, now" + << (isFullScreenNow ? "fullscreen" : "window"); #ifdef __LINUX__ // Fix for "No menu bar with ubuntu unity in full screen mode" (issues // #885890 and #1076789). Before touching anything here, please read @@ -1288,6 +1291,7 @@ bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) { // Set this attribute instead of calling setNativeMenuBar(false), see // https://github.com/mixxxdj/mixxx/issues/11320 if (m_supportsGlobalMenuBar) { + qWarning() << "$ global menu > rebuild"; QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, isFullScreenNow); createMenuBar(); connectMenuBar(); diff --git a/src/widget/wmainmenubar.cpp b/src/widget/wmainmenubar.cpp index 61cbed78ff82..1772b0ab7f18 100644 --- a/src/widget/wmainmenubar.cpp +++ b/src/widget/wmainmenubar.cpp @@ -748,7 +748,9 @@ void WMainMenuBar::connectMenuToSlotShowMenuBar(const QMenu* pMenu) { } void WMainMenuBar::slotToggleMenuBar() { + qWarning() << " # toggle menubar"; if (isNativeMenuBar()) { + qWarning() << " # (ignore)"; return; } @@ -760,6 +762,7 @@ void WMainMenuBar::slotToggleMenuBar() { } void WMainMenuBar::showMenuBar() { + qWarning() << " # show menubar"; if (isNativeMenuBar()) { return; } @@ -768,20 +771,22 @@ void WMainMenuBar::showMenuBar() { // Left/Right keys, i.e. we're stuck with the triggered menu. // Current active action can be none, user-requested (hotkey) or auto-selected // (first, behaviour differs per platform and/or Qt version). - // Workaround: reselect the active action manually after unhiding + // Workaround: reselect the active action after unhiding QAction* pAct = activeAction(); setMinimumHeight(sizeHint().height()); - // If there was a menu selected before, reselect that. if (pAct) { - // Note: pAct can be be nullptr (no-op). Though, it is is, no menu is + // Note: pAct can be be nullptr (no-op). Though, if it is, no menu is // selected BUT hovering any of them will instantly open that (no click required). - setActiveAction(pAct); // nullptr is no-op + setActiveAction(pAct); } - // TODO Alternativley, activate the first menu? - // setActiveAction(pAct ? pAct : actions().first()); + // TODO Alternativley, always activate the first menu? + // else { + // setActiveAction(pAct ? pAct : actions().first()); + // } } void WMainMenuBar::hideMenuBar() { + qWarning() << " # hide menubar"; if (isNativeMenuBar()) { return; }