Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp	(revision 30212)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp	(revision 30213)
@@ -41,4 +41,8 @@
 #include "UIMachineWindowFullscreen.h"
 #include "UIMachineWindowSeamless.h"
+
+#ifdef Q_WS_X11
+# include <X11/Xlib.h>
+#endif
 
 UIMachineWindow* UIMachineWindow::create(UIMachineLogic *pMachineLogic, UIVisualStateType visualStateType, ulong uScreenId)
@@ -144,4 +148,27 @@
     updateAppearanceOf(UIVisualElement_WindowCaption);
 }
+
+#ifdef Q_WS_X11
+bool UIMachineWindow::x11Event(XEvent *pEvent)
+{
+    // TODO: Check if that is still required!
+    /* Qt bug: when the machine-view grabs the keyboard,
+     * FocusIn, FocusOut, WindowActivate and WindowDeactivate Qt events are
+     * not properly sent on top level window deactivation.
+     * The fix is to substiute the mode in FocusOut X11 event structure
+     * to NotifyNormal to cause Qt to process it as desired. */
+    if (pEvent->type == FocusOut)
+    {
+        if (pEvent->xfocus.mode == NotifyWhileGrabbed  &&
+            (pEvent->xfocus.detail == NotifyAncestor ||
+             pEvent->xfocus.detail == NotifyInferior ||
+             pEvent->xfocus.detail == NotifyNonlinear))
+        {
+             pEvent->xfocus.mode = NotifyNormal;
+        }
+    }
+    return false;
+}
+#endif
 
 void UIMachineWindow::closeEvent(QCloseEvent *pEvent)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h	(revision 30212)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h	(revision 30213)
@@ -70,4 +70,7 @@
 
     /* Common machine window event handlers: */
+#ifdef Q_WS_X11
+    bool x11Event(XEvent *pEvent);
+#endif
     void closeEvent(QCloseEvent *pEvent);
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp	(revision 30212)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp	(revision 30213)
@@ -147,20 +147,5 @@
 bool UIMachineWindowFullscreen::x11Event(XEvent *pEvent)
 {
-    /* Qt bug: when the console view grabs the keyboard, FocusIn, FocusOut,
-     * WindowActivate and WindowDeactivate Qt events are not properly sent
-     * on top level window (i.e. this) deactivation. The fix is to substiute
-     * the mode in FocusOut X11 event structure to NotifyNormal to cause
-     * Qt to process it as desired. */
-    if (pEvent->type == FocusOut)
-    {
-        if (pEvent->xfocus.mode == NotifyWhileGrabbed  &&
-            (pEvent->xfocus.detail == NotifyAncestor ||
-             pEvent->xfocus.detail == NotifyInferior ||
-             pEvent->xfocus.detail == NotifyNonlinear))
-        {
-             pEvent->xfocus.mode = NotifyNormal;
-        }
-    }
-    return false;
+    return UIMachineWindow::x11Event(pEvent);
 }
 #endif
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h	(revision 30212)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h	(revision 30213)
@@ -26,7 +26,4 @@
 #include "QIWithRetranslateUI.h"
 #include "UIMachineWindow.h"
-#ifdef Q_WS_X11
-# include <X11/Xlib.h>
-#endif
 
 /* Local forwards */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp	(revision 30212)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp	(revision 30213)
@@ -319,20 +319,5 @@
 bool UIMachineWindowNormal::x11Event(XEvent *pEvent)
 {
-    /* Qt bug: when the console view grabs the keyboard, FocusIn, FocusOut,
-     * WindowActivate and WindowDeactivate Qt events are not properly sent
-     * on top level window (i.e. this) deactivation. The fix is to substiute
-     * the mode in FocusOut X11 event structure to NotifyNormal to cause
-     * Qt to process it as desired. */
-    if (pEvent->type == FocusOut)
-    {
-        if (pEvent->xfocus.mode == NotifyWhileGrabbed  &&
-            (pEvent->xfocus.detail == NotifyAncestor ||
-             pEvent->xfocus.detail == NotifyInferior ||
-             pEvent->xfocus.detail == NotifyNonlinear))
-        {
-             pEvent->xfocus.mode = NotifyNormal;
-        }
-    }
-    return false;
+    return UIMachineWindow::x11Event(pEvent);
 }
 #endif
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h	(revision 30212)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h	(revision 30213)
@@ -28,7 +28,4 @@
 #include "QIWithRetranslateUI.h"
 #include "UIMachineWindow.h"
-#ifdef Q_WS_X11
-# include <X11/Xlib.h>
-#endif
 
 /* Local forwards */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp	(revision 30212)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp	(revision 30213)
@@ -176,20 +176,5 @@
 bool UIMachineWindowSeamless::x11Event(XEvent *pEvent)
 {
-    /* Qt bug: when the console view grabs the keyboard, FocusIn, FocusOut,
-     * WindowActivate and WindowDeactivate Qt events are not properly sent
-     * on top level window (i.e. this) deactivation. The fix is to substiute
-     * the mode in FocusOut X11 event structure to NotifyNormal to cause
-     * Qt to process it as desired. */
-    if (pEvent->type == FocusOut)
-    {
-        if (pEvent->xfocus.mode == NotifyWhileGrabbed  &&
-            (pEvent->xfocus.detail == NotifyAncestor ||
-             pEvent->xfocus.detail == NotifyInferior ||
-             pEvent->xfocus.detail == NotifyNonlinear))
-        {
-             pEvent->xfocus.mode = NotifyNormal;
-        }
-    }
-    return false;
+    return UIMachineWindow::x11Event(pEvent);
 }
 #endif
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h	(revision 30212)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h	(revision 30213)
@@ -26,7 +26,4 @@
 #include "QIWithRetranslateUI.h"
 #include "UIMachineWindow.h"
-#ifdef Q_WS_X11
-# include <X11/Xlib.h>
-#endif
 
 /* Local forwards */
