From 3fa2676fc3a926e89f0093b88f1983b638c96f43 Mon Sep 17 00:00:00 2001 From: Michael Wetherell Date: Sun, 28 May 2006 19:23:44 +0000 Subject: [PATCH] Take account of the numlock when mapping mgl virtual keycodes to wx ones. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39389 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mgl/window.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index e19d106905..d4fc3b24e5 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -297,23 +297,25 @@ static long wxScanToKeyCode(event_t *event, bool translate) if ( translate ) { + bool numlock = (event->modifiers & EVT_NUMLOCK) != 0; + switch ( EVT_scanCode(event->message) ) { KEY (KB_padMinus, WXK_NUMPAD_SUBTRACT) KEY (KB_padPlus, WXK_NUMPAD_ADD) KEY (KB_padTimes, WXK_NUMPAD_MULTIPLY) KEY (KB_padDivide, WXK_NUMPAD_DIVIDE) - KEY (KB_padCenter, WXK_NUMPAD_SEPARATOR) // ? - KEY (KB_padLeft, WXK_NUMPAD_LEFT) - KEY (KB_padRight, WXK_NUMPAD_RIGHT) - KEY (KB_padUp, WXK_NUMPAD_UP) - KEY (KB_padDown, WXK_NUMPAD_DOWN) - KEY (KB_padInsert, WXK_NUMPAD_INSERT) - KEY (KB_padDelete, WXK_NUMPAD_DELETE) - KEY (KB_padHome, WXK_NUMPAD_HOME) - KEY (KB_padEnd, WXK_NUMPAD_END) - KEY (KB_padPageUp, WXK_NUMPAD_PAGEUP) - KEY (KB_padPageDown, WXK_NUMPAD_PAGEDOWN) + KEY (KB_padCenter, numlock ? WXK_NUMPAD5 : WXK_NUMPAD_SEPARATOR) // ? + KEY (KB_padLeft, numlock ? WXK_NUMPAD4 : WXK_NUMPAD_LEFT) + KEY (KB_padRight, numlock ? WXK_NUMPAD6 : WXK_NUMPAD_RIGHT) + KEY (KB_padUp, numlock ? WXK_NUMPAD8 : WXK_NUMPAD_UP) + KEY (KB_padDown, numlock ? WXK_NUMPAD2 : WXK_NUMPAD_DOWN) + KEY (KB_padInsert, numlock ? WXK_NUMPAD0 : WXK_NUMPAD_INSERT) + KEY (KB_padDelete, numlock ? WXK_DECIMAL : WXK_NUMPAD_DELETE) + KEY (KB_padHome, numlock ? WXK_NUMPAD7 : WXK_NUMPAD_HOME) + KEY (KB_padEnd, numlock ? WXK_NUMPAD1 : WXK_NUMPAD_END) + KEY (KB_padPageUp, numlock ? WXK_NUMPAD9 : WXK_NUMPAD_PAGEUP) + KEY (KB_padPageDown, numlock ? WXK_NUMPAD3 : WXK_NUMPAD_PAGEDOWN) KEY (KB_1, '1') KEY (KB_2, '2') KEY (KB_3, '3') -- 2.45.2