[Scummvm-cvs-logs] SF.net SVN: scummvm: [26175] scummvm/trunk/engines/agi
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Sat Mar 17 17:08:30 CET 2007
Revision: 26175
http://scummvm.svn.sourceforge.net/scummvm/?rev=26175&view=rev
Author: eriktorbjorn
Date: 2007-03-17 09:08:29 -0700 (Sat, 17 Mar 2007)
Log Message:
-----------
Allow synthetic events in dialog windows, e.g. so you can use keyboard repeat
when scrolling the list of savegames.
Modified Paths:
--------------
scummvm/trunk/engines/agi/agi.cpp
scummvm/trunk/engines/agi/agi.h
scummvm/trunk/engines/agi/keyboard.h
scummvm/trunk/engines/agi/savegame.cpp
scummvm/trunk/engines/agi/text.cpp
Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp 2007-03-17 16:05:16 UTC (rev 26174)
+++ scummvm/trunk/engines/agi/agi.cpp 2007-03-17 16:08:29 UTC (rev 26175)
@@ -53,6 +53,10 @@
static uint32 g_tickTimer;
struct Mouse g_mouse;
+void AgiEngine::allowSynthetic(bool allow) {
+ _allowSynthetic = allow;
+}
+
void AgiEngine::processEvents() {
OSystem::Event event;
int key = 0;
@@ -113,42 +117,42 @@
switch (key = event.kbd.keycode) {
case 256 + 20: // left arrow
case 260: // key pad 4
- if (!event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_LEFT;
break;
case 256 + 19: // right arrow
case 262: // key pad 6
- if (!event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_RIGHT;
break;
case 256 + 17: // up arrow
case 264: // key pad 8
- if (!event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_UP;
break;
case 256 + 18: // down arrow
case 258: // key pad 2
- if (!event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_DOWN;
break;
case 256 + 24: // page up
case 265: // key pad 9
- if (!event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_UP_RIGHT;
break;
case 256 + 25: // page down
case 259: // key pad 3
- if (!event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_DOWN_RIGHT;
break;
case 256 + 22: // home
case 263: // key pad 7
- if (!event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_UP_LEFT;
break;
case 256 + 23: // end
case 257: // key pad 1
- if (!event.synthetic)
+ if (_allowSynthetic || !event.synthetic)
key = KEY_DOWN_LEFT;
break;
case 261: // key pad 5
@@ -552,6 +556,8 @@
_keyControl = 0;
_keyAlt = 0;
+ _allowSynthetic = false;
+
g_tickTimer = 0;
_intobj = NULL;
Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h 2007-03-17 16:05:16 UTC (rev 26174)
+++ scummvm/trunk/engines/agi/agi.h 2007-03-17 16:08:29 UTC (rev 26175)
@@ -518,6 +518,8 @@
int _keyQueueStart;
int _keyQueueEnd;
+ bool _allowSynthetic;
+
int checkPriority(VtEntry *v);
int checkCollision(VtEntry *v);
int checkPosition(VtEntry *v);
@@ -634,6 +636,7 @@
int showItems();
void selectItems(int n);
+ void allowSynthetic(bool);
void processEvents();
// Objects
Modified: scummvm/trunk/engines/agi/keyboard.h
===================================================================
--- scummvm/trunk/engines/agi/keyboard.h 2007-03-17 16:05:16 UTC (rev 26174)
+++ scummvm/trunk/engines/agi/keyboard.h 2007-03-17 16:08:29 UTC (rev 26175)
@@ -34,6 +34,22 @@
#define keyDequeue(k) do { (k) = _keyQueue[_keyQueueStart++]; \
_keyQueueStart %= KEY_QUEUE_SIZE; } while (0)
+// Class to turn on synthetic events temporarily. Usually until the end of the
+// current function.
+
+class AllowSyntheticEvents {
+private:
+ AgiEngine *_vm;
+public:
+ AllowSyntheticEvents(AgiEngine *vm) : _vm(vm) {
+ _vm->allowSynthetic(true);
+ }
+
+ ~AllowSyntheticEvents() {
+ _vm->allowSynthetic(false);
+ }
+};
+
/* QNX4 has a KEY_DOWN defined which we don't need to care about */
#undef KEY_DOWN
Modified: scummvm/trunk/engines/agi/savegame.cpp
===================================================================
--- scummvm/trunk/engines/agi/savegame.cpp 2007-03-17 16:05:16 UTC (rev 26174)
+++ scummvm/trunk/engines/agi/savegame.cpp 2007-03-17 16:08:29 UTC (rev 26175)
@@ -509,6 +509,8 @@
for (i = 0; i < 2; i++)
_gfx->drawButton(buttonX[i], buttonY, buttonText[i], 0, 0, MSG_BOX_TEXT, MSG_BOX_COLOUR);
+ AllowSyntheticEvents on(this);
+
for (;;) {
char dstr[64];
for (i = 0; i < NUM_VISIBLE_SLOTS; i++) {
Modified: scummvm/trunk/engines/agi/text.cpp
===================================================================
--- scummvm/trunk/engines/agi/text.cpp 2007-03-17 16:05:16 UTC (rev 26174)
+++ scummvm/trunk/engines/agi/text.cpp 2007-03-17 16:08:29 UTC (rev 26175)
@@ -350,6 +350,8 @@
_gfx->getKey();
}
+ AllowSyntheticEvents on(this);
+
debugC(4, kDebugLevelText, "waiting...");
for (;;) {
for (i = 0; b[i]; i++)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list