From 4536c68f0065ec01b22c3eecd0ae4e73fea5a7f0 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Sun, 27 Jan 2013 18:26:20 -0200 Subject: [PATCH] Fix #249 --- modules/game_console/console.lua | 8 +++----- src/framework/platform/platformwindow.cpp | 5 +++++ src/framework/platform/win32window.cpp | 21 +++++++++++---------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index 613f4858..679f6e26 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -496,10 +496,8 @@ function addTabText(text, speaktype, tab, creatureName) end label.name = creatureName - if creatureName and #creatureName > 0 then - label.onMouseRelease = function (self, mousePos, mouseButton) - processMessageMenu(mousePos, mouseButton, creatureName, text, self, tab) - end + label.onMouseRelease = function (self, mousePos, mouseButton) + processMessageMenu(mousePos, mouseButton, creatureName, text, self, tab) end if consoleBuffer:getChildCount() > MAX_LINES then @@ -542,7 +540,7 @@ end function processMessageMenu(mousePos, mouseButton, creatureName, text, label, tab) if mouseButton == MouseRightButton then local menu = g_ui.createWidget('PopupMenu') - if creatureName then + if creatureName and #creatureName > 0 then if creatureName ~= g_game.getCharacterName() then menu:addOption(tr('Message to ' .. creatureName), function () g_game.openPrivateChannel(creatureName) end) if not g_game.getLocalPlayer():hasVip(creatureName) then diff --git a/src/framework/platform/platformwindow.cpp b/src/framework/platform/platformwindow.cpp index 1c954272..b51eff23 100644 --- a/src/framework/platform/platformwindow.cpp +++ b/src/framework/platform/platformwindow.cpp @@ -117,6 +117,11 @@ void PlatformWindow::processKeyUp(Fw::Key keyCode) } else if(keyCode == Fw::KeyShift) { m_inputEvent.keyboardModifiers &= ~Fw::KeyboardShiftModifier; return; + } else if(keyCode == Fw::KeyNumLock) { + for(uchar k = Fw::KeyNumpad0; k <= Fw::KeyNumpad9; ++k) { + if(m_keysState[(Fw::Key)k]) + processKeyUp((Fw::Key)k); + } } if(!m_keysState[keyCode]) diff --git a/src/framework/platform/win32window.cpp b/src/framework/platform/win32window.cpp index 1329808c..6e3de22e 100644 --- a/src/framework/platform/win32window.cpp +++ b/src/framework/platform/win32window.cpp @@ -510,28 +510,29 @@ Fw::Key WIN32Window::retranslateVirtualKey(WPARAM wParam, LPARAM lParam) // lParam will have this state when receiving insert,end,down,etc presses from numpad if(!(((HIWORD(lParam) >> 8) & 0xFF) & 1)) { + bool numlockOn = GetKeyState(VK_NUMLOCK); // retranslate numpad keys switch(wParam) { case VK_INSERT: - return Fw::KeyNumpad0; + return numlockOn ? Fw::KeyUnknown : Fw::KeyNumpad0; case VK_END: - return Fw::KeyNumpad1; + return numlockOn ? Fw::KeyUnknown : Fw::KeyNumpad1; case VK_DOWN: - return Fw::KeyNumpad2; + return numlockOn ? Fw::KeyUnknown : Fw::KeyNumpad2; case VK_NEXT: - return Fw::KeyNumpad3; + return numlockOn ? Fw::KeyUnknown : Fw::KeyNumpad3; case VK_LEFT: - return Fw::KeyNumpad4; + return numlockOn ? Fw::KeyUnknown : Fw::KeyNumpad4; case VK_CLEAR: - return Fw::KeyNumpad5; + return numlockOn ? Fw::KeyUnknown : Fw::KeyNumpad5; case VK_RIGHT: - return Fw::KeyNumpad6; + return numlockOn ? Fw::KeyUnknown : Fw::KeyNumpad6; case VK_HOME: - return Fw::KeyNumpad7; + return numlockOn ? Fw::KeyUnknown : Fw::KeyNumpad7; case VK_UP: - return Fw::KeyNumpad8; + return numlockOn ? Fw::KeyUnknown : Fw::KeyNumpad8; case VK_PRIOR: - return Fw::KeyNumpad9; + return numlockOn ? Fw::KeyUnknown : Fw::KeyNumpad9; } }