Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp	(revision 52013)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp	(revision 52014)
@@ -783,7 +783,7 @@
 public:
 
-    /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */
-    UIIndicatorMouse(CSession &session)
-        : UISessionStateStatusBarIndicator(session)
+    /** Constructor, using @a pSession for state-update routine. */
+    UIIndicatorMouse(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession->session())
     {
         /* Assign state-icons: */
@@ -793,4 +793,7 @@
         setStateIcon(3, UIIconPool::iconSet(":/mouse_can_seamless_16px.png"));
         setStateIcon(4, UIIconPool::iconSet(":/mouse_can_seamless_uncaptured_16px.png"));
+        /* Configure connection: */
+        connect(pSession, SIGNAL(sigMouseStateChange(int)), this, SLOT(setState(int)));
+        setState(pSession->mouseState());
         /* Translate finally: */
         retranslateUi();
@@ -840,7 +843,7 @@
 public:
 
-    /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */
-    UIIndicatorKeyboard(CSession &session)
-        : UISessionStateStatusBarIndicator(session)
+    /** Constructor, using @a pSession for state-update routine. */
+    UIIndicatorKeyboard(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession->session())
     {
         /* Assign state-icons: */
@@ -849,4 +852,7 @@
         setStateIcon(2, UIIconPool::iconSet(":/hostkey_pressed_16px.png"));
         setStateIcon(3, UIIconPool::iconSet(":/hostkey_captured_pressed_16px.png"));
+        /* Configure connection: */
+        connect(pSession, SIGNAL(sigKeyboardStateChange(int)), this, SLOT(setState(int)));
+        setState(pSession->keyboardState());
         /* Translate finally: */
         retranslateUi();
@@ -1065,6 +1071,6 @@
                 case IndicatorType_VideoCapture:      m_pool[indicatorType] = new UIIndicatorVideoCapture(m_session);  break;
                 case IndicatorType_Features:          m_pool[indicatorType] = new UIIndicatorFeatures(m_session);      break;
-                case IndicatorType_Mouse:             m_pool[indicatorType] = new UIIndicatorMouse(m_session);         break;
-                case IndicatorType_Keyboard:          m_pool[indicatorType] = new UIIndicatorKeyboard(m_session);      break;
+                case IndicatorType_Mouse:             m_pool[indicatorType] = new UIIndicatorMouse(m_pSession);        break;
+                case IndicatorType_Keyboard:          m_pool[indicatorType] = new UIIndicatorKeyboard(m_pSession);     break;
                 case IndicatorType_KeyboardExtension: m_pool[indicatorType] = new UIIndicatorKeyboardExtension;        break;
                 default: break;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp	(revision 52013)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp	(revision 52014)
@@ -220,5 +220,5 @@
 
         /* Notify all the listeners: */
-        emit keyboardStateChanged(keyboardState());
+        emit sigStateChange(state());
     }
 }
@@ -275,5 +275,5 @@
 
         /* Notify all the listeners: */
-        emit keyboardStateChanged(keyboardState());
+        emit sigStateChange(state());
     }
 }
@@ -332,9 +332,10 @@
 #endif
 
-    emit keyboardStateChanged(keyboardState());
+    /* Notify all the listeners: */
+    emit sigStateChange(state());
 }
 
 /* Current keyboard state: */
-int UIKeyboardHandler::keyboardState() const
+int UIKeyboardHandler::state() const
 {
     return (m_fIsKeyboardCaptured ? UIViewStateType_KeyboardCaptured : 0) |
@@ -1522,6 +1523,6 @@
     }
 
-    /* Notify all listeners: */
-    emit keyboardStateChanged(keyboardState());
+    /* Notify all the listeners: */
+    emit sigStateChange(state());
 
     /* If the VM is NOT paused: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h	(revision 52013)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h	(revision 52014)
@@ -51,4 +51,9 @@
     Q_OBJECT;
 
+signals:
+
+    /** Notifies listeners about state-change. */
+    void sigStateChange(int iState);
+
 public:
 
@@ -67,5 +72,5 @@
 
     /* Current keyboard state: */
-    int keyboardState() const;
+    int state() const;
 
     /* Some getters required by side-code: */
@@ -88,9 +93,4 @@
     bool x11EventFilter(XEvent *pEvent, ulong uScreenId);
 #endif
