summaryrefslogtreecommitdiff
path: root/noncore/apps/keyz-cfg/zkb.cpp
Unidiff
Diffstat (limited to 'noncore/apps/keyz-cfg/zkb.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/keyz-cfg/zkb.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/apps/keyz-cfg/zkb.cpp b/noncore/apps/keyz-cfg/zkb.cpp
index c9e1dc5..a357b88 100644
--- a/noncore/apps/keyz-cfg/zkb.cpp
+++ b/noncore/apps/keyz-cfg/zkb.cpp
@@ -1,28 +1,29 @@
1#include "zkb.h" 1#include "zkb.h"
2 2
3/* OPIE */ 3/* OPIE */
4#include <opie2/odebug.h> 4#include <opie2/odebug.h>
5#include <opie2/okeyfilter.h>
5 6
6#include <stdio.h> 7#include <stdio.h>
7 8
8// Implementation of Action class 9// Implementation of Action class
9Action::Action():state(0), keycode(0), unicode(0), flags(0) { 10Action::Action():state(0), keycode(0), unicode(0), flags(0) {
10} 11}
11 12
12Action::Action(State* s, ushort kc, ushort uni, int f): 13Action::Action(State* s, ushort kc, ushort uni, int f):
13 state(s), keycode(kc), unicode(uni), flags(f) { 14 state(s), keycode(kc), unicode(uni), flags(f) {
14} 15}
15 16
16Action::~Action() { 17Action::~Action() {
17} 18}
18 19
19State* Action::getState() const { 20State* Action::getState() const {
20 return state; 21 return state;
21} 22}
22 23
23void Action::setState(State* s) { 24void Action::setState(State* s) {
24 state = s; 25 state = s;
25 setDefined(true); 26 setDefined(true);
26} 27}
27 28
28bool Action::hasEvent() const { 29bool Action::hasEvent() const {
@@ -225,48 +226,50 @@ int State::translateKeycode(int keycode) const {
225 226
226 if (keycode < 0x80) { 227 if (keycode < 0x80) {
227 return x1[keycode - 0x20]; 228 return x1[keycode - 0x20];
228 } 229 }
229 230
230 if (keycode < 0x1000) { 231 if (keycode < 0x1000) {
231 return -1; 232 return -1;
232 } 233 }
233 234
234 if (keycode < 0x1057) { 235 if (keycode < 0x1057) {
235 return x2[keycode - 0x1000]; 236 return x2[keycode - 0x1000];
236 } 237 }
237 238
238 return -1; 239 return -1;
239} 240}
240 241
241// Implementation of Keymap class 242// Implementation of Keymap class
242Keymap::Keymap():enabled(true), currentState(0), autoRepeatAction(0), repeater(this) { 243Keymap::Keymap():enabled(true), currentState(0), autoRepeatAction(0), repeater(this) {
243 repeatDelay=400; 244 repeatDelay=400;
244 repeatPeriod=80; 245 repeatPeriod=80;
245 connect(&repeater, SIGNAL(timeout()), this, SLOT(autoRepeat())); 246 connect(&repeater, SIGNAL(timeout()), this, SLOT(autoRepeat()));
246} 247}
247 248
248Keymap::~Keymap() { 249Keymap::~Keymap() {
250 odebug << "removing keyboard filter for zkb"<<oendl;
251 Opie::Core::OKeyFilter::inst()->remHandler(this);
249 QMap<QString, State*>::Iterator it; 252 QMap<QString, State*>::Iterator it;
250 for(it = states.begin(); it != states.end(); ++it) { 253 for(it = states.begin(); it != states.end(); ++it) {
251 delete it.data(); 254 delete it.data();
252 } 255 }
253 states.clear(); 256 states.clear();
254} 257}
255 258
256bool Keymap::filter(int unicode, int keycode, int modifiers, 259bool Keymap::filter(int unicode, int keycode, int modifiers,
257 bool isPress, bool autoRepeat) { 260 bool isPress, bool autoRepeat) {
258 261
259 odebug << "filter: >>> unicode=" << unicode << ", keycode=" << keycode 262 odebug << "filter: >>> unicode=" << unicode << ", keycode=" << keycode
260 << ", modifiers=" << modifiers << ", ispressed=" << isPress << oendl; 263 << ", modifiers=" << modifiers << ", ispressed=" << isPress << oendl;
261 264
262 if (!enabled) { 265 if (!enabled) {
263 return false; 266 return false;
264 } 267 }
265 268
266 // the second check is workaround to make suspend work if 269 // the second check is workaround to make suspend work if
267 // the user pressed it right after he did resume. for some 270 // the user pressed it right after he did resume. for some
268 // reason the event sent by qt has autoRepeat true in this 271 // reason the event sent by qt has autoRepeat true in this
269 // case 272 // case
270 if (autoRepeat && keycode != 4177) { 273 if (autoRepeat && keycode != 4177) {
271 return true; 274 return true;
272 } 275 }