Implement right mouse click on OS X when pressing control + click. This

restores the previous mouse behaviour as found in LWJGL 2.8.5 and below.
This commit is contained in:
kappaOne 2013-10-28 23:51:44 +00:00
parent 46cbd89430
commit 43a6a8bfbb
1 changed files with 19 additions and 1 deletions

View File

@ -57,6 +57,9 @@ static NSAutoreleasePool *pool;
static MacOSXPeerInfo *peer_info;
static bool leftMouseDown = false;
static bool rightMouseDown = false;
@implementation MacOSXKeyableWindow
+ (void) createWindow {
@ -348,6 +351,13 @@ static MacOSXPeerInfo *peer_info;
}
- (void)mouseDown:(NSEvent *)event {
if ([event modifierFlags] & NSControlKeyMask) {
rightMouseDown = true;
[self rightMouseDown:event];
return;
}
leftMouseDown = true;
[self mouseButtonState:event :0 :1];
}
@ -360,7 +370,15 @@ static MacOSXPeerInfo *peer_info;
}
- (void)mouseUp:(NSEvent *)event {
[self mouseButtonState:event :0 :0];
if (rightMouseDown) {
rightMouseDown = false;
[self rightMouseUp:event];
}
if (leftMouseDown) {
leftMouseDown = false;
[self mouseButtonState:event :0 :0];
}
}
- (void)rightMouseUp:(NSEvent *)event {