-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 | |||
@@ -25,8 +25,8 @@ | |||
25 | if ((mouseFD = open( "/dev/h3600_ts", O_RDONLY | O_NDELAY)) < 0) { | 25 | if ((mouseFD = open( "/dev/h3600_ts", O_RDONLY | O_NDELAY)) < 0) { |
26 | # endif | 26 | # endif |
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 | ||
31 | #endif // QNX6 | 31 | #endif // QNX6 |
32 | 32 | ||
@@ -63,17 +63,33 @@ | |||
63 | + | 63 | + |
64 | + private slots: | 64 | + private slots: |
65 | + void readSwitchesData(); | 65 | + void readSwitchesData(); |
66 | + void autoRepeat(); | ||
66 | + | 67 | + |
67 | + private: | 68 | + private: |
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; |
71 | +}; | 78 | +}; |
72 | + | 79 | + |
73 | #ifdef QT_QWS_SL5XXX | 80 | #ifdef QT_QWS_SL5XXX |
74 | static const QWSServer::KeyMap keyM[] = { | 81 | static const QWSServer::KeyMap keyM[] = { |
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 { |
78 | type = spec; | 94 | type = spec; |
79 | } | 95 | } |
@@ -86,20 +102,21 @@ | |||
86 | if ( type == "Buttons" ) { | 102 | if ( type == "Buttons" ) { |
87 | #if defined(QT_QWS_YOPY) | 103 | #if defined(QT_QWS_YOPY) |
88 | handler = new QWSyopyButtonsHandler(); | 104 | handler = new QWSyopyButtonsHandler(); |
89 | @@ -1469,6 +1513,72 @@ | 105 | @@ -1469,6 +1519,103 @@ |
90 | return keyM; | 106 | return keyM; |
91 | } | 107 | } |
92 | 108 | ||
93 | -#endif // QT_NO_QWS_KEYBOARD | 109 | -#endif // QT_NO_QWS_KEYBOARD |
94 | 110 | + | |
95 | +/* | 111 | +/* |
96 | + * SIMpad switches handler | 112 | + * SIMpad switches handler |
97 | + * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 113 | + * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
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 | +{ |
104 | + qDebug( "SimpadButtonsHandler()" ); | 121 | + qDebug( "SimpadButtonsHandler()" ); |
105 | + fd = ::open( SIMPAD_SWITCHES_DEVICE, O_RDWR | O_NDELAY, 0 ); | 122 | + fd = ::open( SIMPAD_SWITCHES_DEVICE, O_RDWR | O_NDELAY, 0 ); |
@@ -111,8 +128,12 @@ | |||
111 | + | 128 | + |
112 | + notifier = new QSocketNotifier( fd, QSocketNotifier::Read, this ); | 129 | + notifier = new QSocketNotifier( fd, QSocketNotifier::Read, this ); |
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 | + |
117 | +QWSsimpadButtonsHandler::~QWSsimpadButtonsHandler() | 138 | +QWSsimpadButtonsHandler::~QWSsimpadButtonsHandler() |
118 | +{ | 139 | +{ |
@@ -135,12 +156,12 @@ | |||
135 | + return; | 156 | + return; |
136 | + } | 157 | + } |
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] ); |
140 | + | 161 | + |
141 | + bool press = switches.states[0]; // == switches.event[0]; | 162 | + bool press = switches.states[0]; // == switches.event[0]; |
142 | + int code = switches.events[0]; | 163 | + int code = switches.events[0]; |
143 | + int k = -1; | 164 | + k = -1; |
144 | + | 165 | + |
145 | + switch(code) | 166 | + switch(code) |
146 | + { | 167 | + { |
@@ -153,10 +174,36 @@ | |||
153 | + default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event!" ); break; | 174 | + default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event!" ); break; |
154 | + } | 175 | + } |
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 ) |
157 | + { | 195 | + { |
158 | + qwsServer->processKeyEvent( 0, k, 0, press, false ); | 196 | + qwsServer->processKeyEvent( 0, k, 0, press, false ); |
159 | + } | 197 | + } |
160 | +} | 198 | +} |
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 |