Improve toggle fullscreen
This commit is contained in:
@@ -66,12 +66,14 @@ class NativeApplication {
|
||||
|
||||
private var frameRate:Float;
|
||||
private var parent:Application;
|
||||
private var toggleFullscreen:Bool;
|
||||
|
||||
|
||||
public function new (parent:Application):Void {
|
||||
|
||||
this.parent = parent;
|
||||
frameRate = 60;
|
||||
toggleFullscreen = true;
|
||||
|
||||
#if (lime_console && final)
|
||||
// suppress traces in final builds
|
||||
@@ -302,17 +304,53 @@ class NativeApplication {
|
||||
|
||||
#if (windows || linux)
|
||||
|
||||
if (keyCode == RETURN && (modifier == KeyModifier.LEFT_ALT || modifier == KeyModifier.RIGHT_ALT) && type == KEY_DOWN && !window.onKeyDown.canceled) {
|
||||
if (keyCode == RETURN) {
|
||||
|
||||
window.fullscreen = !window.fullscreen;
|
||||
if (type == KEY_DOWN) {
|
||||
|
||||
if (toggleFullscreen && modifier.altKey && (!modifier.ctrlKey && !modifier.shiftKey && !modifier.metaKey)) {
|
||||
|
||||
toggleFullscreen = false;
|
||||
|
||||
if (!window.onKeyDown.canceled) {
|
||||
|
||||
window.fullscreen = !window.fullscreen;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
toggleFullscreen = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#elseif mac
|
||||
|
||||
if (keyCode == F && modifier.ctrlKey && modifier.metaKey && type == KEY_DOWN && !modifier.altKey && !modifier.shiftKey && !window.onKeyDown.canceled) {
|
||||
if (keyCode == F) {
|
||||
|
||||
window.fullscreen = !window.fullscreen;
|
||||
if (type == KEY_DOWN) {
|
||||
|
||||
if (toggleFullscreen && (modifier.ctrlKey && modifier.metaKey) && (!modifier.altKey && !modifier.shiftKey)) {
|
||||
|
||||
toggleFullscreen = false;
|
||||
|
||||
if (!window.onKeyDown.canceled) {
|
||||
|
||||
window.fullscreen = !window.fullscreen;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
toggleFullscreen = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace lime {
|
||||
static void Dispatch (KeyEvent* event);
|
||||
|
||||
double keyCode;
|
||||
int modifier;
|
||||
uint16_t modifier;
|
||||
KeyEventType type;
|
||||
uint32_t windowID;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user