summaryrefslogtreecommitdiff
path: root/libopie2
Side-by-side diff
Diffstat (limited to 'libopie2') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp87
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h50
2 files changed, 92 insertions, 45 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 67dfa41..89b9258 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -1,27 +1,27 @@
/*
-                 This file is part of the Opie Project
-              Copyright (C) The Opie Team <opie-devel@handhelds.org>
- =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
+                 This file is part of the Opie Project
+              Copyright (C) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org>
+ =.
.=l.
-           .>+-=
- _;:,     .>    :=|. This program is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This program is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
@@ -238,6 +238,10 @@ void Zaurus::initButtons()
if ( d->m_buttons )
return;
+ if ( isQWS( ) ) {
+ addPreHandler(this);
+ }
+
d->m_buttons = new QValueList <ODeviceButton>;
struct z_button * pz_buttons;
@@ -591,3 +595,42 @@ OHingeStatus Zaurus::readHingeSensor() const
return CASE_UNKNOWN;
}
}
+
+/*
+ * Take code from iPAQ device.
+ * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction.
+ * I hope that is ok - Alwin
+ */
+bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
+{
+ Transformation rot;
+ int newkeycode = keycode;
+
+
+ if (d->m_model!=Model_Zaurus_SLC3000 && d->m_model!=Model_Zaurus_SLC7x0) return false;
+ rot = rotation();
+ if (rot==Rot0) return false;
+
+ /* map cursor keys depending on the hinge status */
+ switch ( keycode ) {
+ // Rotate cursor keys
+ case Key_Left :
+ case Key_Right:
+ case Key_Up :
+ case Key_Down :
+ {
+ if (rot==Rot90) {
+ newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
+ }
+ }
+ break;
+
+ }
+ if (newkeycode!=keycode) {
+ if ( newkeycode != Key_unknown ) {
+ QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
+ }
+ return true;
+ }
+ return false;
+}
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index 6e6ca46..1fb0cd9 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -1,27 +1,27 @@
/*
-                 This file is part of the Opie Project
-              Copyright (C) The Opie Team <opie-devel@handhelds.org>
- =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
+                 This file is part of the Opie Project
+              Copyright (C) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org>
+ =.
.=l.
-           .>+-=
- _;:,     .>    :=|. This program is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This program is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
@@ -32,6 +32,9 @@
#include "odevice_abstractmobiledevice.h"
+/* QT */
+#include <qwindowsystem_qws.h>
+
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
@@ -91,7 +94,7 @@ namespace Opie {
namespace Core {
namespace Internal {
-class Zaurus : public OAbstractMobileDevice
+class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter
{
protected:
virtual void init(const QString&);
@@ -119,6 +122,7 @@ class Zaurus : public OAbstractMobileDevice
protected:
virtual void buzzer( int snd );
+ virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
OLedState m_leds[1];
bool m_embedix;