[Scummvm-cvs-logs] SF.net SVN: scummvm: [27232] scummvm/trunk/backends/platform/wince/CEgui
knakos at users.sourceforge.net
knakos at users.sourceforge.net
Sat Jun 9 10:40:39 CEST 2007
Revision: 27232
http://scummvm.svn.sourceforge.net/scummvm/?rev=27232&view=rev
Author: knakos
Date: 2007-06-09 01:40:39 -0700 (Sat, 09 Jun 2007)
Log Message:
-----------
fix keys getting stuck in virtual keyboard
Modified Paths:
--------------
scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.cpp
scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.h
Modified: scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.cpp 2007-06-09 07:51:58 UTC (rev 27231)
+++ scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.cpp 2007-06-09 08:40:39 UTC (rev 27232)
@@ -35,6 +35,9 @@
PanelKeyboard::PanelKeyboard(WORD reference) : Toolbar() {
setBackground(reference);
+ _state = false;
+ _lastKey.setAscii(0);
+ _lastKey.setKeycode(0);
}
@@ -42,6 +45,7 @@
}
bool PanelKeyboard::action(int x, int y, bool pushed) {
+ Key key;
if (checkInside(x, y)) {
int keyAscii = 0;
@@ -67,14 +71,34 @@
}
if (keyAscii != 0) {
- _key.setAscii(keyAscii);
- _key.setKeycode(tolower(keyCode));
- return EventsBuffer::simulateKey(&_key, pushed);
+ if (_state && pushed && keyCode != _lastKey.keycode()) // if cursor is still down and off the current key
+ return false;
+ else if (_state && !pushed && keyCode != _lastKey.keycode()) { // cursor is up but off the current key
+ keyAscii = _lastKey.ascii();
+ keyCode = _lastKey.keycode();
+ }
+ _state = pushed;
+ _lastKey.setAscii(keyAscii);
+ _lastKey.setKeycode(tolower(keyCode));
+
+ key.setAscii(keyAscii);
+ key.setKeycode(tolower(keyCode));
+ return EventsBuffer::simulateKey(&key, pushed);
}
- else
+ else if (_state && !pushed) { // cursor is in some forbidden region and is up
+ _state = false;
+ key.setAscii(_lastKey.ascii());
+ key.setKeycode(_lastKey.keycode());
+ return EventsBuffer::simulateKey(&key, false);
+ } else
return false;
}
- else
+ else if (_state && !pushed) { // cursor left the keyboard area and is up
+ _state = false;
+ key.setAscii(_lastKey.ascii());
+ key.setKeycode(_lastKey.keycode());
+ return EventsBuffer::simulateKey(&key, false);
+ } else
return false;
}
}
Modified: scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.h
===================================================================
--- scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.h 2007-06-09 07:51:58 UTC (rev 27231)
+++ scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.h 2007-06-09 08:40:39 UTC (rev 27232)
@@ -44,7 +44,8 @@
virtual ~PanelKeyboard();
virtual bool action(int x, int y, bool pushed);
private:
- Key _key;
+ bool _state;
+ Key _lastKey;
};
}
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