Index: /trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp	(revision 79728)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp	(revision 79729)
@@ -96,12 +96,4 @@
 };
 
-struct KeyCaptions
-{
-    QString m_strBase;
-    QString m_strShift;
-    QString m_strAltGr;
-    QString m_strShiftAltGr;
-};
-
 enum KeyboardColorType
 {
@@ -112,4 +104,19 @@
     KeyboardColorType_Pressed,
     KeyboardColorType_Max
+};
+
+struct KeyCaptions
+{
+    QString m_strBase;
+    QString m_strShift;
+    QString m_strAltGr;
+    QString m_strShiftAltGr;
+};
+
+struct UsageCode
+{
+    LONG usageId;
+    LONG usagePage;
+    bool fRelease;
 };
 
@@ -327,4 +334,8 @@
     void addScanCodePrefix(LONG scanCode);
     const QVector<LONG> &scanCodePrefix() const;
+
+    void setUsageId(LONG usageId);
+    void setUsagePage(LONG usagePage);
+    QPair<LONG, LONG> usagePageIdPair() const;
 
     void setSpaceWidthAfter(int iSpace);
@@ -391,4 +402,8 @@
     int        m_iPosition;
     UISoftKeyboardWidget  *m_pParentWidget;
+
+    LONG m_iUsageId;
+    LONG m_iUsagePage;
+
     bool m_fIsNumPadKey;
     bool m_fIsOSMenuKey;
@@ -509,4 +524,9 @@
     void sigStatusBarMessage(const QString &strMessage);
     void sigPutKeyboardSequence(QVector<LONG> sequence);
+
+    void sigPutUsageCodesPress(QVector<QPair<LONG, LONG> > sequence);
+    void sigPutUsageCodesRelease(QVector<QPair<LONG, LONG> > sequence);
+
+
     void sigCurrentLayoutChange();
     void sigKeyToEdit(UISoftKeyboardKey* pKey);
@@ -1463,4 +1483,19 @@
 }
 
+void UISoftKeyboardKey::setUsageId(LONG usageId)
+{
+    m_iUsageId = usageId;
+}
+
+void UISoftKeyboardKey::setUsagePage(LONG usagePage)
+{
+    m_iUsagePage = usagePage;
+}
+
+QPair<LONG, LONG> UISoftKeyboardKey::usagePageIdPair() const
+{
+    return QPair<LONG, LONG>(m_iUsageId, m_iUsagePage);
+}
+
 int UISoftKeyboardKey::spaceWidthAfter() const
 {
@@ -2426,4 +2461,6 @@
         return;
 
+#if 0
+
     QVector<LONG> sequence;
     if (!pKey->scanCodePrefix().isEmpty())
@@ -2442,4 +2479,20 @@
     }
     emit sigPutKeyboardSequence(sequence);
+
+#else
+
+    QVector<QPair<LONG, LONG> > sequence;
+    sequence << QPair<LONG, LONG>(pKey->usagePageIdPair());
+    /* Add the pressed modifiers in the reverse order: */
+    for (int i = m_pressedModifiers.size() - 1; i >= 0; --i)
+    {
+        UISoftKeyboardKey *pModifier = m_pressedModifiers[i];
+        sequence << pModifier->usagePageIdPair();
+        /* Release the pressed modifiers (if there are not locked): */
+        pModifier->release();
+    }
+    emit sigPutUsageCodesRelease(sequence);
+
+#endif
 }
 
@@ -2453,4 +2506,5 @@
         return;
 
+#if 0
     QVector<LONG> sequence;
      /* Add the pressed modifiers first: */
@@ -2467,4 +2521,20 @@
     sequence << pKey->scanCode();
     emit sigPutKeyboardSequence(sequence);
+
+#else
+
+    QVector<QPair<LONG, LONG> > sequence;
+
+     /* Add the pressed modifiers first: */
+    for (int i = 0; i < m_pressedModifiers.size(); ++i)
+    {
+        UISoftKeyboardKey *pModifier = m_pressedModifiers[i];
+        sequence << pModifier->usagePageIdPair();
+    }
+
+    sequence << pKey->usagePageIdPair();
+    emit sigPutUsageCodesPress(sequence);
+
+#endif
 }
 
@@ -2923,4 +2993,16 @@
                     key.addScanCodePrefix(iCode);
             }
+        }
+        else if (m_xmlReader.name() == "usageid")
+        {
+            QString strCode = m_xmlReader.readElementText();
+            bool fOk = false;
+            key.setUsageId(strCode.toInt(&fOk, 16));
+        }
+        else if (m_xmlReader.name() == "usagepage")
+        {
+            QString strCode = m_xmlReader.readElementText();
+            bool fOk = false;
+            key.setUsagePage(strCode.toInt(&fOk, 16));
         }
         else if (m_xmlReader.name() == "cutout")
@@ -3391,4 +3473,16 @@
 }
 
+void UISoftKeyboard::sltPutUsageCodesPress(QVector<QPair<LONG, LONG> > sequence)
+{
+    for (int i = 0; i < sequence.size(); ++i)
+        keyboard().PutUsageCode(sequence[i].first, sequence[i].second, false);
+}
+
+void UISoftKeyboard::sltPutUsageCodesRelease(QVector<QPair<LONG, LONG> > sequence)
+{
+    for (int i = 0; i < sequence.size(); ++i)
+        keyboard().PutUsageCode(sequence[i].first, sequence[i].second, true);
+}
+
 void UISoftKeyboard::sltStatusBarContextMenuRequest(const QPoint &point)
 {
@@ -3592,4 +3686,7 @@
     connect(m_pSession, &UISession::sigKeyboardLedsChange, this, &UISoftKeyboard::sltKeyboardLedsChange);
     connect(m_pKeyboardWidget, &UISoftKeyboardWidget::sigPutKeyboardSequence, this, &UISoftKeyboard::sltPutKeyboardSequence);
+    connect(m_pKeyboardWidget, &UISoftKeyboardWidget::sigPutUsageCodesPress, this, &UISoftKeyboard::sltPutUsageCodesPress);
+    connect(m_pKeyboardWidget, &UISoftKeyboardWidget::sigPutUsageCodesRelease, this, &UISoftKeyboard::sltPutUsageCodesRelease);
+
     connect(m_pKeyboardWidget, &UISoftKeyboardWidget::sigCurrentLayoutChange, this, &UISoftKeyboard::sltCurentLayoutChanged);
     connect(m_pKeyboardWidget, &UISoftKeyboardWidget::sigKeyToEdit, this, &UISoftKeyboard::sltKeyToEditChanged);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h	(revision 79728)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h	(revision 79729)
@@ -67,4 +67,7 @@
     void sltKeyboardLedsChange();
     void sltPutKeyboardSequence(QVector<LONG> sequence);
+    void sltPutUsageCodesPress(QVector<QPair<LONG, LONG> > sequence);
+    void sltPutUsageCodesRelease(QVector<QPair<LONG, LONG> > sequence);
+
     void sltStatusBarContextMenuRequest(const QPoint &point);
     /** Handles the signal we get from the layout selector widget.