-
-signals:
-
-    /* Notifies listeners about keyboard state-change: */
-    void keyboardStateChanged(int iNewState);
 
 protected slots:
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 52013)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 52014)
@@ -685,10 +685,18 @@
 void UIMachineLogic::setKeyboardHandler(UIKeyboardHandler *pKeyboardHandler)
 {
+    /* Set new handler: */
     m_pKeyboardHandler = pKeyboardHandler;
+    /* Connect to session: */
+    connect(m_pKeyboardHandler, SIGNAL(sigStateChange(int)),
+            uisession(), SLOT(setKeyboardState(int)));
 }
 
 void UIMachineLogic::setMouseHandler(UIMouseHandler *pMouseHandler)
 {
+    /* Set new handler: */
     m_pMouseHandler = pMouseHandler;
+    /* Connect to session: */
+    connect(m_pMouseHandler, SIGNAL(sigStateChange(int)),
+            uisession(), SLOT(setMouseState(int)));
 }
 
@@ -955,9 +963,11 @@
 void UIMachineLogic::prepareHandlers()
 {
-    /* Create keyboard-handler: */
+    /* Create handlers: */
     setKeyboardHandler(UIKeyboardHandler::create(this, visualStateType()));
-
-    /* Create mouse-handler: */
     setMouseHandler(UIMouseHandler::create(this, visualStateType()));
+
+    /* Update UI session values with current: */
+    uisession()->setKeyboardState(keyboardHandler()->state());
+    uisession()->setMouseState(mouseHandler()->state());
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp	(revision 52013)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp	(revision 52014)
@@ -201,6 +201,6 @@
         mouse.PutMouseEvent(0, 0, 0, 0, 0);
 
-        /* Emit signal if required: */
-        emit mouseStateChanged(mouseState());
+        /* Notify all the listeners: */
+        emit sigStateChange(state());
     }
 }
@@ -233,6 +233,6 @@
         m_iMouseCaptureViewIndex = -1;
 
-        /* Emit signal if required: */
-        emit mouseStateChanged(mouseState());
+        /* Notify all the listeners: */
+        emit sigStateChange(state());
     }
 }
@@ -253,5 +253,5 @@
 
 /* Current mouse state: */
-int UIMouseHandler::mouseState() const
+int UIMouseHandler::state() const
 {
     return (uisession()->isMouseCaptured() ? UIMouseStateType_MouseCaptured : 0) |
@@ -294,7 +294,7 @@
 {
     /* Get machine state: */
-    KMachineState state = uisession()->machineState();
+    KMachineState machineState = uisession()->machineState();
     /* Handle particular machine states: */
-    switch (state)
+    switch (machineState)
     {
         case KMachineState_Paused:
@@ -313,11 +313,10 @@
      * if we are not in paused VM state already: */
     if (machineLogic()->activeMachineWindow() &&
-        state != KMachineState_Paused &&
-        state != KMachineState_TeleportingPausedVM)
+        machineState != KMachineState_Paused &&
+        machineState != KMachineState_TeleportingPausedVM)
         popupCenter().forgetAboutPausedVMInput(machineLogic()->activeMachineWindow());
 
-    // TODO: Is it really required?
-    /* Notify all listeners: */
-    emit mouseStateChanged(mouseState());
+    /* Notify all the listeners: */
+    emit sigStateChange(state());
 }
 
@@ -376,6 +375,6 @@
     }
 
-    /* Notify all listeners: */
-    emit mouseStateChanged(mouseState());
+    /* Notify all the listeners: */
+    emit sigStateChange(state());
 }
 
@@ -456,5 +455,5 @@
     /* Mouse pointer shape state-change updaters: */
     connect(uisession(), SIGNAL(sigMousePointerShapeChange()), this, SLOT(sltMousePointerShapeChanged()));
-    connect(this, SIGNAL(mouseStateChanged(int)), this, SLOT(sltMousePointerShapeChanged()));
+    connect(this, SIGNAL(sigStateChange(int)), this, SLOT(sltMousePointerShapeChanged()));
 
     /* Initialize: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h	(revision 52013)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h	(revision 52014)
@@ -47,4 +47,9 @@
     Q_OBJECT;
 
+signals:
+
+    /** Notifies listeners about state-change. */
+    void sigStateChange(int iState);
+
 public:
 
@@ -65,14 +70,9 @@
 
     /* Current mouse state: */
