Index: /trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.h	(revision 29815)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.h	(revision 29816)
@@ -23,5 +23,4 @@
 # import <AppKit/NSApplication.h>
 #endif
-#include <Carbon/Carbon.h>
 
 RT_C_DECLS_BEGIN
Index: /trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.m
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.m	(revision 29815)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.m	(revision 29816)
@@ -24,4 +24,6 @@
 #import <AppKit/NSWindow.h>
 #import <AppKit/NSEvent.h>
+
+#include <Carbon/Carbon.h>
 
 #include <stdio.h>
Index: /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIHotKeyEdit.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIHotKeyEdit.cpp	(revision 29815)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIHotKeyEdit.cpp	(revision 29816)
@@ -143,24 +143,5 @@
 #ifdef Q_WS_MAC
     mDarwinKeyModifiers = GetCurrentEventKeyModifiers();
-# ifdef QT_MAC_USE_COCOA
     ::VBoxCocoaApplication_setCallback (UINT32_MAX, QIHotKeyEdit::darwinEventHandlerProc, this);
-# else  /* !QT_MAC_USE_COCOA */
-    EventTypeSpec eventTypes [4];
-    eventTypes [0].eventClass = kEventClassKeyboard;
-    eventTypes [0].eventKind  = kEventRawKeyDown;
-    eventTypes [1].eventClass = kEventClassKeyboard;
-    eventTypes [1].eventKind  = kEventRawKeyUp;
-    eventTypes [2].eventClass = kEventClassKeyboard;
-    eventTypes [2].eventKind  = kEventRawKeyRepeat;
-    eventTypes [3].eventClass = kEventClassKeyboard;
-    eventTypes [3].eventKind  = kEventRawKeyModifiersChanged;
-
-    EventHandlerUPP eventHandler = ::NewEventHandlerUPP (QIHotKeyEdit::darwinEventHandlerProc);
-
-    mDarwinEventHandlerRef = NULL;
-    ::InstallApplicationEventHandler (eventHandler, RT_ELEMENTS (eventTypes), &eventTypes [0],
-                                      this, &mDarwinEventHandlerRef);
-    ::DisposeEventHandlerUPP (eventHandler);
-# endif /* !QT_MAC_USE_COCOA */
     ::DarwinGrabKeyboard (false /* just modifiers */);
 #endif
@@ -171,10 +152,5 @@
 #ifdef Q_WS_MAC
     ::DarwinReleaseKeyboard();
-# ifdef QT_MAC_USE_COCOA
     ::VBoxCocoaApplication_unsetCallback (UINT32_MAX, QIHotKeyEdit::darwinEventHandlerProc, this);
-# else
-    ::RemoveEventHandler (mDarwinEventHandlerRef);
-    mDarwinEventHandlerRef = NULL;
-# endif
 #endif
 }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIHotKeyEdit.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIHotKeyEdit.h	(revision 29815)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIHotKeyEdit.h	(revision 29816)
@@ -21,24 +21,18 @@
 
 #include <QLabel>
-#if defined (Q_WS_X11)
-#include <QMap>
-#endif
-#if defined (Q_WS_MAC)
-# include <Carbon/Carbon.h>
-/* Carbon.h includes AssertMacros.h which defines the macro "check". In
- * QItemDelegate a class method is called check also. As we not used the macro
- * undefine it here. */
-# undef check
+
+#ifdef Q_WS_X11
+# include <QMap>
 #endif
 
-#if defined (Q_WS_PM)
+#ifdef Q_WS_PM
 /* Extra virtual keys returned by QIHotKeyEdit::virtualKey() */
-#define VK_LSHIFT   VK_USERFIRST + 0
-#define VK_LCTRL    VK_USERFIRST + 1
-#define VK_LWIN     VK_USERFIRST + 2
-#define VK_RWIN     VK_USERFIRST + 3
-#define VK_WINMENU  VK_USERFIRST + 4
-#define VK_FORWARD  VK_USERFIRST + 5
-#define VK_BACKWARD VK_USERFIRST + 6
+# define VK_LSHIFT   VK_USERFIRST + 0
+# define VK_LCTRL    VK_USERFIRST + 1
+# define VK_LWIN     VK_USERFIRST + 2
+# define VK_RWIN     VK_USERFIRST + 3
+# define VK_WINMENU  VK_USERFIRST + 4
+# define VK_FORWARD  VK_USERFIRST + 5
+# define VK_BACKWARD VK_USERFIRST + 6
 #endif
 
