aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-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;
};
}