-    int mouseState() const;
+    int state() const;
 
 #ifdef Q_WS_X11
     bool x11EventFilter(XEvent *pEvent, ulong uScreenId);
 #endif /* Q_WS_X11 */
-
-signals:
-
-    /* Notifies listeners about mouse state-change: */
-    void mouseStateChanged(int iNewState);
 
 protected slots:
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h	(revision 52013)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h	(revision 52014)
@@ -190,4 +190,6 @@
 
     /* Keyboard getters: */
+    /** Returns keyboard-state. */
+    int keyboardState() const { return m_iKeyboardState; }
     bool isNumLock() const { return m_fNumLock; }
     bool isCapsLock() const { return m_fCapsLock; }
@@ -197,4 +199,6 @@
 
     /* Mouse getters: */
+    /** Returns mouse-state. */
+    int mouseState() const { return m_iMouseState; }
     bool isMouseSupportsAbsolute() const { return m_fIsMouseSupportsAbsolute; }
     bool isMouseSupportsRelative() const { return m_fIsMouseSupportsRelative; }
@@ -243,4 +247,8 @@
 
     /* Console callback signals: */
+    /** Notifies listeners about keyboard state-change. */
+    void sigKeyboardStateChange(int iState);
+    /** Notifies listeners about mouse state-change. */
+    void sigMouseStateChange(int iState);
     void sigMousePointerShapeChange();
     void sigMouseCapabilityChange();
@@ -273,4 +281,10 @@
     void sltInstallGuestAdditionsFrom(const QString &strSource);
 
+    /** Defines @a iKeyboardState. */
+    void setKeyboardState(int iKeyboardState) { m_iKeyboardState = iKeyboardState; emit sigKeyboardStateChange(m_iKeyboardState); }
+
+    /** Defines @a iMouseState. */
+    void setMouseState(int iMouseState) { m_iMouseState = iMouseState; emit sigMouseStateChange(m_iMouseState); }
+
 private slots:
 
@@ -445,4 +459,6 @@
 
     /* Keyboard flags: */
+    /** Holds the keyboard-state. */
+    int m_iKeyboardState;
     bool m_fNumLock : 1;
     bool m_fCapsLock : 1;
@@ -452,4 +468,6 @@
 
     /* Mouse flags: */
+    /** Holds the mouse-state. */
+    int m_iMouseState;
     bool m_fIsMouseSupportsAbsolute : 1;
     bool m_fIsMouseSupportsRelative : 1;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp	(revision 52013)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp	(revision 52014)
@@ -232,30 +232,4 @@
 }
 
-void UIMachineWindowNormal::prepareHandlers()
-{
-    /* Call to base-class: */
-    UIMachineWindow::prepareHandlers();
-
-    /* Get keyboard/mouse indicators: */
-    QIStateStatusBarIndicator *pKeyboardIndicator =
-        qobject_cast<QIStateStatusBarIndicator*>(m_pIndicatorsPool->indicator(IndicatorType_Keyboard));
-    QIStateStatusBarIndicator *pMouseIndicator =
-        qobject_cast<QIStateStatusBarIndicator*>(m_pIndicatorsPool->indicator(IndicatorType_Mouse));
-
-    /* Connect keyboard/mouse state-change handlers: */
-    if (pKeyboardIndicator)
-        connect(machineLogic()->keyboardHandler(), SIGNAL(keyboardStateChanged(int)),
-                pKeyboardIndicator, SLOT(setState(int)));
-    if (pMouseIndicator)
-        connect(machineLogic()->mouseHandler(), SIGNAL(mouseStateChanged(int)),
-                pMouseIndicator, SLOT(setState(int)));
-
-    /* Early initialize created connections: */
-    if (pKeyboardIndicator)
-        pKeyboardIndicator->setState(machineLogic()->keyboardHandler()->keyboardState());
-    if (pMouseIndicator)
-        pMouseIndicator->setState(machineLogic()->mouseHandler()->mouseState());
-}
-
 void UIMachineWindowNormal::loadSettings()
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h	(revision 52013)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h	(revision 52014)
@@ -64,10 +64,8 @@
     void prepareStatusBar();
     void prepareVisualState();
-    void prepareHandlers();
     void loadSettings();
 
     /* Cleanup helpers: */
     void saveSettings();
-    //void cleanupHandlers() {}
     //coid cleanupVisualState() {}
     //void cleanupStatusBar() {}
