Ken Thomases : winemac: Add a category on NSEvent to simplify checking if the Command key ( and only that modifier) is pressed for an event.
Alexandre Julliard
julliard at winehq.org
Mon Apr 24 16:11:24 CDT 2017
Module: wine
Branch: master
Commit: af2690ab0664a9dfbad69fd6905d3a15dc8a499a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=af2690ab0664a9dfbad69fd6905d3a15dc8a499a
Author: Ken Thomases <ken at codeweavers.com>
Date: Mon Apr 24 13:07:09 2017 -0500
winemac: Add a category on NSEvent to simplify checking if the Command key (and only that modifier) is pressed for an event.
Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winemac.drv/cocoa_app.m | 2 +-
dlls/winemac.drv/cocoa_event.h | 6 ++++++
dlls/winemac.drv/cocoa_event.m | 20 ++++++++++++++++++++
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 6d1473a..f13e496 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -1653,7 +1653,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
if ([window isKindOfClass:[WineWindow class]] &&
type == NSLeftMouseDown &&
- (([theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask| NSAlternateKeyMask | NSCommandKeyMask)) != NSCommandKeyMask))
+ ![theEvent wine_commandKeyDown])
{
NSWindowButton windowButton;
diff --git a/dlls/winemac.drv/cocoa_event.h b/dlls/winemac.drv/cocoa_event.h
index 4d814a2..72ff8f9 100644
--- a/dlls/winemac.drv/cocoa_event.h
+++ b/dlls/winemac.drv/cocoa_event.h
@@ -28,6 +28,12 @@ enum {
};
+ at interface NSEvent (WineExtensions)
+ + (BOOL) wine_commandKeyDown;
+ - (BOOL) wine_commandKeyDown;
+ at end
+
+
@class WineWindow;
diff --git a/dlls/winemac.drv/cocoa_event.m b/dlls/winemac.drv/cocoa_event.m
index 08a706f..40066ff 100644
--- a/dlls/winemac.drv/cocoa_event.m
+++ b/dlls/winemac.drv/cocoa_event.m
@@ -40,6 +40,26 @@ static NSString* const WineHotKeyCarbonRefKey = @"hotKeyRef";
static const OSType WineHotKeySignature = 'Wine';
+ at implementation NSEvent (WineExtensions)
+
+ static BOOL wine_commandKeyDown(NSUInteger flags)
+ {
+ return ((flags & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)) == NSCommandKeyMask);
+ }
+
+ + (BOOL) wine_commandKeyDown
+ {
+ return wine_commandKeyDown([self modifierFlags]);
+ }
+
+ - (BOOL) wine_commandKeyDown
+ {
+ return wine_commandKeyDown([self modifierFlags]);
+ }
+
+ at end
+
+
@interface MacDrvEvent : NSObject
{
@public
More information about the wine-cvs
mailing list