Kiosk mode and window resize limit issue


#1

Issue: When kiosk mode is exited using the green full screen button then the resize limit is no longer enforced.

Affects: JUCE master tip (4b4d216 2/11/15)

Steps:

1. Launch the JuceDemo. Check to see minimum size is enforced by resizing the window to its minimum size (400, 400)

2. Click on the 'Shortcut Keys' section and full screen JuceDemo by pressing Command+F

3. Exit full screen by hovering the mouse to the top of the window and showing the window bar and pressing the green full screen button

4. Resize the window - the resize limit is no longer enforced


#2

Sorry, just saw this old and forgotten post!

Which OS is this? (I can't reproduce it on OSX)

Also worth grabbing the latest version in case we've inadvertently fixed it since you reported it.


#3

Hi,

Thank you for your reply

This is on OSX 10.10.5, and I can reproduce it on the latest tip (26ff85a 4/12/15)

The following is my hypothesis on what is occurring

2. Click on the 'Shortcut Keys' section and full screen JuceDemo by pressing Command+F

 By pressing Command+F we enter Kiosk mode

3. Exit full screen by hovering the mouse to the top of the window and showing the window bar and pressing the green full screen button

We exit full screen mode using the native Mac window bar however there is no callback to exit Kiosk mode

4. Resize the window - the resize limit is no longer enforced

Because JUCE doesn't know we have exited Kiosk mode it does not enforce size constraints upon resizing


#4

Yes, you are right. I just reproduced it with the latest.


#5

I did some digging and have a fix for it. @jules I could do a pull request, but not sure the way I did it would follow your preferred style (and I also changed a pointer in a non thread-safe manner, which might be ok in this situation, but not ideal).
More specifically,

static void windowDidExitFullScreen (id, SEL, NSNotification*)

in juce_mac_NSViewComponentPeer.mm –line 1938 in latest– doesn’t set the Desktop “kioskModeComponent” to nullptr, so when on resize the code checks if isKioskMode() to not constraint the size, it returns true because the desktop thinks it is still in kiosk mode.

Simply calling Desktop::getInstance().setKioskModeComponent(nullptr) doesn’t work because it actually calls into the OS to set full screen, which it basically causes the screen to go back to full screen.

I added a method called: didExitKioskMode() where I simply set kioskModeComponent to nullptr, and call it from windowDidExitFullScreen. That works! Again, a bit simplistic as there might be other state to take care of, but seemed to work just fine.

Cheers!