[Scummvm-cvs-logs] CVS: scummvm/backends/sdl events.cpp,1.12,1.13
Max Horn
fingolfin at users.sourceforge.net
Thu Dec 30 06:12:02 CET 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/gui EditTextWidget.cpp,1.26,1.26.2.1 EditTextWidget.h,1.14,1.14.4.1 TabWidget.cpp,1.12,1.12.2.1 about.cpp,1.13.2.3,1.13.2.4 credits.h,1.1.2.3,1.1.2.4 dialog.cpp,1.43,1.43.4.1 dialog.h,1.28,1.28.2.1 launcher.cpp,1.102,1.102.2.1 widget.cpp,1.38,1.38.2.1
- Next message: [Scummvm-cvs-logs] CVS: scummvm/common singleton.h,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24679
Modified Files:
events.cpp
Log Message:
set key modifiers for keyup events, too; use SDL_GetModState to determine mod flags, so that the modifier flags get set if e.g. the shift key is pressed alone
Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/events.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- events.cpp 18 Dec 2004 16:38:44 -0000 1.12
+++ events.cpp 30 Dec 2004 14:11:00 -0000 1.13
@@ -145,6 +145,25 @@
}
}
+static byte SDLModToOSystemKeyFlags(SDLMod mod) {
+ byte b = 0;
+#ifdef LINUPY
+ // Yopy has no ALT key, steal the SHIFT key
+ // (which isn't used much anyway)
+ if (mod & KMOD_SHIFT)
+ b |= OSystem::KBD_ALT;
+#else
+ if (mod & KMOD_SHIFT)
+ b |= OSystem::KBD_SHIFT;
+ if (mod & KMOD_ALT)
+ b |= OSystem::KBD_ALT;
+#endif
+ if (mod & KMOD_CTRL)
+ b |= OSystem::KBD_CTRL;
+
+ return b;
+}
+
bool OSystem_SDL::pollEvent(Event &event) {
SDL_Event ev;
int axis;
@@ -162,21 +181,7 @@
while(SDL_PollEvent(&ev)) {
switch(ev.type) {
case SDL_KEYDOWN:
-#ifdef LINUPY
- // Yopy has no ALT key, steal the SHIFT key
- // (which isn't used much anyway)
- if (ev.key.keysym.mod & KMOD_SHIFT)
- b |= KBD_ALT;
- if (ev.key.keysym.mod & KMOD_CTRL)
- b |= KBD_CTRL;
-#else
- if (ev.key.keysym.mod & KMOD_SHIFT)
- b |= KBD_SHIFT;
- if (ev.key.keysym.mod & KMOD_CTRL)
- b |= KBD_CTRL;
- if (ev.key.keysym.mod & KMOD_ALT)
- b |= KBD_ALT;
-#endif
+ b = SDLModToOSystemKeyFlags(SDL_GetModState());
event.kbd.flags = b;
// Alt-Return and Alt-Enter toggle full screen mode
@@ -418,6 +423,7 @@
event.type = EVENT_KEYUP;
event.kbd.keycode = ev.key.keysym.sym;
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
+ event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());;
/*
switch(ev.key.keysym.sym) {
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/gui EditTextWidget.cpp,1.26,1.26.2.1 EditTextWidget.h,1.14,1.14.4.1 TabWidget.cpp,1.12,1.12.2.1 about.cpp,1.13.2.3,1.13.2.4 credits.h,1.1.2.3,1.1.2.4 dialog.cpp,1.43,1.43.4.1 dialog.h,1.28,1.28.2.1 launcher.cpp,1.102,1.102.2.1 widget.cpp,1.38,1.38.2.1
- Next message: [Scummvm-cvs-logs] CVS: scummvm/common singleton.h,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list