Changeset 965 in vbox
- Timestamp:
- Feb 18, 2007 12:49:09 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 18735
- Location:
- trunk/src/VBox/Frontends
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/Frontends/VBoxBFE/SDLConsole.cpp ¶
r963 r965 25 25 *******************************************************************************/ 26 26 #define LOG_GROUP LOG_GROUP_GUI 27 #ifdef __DARWIN__ 28 # include <Carbon/Carbon.h> 29 # define OSType VBoxOSType 30 # undef PAGE_SIZE 31 # undef PAGE_SHIFT 32 #endif 27 33 28 34 #ifdef VBOXBFE_WITHOUT_COM … … 1027 1033 } 1028 1034 1035 #ifdef __DARWIN__ 1036 1037 __BEGIN_DECLS 1038 /* Private interface in 10.3 and later. */ 1039 typedef int CGSConnection; 1040 typedef enum 1041 { 1042 kCGSGlobalHotKeyEnable = 0, 1043 kCGSGlobalHotKeyDisable, 1044 kCGSGlobalHotKeyInvalid = -1 /* bird */ 1045 } CGSGlobalHotKeyOperatingMode; 1046 extern CGSConnection _CGSDefaultConnection(void); 1047 extern CGError CGSGetGlobalHotKeyOperatingMode(CGSConnection Connection, CGSGlobalHotKeyOperatingMode *enmMode); 1048 extern CGError CGSSetGlobalHotKeyOperatingMode(CGSConnection Connection, CGSGlobalHotKeyOperatingMode enmMode); 1049 __END_DECLS 1050 1051 /** Keeping track of whether we disabled the hotkeys or not. */ 1052 static bool g_fHotKeysDisabled = false; 1053 /** Whether we've connected or not. */ 1054 static bool g_fConnectedToCGS = false; 1055 /** Cached connection. */ 1056 static CGSConnection g_CGSConnection; 1057 1058 /** 1059 * Disables or enabled global hot keys. 1060 */ 1061 static void DisableGlobalHotKeys(bool fDisable) 1062 { 1063 if (!g_fConnectedToCGS) 1064 { 1065 g_CGSConnection = _CGSDefaultConnection(); 1066 g_fConnectedToCGS = true; 1067 } 1068 1069 /* get current mode. */ 1070 CGSGlobalHotKeyOperatingMode enmMode = kCGSGlobalHotKeyInvalid; 1071 CGSGetGlobalHotKeyOperatingMode(g_CGSConnection, &enmMode); 1072 1073 /* calc new mode. */ 1074 if (fDisable) 1075 { 1076 if (enmMode != kCGSGlobalHotKeyEnable) 1077 return; 1078 enmMode = kCGSGlobalHotKeyDisable; 1079 } 1080 else 1081 { 1082 if ( enmMode != kCGSGlobalHotKeyDisable 1083 /*|| !g_fHotKeysDisabled*/) 1084 return; 1085 enmMode = kCGSGlobalHotKeyEnable; 1086 } 1087 1088 /* try set it and check the actual result. */ 1089 CGSSetGlobalHotKeyOperatingMode(g_CGSConnection, enmMode); 1090 CGSGlobalHotKeyOperatingMode enmNewMode = kCGSGlobalHotKeyInvalid; 1091 CGSGetGlobalHotKeyOperatingMode(g_CGSConnection, &enmNewMode); 1092 if (enmNewMode == enmMode) 1093 g_fHotKeysDisabled = enmMode == kCGSGlobalHotKeyDisable; 1094 } 1095 #endif /* __DARWIN__ */ 1096 1029 1097 /** 1030 1098 * Start grabbing the mouse. … … 1032 1100 void SDLConsole::inputGrabStart() 1033 1101 { 1102 #ifdef __DARWIN__ 1103 DisableGlobalHotKeys(true); 1104 #endif 1034 1105 if (!gMouse->getNeedsHostCursor()) 1035 1106 SDL_ShowCursor(SDL_DISABLE); … … 1049 1120 if (!gMouse->getNeedsHostCursor()) 1050 1121 SDL_ShowCursor(SDL_ENABLE); 1122 #ifdef __DARWIN__ 1123 DisableGlobalHotKeys(false); 1124 #endif 1051 1125 fInputGrab = 0; 1052 1126 updateTitlebar(); -
TabularUnified trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp ¶
r964 r965 3236 3236 } 3237 3237 3238 #ifdef __DARWIN__ 3239 #include <Carbon/Carbon.h> 3240 __BEGIN_DECLS 3241 /* Private interface in 10.3 and later. */ 3242 typedef int CGSConnection; 3243 typedef enum 3244 { 3245 kCGSGlobalHotKeyEnable = 0, 3246 kCGSGlobalHotKeyDisable, 3247 kCGSGlobalHotKeyInvalid = -1 /* bird */ 3248 } CGSGlobalHotKeyOperatingMode; 3249 extern CGSConnection _CGSDefaultConnection(void); 3250 extern CGError CGSGetGlobalHotKeyOperatingMode(CGSConnection Connection, CGSGlobalHotKeyOperatingMode *enmMode); 3251 extern CGError CGSSetGlobalHotKeyOperatingMode(CGSConnection Connection, CGSGlobalHotKeyOperatingMode enmMode); 3252 __END_DECLS 3253 3254 /** Keeping track of whether we disabled the hotkeys or not. */ 3255 static bool g_fHotKeysDisabled = false; 3256 /** Whether we've connected or not. */ 3257 static bool g_fConnectedToCGS = false; 3258 /** Cached connection. */ 3259 static CGSConnection g_CGSConnection; 3260 3261 /** 3262 * Disables or enabled global hot keys. 3263 */ 3264 static void DisableGlobalHotKeys(bool fDisable) 3265 { 3266 if (!g_fConnectedToCGS) 3267 { 3268 g_CGSConnection = _CGSDefaultConnection(); 3269 g_fConnectedToCGS = true; 3270 } 3271 3272 /* get current mode. */ 3273 CGSGlobalHotKeyOperatingMode enmMode = kCGSGlobalHotKeyInvalid; 3274 CGSGetGlobalHotKeyOperatingMode(g_CGSConnection, &enmMode); 3275 3276 /* calc new mode. */ 3277 if (fDisable) 3278 { 3279 if (enmMode != kCGSGlobalHotKeyEnable) 3280 return; 3281 enmMode = kCGSGlobalHotKeyDisable; 3282 } 3283 else 3284 { 3285 if ( enmMode != kCGSGlobalHotKeyDisable 3286 /*|| !g_fHotKeysDisabled*/) 3287 return; 3288 enmMode = kCGSGlobalHotKeyEnable; 3289 } 3290 3291 /* try set it and check the actual result. */ 3292 CGSSetGlobalHotKeyOperatingMode(g_CGSConnection, enmMode); 3293 CGSGlobalHotKeyOperatingMode enmNewMode = kCGSGlobalHotKeyInvalid; 3294 CGSGetGlobalHotKeyOperatingMode(g_CGSConnection, &enmNewMode); 3295 if (enmNewMode == enmMode) 3296 g_fHotKeysDisabled = enmMode == kCGSGlobalHotKeyDisable; 3297 } 3298 #endif /* __DARWIN__ */ 3299 3238 3300 /** 3239 3301 * Start grabbing the mouse. … … 3241 3303 static void InputGrabStart(void) 3242 3304 { 3305 #ifdef __DARWIN__ 3306 DisableGlobalHotKeys(true); 3307 #endif 3243 3308 if (!gfGuestNeedsHostCursor) 3244 3309 SDL_ShowCursor(SDL_DISABLE); … … 3258 3323 if (!gfGuestNeedsHostCursor) 3259 3324 SDL_ShowCursor(SDL_ENABLE); 3325 #ifdef __DARWIN__ 3326 DisableGlobalHotKeys(false); 3327 #endif 3260 3328 gfGrabbed = FALSE; 3261 3329 UpdateTitlebar(TITLEBAR_NORMAL);
Note:
See TracChangeset
for help on using the changeset viewer.