Changeset 25211 in vbox
- Timestamp:
- Dec 7, 2009 2:47:25 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r25135 r25211 138 138 ::VBoxCocoaApplication_printEvent ("view: ", pvCocoaEvent); 139 139 #endif 140 141 /* 142 * Not sure but this seems an triggered event if the spotlight searchbar is 143 * displayed. So flag that the host key isn't pressed alone. 144 */ 145 if ( eventClass == 'cgs ' 146 && view->mIsHostkeyPressed 147 && ::GetEventKind (inEvent) == 0x15) 148 view->mIsHostkeyAlone = false; 140 /* Check if this is an application key combo. In that case we will not pass 141 the event to the guest, but let the host process it. */ 142 if (VBoxCocoaApplication_isApplicationCommand(pvCocoaEvent)) 143 return false; 149 144 150 145 /* … … 154 149 { 155 150 if (view->darwinKeyboardEvent (pvCocoaEvent, inEvent)) 156 return true;157 }158 /*159 * Command-H and Command-Q aren't properly disabled yet, and it's still160 * possible to use the left command key to invoke them when the keyboard161 * is captured. We discard the events these if the keyboard is captured162 * as a half measure to prevent unexpected behaviour. However, we don't163 * get any key down/up events, so these combinations are dead to the guest...164 */165 else if (eventClass == kEventClassCommand)166 {167 if (view->mKbdCaptured)168 151 return true; 169 152 } -
trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.h
r20374 r25211 91 91 void VBoxCocoaApplication_setMouseCoalescingEnabled(bool fEnabled); 92 92 const char *VBoxCocoaApplication_eventTypeName(unsigned long eEvtType); 93 bool VBoxCocoaApplication_isApplicationCommand(const void *pvEvent); 93 94 void VBoxCocoaApplication_printEvent(const char *pszPrefix, const void *pvEvent); 94 95 /** @} */ -
trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.m
r23463 r25211 340 340 } 341 341 342 /** 343 * Check for some default application key combinations a Mac user expect, like 344 * CMD+Q or CMD+H. 345 * 346 * @returns true if such a key combo was hit, false otherwise. 347 * @param eEvtType The Cocoa event type. 348 */ 349 bool VBoxCocoaApplication_isApplicationCommand(const void *pvEvent) 350 { 351 NSEvent *pEvent = (NSEvent *)pvEvent; 352 NSEventType eEvtType = [pEvent type]; 353 bool fGlobalHotkey = false; 354 355 switch (eEvtType) 356 { 357 case NSKeyDown: 358 case NSKeyUp: 359 { 360 NSUInteger fEvtMask = [pEvent modifierFlags]; 361 unsigned short KeyCode = [pEvent keyCode]; 362 if ( fEvtMask & (NX_NONCOALSESCEDMASK | NX_COMMANDMASK | NX_DEVICELCMDKEYMASK) // L+CMD 363 || fEvtMask & (NX_NONCOALSESCEDMASK | NX_COMMANDMASK | NX_DEVICERCMDKEYMASK)) // R+CMD 364 { 365 if ( KeyCode == 0x0c // CMD+Q (Quit) 366 || KeyCode == 0x04) // CMD+H (Hide) 367 fGlobalHotkey = true; 368 } 369 else if ( fEvtMask & (NX_NONCOALSESCEDMASK | NX_ALTERNATEMASK | NX_DEVICELALTKEYMASK | NX_COMMANDMASK | NX_DEVICELCMDKEYMASK) // L+ALT+CMD 370 || fEvtMask & (NX_NONCOALSESCEDMASK | NX_ALTERNATEMASK | NX_DEVICERCMDKEYMASK | NX_COMMANDMASK | NX_DEVICERCMDKEYMASK)) // R+ALT+CMD 371 { 372 if (KeyCode == 0x04) // ALT+CMD+H (Hide-Others) 373 fGlobalHotkey = true; 374 } 375 break; 376 } 377 default: break; 378 } 379 return fGlobalHotkey; 380 } 342 381 343 382 /**
Note:
See TracChangeset
for help on using the changeset viewer.