Skip to content
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

Fullscreen toggle rework #11313

Closed
wants to merge 14 commits into from
Closed

Fullscreen toggle rework #11313

wants to merge 14 commits into from

Conversation

ronso0
Copy link
Member

@ronso0 ronso0 commented Feb 27, 2023

This PR makes MixxxMainWindow::slotViewFullScreen() just toggle fullscreen.
MixxxMainWindow::eventFilter() catches ALL fullscreen changes (QWindowStateChangeEvent), no matter the origin, and also emits a signal to recreate & connect the menu bar (only on Linux desktops that use a global menu) and hide it when going fullscreen (Linux & Windows).

This works perfectly fine for me, and I'm curious how it performs on Windows and macOS. Please test!

Motivation

While working on #11304 I noticed that my window manager (xfwm4 on Ubuntu Studio) consumes the fullscreen hotkey F11 and MixxxMainWindow::slotViewFullScreen() never gets called, except when I click the menu checkbox.
This happens because the fullscreen hotkey in Mixxx and in my window manager are identical.
(so most of my fullscreen testing was kinda worthless... : \ )

TODO

  • ensure smooth startup (fullscreen or not), i.e. no flickering, static launch screen

Testing

  • clicking View > Fullscreen as well as all hotkeys printed next to it should toggle fullscreen without any unusual flickering
  • Linux/Windows: menu bar should hide when going fullscreen
  • Mixxx should start in fullscreen when using the fullscreen command line arguments --f or --full-screen, regardless the preferences option "Start in fullscreen"
  • fullscreen main window should not flicker if any dialog is openened (About, key wheel window, preferences, ...)

This is based on #11304, so you'll also see full keypress/release logging.

Since this is actually a bugfix/workaround I can imagine to rebase onto 2.3 but I need CI builds to test in a Ubuntu 22.04 VM.

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just tested this a bit, with some results:

  • "Enter" is still not equal pressing Ok
  • The Menu bar disappears when going to fullscreen, which is OK, but it does not com back on window mode, which was my expectation. Maybe we should store the menu bar visible state for both independently. Default: Windowed = menu bar visible; Full-screen = menu bar hidden.

QKeySequence k;

if (e->key() >= 0x01000020 && e->key() <= 0x01000023) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (e->key() >= 0x01000020 && e->key() <= 0x01000023) {
if (e->key() >= Qt::Key_Shift && e->key() <= Qt::Key_Alt) {

And how about Qt::Key_AltGr?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adopted in #11526


pLabelLayout->addStretch();

m_pOkayBtn = new QPushButton(tr("&Okay"), this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
m_pOkayBtn = new QPushButton(tr("&Okay"), this);
m_pOkayBtn = new QPushButton(tr("&Ok"), this);

@ronso0
Copy link
Member Author

ronso0 commented Apr 7, 2023

@daschuer Thanks for testing!
However, this branch is about the fullscreen change only, I only based it on https://github.com/ronso0/mixxx/tree/menubar-toggle-with-Alt-key / #11304 to see how it works together. This branch addresses a different issue and needs separate testing, so I don't want to propose both change sets at once.

I'll respond to your comment in #11304

@daschuer
Copy link
Member

daschuer commented Apr 7, 2023

Ah, I was wondering why my pending review comments where lost. There where not lost. just picked the wrong branch.

@ronso0 ronso0 mentioned this pull request May 17, 2023
1 task
Now, slotViewFullScreen() just toggles fullscreen and eventFilter() catches ALL fullscreen
changes, no matter the origin.

Previously, slotViewFullScreen() was also reponsible for recreating and reconnecting the
menu bar and for refreshing the Fullscreen checkbox. This is okay if only Mixxx could
change the fullscreen state.
However, it can happen that the (Linux) window manager consumes the fullscreen hotkey,
makes Mixxx go fullscreen and slotViewFullScreen() is never called.
No-op QWindowStateChangeEvent can occur if another window (preferences, About, ...) is shown above
MixxxMainWindow. The event's oldState() is QWindowNoState even though the window is and was fullscreen.
Ignore these event to not recreate and reconnect the menu bar unnecessarily.
Also, that avoids flickering, at least on desktops that feature a global menu (when going fullscreen
the menu is moved to the main window and hidden immediately = rapid resizing of window content)
@github-actions github-actions bot added the build label May 31, 2023
@ronso0 ronso0 changed the base branch from 2.4 to main May 31, 2023 20:51
@ronso0
Copy link
Member Author

ronso0 commented Jun 1, 2023

Closing in favor of #11566

@ronso0 ronso0 closed this Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crash when pressing menu hotkey (Alt+F) in fullscreen mode on Linux with a global menu
2 participants