- Timestamp:
- May 26, 2010 1:52:52 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 62027
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.h
r28800 r29816 23 23 # import <AppKit/NSApplication.h> 24 24 #endif 25 #include <Carbon/Carbon.h>26 25 27 26 RT_C_DECLS_BEGIN -
trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.m
r28800 r29816 24 24 #import <AppKit/NSWindow.h> 25 25 #import <AppKit/NSEvent.h> 26 27 #include <Carbon/Carbon.h> 26 28 27 29 #include <stdio.h> -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIHotKeyEdit.cpp
r28800 r29816 143 143 #ifdef Q_WS_MAC 144 144 mDarwinKeyModifiers = GetCurrentEventKeyModifiers(); 145 # ifdef QT_MAC_USE_COCOA146 145 ::VBoxCocoaApplication_setCallback (UINT32_MAX, QIHotKeyEdit::darwinEventHandlerProc, this); 147 # else /* !QT_MAC_USE_COCOA */148 EventTypeSpec eventTypes [4];149 eventTypes [0].eventClass = kEventClassKeyboard;150 eventTypes [0].eventKind = kEventRawKeyDown;151 eventTypes [1].eventClass = kEventClassKeyboard;152 eventTypes [1].eventKind = kEventRawKeyUp;153 eventTypes [2].eventClass = kEventClassKeyboard;154 eventTypes [2].eventKind = kEventRawKeyRepeat;155 eventTypes [3].eventClass = kEventClassKeyboard;156 eventTypes [3].eventKind = kEventRawKeyModifiersChanged;157 158 EventHandlerUPP eventHandler = ::NewEventHandlerUPP (QIHotKeyEdit::darwinEventHandlerProc);159 160 mDarwinEventHandlerRef = NULL;161 ::InstallApplicationEventHandler (eventHandler, RT_ELEMENTS (eventTypes), &eventTypes [0],162 this, &mDarwinEventHandlerRef);163 ::DisposeEventHandlerUPP (eventHandler);164 # endif /* !QT_MAC_USE_COCOA */165 146 ::DarwinGrabKeyboard (false /* just modifiers */); 166 147 #endif … … 171 152 #ifdef Q_WS_MAC 172 153 ::DarwinReleaseKeyboard(); 173 # ifdef QT_MAC_USE_COCOA174 154 ::VBoxCocoaApplication_unsetCallback (UINT32_MAX, QIHotKeyEdit::darwinEventHandlerProc, this); 175 # else176 ::RemoveEventHandler (mDarwinEventHandlerRef);177 mDarwinEventHandlerRef = NULL;178 # endif179 155 #endif 180 156 } -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIHotKeyEdit.h
r28800 r29816 21 21 22 22 #include <QLabel> 23 #if defined (Q_WS_X11) 24 #include <QMap> 25 #endif 26 #if defined (Q_WS_MAC) 27 # include <Carbon/Carbon.h> 28 /* Carbon.h includes AssertMacros.h which defines the macro "check". In 29 * QItemDelegate a class method is called check also. As we not used the macro 30 * undefine it here. */ 31 # undef check 23 24 #ifdef Q_WS_X11 25 # include <QMap> 32 26 #endif 33 27 34 #if defined (Q_WS_PM)28 #ifdef Q_WS_PM 35 29 /* Extra virtual keys returned by QIHotKeyEdit::virtualKey() */ 36 # define VK_LSHIFT VK_USERFIRST + 037 # define VK_LCTRL VK_USERFIRST + 138 # define VK_LWIN VK_USERFIRST + 239 # define VK_RWIN VK_USERFIRST + 340 # define VK_WINMENU VK_USERFIRST + 441 # define VK_FORWARD VK_USERFIRST + 542 # define VK_BACKWARD VK_USERFIRST + 630 # define VK_LSHIFT VK_USERFIRST + 0 31 # define VK_LCTRL VK_USERFIRST + 1 32 # define VK_LWIN VK_USERFIRST + 2 33 # define VK_RWIN VK_USERFIRST + 3 34 # define VK_WINMENU VK_USERFIRST + 4 35 # define VK_FORWARD VK_USERFIRST + 5 36 # define VK_BACKWARD VK_USERFIRST + 6 43 37 #endif 44 38 … … 60 54 QSize minimumSizeHint() const; 61 55 62 #if defined (Q_WS_PM)56 #ifdef Q_WS_PM 63 57 static int virtualKey (QMSG *aMsg); 64 58 #endif … … 83 77 bool x11Event (XEvent *event); 84 78 #elif defined (Q_WS_MAC) 85 # ifdef QT_MAC_USE_COCOA86 79 static bool darwinEventHandlerProc (const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser); 87 # else88 static pascal OSStatus darwinEventHandlerProc (EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData);89 # endif90 80 bool darwinKeyboardEvent (const void *pvCocoaEvent, EventRef inEvent); 91 81 #endif … … 109 99 #endif 110 100 111 #if defined (Q_WS_MAC) 112 # ifndef QT_MAC_USE_COCOA 113 /** Event handler reference. NULL if the handler isn't installed. */ 114 EventHandlerRef mDarwinEventHandlerRef; 115 # endif 101 #ifdef Q_WS_MAC 116 102 /** The current modifier key mask. Used to figure out which modifier 117 103 * key was pressed when we get a kEventRawKeyModifiersChanged event. */ 118 UInt32mDarwinKeyModifiers;104 uint32_t mDarwinKeyModifiers; 119 105 #endif 120 106 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.h
r28800 r29816 26 26 #include "UIFrameBuffer.h" 27 27 28 #include < Carbon/Carbon.h>28 #include <ApplicationServices/ApplicationServices.h> 29 29 30 30 /* Local forward declarations */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r29700 r29816 30 30 31 31 #ifdef Q_WS_MAC 32 # include < Carbon/Carbon.h>32 # include <ApplicationServices/ApplicationServices.h> 33 33 #endif /* Q_WS_MAC */ 34 34 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r29773 r29816 82 82 # include "DockIconPreview.h" 83 83 # include "DarwinKeyboard.h" 84 # include " darwin/VBoxCocoaApplication.h"84 # include "VBoxCocoaApplication.h" 85 85 # include <VBox/err.h> 86 # include <Carbon/Carbon.h> 86 87 #endif /* Q_WS_MAC */ 87 88 … … 1102 1103 if (mouseEvent(pWheelEvent->type(), pWheelEvent->pos(), pWheelEvent->globalPos(), 1103 1104 #ifdef QT_MAC_USE_COCOA 1104 1105 1106 1107 1105 /* Qt Cocoa is buggy. It always reports a left button pressed when the 1106 * mouse wheel event occurs. A workaround is to ask the application which 1107 * buttons are pressed currently: */ 1108 QApplication::mouseButtons(), 1108 1109 #else /* QT_MAC_USE_COCOA */ 1109 1110 #endif /* QT_MAC_USE_COCOA */1111 1112 1110 pWheelEvent->buttons(), 1111 #endif /* !QT_MAC_USE_COCOA */ 1112 pWheelEvent->modifiers(), 1113 iDelta, pWheelEvent->orientation())) 1113 1114 return true; 1114 1115 break; … … 2326 2327 2327 2328 /* Register the event callback/hook and grab the keyboard. */ 2328 # ifdef QT_MAC_USE_COCOA2329 2329 ::VBoxCocoaApplication_setCallback (UINT32_MAX, /** @todo fix mask */ 2330 2330 UIMachineView::darwinEventHandlerProc, this); 2331 2331 2332 # else /* QT_MAC_USE_COCOA */2333 EventTypeSpec eventTypes[6];2334 eventTypes[0].eventClass = kEventClassKeyboard;2335 eventTypes[0].eventKind = kEventRawKeyDown;2336 eventTypes[1].eventClass = kEventClassKeyboard;2337 eventTypes[1].eventKind = kEventRawKeyUp;2338 eventTypes[2].eventClass = kEventClassKeyboard;2339 eventTypes[2].eventKind = kEventRawKeyRepeat;2340 eventTypes[3].eventClass = kEventClassKeyboard;2341 eventTypes[3].eventKind = kEventRawKeyModifiersChanged;2342 /* For ignorning Command-H and Command-Q which aren't affected by the2343 * global hotkey stuff (doesn't work well): */2344 eventTypes[4].eventClass = kEventClassCommand;2345 eventTypes[4].eventKind = kEventCommandProcess;2346 eventTypes[5].eventClass = kEventClassCommand;2347 eventTypes[5].eventKind = kEventCommandUpdateStatus;2348 2349 EventHandlerUPP eventHandler = ::NewEventHandlerUPP(UIMachineView::darwinEventHandlerProc);2350 2351 m_darwinEventHandlerRef = NULL;2352 ::InstallApplicationEventHandler(eventHandler, RT_ELEMENTS (eventTypes), &eventTypes[0],2353 this, &m_darwinEventHandlerRef);2354 ::DisposeEventHandlerUPP(eventHandler);2355 # endif /* !QT_MAC_USE_COCOA */2356 2357 2332 ::DarwinGrabKeyboard (false); 2358 2333 } … … 2360 2335 { 2361 2336 ::DarwinReleaseKeyboard(); 2362 # ifdef QT_MAC_USE_COCOA2363 2337 ::VBoxCocoaApplication_unsetCallback(UINT32_MAX, /** @todo fix mask */ 2364 2338 UIMachineView::darwinEventHandlerProc, this); 2365 # else /* QT_MAC_USE_COCOA */ 2366 if (m_darwinEventHandlerRef) 2367 { 2368 ::RemoveEventHandler(m_darwinEventHandlerRef); 2369 m_darwinEventHandlerRef = NULL; 2370 } 2371 # endif /* !QT_MAC_USE_COCOA */ 2372 } 2373 } 2374 2375 # ifdef QT_MAC_USE_COCOA 2339 } 2340 } 2341 2376 2342 bool UIMachineView::darwinEventHandlerProc(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser) 2377 2343 { … … 2394 2360 return false; 2395 2361 } 2396 # else /* QT_MAC_USE_COCOA */2397 2398 pascal OSStatus UIMachineView::darwinEventHandlerProc(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData)2399 {2400 UIMachineView *view = static_cast<UIMachineView *> (inUserData);2401 UInt32 eventClass = ::GetEventClass (inEvent);2402 2403 /* Not sure but this seems an triggered event if the spotlight searchbar is2404 * displayed. So flag that the host key isn't pressed alone. */2405 if (eventClass == 'cgs ' && view->m_bIsHostkeyPressed && ::GetEventKind (inEvent) == 0x15)2406 view->m_bIsHostkeyAlone = false;2407 2408 if (eventClass == kEventClassKeyboard)2409 {2410 if (view->darwinKeyboardEvent (NULL, inEvent))2411 return 0;2412 }2413 2414 /*2415 * Command-H and Command-Q aren't properly disabled yet, and it's still2416 * possible to use the left command key to invoke them when the keyboard2417 * is captured. We discard the events these if the keyboard is captured2418 * as a half measure to prevent unexpected behaviour. However, we don't2419 * get any key down/up events, so these combinations are dead to the guest...2420 */2421 else if (eventClass == kEventClassCommand)2422 {2423 if (view->m_bIsKeyboardCaptured)2424 return 0;2425 }2426 return ::CallNextEventHandler(inHandlerCallRef, inEvent);2427 }2428 # endif /* !QT_MAC_USE_COCOA */2429 2362 2430 2363 #endif -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r29410 r29816 195 195 bool darwinKeyboardEvent(const void *pvCocoaEvent, EventRef inEvent); 196 196 void darwinGrabKeyboardEvents(bool fGrab); 197 # ifdef QT_MAC_USE_COCOA198 197 static bool darwinEventHandlerProc(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser); 199 # else /* QT_MAC_USE_COCOA */200 static pascal OSStatus darwinEventHandlerProc(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData);201 # endif /* !QT_MAC_USE_COCOA */202 198 #endif 203 199 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsHD.h
r29010 r29816 21 21 22 22 /* Global includes */ 23 #include <qglobal.h> /* for Q_WS_MAC */ 24 #ifdef Q_WS_MAC 25 /* Somewhere Carbon.h includes AssertMacros.h which defines the macro "check". 26 * In QItemDelegate a class method is called "check" also. As we not used the 27 * macro undefine it here. */ 28 # undef check 29 #endif /* Q_WS_MAC */ 23 30 #include <QItemDelegate> 24 31 #include <QPointer>
Note:
See TracChangeset
for help on using the changeset viewer.