Skip to content

Commit

Permalink
Merge pull request #13301 from ronso0/menubar-fullscreen-toggle
Browse files Browse the repository at this point in the history
show 'hide menubar?' dialog on Linux only when the menubar will be in the window
  • Loading branch information
daschuer authored May 30, 2024
2 parents a53437e + 98de30b commit 8022982
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/mixxxmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ void MixxxMainWindow::initializeWindow() {

#ifndef __APPLE__
void MixxxMainWindow::alwaysHideMenuBarDlg() {
// Don't show the dialog if the user unchecked "Ask me again"
if (!m_pCoreServices->getSettings()->getValue<bool>(
kMenuBarHintConfigKey, true)) {
return;
Expand Down Expand Up @@ -956,13 +957,15 @@ void MixxxMainWindow::connectMenuBar() {
#endif
}

/// Enable/disable listening to Alt key press for toggling the menubar.
#ifndef __APPLE__
void MixxxMainWindow::slotUpdateMenuBarAltKeyConnection() {
if (!m_pCoreServices->getKeyboardEventFilter() || !m_pMenuBar) {
return;
}

if (m_pCoreServices->getSettings()->getValue<bool>(kHideMenuBarConfigKey, false)) {
// with Qt::UniqueConnection we don't need to check whether we're already connected
connect(m_pCoreServices->getKeyboardEventFilter().get(),
&KeyboardEventFilter::altPressedWithoutKeys,
m_pMenuBar,
Expand Down Expand Up @@ -1238,7 +1241,7 @@ bool MixxxMainWindow::loadConfiguredSkin() {
return m_pCentralWidget != nullptr;
}

// Try to load default styles that can be overridden by skins
/// Try to load default styles that can be overridden by skins
void MixxxMainWindow::tryParseAndSetDefaultStyleSheet() {
const QString resPath = m_pCoreServices->getSettings()->getResourcePath();
QFile file(resPath + "/skins/default.qss");
Expand All @@ -1251,6 +1254,7 @@ void MixxxMainWindow::tryParseAndSetDefaultStyleSheet() {
}
}

/// Catch ToolTip and WindowStateChange events
bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) {
if (event->type() == QEvent::ToolTip) {
// always show tooltips in the preferences window
Expand Down Expand Up @@ -1307,12 +1311,21 @@ bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) {
QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, isFullScreenNow);
createMenuBar();
connectMenuBar();
// With a global menu we didn't show the menubar auto-hide dialog
// during (windowed) startup, so ask now.
}
#endif

#ifndef __APPLE__
#ifdef __LINUX__
// Only show the dialog if we are able to have the menubar in the
// main window, only then we're able to hide it.
if (!m_supportsGlobalMenuBar || isFullScreenNow)
#endif
{
alwaysHideMenuBarDlg();
slotUpdateMenuBarAltKeyConnection();
}
#endif

// This will toggle the Fullscreen checkbox and hide the menubar if
// we go fullscreen.
// Skip this during startup or the launchimage will be shifted
Expand Down

0 comments on commit 8022982

Please sign in to comment.