Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 30541)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 30542)
@@ -554,4 +554,10 @@
 }
 
+void UIMachineLogic::prepareHandlers()
+{
+    /* Create mouse-handler: */
+    setMouseHandler(UIMouseHandler::create(this, visualStateType()));
+}
+
 #ifdef Q_WS_MAC
 void UIMachineLogic::prepareDock()
@@ -647,4 +653,10 @@
 }
 #endif /* Q_WS_MAC */
+
+void UIMachineLogic::cleanupHandlers()
+{
+    /* Cleanup mouse-handler: */
+    UIMouseHandler::destroy(mouseHandler());
+}
 
 void UIMachineLogic::sltMachineStateChanged()
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h	(revision 30541)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h	(revision 30542)
@@ -115,4 +115,5 @@
     virtual void prepareActionConnections();
     virtual void prepareActionGroups();
+    virtual void prepareHandlers();
 #ifdef Q_WS_MAC
     virtual void prepareDock();
@@ -125,4 +126,5 @@
     virtual void cleanupDock();
 #endif /* Q_WS_MAC */
+    virtual void cleanupHandlers();
     //virtual void cleanupActionGroups() {}
     //virtual void cleanupActionConnections() {}
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 30541)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 30542)
@@ -556,7 +556,4 @@
     NOREF(ok);
 #endif
-
-    /* Register mouse-handler: */
-    machineLogic()->mouseHandler()->addMachineView(screenId(), this);
 }
 
@@ -615,7 +612,4 @@
 void UIMachineView::cleanupCommon()
 {
-    /* Unregister mouse-handler: */
-    machineLogic()->mouseHandler()->delMachineView(screenId());
-
 #ifdef Q_WS_PM
     bool ok = VBoxHlpUninstallKbdHook(0, winId(), UM_PREACCEL_CHAR);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp	(revision 30541)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp	(revision 30542)
@@ -35,4 +35,5 @@
 #include "UISession.h"
 #include "UIActionsPool.h"
+#include "UIMouseHandler.h"
 #include "UIMachineLogic.h"
 #include "UIMachineWindow.h"
@@ -458,4 +459,16 @@
 }
 
+void UIMachineWindow::prepareHandlers()
+{
+    /* Register machine-view in mouse-handler: */
+    machineLogic()->mouseHandler()->addMachineView(m_uScreenId, this->machineView());
+}
+
+void UIMachineWindow::cleanupHandlers()
+{
+    /* Unregister machine-view from mouse-handler: */
+    machineLogic()->mouseHandler()->delMachineView(m_uScreenId);
+}
+
 void UIMachineWindow::updateAppearanceOf(int iElement)
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h	(revision 30541)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h	(revision 30542)
@@ -80,6 +80,8 @@
     virtual void prepareMachineViewContainer();
     //virtual void loadWindowSettings() {}
+    virtual void prepareHandlers();
 
     /* Cleanup helpers: */
+    virtual void cleanupHandlers();
     //virtual void saveWindowSettings() {}
     //virtual void cleanupMachineViewContainer() {}
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp	(revision 30541)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp	(revision 30542)
@@ -55,4 +55,7 @@
     /* Cleanup machine window(s): */
     cleanupMachineWindows();
+
+    /* Cleanup handlers: */
+    cleanupHandlers();
 
     /* Cleanup action related stuff */
@@ -133,4 +136,7 @@
     prepareActionConnections();
 
+    /* Prepare handlers: */
+    prepareHandlers();
+
     /* Prepare machine window: */
     prepareMachineWindows();
@@ -194,8 +200,4 @@
     /* Update the multi screen layout: */
     m_pScreenLayout->update();
-
-    /* Create mouse-handler: */
-    UIMouseHandler *pMouseHandler = UIMouseHandler::create(this, visualStateType());
-    setMouseHandler(pMouseHandler);
 
     /* Create machine window(s): */
@@ -230,7 +232,4 @@
     foreach (UIMachineWindow *pMachineWindow, machineWindows())
         UIMachineWindow::destroy(pMachineWindow);
