Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp	(revision 53076)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp	(revision 53079)
@@ -297,5 +297,4 @@
 void UIKeyboardHandler::releaseAllPressedKeys(bool aReleaseHostKey /* = true */)
 {
-    CKeyboard keyboard = session().GetConsole().GetKeyboard();
     bool fSentRESEND = false;
 
@@ -311,8 +310,8 @@
             if (!fSentRESEND)
             {
-                keyboard.PutScancode (0xFE);
+                keyboard().PutScancode(0xFE);
                 fSentRESEND = true;
             }
-            keyboard.PutScancode(i | 0x80);
+            keyboard().PutScancode(i | 0x80);
         }
         else if (m_pressedKeys[i] & IsExtKeyPressed)
@@ -320,5 +319,5 @@
             if (!fSentRESEND)
             {
-                keyboard.PutScancode(0xFE);
+                keyboard().PutScancode(0xFE);
                 fSentRESEND = true;
             }
@@ -326,5 +325,5 @@
             codes[0] = 0xE0;
             codes[1] = i | 0x80;
-            keyboard.PutScancodes(codes);
+            keyboard().PutScancodes(codes);
         }
         m_pressedKeys[i] = 0;
@@ -869,8 +868,7 @@
 }
 
-/* Main Session getter: */
-CSession& UIKeyboardHandler::session() const
-{
-    return uisession()->session();
+CKeyboard& UIKeyboardHandler::keyboard() const
+{
+    return uisession()->keyboard();
 }
 
@@ -1022,6 +1020,5 @@
                             combo[3] = 0xd7 + (pKeyEvent->key() - Qt::Key_F11); /* F11-F12 up   */
                         }
-                        CKeyboard keyboard = session().GetConsole().GetKeyboard();
-                        keyboard.PutScancodes(combo);
+                        keyboard().PutScancodes(combo);
                     }
                     /* Process hot keys not processed in keyEvent() (as in case of non-alphanumeric keys): */
@@ -1564,8 +1561,4 @@
     if (!uisession()->isPaused())
     {
-        /* Get the VM keyboard: */
-        CKeyboard keyboard = session().GetConsole().GetKeyboard();
-        Assert(!keyboard.isNull());
-
         /* If there are scan-codes to send: */
         if (uCodesCount)
@@ -1573,5 +1566,5 @@
             /* Send prepared scan-codes to the guest: */
             std::vector<LONG> scancodes(pCodes, &pCodes[uCodesCount]);
-            keyboard.PutScancodes(QVector<LONG>::fromStdVector(scancodes));
+            keyboard().PutScancodes(QVector<LONG>::fromStdVector(scancodes));
         }
 
@@ -1579,5 +1572,5 @@
         if (isHostComboStateChanged && m_bIsHostComboPressed)
         {
-            keyEventReleaseHostComboKeys(keyboard);
+            keyEventReleaseHostComboKeys(keyboard());
         }
     }
@@ -1730,5 +1723,4 @@
 {
     QVector <LONG> codes(2);
-    CKeyboard keyboard = session().GetConsole().GetKeyboard();
     for (uint i = 0; i < SIZEOF_ARRAY(m_pressedKeys); ++ i)
     {
@@ -1740,5 +1732,5 @@
             if (!(ns & IsKeyPressed))
                 codes[0] |= 0x80;
-            keyboard.PutScancode(codes[0]);
+            keyboard().PutScancode(codes[0]);
         }
         else if ((os & IsExtKeyPressed) != (ns & IsExtKeyPressed))
@@ -1748,5 +1740,5 @@
             if (!(ns & IsExtKeyPressed))
                 codes[1] |= 0x80;
-            keyboard.PutScancodes(codes);
+            keyboard().PutScancodes(codes);
         }
     }
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h	(revision 53076)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h	(revision 53079)
@@ -35,5 +35,4 @@
 /* Forward declarations: */
 class QWidget;
-class CSession;
 class UISession;
 class UIActionPool;
@@ -45,4 +44,5 @@
 typedef union  _XEvent XEvent;
 #endif /* Q_WS_X11 */
+class CKeyboard;
 
 /* Delegate to control VM keyboard functionality: */
@@ -117,5 +117,7 @@
     UIActionPool* actionPool() const;
     UISession* uisession() const;
-    CSession& session() const;
+
+    /** Returns the console's keyboard reference. */
+    CKeyboard& keyboard() const;
 
     /* Event handler for registered machine-view(s): */
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp	(revision 53076)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp	(revision 53079)
@@ -206,6 +206,5 @@
 
         /* Switch guest mouse to the relative mode: */
