author | mickeyl <mickeyl> | 2003-05-26 18:22:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-26 18:22:40 (UTC) |
commit | bafafde5e5777e6af8c5f7dcc93472d75e942a8f (patch) (unidiff) | |
tree | 3bc7de6766d39664f89c66c32160d52015b0aadf | |
parent | 304b92e24c7a7da309977cd996fc89848d8899dc (diff) | |
download | opie-bafafde5e5777e6af8c5f7dcc93472d75e942a8f.zip opie-bafafde5e5777e6af8c5f7dcc93472d75e942a8f.tar.gz opie-bafafde5e5777e6af8c5f7dcc93472d75e942a8f.tar.bz2 |
add improved version of QWSSimpadButtonHandler
this one now features automatic keyrepeat and adapts to rotation :-D
-rw-r--r-- | qt/qte234-for-opie091-simpad.patch | 69 |
1 files changed, 58 insertions, 11 deletions
diff --git a/qt/qte234-for-opie091-simpad.patch b/qt/qte234-for-opie091-simpad.patch index fd535d4..93f4be3 100644 --- a/qt/qte234-for-opie091-simpad.patch +++ b/qt/qte234-for-opie091-simpad.patch | |||
@@ -27,4 +27,4 @@ | |||
27 | --- src/kernel/qkeyboard_qws.cpp.origSat May 24 16:49:38 2003 | 27 | --- src/kernel/qkeyboard_qws.cpp.origSat May 24 16:49:38 2003 |
28 | +++ src/kernel/qkeyboard_qws.cppSat May 24 17:58:22 2003 | 28 | +++ src/kernel/qkeyboard_qws.cppMon May 26 19:52:05 2003 |
29 | @@ -131,6 +131,46 @@ | 29 | @@ -131,6 +131,53 @@ |
30 | 30 | ||
@@ -65,2 +65,3 @@ | |||
65 | + void readSwitchesData(); | 65 | + void readSwitchesData(); |
66 | + void autoRepeat(); | ||
66 | + | 67 | + |
@@ -68,3 +69,9 @@ | |||
68 | + switches_mask_t switches; | 69 | + switches_mask_t switches; |
70 | + | ||
69 | + int fd; | 71 | + int fd; |
72 | + int repeatdelay; | ||
73 | + int repeatperiod; | ||
74 | + int k; | ||
75 | + | ||
76 | + QTimer* repeater; | ||
70 | + QSocketNotifier *notifier; | 77 | + QSocketNotifier *notifier; |
@@ -75,3 +82,12 @@ | |||
75 | { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 00 | 82 | { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 00 |
76 | @@ -1440,7 +1480,11 @@ | 83 | @@ -396,7 +443,7 @@ |
84 | for the list of codes). | ||
85 | <li>\a modifiers is the set of modifier keys (see Qt::Modifier). | ||
86 | <li>\a isPress says whether this is a press or a release. | ||
87 | - <li>\a autoRepeat says whether this event was generated by an auto-repeat | ||
88 | + <li>\a time says whether this event was generated by an auto-repeat | ||
89 | mechanism, or an actual key press. | ||
90 | </ul> | ||
91 | */ | ||
92 | @@ -1440,7 +1486,11 @@ | ||
77 | } else { | 93 | } else { |
@@ -88,3 +104,3 @@ | |||
88 | handler = new QWSyopyButtonsHandler(); | 104 | handler = new QWSyopyButtonsHandler(); |
89 | @@ -1469,6 +1513,72 @@ | 105 | @@ -1469,6 +1519,103 @@ |
90 | return keyM; | 106 | return keyM; |
@@ -93,3 +109,3 @@ | |||
93 | -#endif // QT_NO_QWS_KEYBOARD | 109 | -#endif // QT_NO_QWS_KEYBOARD |
94 | 110 | + | |
95 | +/* | 111 | +/* |
@@ -98,6 +114,7 @@ | |||
98 | + */ | 114 | + */ |
99 | + | 115 | |
100 | + | 116 | |
101 | +QWSsimpadButtonsHandler::QWSsimpadButtonsHandler() | 117 | +QWSsimpadButtonsHandler::QWSsimpadButtonsHandler() |
102 | + :QWSKeyboardHandler(), fd( -1 ) | 118 | + :QWSKeyboardHandler(), fd( -1 ), |
119 | + repeatdelay( 400 ), repeatperiod( 80 ) | ||
103 | +{ | 120 | +{ |
@@ -113,4 +130,8 @@ | |||
113 | + connect( notifier, SIGNAL( activated(int) ),this, SLOT( readSwitchesData() ) ); | 130 | + connect( notifier, SIGNAL( activated(int) ),this, SLOT( readSwitchesData() ) ); |
131 | + | ||
132 | + repeater = new QTimer(this); | ||
133 | + connect(repeater, SIGNAL(timeout()), this, SLOT(autoRepeat())); | ||
134 | + | ||
114 | +} | 135 | +} |
115 | 136 | + | |
116 | + | 137 | + |
@@ -137,3 +158,3 @@ | |||
137 | + | 158 | + |
138 | + qDebug( "SimpadButtonsHandler() - EVENT = %04xd | %04xd", | 159 | + qDebug( "SimpadButtonsHandler() - SwitchEvent = %0x | %0x", |
139 | + switches.events[0], switches.states[0] ); | 160 | + switches.events[0], switches.states[0] ); |
@@ -142,3 +163,3 @@ | |||
142 | + int code = switches.events[0]; | 163 | + int code = switches.events[0]; |
143 | + int k = -1; | 164 | + k = -1; |
144 | + | 165 | + |
@@ -155,2 +176,19 @@ | |||
155 | + | 176 | + |
177 | + bool repeatable = ( k != SIMPAD_SWITCH_UPPER && k != SIMPAD_SWITCH_LOWER ); | ||
178 | + | ||
179 | + qDebug( "SimpadButtonsHandler() - Repeatable = %s", repeatable? "true":"false" ); | ||
180 | + | ||
181 | + if ( qt_screen->isTransformed() && k >= Qt::Key_Left && k <= Qt::Key_Down ) | ||
182 | + { | ||
183 | + qDebug( "SimpadButtonsHandler() - We are transformed! Correcting..." ); | ||
184 | + int oldK = k; | ||
185 | + k = xform_dirkey( k ); | ||
186 | + qDebug( "SimpadButtonsHandler() - Old Key: %d - New Key %d", oldK, k ); | ||
187 | + } | ||
188 | + | ||
189 | + if ( repeatable && press ) | ||
190 | + repeater->start( repeatdelay, true ); | ||
191 | + else | ||
192 | + repeater->stop(); | ||
193 | + | ||
156 | + if ( k >= 0 ) | 194 | + if ( k >= 0 ) |
@@ -161,2 +199,11 @@ | |||
161 | + | 199 | + |
200 | + | ||
201 | +void QWSsimpadButtonsHandler::autoRepeat() | ||
202 | +{ | ||
203 | + processKeyEvent( 0, k, 0, false, true ); | ||
204 | + processKeyEvent( 0, k, 0, true, true ); | ||
205 | + repeater->start(repeatperiod); | ||
206 | +} | ||
207 | + | ||
208 | + | ||
162 | +#endif // QT_NO_QWS_KEYBOARD | 209 | +#endif // QT_NO_QWS_KEYBOARD |