mirror of https://github.com/encounter/SDL.git
Mac: Translate Ctrl-Left click to right click.
This commit is contained in:
parent
e231d5b450
commit
67c02a282a
|
@ -30,6 +30,7 @@ typedef struct SDL_WindowData SDL_WindowData;
|
||||||
@interface Cocoa_WindowListener : NSResponder <NSWindowDelegate> {
|
@interface Cocoa_WindowListener : NSResponder <NSWindowDelegate> {
|
||||||
SDL_WindowData *_data;
|
SDL_WindowData *_data;
|
||||||
BOOL observingVisible;
|
BOOL observingVisible;
|
||||||
|
BOOL wasCtrlLeft;
|
||||||
BOOL wasVisible;
|
BOOL wasVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ static void ScheduleContextUpdates(SDL_WindowData *data)
|
||||||
|
|
||||||
_data = data;
|
_data = data;
|
||||||
observingVisible = YES;
|
observingVisible = YES;
|
||||||
|
wasCtrlLeft = NO;
|
||||||
wasVisible = [window isVisible];
|
wasVisible = [window isVisible];
|
||||||
|
|
||||||
center = [NSNotificationCenter defaultCenter];
|
center = [NSNotificationCenter defaultCenter];
|
||||||
|
@ -333,7 +334,13 @@ static void ScheduleContextUpdates(SDL_WindowData *data)
|
||||||
|
|
||||||
switch ([theEvent buttonNumber]) {
|
switch ([theEvent buttonNumber]) {
|
||||||
case 0:
|
case 0:
|
||||||
button = SDL_BUTTON_LEFT;
|
if ([theEvent modifierFlags] & NSControlKeyMask) {
|
||||||
|
wasCtrlLeft = YES;
|
||||||
|
button = SDL_BUTTON_RIGHT;
|
||||||
|
} else {
|
||||||
|
wasCtrlLeft = NO;
|
||||||
|
button = SDL_BUTTON_LEFT;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
button = SDL_BUTTON_RIGHT;
|
button = SDL_BUTTON_RIGHT;
|
||||||
|
@ -364,7 +371,12 @@ static void ScheduleContextUpdates(SDL_WindowData *data)
|
||||||
|
|
||||||
switch ([theEvent buttonNumber]) {
|
switch ([theEvent buttonNumber]) {
|
||||||
case 0:
|
case 0:
|
||||||
button = SDL_BUTTON_LEFT;
|
if (wasCtrlLeft) {
|
||||||
|
button = SDL_BUTTON_RIGHT;
|
||||||
|
wasCtrlLeft = NO;
|
||||||
|
} else {
|
||||||
|
button = SDL_BUTTON_LEFT;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
button = SDL_BUTTON_RIGHT;
|
button = SDL_BUTTON_RIGHT;
|
||||||
|
|
Loading…
Reference in New Issue