-        CMouse mouse = session().GetConsole().GetMouse();
-        mouse.PutMouseEvent(0, 0, 0, 0, 0);
+        mouse().PutMouseEvent(0, 0, 0, 0, 0);
 
         /* Notify all the listeners: */
@@ -338,6 +337,5 @@
         releaseMouse();
         /* Also we should switch guest mouse to the absolute mode: */
-        CMouse mouse = session().GetConsole().GetMouse();
-        mouse.PutMouseEventAbsolute(-1, -1, 0, 0, 0);
+        mouse().PutMouseEventAbsolute(-1, -1, 0, 0, 0);
     }
 #if 0 /* current team's decision is NOT to capture mouse on mouse-absolute mode loosing! */
@@ -368,6 +366,5 @@
     {
         /* Switch guest mouse to the relative mode: */
-        CMouse mouse = session().GetConsole().GetMouse();
-        mouse.PutMouseEvent(0, 0, 0, 0, 0);
+        mouse().PutMouseEvent(0, 0, 0, 0, 0);
     }
 #endif
@@ -488,8 +485,12 @@
 }
 
-/* Main Session getter: */
-CSession& UIMouseHandler::session() const
-{
-    return uisession()->session();
+CDisplay& UIMouseHandler::display() const
+{
+    return uisession()->display();
+}
+
+CMouse& UIMouseHandler::mouse() const
+{
+    return uisession()->mouse();
 }
 
@@ -842,8 +843,7 @@
         ::UpdateWindow(m_viewports[uScreenId]->winId());
 #endif
-        CMouse mouse = session().GetConsole().GetMouse();
-        mouse.PutMouseEvent(globalPos.x() - m_lastMousePos.x(),
-                            globalPos.y() - m_lastMousePos.y(),
-                            iWheelVertical, iWheelHorizontal, iMouseButtonsState);
+        mouse().PutMouseEvent(globalPos.x() - m_lastMousePos.x(),
+                              globalPos.y() - m_lastMousePos.y(),
+                              iWheelVertical, iWheelHorizontal, iMouseButtonsState);
 
 #ifdef Q_WS_WIN
@@ -963,5 +963,5 @@
             ULONG dummy;
             KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
-            session().GetConsole().GetDisplay().GetScreenResolution(uScreenId, dummy, dummy, dummy, xShift, yShift, monitorStatus);
+            display().GetScreenResolution(uScreenId, dummy, dummy, dummy, xShift, yShift, monitorStatus);
             /* Set shifting: */
             cpnt.setX(cpnt.x() + xShift);
@@ -969,6 +969,5 @@
 
             /* Post absolute mouse-event into guest: */
-            CMouse mouse = session().GetConsole().GetMouse();
-            mouse.PutMouseEventAbsolute(cpnt.x() + 1, cpnt.y() + 1, iWheelVertical, iWheelHorizontal, iMouseButtonsState);
+            mouse().PutMouseEventAbsolute(cpnt.x() + 1, cpnt.y() + 1, iWheelVertical, iWheelHorizontal, iMouseButtonsState);
             return true;
         }
@@ -1021,7 +1020,4 @@
         return true;
 
-    /* Get mouse: */
-    CMouse mouse = session().GetConsole().GetMouse();
-
     QVector<LONG64> contacts(pTouchEvent->touchPoints().size());
 
@@ -1029,5 +1025,5 @@
     ULONG dummy;
     KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
-    session().GetConsole().GetDisplay().GetScreenResolution(uScreenId, dummy, dummy, dummy, xShift, yShift, monitorStatus);
+    display().GetScreenResolution(uScreenId, dummy, dummy, dummy, xShift, yShift, monitorStatus);
 
     /* Pass all multi-touch events into guest: */
@@ -1065,7 +1061,7 @@
     }
 
-    mouse.PutEventMultiTouch(pTouchEvent->touchPoints().size(),
-                             contacts,
-                             (ULONG)RTTimeMilliTS());
+    mouse().PutEventMultiTouch(pTouchEvent->touchPoints().size(),
+                               contacts,
+                               (ULONG)RTTimeMilliTS());
 
     /* Eat by default? */
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h	(revision 53076)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h	(revision 53079)
@@ -38,5 +38,6 @@
 typedef union  _XEvent XEvent;
 #endif /* Q_WS_X11 */
-class CSession;
+class CDisplay;
+class CMouse;
 
 /* Delegate to control VM mouse functionality: */
@@ -97,5 +98,9 @@
     UIMachineLogic* machineLogic() const;
     UISession* uisession() const;
-    CSession& session() const;
+
+    /** Returns the console's display reference. */
+    CDisplay& display() const;
+    /** Returns the console's mouse reference. */
+    CMouse& mouse() const;
 
     /* Event handler for registered machine-view(s): */
