[Scummvm-git-logs] scummvm master -> f14703e70964eb3247259110f3e4b18b97e1ff40
dreammaster
paulfgilbert at gmail.com
Sat Mar 2 04:40:57 CET 2019
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e91e911b61 GLK: Don't treat modifier keys as standard keypresses
f14703e709 GLK: Don't ignore Alt key combinations
Commit: e91e911b613e4b6cdee5c37346c9304452507aa9
https://github.com/scummvm/scummvm/commit/e91e911b613e4b6cdee5c37346c9304452507aa9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-03-01T19:38:21-08:00
Commit Message:
GLK: Don't treat modifier keys as standard keypresses
Changed paths:
engines/glk/events.cpp
engines/glk/events.h
diff --git a/engines/glk/events.cpp b/engines/glk/events.cpp
index 3689836..10651b0 100644
--- a/engines/glk/events.cpp
+++ b/engines/glk/events.cpp
@@ -185,8 +185,10 @@ void Events::pollEvents() {
switch (event.type) {
case Common::EVENT_KEYDOWN:
- setCursor(CURSOR_NONE);
- handleKeyDown(event.kbd);
+ if (!isModifierKey(event.kbd.keycode)) {
+ setCursor(CURSOR_NONE);
+ handleKeyDown(event.kbd);
+ }
return;
case Common::EVENT_LBUTTONDOWN:
@@ -365,6 +367,13 @@ void Events::handleButtonUp(bool isLeft, const Point &pos) {
}
}
+bool Events::isModifierKey(const Common::KeyCode &keycode) const {
+ return keycode == Common::KEYCODE_LCTRL || keycode == Common::KEYCODE_LALT
+ || keycode == Common::KEYCODE_RCTRL || keycode == Common::KEYCODE_RALT
+ || keycode == Common::KEYCODE_LSHIFT || keycode == Common::KEYCODE_RSHIFT
+ || keycode == Common::KEYCODE_LSUPER || keycode == Common::KEYCODE_RSUPER;
+}
+
void Events::waitForPress() {
Common::Event e;
@@ -372,9 +381,8 @@ void Events::waitForPress() {
g_system->getEventManager()->pollEvent(e);
g_system->delayMillis(10);
checkForNextFrameCounter();
- } while (!g_vm->shouldQuit() && e.type != Common::EVENT_KEYDOWN &&
- e.type != Common::EVENT_LBUTTONDOWN && e.type != Common::EVENT_RBUTTONDOWN &&
- e.type != Common::EVENT_MBUTTONDOWN);
+ } while (!g_vm->shouldQuit() && (e.type != Common::EVENT_KEYDOWN || isModifierKey(e.kbd.keycode))
+ && e.type != Common::EVENT_LBUTTONDOWN && e.type != Common::EVENT_RBUTTONDOWN && e.type != Common::EVENT_MBUTTONDOWN);
}
void Events::setCursor(CursorId cursorId) {
diff --git a/engines/glk/events.h b/engines/glk/events.h
index 37cd3c2..2a4f10c 100644
--- a/engines/glk/events.h
+++ b/engines/glk/events.h
@@ -220,6 +220,11 @@ private:
* Handle mouse up events
*/
void handleButtonUp(bool isLeft, const Point &pos);
+
+ /**
+ * Returns true if the passed keycode is for the Ctrl or Alt keys
+ */
+ bool isModifierKey(const Common::KeyCode &keycode) const;
public:
bool _forceClick;
public:
Commit: f14703e70964eb3247259110f3e4b18b97e1ff40
https://github.com/scummvm/scummvm/commit/f14703e70964eb3247259110f3e4b18b97e1ff40
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-03-01T19:38:21-08:00
Commit Message:
GLK: Don't ignore Alt key combinations
I'm told that on some foreign keyboards, combinations of Alt & Fn
keys are used to produce standard characters. So I can't just
ignore Alt combinations because of this
Changed paths:
engines/glk/events.cpp
diff --git a/engines/glk/events.cpp b/engines/glk/events.cpp
index 10651b0..ed6ad9b 100644
--- a/engines/glk/events.cpp
+++ b/engines/glk/events.cpp
@@ -222,28 +222,29 @@ void Events::handleKeyDown(const Common::KeyState &ks) {
Windows &windows = *g_vm->_windows;
if (ks.flags & Common::KBD_CTRL) {
- if (ks.keycode == Common::KEYCODE_a)
- windows.inputHandleKey(keycode_Home);
- else if (ks.keycode == Common::KEYCODE_c)
- clipboard.clipboardSend(CLIPBOARD);
- else if (ks.keycode == Common::KEYCODE_e)
- windows.inputHandleKey(keycode_End);
- else if (ks.keycode == Common::KEYCODE_u)
- windows.inputHandleKey(keycode_Escape);
- else if (ks.keycode == Common::KEYCODE_v)
- clipboard.clipboardReceive(CLIPBOARD);
- else if (ks.keycode == Common::KEYCODE_x)
- clipboard.clipboardSend(CLIPBOARD);
- else if (ks.keycode == Common::KEYCODE_LEFT || ks.keycode == Common::KEYCODE_KP4)
- windows.inputHandleKey(keycode_SkipWordLeft);
- else if (ks.keycode == Common::KEYCODE_RIGHT || ks.keycode == Common::KEYCODE_KP6)
- windows.inputHandleKey(keycode_SkipWordRight);
-
- return;
- }
+ do {
+ if (ks.keycode == Common::KEYCODE_a)
+ windows.inputHandleKey(keycode_Home);
+ else if (ks.keycode == Common::KEYCODE_c)
+ clipboard.clipboardSend(CLIPBOARD);
+ else if (ks.keycode == Common::KEYCODE_e)
+ windows.inputHandleKey(keycode_End);
+ else if (ks.keycode == Common::KEYCODE_u)
+ windows.inputHandleKey(keycode_Escape);
+ else if (ks.keycode == Common::KEYCODE_v)
+ clipboard.clipboardReceive(CLIPBOARD);
+ else if (ks.keycode == Common::KEYCODE_x)
+ clipboard.clipboardSend(CLIPBOARD);
+ else if (ks.keycode == Common::KEYCODE_LEFT || ks.keycode == Common::KEYCODE_KP4)
+ windows.inputHandleKey(keycode_SkipWordLeft);
+ else if (ks.keycode == Common::KEYCODE_RIGHT || ks.keycode == Common::KEYCODE_KP6)
+ windows.inputHandleKey(keycode_SkipWordRight);
+ else
+ break;
- if (ks.flags & Common::KBD_ALT)
- return;
+ return;
+ } while (false);
+ }
switch (ks.keycode) {
case Common::KEYCODE_RETURN:
@@ -322,8 +323,7 @@ void Events::handleKeyDown(const Common::KeyState &ks) {
windows.inputHandleKey(keycode_Func12);
break;
default:
- windows.inputHandleKey(ks.ascii);
- break;
+ windows.inputHandleKey(ks.keycode);
break;
}
}
More information about the Scummvm-git-logs
mailing list