Index: /trunk/src/gui/kernel/qkeymapper_pm.cpp
===================================================================
--- /trunk/src/gui/kernel/qkeymapper_pm.cpp	(revision 432)
+++ /trunk/src/gui/kernel/qkeymapper_pm.cpp	(revision 433)
@@ -164,6 +164,6 @@
     Qt::Key_Insert,     //  26   0x1A   VK_INSERT           | Ins key
     Qt::Key_Delete,     //  27   0x1B   VK_DELETE           | Del key
-    Qt::Key_NumLock,    //  28   0x1C   VK_SCROLL           | Scroll Lock key
-    Qt::Key_ScrollLock, //  29   0x1D   VK_NUMLOCK          | Num Lock key
+    Qt::Key_ScrollLock, //  28   0x1C   VK_SCROLL           | Scroll Lock key
+    Qt::Key_NumLock,    //  29   0x1D   VK_NUMLOCK          | Num Lock key
     Qt::Key_Enter,      //  30   0x1E   VK_ENTER            | Enter (Numpad) key
     Qt::Key_SysReq,     //  31   0x1F   VK_SYSRQ            | SysReq key
@@ -349,5 +349,32 @@
             chm.chr = state & Qt::ShiftModifier ? '|' : '\\';
             break;
-    }
+        case 0xFA00: // Back
+            code = Qt::Key_Back;
+            break;
+        case 0xF900: // Forward
+            code = Qt::Key_Forward;
+            break;
+        case 0x2064: // Volume Mute
+            code = Qt::Key_VolumeMute;
+            break;
+        case 0x2E63: // Volume Down
+            code = Qt::Key_VolumeDown;
+            break;
+        case 0x3062: // Volume Up
+            code = Qt::Key_VolumeUp;
+            break;
+        case 0x2267: // Play/Pause
+            code = Qt::Key_MediaPlay;
+            break;
+        case 0x326D: // Web/Home
+            code = Qt::Key_HomePage;
+            break;
+        case 0xF500: // Search
+            code = Qt::Key_Search;
+            break;
+        case 0xF600: // Favorites
+            code = Qt::Key_Favorites;
+            break;
+        }
 
     // update state after updating extraKeyState
@@ -375,4 +402,54 @@
     else if (code == Qt::Key_Meta)
         state = state ^ Qt::MetaModifier;
+
+    // detect numeric keypad keys
+    if (chm.vkey == VK_ENTER || chm.vkey == VK_NUMLOCK) {
+        // these always come from the numpad
+        state |= Qt::KeypadModifier;
+    } else if (((chm.vkey >= VK_PAGEUP && chm.vkey <= VK_DOWN) ||
+                chm.vkey == VK_INSERT || chm.vkey == VK_DELETE)) {
+        if ((chm.chr & 0xFF) != 0xE0) {
+            state |= Qt::KeypadModifier;
+            if ((state & Qt::AltModifier) && chm.vkey != VK_DELETE) {
+                // hide the key from Qt widgets and let the standard OS/2 Alt+ddd
+                // shortcut (that composed chars from typed in ASCII codes) work
+                // correctly. If we don't do that, widgets will see both individual
+                // digits (or cursor movements if NumLock is off) and the char
+                // composed by Alt+ddd.
+                return false;
+            }
+        }
+    }
+    // detect other numpad keys. OS/2 doesn't assign virtual keys to them
+    // so use scancodes (it can be device-dependent, is there a better way?)
+    switch (chm.scancode) {
+        case 0x4C: // 5
+            state |= Qt::KeypadModifier;
+            if (state & Qt::AltModifier) {
+                // hide the key from Qt (see above)
+                return false;
+            } else {
+                // scancode is zero if Numlock is set
+                if (!code)
+                    code = Qt::Key_Clear;
+            }
+            break;
+        case 0x37: // *
+            // OS/2 assigns VK_PRINTSCRN to it when pressed with Shift, also
+            // it sets chr to zero when it is released with Alt or Ctrl
+            // leaving vkey as zero too, and does few other strange things --
+            // override them all
+            code = Qt::Key_Asterisk;
+            state |= Qt::KeypadModifier;
+            break;
+        case 0x5C: // /
+            code = Qt::Key_Slash;
+            // fall through
+        case 0x4A: // -
+        case 0x4E: // +
+            // the code for the above two is obtained by KbdXlate above
+            state |= Qt::KeypadModifier;
+            break;
+    }
 
     // Note: code and/or chm.scancode may be zero here. We cannot ignore such
