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

AIR 27 - Alt+Enter toggles fullscreen; behavior not cancelable #24

Open
tconkling opened this issue Sep 27, 2017 · 6 comments
Open

AIR 27 - Alt+Enter toggles fullscreen; behavior not cancelable #24

tconkling opened this issue Sep 27, 2017 · 6 comments

Comments

@tconkling
Copy link

Problem Description

Beginning in AIR 27, holding Alt and pressing Enter (or Numpad-Enter) toggles a Windows app's fullscreen state. Installing a KEY_DOWN event listener and calling Event.preventDefault() doesn't prevent this behavior.

Tracker link: https://tracker.adobe.com/#/view/AIR-4198470

Steps to Reproduce

Build a Windows app with AIR 27. Hold Alt and press the Enter key.

The app will toggle its fullscreen state. This behavior cannot be canceled with Event.preventDefault:

stage.addEventListener(KeyboardEvent.KEY_DOWN, function (e :KeyboardEvent) :void {
   if ((e.keyCode == Keyboard.ENTER && e.altKey) ||
        (e.keyCode == Keyboard.NUMPAD_ENTER && e.altKey)) {
       // this has no effect
       e.preventDefault();
   }
}, true);
@itlancer
Copy link

itlancer commented Mar 1, 2020

Essential feature. Need a way to disable or override such behavior.
Alt+Enter could lead unexpectable behavior and application crashes:
#246
#247
One important notice.
Alt+Enter fullscreen will be "enabled" only with <renderMode>direct</renderMode> or <renderMode>gpu</renderMode> in application manifest.

@ajwfrost
Copy link
Collaborator

Just noticed this issue -> the Alt-Enter behaviour is coming from Direct3D 11, before we receive the key down message from Windows. So to disable this behaviour we have to turn it off completely. For people who might want this behaviour, I would suggest they handle the Alt-Enter keystroke per the above and then set the application into full-screen mode via the AIR APIs.

So .. just checking for anyone who's commented on this thread - would you be okay with us disabling the Alt-Enter behaviour at the DirectX layer? (Well, we'll be putting this change in, unless folk really want it to be handled via a separate mechanism such as in the app descriptor file...)

@itlancer
Copy link

@ajwfrost
"Default" Windows Alt+Enter behavior stopped working correctly for most of AIR applications about AIR version 23-26. So right now such behavior cause just problems. For backward compatibility and "old-school UX" I think AIR developers should handle Alt+Enter key events via AIR (please check that it could be handled) and make fullscreen switching logic manually using Stage:displayState and StageDisplayState.
If it will work - your suggested solution will be great.

@ajwfrost
Copy link
Collaborator

Just checked this, and it seems to work:

			stage.addEventListener(KeyboardEvent.KEY_DOWN, function (e :KeyboardEvent) :void {
				if ((e.keyCode == Keyboard.ENTER && e.altKey) ||
					(e.keyCode == Keyboard.NUMPAD_ENTER && e.altKey)) {
				   // this has no effect
				   e.preventDefault();
				   stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
				}
			}, true);

Note, there is still no impact of 'preventDefault' for a key event.. but hopefully it's no longer needed!

thanks

@itlancer
Copy link

@ajwfrost
Great! Hope to see it at new AIR release.

@itlancer
Copy link

Fixed with AIR 33.1.1.575+.
I think this issue should be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants