Fullscreen & presentation view issues on macOS

Bug #1912419 reported by Vit
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qpdfview
New
Undecided
Unassigned

Bug Description

Firstly, let me explain how macOS works in terms of full screen and window maximisation.

On macOS full screen mode is essentially creating a second virtual desktop and assigning the window to it. The window bar, i.e. a bar with the close button, and the menu bar, i.e. a unified bar with app menu and notification icons, are hidden by default. However, you can unhide them by moving the mouse to the top of the screen.

On the other side, maximised mode is simply making the window cover the whole screen except the system controls (e.g. the menu bar). You can enter both by clicking on the maximise icon on the window bar: simple clicking gives you full screen and OPT-clicking gives you maximised window.

There is an additional variant of full screen mode that allows you to enter full screen mode but have multiple apps assigned to the virtual desktop (i.e. split view). This one you can achieve by clicking and holding the maximise button. For the app itself (code-wise) it hardly differs from the normal full screen and is thus not addressed anyhow specifically.

With this in mind, let me try to cover the issues we have with full screen and presentation view in qpdfview in macOS:

1. There are several ways to enter full screen mode and they are not covered by Qt. For instance, the maximise button is not routed through `on_fullscreen_triggered`. This results in completely desynchronised full screen state if you use both qpdfview "Full screen" menu entry and the maximise button.

2. macOS adds a system "Enter Full Screen" menu entry, which we cannot easily customise ourselves (e.g. assign a hotkey) even with Objective-C.

3. On macOS one is not allowed to modify geometry close to `showNormal()`, as it causes heavy glitches to the animation. However, simply dropping the `restoreGeometry()` calls is not enough: Qt drops maximised window attribute, which results leaving full screen via `showNormal()` function reduce the window to the minimal size. Fortunately it works just fine in all the other cases.

4. On macOS presentation view becomes a variant of full screen. This makes both app menu and window bar accessible to it. I.e. a natural way of leaving the presentation view for the user is moving the mouse to the top of the screen and clicking on the maximise button or the presentation menu entry.

I created the first version of the patch to resolve these issues[1]. Not sure how many iterations will be needed to merge this upstream, but here are some details on what I did on each:

1. This is handled by moving most of the custom full screen code to the event model (`changeEvent()`), which is notified by both macOS system triggers and qpdfview buttons/menu entries. The action state for the checkbox is kept in sync based on the events as well.

2. I did not address it anyhow, but both entries work fine for me now. In the future we could incorporate Objective-C code to disable the system entry[2].

3. A small workaround is provided to handle the maximised window by preserving the attribute at entering full screen and setting it when leaving. For macOS window state is manipulated directly instead of using the wrappers. Perhaps the same can be done for other operating systems.

4. Presentation view became a stateful checkbox, similar to full screen mode. One can now properly leave it by clicking the menu entry or the maximise button. As a bonus one can also enter full screen mode directly from the presentation view. The opposite is not possible, since leaving "normal" full screen mode requires an animation, and due to some bug in Qt qpdfview simply shows black screen.

Hope it helps!

P.S. I noticed that editing the tab bar through settings is really difficult, therefore I applied a patch from Ubuntu[3] to change the defaults instead. Maybe it can be included out of the box?

[1] https://github.com/vit9696/qpdfview/blob/master/patches/fullscreen.diff
[2] https://forum.qt.io/topic/60623/qt-5-4-2-os-x-10-11-el-capitan-how-to-remove-the-enter-full-screen-menu-item
[3] https://github.com/vit9696/qpdfview/blob/master/patches/toolbars.diff

Revision history for this message
Vit (vit9696) wrote :

Hello,

I have been using this for some time now, and it worked quite reliably. I rebased it for r2126 and do not see any (new) issues for the time being[1]. Can this be included in 0.5 release?

Additionally I discovered a navigation issue in the presentation view. The arrow keys on macOS get a numpad modifier, and are thus undetected. I created a patch to filter them out[2].

Thanks!

[1] https://github.com/vit9696/qpdfview/blob/master/patches/fullscreen.diff
[2] https://github.com/vit9696/qpdfview/blob/master/patches/navigation.diff

Revision history for this message
Vit (vit9696) wrote :

Ping. Can we get this merged?

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello,

As discussed earlier, I would very much prefer using Launchpad's code review facilities to make this easier to discuss. The main issue I see here is that I do not follow how

> On macOS presentation view becomes a variant of full screen.

is implied by the other observations made above. More concretely, I would prefer to not entangle those two concepts, especially as macOS is relatively niche platform from qpdfview's point of view.

There are various small nits on the code level but as written initially that would be easier to review using Launchpad's merge requests. It would certainly benefit from splitting out the bug fixes from the behaviour changes. I would also suggest trying to avoid the duplicate book keeping between main window and document view, e.g. by returning the newly created presentation view widget from the DocumentView::startPresentation method instead of holding on to it internally.

Regards,
Adam

Revision history for this message
Vit (vit9696) wrote :

Hi Adam,

Regarding

> On macOS presentation view becomes a variant of full screen

Neither you can disable access to menu bar on macOS, nor you can disable access to other apps, like quickly jumping to a primary virtual desktop. So technically presentation view is not different from virtual desktop.

I can try to find resources to submit patch through bzr.

Vit

Revision history for this message
Adam Reichold (adamreichold) wrote :

Launchpad has decent documentation available at for example: https://help.launchpad.net/Code/Review

Revision history for this message
Vit (vit9696) wrote :

Hi Adam,

I rebased and created a merge request for these changes[1].

Thank you for your time and the link.

Vit

[1] https://code.launchpad.net/~vit9696/qpdfview/qpdfview/+merge/407803

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.