aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/wince
diff options
context:
space:
mode:
authorKostas Nakos2007-06-09 08:40:39 +0000
committerKostas Nakos2007-06-09 08:40:39 +0000
commit910ff9289b7024f2b2264c088116be2828ff3373 (patch)
tree9cc301080adde23a2692ad4d043a4218c8fafb71 /backends/platform/wince
parent037e545dc1589504fc21f3fe5e5fc3c09feaa2ca (diff)
downloadscummvm-rg350-910ff9289b7024f2b2264c088116be2828ff3373.tar.gz
scummvm-rg350-910ff9289b7024f2b2264c088116be2828ff3373.tar.bz2
scummvm-rg350-910ff9289b7024f2b2264c088116be2828ff3373.zip
fix keys getting stuck in virtual keyboard
svn-id: r27232
Diffstat (limited to 'backends/platform/wince')
-rw-r--r--backends/platform/wince/CEgui/PanelKeyboard.cpp34
-rw-r--r--backends/platform/wince/CEgui/PanelKeyboard.h3
2 files changed, 31 insertions, 6 deletions
diff --git a/backends/platform/wince/CEgui/PanelKeyboard.cpp b/backends/platform/wince/CEgui/PanelKeyboard.cpp
index 99bd125431..fdbb3b4e32 100644
--- a/backends/platform/wince/CEgui/PanelKeyboard.cpp
+++ b/backends/platform/wince/CEgui/PanelKeyboard.cpp
@@ -35,6 +35,9 @@ namespace CEGUI {
PanelKeyboard::PanelKeyboard(WORD reference) : Toolbar() {
setBackground(reference);
+ _state = false;
+ _lastKey.setAscii(0);
+ _lastKey.setKeycode(0);
}
@@ -42,6 +45,7 @@ namespace CEGUI {
}
bool PanelKeyboard::action(int x, int y, bool pushed) {
+ Key key;
if (checkInside(x, y)) {
int keyAscii = 0;
@@ -67,14 +71,34 @@ namespace CEGUI {
}
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;
}
}
diff --git a/backends/platform/wince/CEgui/PanelKeyboard.h b/backends/platform/wince/CEgui/PanelKeyboard.h
index fe586b3727..d0182ce5fe 100644
--- a/backends/platform/wince/CEgui/PanelKeyboard.h
+++ b/backends/platform/wince/CEgui/PanelKeyboard.h
@@ -44,7 +44,8 @@ namespace CEGUI {
virtual ~PanelKeyboard();
virtual bool action(int x, int y, bool pushed);
private:
- Key _key;
+ bool _state;
+ Key _lastKey;
};
}