@@ -60,5 +54,5 @@
     QSize minimumSizeHint() const;
 
-#if defined (Q_WS_PM)
+#ifdef Q_WS_PM
     static int virtualKey (QMSG *aMsg);
 #endif
@@ -83,9 +77,5 @@
     bool x11Event (XEvent *event);
 #elif defined (Q_WS_MAC)
-# ifdef QT_MAC_USE_COCOA
     static bool darwinEventHandlerProc (const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser);
-# else
-    static pascal OSStatus darwinEventHandlerProc (EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData);
-# endif
     bool darwinKeyboardEvent (const void *pvCocoaEvent, EventRef inEvent);
 #endif
@@ -109,12 +99,8 @@
 #endif
 
-#if defined (Q_WS_MAC)
-# ifndef QT_MAC_USE_COCOA
-    /** Event handler reference. NULL if the handler isn't installed. */
-    EventHandlerRef mDarwinEventHandlerRef;
-# endif
+#ifdef Q_WS_MAC
     /** The current modifier key mask. Used to figure out which modifier
      *  key was pressed when we get a kEventRawKeyModifiersChanged event. */
-    UInt32 mDarwinKeyModifiers;
+    uint32_t mDarwinKeyModifiers;
 #endif
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.h	(revision 29815)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.h	(revision 29816)
@@ -26,5 +26,5 @@
 #include "UIFrameBuffer.h"
 
-#include <Carbon/Carbon.h>
+#include <ApplicationServices/ApplicationServices.h>
 
 /* Local forward declarations */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp	(revision 29815)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp	(revision 29816)
@@ -30,5 +30,5 @@
 
 #ifdef Q_WS_MAC
-# include <Carbon/Carbon.h>
+# include <ApplicationServices/ApplicationServices.h>
 #endif /* Q_WS_MAC */
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 29815)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 29816)
@@ -82,6 +82,7 @@
 # include "DockIconPreview.h"
 # include "DarwinKeyboard.h"
-# include "darwin/VBoxCocoaApplication.h"
+# include "VBoxCocoaApplication.h"
 # include <VBox/err.h>
+# include <Carbon/Carbon.h>
 #endif /* Q_WS_MAC */
 
@@ -1102,13 +1103,13 @@
                 if (mouseEvent(pWheelEvent->type(), pWheelEvent->pos(), pWheelEvent->globalPos(),
 #ifdef QT_MAC_USE_COCOA
-                                /* Qt Cocoa is buggy. It always reports a left button pressed when the
-                                 * mouse wheel event occurs. A workaround is to ask the application which
-                                 * buttons are pressed currently: */
-                                QApplication::mouseButtons(),
+                               /* Qt Cocoa is buggy. It always reports a left button pressed when the
+                                * mouse wheel event occurs. A workaround is to ask the application which
+                                * buttons are pressed currently: */
+                               QApplication::mouseButtons(),
 #else /* QT_MAC_USE_COCOA */
-                                pWheelEvent->buttons(),
-#endif /* QT_MAC_USE_COCOA */
-                                pWheelEvent->modifiers(),
-                                iDelta, pWheelEvent->orientation()))
+                               pWheelEvent->buttons(),
+#endif /* !QT_MAC_USE_COCOA */
+                               pWheelEvent->modifiers(),
+                               iDelta, pWheelEvent->orientation()))
                     return true;
                 break;
@@ -2326,33 +2327,7 @@
 
         /* Register the event callback/hook and grab the keyboard. */
-# ifdef QT_MAC_USE_COCOA
         ::VBoxCocoaApplication_setCallback (UINT32_MAX, /** @todo fix mask */
                                             UIMachineView::darwinEventHandlerProc, this);
 
