summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-14 09:14:08 (UTC)
committer alwin <alwin>2005-03-14 09:14:08 (UTC)
commit69f310d4a0a2330d10ba37ff4db388e8c60ba64b (patch) (unidiff)
tree95d8e7660560ae88d04d6215b5b3e048400f7ebf
parent826bc5ef2aa34877fd8816ddfc4156f865dc9149 (diff)
downloadopie-69f310d4a0a2330d10ba37ff4db388e8c60ba64b.zip
opie-69f310d4a0a2330d10ba37ff4db388e8c60ba64b.tar.gz
opie-69f310d4a0a2330d10ba37ff4db388e8c60ba64b.tar.bz2
hopefull speedups on keyeventhandler, eventhandler will just set when
device with hinge-sensor.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 89b9258..59d4eb0 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -217,59 +217,59 @@ void Zaurus::init(const QString& cpu_info)
217 case Model_Zaurus_SLC7x0: 217 case Model_Zaurus_SLC7x0:
218 d->m_rotation = rotation(); 218 d->m_rotation = rotation();
219 d->m_direction = direction(); 219 d->m_direction = direction();
220 break; 220 break;
221 case Model_Zaurus_SLB600: // fallthrough 221 case Model_Zaurus_SLB600: // fallthrough
222 case Model_Zaurus_SL5000: // fallthrough 222 case Model_Zaurus_SL5000: // fallthrough
223 case Model_Zaurus_SL5500: // fallthrough 223 case Model_Zaurus_SL5500: // fallthrough
224 default: 224 default:
225 d->m_rotation = Rot270; 225 d->m_rotation = Rot270;
226 break; 226 break;
227 } 227 }
228 m_leds[0] = Led_Off; 228 m_leds[0] = Led_Off;
229 229
230 if ( m_embedix ) 230 if ( m_embedix )
231 qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); 231 qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr );
232 else 232 else
233 qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); 233 qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
234} 234}
235 235
236void Zaurus::initButtons() 236void Zaurus::initButtons()
237{ 237{
238 if ( d->m_buttons ) 238 if ( d->m_buttons )
239 return; 239 return;
240 240
241 if ( isQWS( ) ) {
242 addPreHandler(this);
243 }
244 241
245 d->m_buttons = new QValueList <ODeviceButton>; 242 d->m_buttons = new QValueList <ODeviceButton>;
246 243
247 struct z_button * pz_buttons; 244 struct z_button * pz_buttons;
248 int buttoncount; 245 int buttoncount;
249 switch ( d->m_model ) { 246 switch ( d->m_model ) {
250 case Model_Zaurus_SLC3000: // fallthrough 247 case Model_Zaurus_SLC3000: // fallthrough
251 case Model_Zaurus_SLC7x0: 248 case Model_Zaurus_SLC7x0:
249 if ( isQWS( ) ) {
250 addPreHandler(this); // hinge-sensor-handler
251 }
252 pz_buttons = z_buttons_c700; 252 pz_buttons = z_buttons_c700;
253 buttoncount = ARRAY_SIZE(z_buttons_c700); 253 buttoncount = ARRAY_SIZE(z_buttons_c700);
254 break; 254 break;
255 default: 255 default:
256 pz_buttons = z_buttons; 256 pz_buttons = z_buttons;
257 buttoncount = ARRAY_SIZE(z_buttons); 257 buttoncount = ARRAY_SIZE(z_buttons);
258 break; 258 break;
259 } 259 }
260 260
261 for ( int i = 0; i < buttoncount; i++ ) { 261 for ( int i = 0; i < buttoncount; i++ ) {
262 struct z_button *zb = pz_buttons + i; 262 struct z_button *zb = pz_buttons + i;
263 ODeviceButton b; 263 ODeviceButton b;
264 264
265 b.setKeycode( zb->code ); 265 b.setKeycode( zb->code );
266 b.setUserText( QObject::tr( "Button", zb->utext )); 266 b.setUserText( QObject::tr( "Button", zb->utext ));
267 b.setPixmap( Resource::loadPixmap( zb->pix )); 267 b.setPixmap( Resource::loadPixmap( zb->pix ));
268 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); 268 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
269 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); 269 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
270 d->m_buttons->append( b ); 270 d->m_buttons->append( b );
271 } 271 }
272 272
273 reloadButtonMapping(); 273 reloadButtonMapping();
274} 274}
275 275
@@ -582,55 +582,52 @@ OHingeStatus Zaurus::readHingeSensor() const
582 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); 582 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" );
583 return CASE_UNKNOWN; 583 return CASE_UNKNOWN;
584 } 584 }
585 } 585 }
586 } 586 }
587 else 587 else
588 { 588 {
589 // corgi keyboard is event source 0 in OZ kernel 2.6 589 // corgi keyboard is event source 0 in OZ kernel 2.6
590 OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); 590 OInputDevice* keyboard = OInputSystem::instance()->device( "event0" );
591 if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE; 591 if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE;
592 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT; 592 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT;
593 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED; 593 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED;
594 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); 594 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" );
595 return CASE_UNKNOWN; 595 return CASE_UNKNOWN;
596 } 596 }
597} 597}
598 598
599/* 599/*
600 * Take code from iPAQ device. 600 * Take code from iPAQ device.
601 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. 601 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction.
602 * I hope that is ok - Alwin 602 * I hope that is ok - Alwin
603 */ 603 */
604bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 604bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
605{ 605{
606 Transformation rot;
607 int newkeycode = keycode; 606 int newkeycode = keycode;
608 607
609
610 if (d->m_model!=Model_Zaurus_SLC3000 && d->m_model!=Model_Zaurus_SLC7x0) return false; 608 if (d->m_model!=Model_Zaurus_SLC3000 && d->m_model!=Model_Zaurus_SLC7x0) return false;
611 rot = rotation();
612 if (rot==Rot0) return false;
613 609
614 /* map cursor keys depending on the hinge status */ 610 /* map cursor keys depending on the hinge status */
615 switch ( keycode ) { 611 switch ( keycode ) {
616 // Rotate cursor keys 612 // Rotate cursor keys
617 case Key_Left : 613 case Key_Left :
618 case Key_Right: 614 case Key_Right:
619 case Key_Up : 615 case Key_Up :
620 case Key_Down : 616 case Key_Down :
621 { 617 {
622 if (rot==Rot90) { 618 if (rotation()==Rot90) {
623 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; 619 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
624 } 620 }
625 } 621 }
626 break; 622 break;
627 623
628 } 624 }
629 if (newkeycode!=keycode) { 625 if (newkeycode!=keycode) {
630 if ( newkeycode != Key_unknown ) { 626 if ( newkeycode != Key_unknown ) {
631 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); 627 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
632 } 628 }
633 return true; 629 return true;
634 } 630 }
635 return false; 631 return false;
636} 632}
633