summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-10-01 03:39:28 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-10-01 03:39:28 +0000
commit40cfc19fed318a97ed030ad2729a6fbae992c8ef (patch)
treea05920933b86faf2f430ed0dd97308d190741257
parentUpdated core (fixed issue in Vk backend) (diff)
downloadDiligentEngine-40cfc19fed318a97ed030ad2729a6fbae992c8ef.tar.gz
DiligentEngine-40cfc19fed318a97ed030ad2729a6fbae992c8ef.zip
MacOS app: using Command+f or Command+Enter to toggle fullscreen mode instead of just 'f'
-rw-r--r--Common/NativeApp/Apple/Source/Classes/OSX/WindowController.m38
1 files changed, 29 insertions, 9 deletions
diff --git a/Common/NativeApp/Apple/Source/Classes/OSX/WindowController.m b/Common/NativeApp/Apple/Source/Classes/OSX/WindowController.m
index b908c1b..e3f7923 100644
--- a/Common/NativeApp/Apple/Source/Classes/OSX/WindowController.m
+++ b/Common/NativeApp/Apple/Source/Classes/OSX/WindowController.m
@@ -21,6 +21,9 @@
@end
@implementation WindowController
+{
+ bool CommandKeyPressed;
+}
- (instancetype)initWithWindow:(NSWindow *)window
{
@@ -32,6 +35,8 @@
_fullscreenWindow = nil;
}
+ CommandKeyPressed = false;
+
return self;
}
@@ -141,16 +146,21 @@
[self goWindow];
}
return;
- // Have f key toggle fullscreen
+
+ // Have Command+f or Command+Enter toggle fullscreen
+ case 13:
case 'f':
- if([self fullscreenWindow] == nil)
- {
- [self goFullscreen];
- }
- else
- {
- [self goWindow];
- }
+ if (CommandKeyPressed)
+ {
+ if([self fullscreenWindow] == nil)
+ {
+ [self goFullscreen];
+ }
+ else
+ {
+ [self goWindow];
+ }
+ }
return;
}
@@ -158,4 +168,14 @@
//[super keyDown:event];
}
+// Informs the receiver that the user has pressed or released a
+// modifier key (Shift, Control, and so on)
+- (void)flagsChanged:(NSEvent *)event
+{
+ auto modifierFlags = [event modifierFlags];
+ CommandKeyPressed = modifierFlags & NSEventModifierFlagCommand;
+
+ [super flagsChanged:event];
+}
+
@end