-# else /* QT_MAC_USE_COCOA */
-        EventTypeSpec eventTypes[6];
-        eventTypes[0].eventClass = kEventClassKeyboard;
-        eventTypes[0].eventKind  = kEventRawKeyDown;
-        eventTypes[1].eventClass = kEventClassKeyboard;
-        eventTypes[1].eventKind  = kEventRawKeyUp;
-        eventTypes[2].eventClass = kEventClassKeyboard;
-        eventTypes[2].eventKind  = kEventRawKeyRepeat;
-        eventTypes[3].eventClass = kEventClassKeyboard;
-        eventTypes[3].eventKind  = kEventRawKeyModifiersChanged;
-        /* For ignorning Command-H and Command-Q which aren't affected by the
-         * global hotkey stuff (doesn't work well): */
-        eventTypes[4].eventClass = kEventClassCommand;
-        eventTypes[4].eventKind  = kEventCommandProcess;
-        eventTypes[5].eventClass = kEventClassCommand;
-        eventTypes[5].eventKind  = kEventCommandUpdateStatus;
-
-        EventHandlerUPP eventHandler = ::NewEventHandlerUPP(UIMachineView::darwinEventHandlerProc);
-
-        m_darwinEventHandlerRef = NULL;
-        ::InstallApplicationEventHandler(eventHandler, RT_ELEMENTS (eventTypes), &eventTypes[0],
-                                         this, &m_darwinEventHandlerRef);
-        ::DisposeEventHandlerUPP(eventHandler);
-# endif /* !QT_MAC_USE_COCOA */
-
         ::DarwinGrabKeyboard (false);
     }
@@ -2360,18 +2335,9 @@
     {
         ::DarwinReleaseKeyboard();
-# ifdef QT_MAC_USE_COCOA
         ::VBoxCocoaApplication_unsetCallback(UINT32_MAX, /** @todo fix mask */
                                              UIMachineView::darwinEventHandlerProc, this);
-# else /* QT_MAC_USE_COCOA */
-        if (m_darwinEventHandlerRef)
-        {
-            ::RemoveEventHandler(m_darwinEventHandlerRef);
-            m_darwinEventHandlerRef = NULL;
-        }
-# endif /* !QT_MAC_USE_COCOA */
-    }
-}
-
-# ifdef QT_MAC_USE_COCOA
+    }
+}
+
 bool UIMachineView::darwinEventHandlerProc(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser)
 {
@@ -2394,37 +2360,4 @@
     return false;
 }
-# else /* QT_MAC_USE_COCOA */
-
-pascal OSStatus UIMachineView::darwinEventHandlerProc(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData)
-{
-    UIMachineView *view = static_cast<UIMachineView *> (inUserData);
-    UInt32 eventClass = ::GetEventClass (inEvent);
-
-    /* Not sure but this seems an triggered event if the spotlight searchbar is
-     * displayed. So flag that the host key isn't pressed alone. */
-    if (eventClass == 'cgs ' && view->m_bIsHostkeyPressed && ::GetEventKind (inEvent) == 0x15)
-        view->m_bIsHostkeyAlone = false;
-
-    if (eventClass == kEventClassKeyboard)
-    {
-        if (view->darwinKeyboardEvent (NULL, inEvent))
-            return 0;
-    }
-
-    /*
-     * Command-H and Command-Q aren't properly disabled yet, and it's still
-     * possible to use the left command key to invoke them when the keyboard
-     * is captured. We discard the events these if the keyboard is captured
-     * as a half measure to prevent unexpected behaviour. However, we don't
-     * get any key down/up events, so these combinations are dead to the guest...
-     */
-    else if (eventClass == kEventClassCommand)
-    {
-        if (view->m_bIsKeyboardCaptured)
-            return 0;
-    }
-    return ::CallNextEventHandler(inHandlerCallRef, inEvent);
-}
-# endif /* !QT_MAC_USE_COCOA */
 
 #endif
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h	(revision 29815)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h	(revision 29816)
@@ -195,9 +195,5 @@
     bool darwinKeyboardEvent(const void *pvCocoaEvent, EventRef inEvent);
     void darwinGrabKeyboardEvents(bool fGrab);
-# ifdef QT_MAC_USE_COCOA
     static bool darwinEventHandlerProc(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser);
-# else /* QT_MAC_USE_COCOA */
-    static pascal OSStatus darwinEventHandlerProc(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData);
-# endif /* !QT_MAC_USE_COCOA */
 #endif
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsHD.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsHD.h	(revision 29815)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsHD.h	(revision 29816)
@@ -21,4 +21,11 @@
 
 /* Global includes */
+#include <qglobal.h> /* for Q_WS_MAC */
+#ifdef Q_WS_MAC
+/* Somewhere Carbon.h includes AssertMacros.h which defines the macro "check".
+ * In QItemDelegate a class method is called "check" also. As we not used the
+ * macro undefine it here. */
+# undef check
+#endif /* Q_WS_MAC */
 #include <QItemDelegate>
 #include <QPointer>
