src/video/cocoa/SDL_cocoawindow.m
changeset 7915 86ad156a82ab
parent 7873 e88af17231bd
child 7946 57c34a54b7c2
equal deleted inserted replaced
7914:a391318fa60f 7915:86ad156a82ab
    22 
    22 
    23 #if SDL_VIDEO_DRIVER_COCOA
    23 #if SDL_VIDEO_DRIVER_COCOA
    24 
    24 
    25 #include "SDL_syswm.h"
    25 #include "SDL_syswm.h"
    26 #include "SDL_timer.h"  /* For SDL_GetTicks() */
    26 #include "SDL_timer.h"  /* For SDL_GetTicks() */
       
    27 #include "SDL_hints.h"
    27 #include "../SDL_sysvideo.h"
    28 #include "../SDL_sysvideo.h"
    28 #include "../../events/SDL_keyboard_c.h"
    29 #include "../../events/SDL_keyboard_c.h"
    29 #include "../../events/SDL_mouse_c.h"
    30 #include "../../events/SDL_mouse_c.h"
    30 #include "../../events/SDL_touch_c.h"
    31 #include "../../events/SDL_touch_c.h"
    31 #include "../../events/SDL_windowevents_c.h"
    32 #include "../../events/SDL_windowevents_c.h"
    55     @synchronized (contexts) {
    56     @synchronized (contexts) {
    56         for (SDLOpenGLContext *context in contexts) {
    57         for (SDLOpenGLContext *context in contexts) {
    57             [context scheduleUpdate];
    58             [context scheduleUpdate];
    58         }
    59         }
    59     }
    60     }
       
    61 }
       
    62 
       
    63 static int GetHintCtrlClickEmulateRightClick()
       
    64 {
       
    65 	const char *hint = SDL_GetHint( SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK );
       
    66 	return hint != NULL && *hint != '0';
    60 }
    67 }
    61 
    68 
    62 @implementation Cocoa_WindowListener
    69 @implementation Cocoa_WindowListener
    63 
    70 
    64 - (void)listen:(SDL_WindowData *)data
    71 - (void)listen:(SDL_WindowData *)data
   339 {
   346 {
   340     int button;
   347     int button;
   341 
   348 
   342     switch ([theEvent buttonNumber]) {
   349     switch ([theEvent buttonNumber]) {
   343     case 0:
   350     case 0:
   344         if ([theEvent modifierFlags] & NSControlKeyMask) {
   351         if (([theEvent modifierFlags] & NSControlKeyMask) &&
       
   352 		    GetHintCtrlClickEmulateRightClick()) {
   345             wasCtrlLeft = YES;
   353             wasCtrlLeft = YES;
   346             button = SDL_BUTTON_RIGHT;
   354             button = SDL_BUTTON_RIGHT;
   347         } else {
   355         } else {
   348             wasCtrlLeft = NO;
   356             wasCtrlLeft = NO;
   349             button = SDL_BUTTON_LEFT;
   357             button = SDL_BUTTON_LEFT;