-
-    /* Cleanup mouse-handler: */
-    UIMouseHandler::destroy(mouseHandler());
 
 #ifdef Q_WS_MAC
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp	(revision 30541)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp	(revision 30542)
@@ -64,4 +64,7 @@
     prepareMachineView();
 
+    /* Prepare handlers: */
+    prepareHandlers();
+
     /* Prepare mini tool-bar: */
     prepareMiniToolBar();
@@ -96,4 +99,7 @@
     /* Save window settings: */
     saveWindowSettings();
+
+    /* Prepare handlers: */
+    cleanupHandlers();
 
     /* Cleanup machine view: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp	(revision 30541)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp	(revision 30542)
@@ -50,4 +50,7 @@
     /* Cleanup machine window(s): */
     cleanupMachineWindow();
+
+    /* Cleanup handlers: */
+    cleanupHandlers();
 }
 
@@ -67,4 +70,7 @@
     /* Prepare action connections: */
     prepareActionConnections();
+
+    /* Prepare handlers: */
+    prepareHandlers();
 
     /* Prepare normal machine window: */
@@ -143,8 +149,4 @@
 #endif /* Q_WS_MAC */
 
-    /* Create mouse-handler: */
-    UIMouseHandler *pMouseHandler = UIMouseHandler::create(this, visualStateType());
-    setMouseHandler(pMouseHandler);
-
     /* Get monitors count: */
     ulong uMonitorCount = session().GetMachine().GetMonitorCount();
@@ -169,7 +171,4 @@
     foreach (UIMachineWindow *pMachineWindow, machineWindows())
         UIMachineWindow::destroy(pMachineWindow);
-
-    /* Cleanup mouse-handler: */
-    UIMouseHandler::destroy(mouseHandler());
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp	(revision 30541)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp	(revision 30542)
@@ -80,4 +80,7 @@
     prepareMachineView();
 
+    /* Prepare handlers: */
+    prepareHandlers();
+
     /* Load normal window settings: */
     loadWindowSettings();
@@ -94,4 +97,7 @@
     /* Save normal window settings: */
     saveWindowSettings();
+
+    /* Prepare handlers: */
+    cleanupHandlers();
 
     /* Cleanup normal machine view: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp	(revision 30541)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp	(revision 30542)
@@ -53,4 +53,7 @@
     /* Cleanup machine window(s): */
     cleanupMachineWindows();
+
+    /* Cleanup handlers: */
+    cleanupHandlers();
 
     /* Cleanup actions groups: */
@@ -125,4 +128,7 @@
     prepareActionConnections();
 
+    /* Prepare handlers: */
+    prepareHandlers();
+
     /* Prepare normal machine window: */
     prepareMachineWindows();
@@ -185,8 +191,4 @@
     m_pScreenLayout->update();
 
-    /* Create machine mouse-handler: */
-    UIMouseHandler *pMouseHandler = UIMouseHandler::create(this, visualStateType());
-    setMouseHandler(pMouseHandler);
-
     /* Create machine window(s): */
     for (int cScreenId = 0; cScreenId < m_pScreenLayout->guestScreenCount(); ++cScreenId)
@@ -211,7 +213,4 @@
     foreach (UIMachineWindow *pMachineWindow, machineWindows())
         UIMachineWindow::destroy(pMachineWindow);
-
-    /* Cleanup mouse-handler: */
-    UIMouseHandler::destroy(mouseHandler());
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp	(revision 30541)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp	(revision 30542)
@@ -75,4 +75,7 @@
     prepareMachineView();
 
+    /* Prepare handlers: */
+    prepareHandlers();
+
     /* Prepare mini tool-bar: */
 #ifndef Q_WS_MAC
@@ -99,4 +102,7 @@
     /* Save window settings: */
     saveWindowSettings();
+
+    /* Prepare handlers: */
+    cleanupHandlers();
 
     /* Cleanup machine view: */
