-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Alt-F Crash fix #11328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Alt-F Crash fix #11328
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -217,6 +217,19 @@ MixxxMainWindow::MixxxMainWindow(QApplication* pApp, const CmdlineArgs& args) | |
| mixxx::Translations::initializeTranslations( | ||
| m_pSettingsManager->settings(), pApp, args.getLocale()); | ||
|
|
||
| #ifdef __LINUX__ | ||
| // If the desktop features a global menubar and we'll go fullscreen during | ||
| // startup, set Qt::AA_DontUseNativeMenuBar so the menubar is placed in the | ||
| // window like it's done in slotViewFullScreen(). On other desktops this | ||
| // attribute has no effect. This is a safe alternative to setNativeMenuBar() | ||
| // which can cause a crash when using menu shortcuts like Alt+F after resetting | ||
| // the menubar. See https://github.com/mixxxdj/mixxx/issues/11320 | ||
| bool fullscreenPref = m_pSettingsManager->settings()->getValue<bool>( | ||
| ConfigKey("[Config]", "StartInFullscreen")); | ||
| QApplication::setAttribute( | ||
| Qt::AA_DontUseNativeMenuBar, | ||
| args.getStartInFullscreen() || fullscreenPref); | ||
| #endif // __LINUX__ | ||
| createMenuBar(); | ||
| m_pMenuBar->hide(); | ||
|
|
||
|
|
@@ -265,13 +278,6 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) { | |
| ConfigKey("[Config]", "StartInFullscreen")); | ||
| if (args.getStartInFullscreen() || fullscreenPref) { | ||
| showFullScreen(); | ||
| #ifdef __LINUX__ | ||
| // If the desktop features a global menubar and we go fullscreen during | ||
| // startup, move the menubar to the window like in slotViewFullScreen() | ||
| if (m_pMenuBar->isNativeMenuBar()) { | ||
| m_pMenuBar->setNativeMenuBar(false); | ||
| } | ||
| #endif | ||
| } | ||
|
|
||
| QString resourcePath = pConfig->getResourcePath(); | ||
|
|
@@ -1435,17 +1441,18 @@ void MixxxMainWindow::slotViewFullScreen(bool toggle) { | |
| 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 | ||
| // Fix for "No menu bar with ubuntu unity in full screen mode" (issues | ||
| // #885890 and #1076789. Before touching anything here, please read | ||
| // those bugs. | ||
| // Set this attribute instead of calling setNativeMenuBar(false), see | ||
| // https://github.com/mixxxdj/mixxx/issues/11320 | ||
| QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my tests I did exactly that (just at the beginning of So I wonder how that makes the difference... |
||
| createMenuBar(); | ||
| connectMenuBar(); | ||
| if (m_pMenuBar->isNativeMenuBar()) { | ||
| m_pMenuBar->setNativeMenuBar(false); | ||
| } | ||
| #endif | ||
| } else { | ||
| #ifdef __LINUX__ | ||
| QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, false); | ||
| createMenuBar(); | ||
| connectMenuBar(); | ||
| #endif | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for future improvements:
it looks like this attribute is the only way to figure whether a platform uses native menus, so let's note the initial state before setting it. That way we could restrict recreating and reconnecting the menu to platforms that actually require/support it.