[Scummvm-cvs-logs] scummvm master -> 171b79c2c528d03a826ab095fcd3b0ebd3236f94

m-kiewitz m_kiewitz at users.sourceforge.net
Fri Jan 29 22:57:09 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
171b79c2c5 SCI: add code to make numpad cursor keys work again


Commit: 171b79c2c528d03a826ab095fcd3b0ebd3236f94
    https://github.com/scummvm/scummvm/commit/171b79c2c528d03a826ab095fcd3b0ebd3236f94
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-01-29T22:57:30+01:00

Commit Message:
SCI: add code to make numpad cursor keys work again

When the users presses keys on the numpad, we get digits in .ascii
even when Num-Lock is not enabled. This caused numpad cursor keys
not working anymore. Imo we should only get .ascii in those cases,
when Num-Lock is enabled.

Changed paths:
    engines/sci/event.cpp



diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index 3f615f6..90ddaaf 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -214,6 +214,15 @@ SciEvent EventManager::getScummVMEvent() {
 		//((ev.kbd.flags & Common::KBD_CAPS) ? SCI_KEYMOD_CAPSLOCK : 0) |
 		//((ev.kbd.flags & Common::KBD_SCRL) ? SCI_KEYMOD_SCRLOCK : 0) |
 
+	if (input.data >= Common::KEYCODE_KP0 && input.data <= Common::KEYCODE_KP9) {
+		if (!(ev.kbd.flags & Common::KBD_NUM)) {
+			// HACK: Num-Lock not enabled
+			// We shouldn't get a valid ascii code in these cases. We fix it here, so that cursor keys
+			// on the numpad work properly.
+			input.character = 0;
+		}
+	}
+
 	if ((input.character) && (input.character <= 0xFF)) {
 		// Directly accept most common keys without conversion
 		if ((input.character >= 0x80) && (input.character <= 0xFF)) {






More information about the Scummvm-git-logs mailing list