summaryrefslogtreecommitdiff
path: root/packages/qte/qte-2.3.10
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2005-06-30 08:19:37 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-06-30 08:19:37 +0000
commitc8e5702127e507e82e6f68a4b8c546803accea9d (patch)
tree00583491f40ecc640f2b28452af995e3a63a09d7 /packages/qte/qte-2.3.10
parent87ec8ca4d2e2eb4d1c1e1e1a6b46a395d56805b9 (diff)
import clean BK tree at cset 1.3670
Diffstat (limited to 'packages/qte/qte-2.3.10')
-rw-r--r--packages/qte/qte-2.3.10/.mtn2git_empty0
-rw-r--r--packages/qte/qte-2.3.10/beagle.patch32
-rw-r--r--packages/qte/qte-2.3.10/bidimetrics.patch2389
-rw-r--r--packages/qte/qte-2.3.10/c700-hardware.patch110
-rw-r--r--packages/qte/qte-2.3.10/daemonize.patch113
-rw-r--r--packages/qte/qte-2.3.10/devfs.patch163
-rw-r--r--packages/qte/qte-2.3.10/encoding.patch34
-rw-r--r--packages/qte/qte-2.3.10/fix-linuxfb-setmode.patch32
-rw-r--r--packages/qte/qte-2.3.10/fix-qgfxraster.patch28
-rw-r--r--packages/qte/qte-2.3.10/gcc3.patch27
-rw-r--r--packages/qte/qte-2.3.10/increase-qxml-robustness.patch17
-rw-r--r--packages/qte/qte-2.3.10/ipaq-keyboard.patch27
-rw-r--r--packages/qte/qte-2.3.10/kernel-keymap-CXK.patch19
-rw-r--r--packages/qte/qte-2.3.10/kernel-keymap-corgi.patch23
-rw-r--r--packages/qte/qte-2.3.10/kernel-keymap-tosa.patch81
-rw-r--r--packages/qte/qte-2.3.10/kernel-keymap.patch1038
-rw-r--r--packages/qte/qte-2.3.10/mnci-touchscreen.patch1987
-rw-r--r--packages/qte/qte-2.3.10/mnci.patch125
-rw-r--r--packages/qte/qte-2.3.10/no-moc.patch37
-rw-r--r--packages/qte/qte-2.3.10/openmn/.mtn2git_empty0
-rw-r--r--packages/qte/qte-2.3.10/openmn/qkeyboard_qws.cpp584
-rw-r--r--packages/qte/qte-2.3.10/openmn/qkeyboard_qws.h56
-rw-r--r--packages/qte/qte-2.3.10/qiconview-speed.patch122
-rw-r--r--packages/qte/qte-2.3.10/qpe.patch105
-rw-r--r--packages/qte/qte-2.3.10/qt-visibility.patch459
-rw-r--r--packages/qte/qte-2.3.10/qtabbar.patch39
-rw-r--r--packages/qte/qte-2.3.10/qte-fix-iconsize.patch99
-rw-r--r--packages/qte/qte-2.3.10/sharp_char.h309
-rw-r--r--packages/qte/qte-2.3.10/switches.h74
-rw-r--r--packages/qte/qte-2.3.10/vt-switch.patch178
30 files changed, 8307 insertions, 0 deletions
diff --git a/packages/qte/qte-2.3.10/.mtn2git_empty b/packages/qte/qte-2.3.10/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/qte/qte-2.3.10/.mtn2git_empty
diff --git a/packages/qte/qte-2.3.10/beagle.patch b/packages/qte/qte-2.3.10/beagle.patch
index e69de29bb2..eeb31c3b98 100644
--- a/packages/qte/qte-2.3.10/beagle.patch
+++ b/packages/qte/qte-2.3.10/beagle.patch
@@ -0,0 +1,32 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp~beagle
++++ qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp
+@@ -138,7 +138,7 @@
+ #include <asm/sharp_char.h>
+ #endif
+
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
++#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_BEAGLE)
+ #define QT_QWS_AUTOREPEAT_MANUALLY
+ #endif
+
+@@ -492,9 +492,15 @@
+ #endif
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 90
++#ifdef QT_QWS_BEAGLE
++ { Qt::Key_F13, 0xffff , 0xffff , 0xffff }, // lightning
++ { Qt::Key_Up, 0xffff , 0xffff , 0xffff }, // Wheel Up
++ { Qt::Key_Down, 0xffff , 0xffff , 0xffff }, // Wheel Down
++#else
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
++#endif
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_Enter, 13 , 13 , 0xffff },
diff --git a/packages/qte/qte-2.3.10/bidimetrics.patch b/packages/qte/qte-2.3.10/bidimetrics.patch
index e69de29bb2..50990f5d19 100644
--- a/packages/qte/qte-2.3.10/bidimetrics.patch
+++ b/packages/qte/qte-2.3.10/bidimetrics.patch
@@ -0,0 +1,2389 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+Index: qt-2.3.10/src/kernel/qgfxraster_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qgfxraster_qws.cpp 2005-05-13 22:22:11.000000000 +0200
++++ qt-2.3.10/src/kernel/qgfxraster_qws.cpp 2005-05-13 22:22:13.000000000 +0200
+@@ -51,6 +51,11 @@
+ #include <fcntl.h>
+ #include <errno.h>
+
++//HAQ bidi patch
++#ifdef USE_BIDI
++#include "qbidi.h"
++#endif
++// end HAQ patch
+
+ extern bool qws_sw_cursor;
+
+@@ -1382,6 +1387,53 @@
+ setAlphaType(BigEndianMask);
+ }
+
++#ifdef USE_BIDI
++ // HAQ do bidi
++ QString n;
++ qApplyBidi(s, n);
++
++ for( loopc=0; loopc < int(n.length()); loopc++ ) {
++ QGlyph glyph = memorymanager->lockGlyph(myfont, n[loopc]);
++ int myw=glyph.metrics->width;
++ srcwidth = myw;
++ srcheight = glyph.metrics->height;
++ setAlphaSource(glyph.data,glyph.metrics->linestep);
++ int myx=x;
++ int myy=y;
++ myx+=glyph.metrics->bearingx;
++ myy-=glyph.metrics->bearingy;
++
++ // HAQ hack to show arabic tashkeel (diacriticals) above
++ // the previous character (which in reversed arabic, as it is here, is the next character)
++
++ QChar c = n[loopc];
++ if (ISTASHKEEL(c.unicode())) {
++ //printf("glyph %d bearingx %d width %d advance %d\n",
++ // c.unicode(),glyph.metrics->bearingx, glyph.metrics->width, glyph.metrics->advance);
++
++ if (loopc < int(n.length()-1)) // if there is a following character then place this glyph over it
++ {
++ QGlyph nextGlyph = memorymanager->lockGlyph(myfont, n[loopc+1]);
++ int nextCharWidth = nextGlyph.metrics->width;
++ myx += nextCharWidth/2 - glyph.metrics->width;
++ // pre-undo the advance in x so that the next glyph is placed over this one
++ x -= glyph.metrics->advance;
++ }
++ }
++
++ if(glyph.metrics->width<1 || glyph.metrics->height<1
++ || glyph.metrics->linestep==0)
++ {
++ // non-printing characters
++ } else {
++ blt(myx,myy,myw,glyph.metrics->height,0,0);
++ }
++ x+=glyph.metrics->advance;
++ // ... unlock glyph
++ }
++
++#else
++
+ for( loopc=0; loopc < int(s.length()); loopc++ ) {
+ QGlyph glyph = memorymanager->lockGlyph(myfont, s[loopc]);
+ int myw=glyph.metrics->width;
+@@ -1402,6 +1454,9 @@
+ x+=glyph.metrics->advance;
+ // ... unlock glyph
+ }
++
++#endif
++
+ #ifdef DEBUG_LOCKS
+ qDebug("unaccelerated drawText unlock");
+ #endif
+Index: qt-2.3.10/src/kernel/qfont_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qfont_qws.cpp 2005-05-13 22:22:11.000000000 +0200
++++ qt-2.3.10/src/kernel/qfont_qws.cpp 2005-05-13 22:22:13.000000000 +0200
+@@ -49,6 +49,12 @@
+ #include "qfontmanager_qws.h"
+ #include "qmemorymanager_qws.h"
+
++//HAQ
++#ifdef USE_BIDI
++#include "qbidi.h"
++#endif
++// end HAQ
++
+ // QFont_Private accesses QFont protected functions
+
+ class QFont_Private : public QFont
+@@ -385,17 +391,46 @@
+
+ int QFontMetrics::width( QChar ch ) const
+ {
++#ifdef USE_BIDI
++
++ int advance;
++ if (ISTASHKEEL(ch.unicode())) {
++ advance = 0;
++ }
++ else
++ advance = memorymanager->lockGlyphMetrics(((QFontMetrics*)this)->internal()->handle(),ch)->advance;
++ return advance;
++
++#else
++
+ return memorymanager->lockGlyphMetrics(((QFontMetrics*)this)->internal()->handle(),ch)->advance;
++
++#endif
+ }
+
+ int QFontMetrics::width( const QString &str, int len ) const
+ {
++#ifdef USE_BIDI
++
++ QString n;
++ qApplyBidi(str, n);
++ if (len < 0) len = n.length();
++ int ret=0;
++ for (int i=0; i<len; i++)
++ ret += width(n[i]);
++ return ret;
++
++#else
++
+ if ( len < 0 )
+ len = str.length();
+ int ret=0;
+ for (int i=0; i<len; i++)
+ ret += width(str[i]);
+ return ret;
++
++#endif
++
+ }
+
+ QRect QFontMetrics::boundingRect( const QString &str, int len ) const
+Index: qt-2.3.10/src/kernel/qbidi.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ qt-2.3.10/src/kernel/qbidi.h 2005-05-13 22:22:13.000000000 +0200
+@@ -0,0 +1,6 @@
++#include "stdio.h"
++#include <qstring.h>
++
++#define ISTASHKEEL(x) ((x >= 0x64B && x<=0x658) || (x>=0x6d6 && x <= 0x6dc) || (x>=0x6df && x <= 0x6e4) || x==0x6e7 || x == 0x6e8 || (x>=0x6ea && x <= 0x6ed) || (x>=0xfe70 && x <= 0xfe7f))
++
++void qApplyBidi(const QString& s, QString& news);
+Index: qt-2.3.10/src/kernel/qbidi.cpp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ qt-2.3.10/src/kernel/qbidi.cpp 2005-05-13 22:22:13.000000000 +0200
+@@ -0,0 +1,45 @@
++#include <malloc.h>
++#include "qbidi.h"
++
++
++#define BLOCKTYPE unsigned short*
++#define CHARTYPE unsigned short
++
++extern "C" {
++
++int doShape(BLOCKTYPE line, CHARTYPE* to, int from, int count);
++int doBidi(BLOCKTYPE line, int count, int applyShape, int reorderCombining, int removeMarks);
++
++}
++
++void qApplyBidi(const QString& s, QString& news) {
++ //convert to utf16 zero-terminated
++ //printf(": qs length is %d\n",s.length());
++ int loopc;
++ int slength = sizeof(unsigned short) * (s.length());
++ //printf(": slength is %d\n",slength);
++ unsigned short* sutf16 = (unsigned short*)malloc(slength);
++ for( loopc=0; loopc < int(s.length()); loopc++ ) {
++ sutf16[loopc] = s[loopc].unicode();
++ //printf(": char %d is %x\n",loopc,sutf16[loopc]);
++ }
++ //printf(": mark 0\n");
++ ///sutf16[s.length()] = 0;
++
++ unsigned short* sutf16s = (unsigned short*)malloc(slength);
++ doShape(sutf16,sutf16s,0,s.length());
++ //printf(": do bidi\n");
++ doBidi(sutf16s, s.length(),0,0,0);
++ //sutf16s[s.length()] = 0;
++
++ //printf(": back to QString\n");
++ news = "";
++ for( loopc=0; loopc < s.length(); loopc++ ) {
++ QChar newChar((short) sutf16s[loopc]);
++ news = news + newChar;
++ //printf(": add char %x\n",newChar.unicode());
++ }
++
++ free(sutf16);
++ free(sutf16s);
++}
+Index: qt-2.3.10/src/kernel/minibidi.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ qt-2.3.10/src/kernel/minibidi.c 2005-05-13 22:22:13.000000000 +0200
+@@ -0,0 +1,2127 @@
++/************************************************************************
++ * $Id: minibidi.c,v 1.2 2005/04/08 18:01:45 lynch Exp $
++ *
++ * ------------
++ * Description:
++ * ------------
++ * This is an implemention of Unicode's Bidirectional Algorithm
++ * (known as UAX #9).
++ *
++ * http://www.unicode.org/reports/tr9/
++ *
++ * Author: Ahmad Khalifa
++ *
++ * -----------------
++ * Revision Details: (Updated by Revision Control System)
++ * -----------------
++ * $Date: 2005/04/08 18:01:45 $
++ * $Author: lynch $
++ * $Revision: 1.2 $
++ * $Source: /home/arabeyes/cvs/projects/external/qt_e/minibidi.c,v $
++ *
++ * (www.arabeyes.org - under MIT license)
++ *
++ ************************************************************************/
++
++#include <malloc.h> /* malloc() and free() definition */
++
++/*
++ * Datatype Extension Macros
++ */
++#define BLOCKTYPE unsigned short*
++#define CHARTYPE unsigned short
++#define GETCHAR(from,i) from[i]
++
++#define GetType(x) getType(x)
++/*=====TESTING mode===========*/
++//#define GetType(x) getCAPRtl(x)
++
++#define lenof(x) sizeof(x) / sizeof(x[0])
++
++/* character types */
++enum
++{
++ /* Strong Char Types */
++ L, /* Left-to-Right char */
++ LRE, /* Left-to-Right Embedding */
++ LRO, /* Left-to-Right Override */
++ R, /* Right-to-Left char */
++ AL, /* Right-to-Left Arabic char */
++ RLE, /* Right-to-Left Embedding */
++ RLO, /* Right-to-Left Override */
++ /* Weak Char Types */
++ PDF, /* Pop Directional Format */
++ EN, /* European Number */
++ ES, /* European Number Separator */
++ ET, /* European Number Terminator */
++ AN, /* Arabic Number */
++ CS, /* Common Number Separator */
++ NSM, /* Non Spacing Mark */
++ BN, /* Boundary Neutral */
++ /* Neutral Char Types */
++ B, /* Paragraph Separator */
++ S, /* Segment Separator */
++ WS, /* Whitespace */
++ ON, /* Other Neutrals */
++};
++
++/* Shaping Types */
++enum
++{
++ SL, /* Left-Joining, doesnt exist in U+0600 - U+06FF */
++ SR, /* Right-Joining, ie has Isolated, Final */
++ SD, /* Dual-Joining, ie has Isolated, Final, Initial, Medial */
++ SU, /* Non-Joining */
++ SC /* Join-Causing, like U+0640 (TATWEEL) */
++};
++
++#define odd(x) (x%2)
++/* Returns the first odd/even value greater than x */
++#define leastGreaterOdd(x) odd(x) ? (x+2) : (x+1)
++#define leastGreaterEven(x) odd(x) ? (x+1) : (x+2)
++
++/* Shaping Helpers */
++#define STYPE(xh) ((xh >= SHAPE_FIRST) && (xh <= SHAPE_LAST)) ? \
++ shapetypes[xh-SHAPE_FIRST].type : SU
++#define SISOLATED(xh) shapetypes[xh-SHAPE_FIRST].form_b
++#define SFINAL(xh) xh+1
++#define SINITIAL(xh) xh+2
++#define SMEDIAL(xh) xh+3
++
++
++/* function declarations */
++int findIndexOfRun(unsigned char* level , int start, int count, int tlevel);
++unsigned char getType(CHARTYPE ch);
++unsigned char getCAPRtl(CHARTYPE ch);
++void doMirror(BLOCKTYPE ch);
++
++typedef struct{
++ unsigned char type;
++ unsigned short form_b;
++} shape_node;
++
++/* Kept near the actual table, for verification. */
++#define SHAPE_FIRST 0x621
++#define SHAPE_LAST 0x668
++/* very bad Memory alignment for 32-bit machines
++ * could split it to 2 arrays or promote type to 2 bytes type
++ */
++shape_node shapetypes[] = {
++/* index, Typ, Iso */
++/* 621 */ {SU, 0xFE80},
++/* 622 */ {SR, 0xFE81},
++/* 623 */ {SR, 0xFE83},
++/* 624 */ {SR, 0xFE85},
++/* 625 */ {SR, 0xFE87},
++/* 626 */ {SD, 0xFE89},
++/* 627 */ {SR, 0xFE8D},
++/* 628 */ {SD, 0xFE8F},
++/* 629 */ {SR, 0xFE93},
++/* 62A */ {SD, 0xFE95},
++/* 62B */ {SD, 0xFE99},
++/* 62C */ {SD, 0xFE9D},
++/* 62D */ {SD, 0xFEA1},
++/* 62E */ {SD, 0xFEA5},
++/* 62F */ {SR, 0xFEA9},
++/* 630 */ {SR, 0xFEAB},
++/* 631 */ {SR, 0xFEAD},
++/* 632 */ {SR, 0xFEAF},
++/* 633 */ {SD, 0xFEB1},
++/* 634 */ {SD, 0xFEB5},
++/* 635 */ {SD, 0xFEB9},
++/* 636 */ {SD, 0xFEBD},
++/* 637 */ {SD, 0xFEC1},
++/* 638 */ {SD, 0xFEC5},
++/* 639 */ {SD, 0xFEC9},
++/* 63A */ {SD, 0xFECD},
++/* 63B */ {SU, 0x0},
++/* 63C */ {SU, 0x0},
++/* 63D */ {SU, 0x0},
++/* 63E */ {SU, 0x0},
++/* 63F */ {SU, 0x0},
++/* 640 */ {SC, 0x0},
++/* 641 */ {SD, 0xFED1},
++/* 642 */ {SD, 0xFED5},
++/* 643 */ {SD, 0xFED9},
++/* 644 */ {SD, 0xFEDD},
++/* 645 */ {SD, 0xFEE1},
++/* 646 */ {SD, 0xFEE5},
++/* 647 */ {SD, 0xFEE9},
++/* 648 */ {SR, 0xFEED},
++/* 649 */ {SR, 0xFEEF}, /* SD */
++/* 64A */ {SD, 0xFEF1},
++/* 64B */ {SU, 0xFEF1},
++/* 64C */ {SU, 0xFEF1},
++/* 64D */ {SU, 0xFEF1},
++/* 64E */ {SU, 0xFEF1},
++/* 64F */ {SU, 0xFEF1},
++/* 650 */ {SU,0xFEF1},
++/* 651 */ {SU,0xFEF1},
++/* 652 */ {SU,0xFEF1},
++/* 653 */ {SU, 0xFEF1},
++/* 654 */ {SU, 0xFEF1},
++/* 655 */ {SU, 0xFEF1},
++/* 656 */ {SU, 0xFEF1},
++/* 657 */ {SU, 0xFEF1},
++/* 658 */ {SU, 0xFEF1},
++/* 659 */ {SU, 0xFEF1},
++/* 65a */ {SU, 0xFEF1},
++/* 65b */ {SU, 0xFEF1},
++/* 65c */ {SU, 0xFEF1},
++/* 65d */ {SU, 0xFEF1},
++/* 65e */ {SU, 0xFEF1},
++/* 65f */ {SU, 0xFEF1},
++/* 660 */ {SU, 0xFEF1},
++/* 661 */ {SU, 0xFEF1},
++/* 662 */ {SU, 0xFEF1},
++/* 663 */ {SU, 0xFEF1},
++/* 664 */ {SU, 0xFEF1},
++/* 665 */ {SU, 0xFEF1},
++/* 666 */ {SU, 0xFEF1},
++/* 667 */ {SU, 0xFEF1},
++/* 668 */ {SU, 0xFEF1}
++};
++
++/*
++ * Flips the text buffer, according to max level, and
++ * all higher levels
++ *
++ * Input:
++ * from: text buffer, on which to apply flipping
++ * level: resolved levels buffer
++ * max: the maximum level found in this line (should be unsigned char)
++ * count: line size in wchar_t
++ */
++void flipThisRun(BLOCKTYPE from, unsigned char* level, int max, int count)
++{
++ int i, j, rcount, tlevel;
++ CHARTYPE temp;
++
++
++ j = i = 0;
++ while(i<count && j<count)
++ {
++
++ /* find the start of the run of level=max */
++ tlevel = max;
++ i = j = findIndexOfRun(level, i, count, max);
++ /* find the end of the run */
++ while((tlevel <= level[i]) && (i < count))
++ {
++ i++;
++ }
++ rcount = i-j;
++ for(; rcount>((i-j)/2); rcount--)
++ {
++ temp = GETCHAR(from, j+rcount-1);
++ GETCHAR(from, j+rcount-1) = GETCHAR(from, i-rcount);
++ GETCHAR(from, i-rcount) = temp;
++ }
++ }
++}
++
++/*
++ * Finds the index of a run with level equals tlevel
++ */
++int findIndexOfRun(unsigned char* level , int start, int count, int tlevel)
++{
++ int i;
++ for(i=start; i<count; i++)
++ {
++ if(tlevel <= level[i])
++ {
++ return i;
++ }
++ }
++ return count;
++}
++
++unsigned char GetParagraphLevel(BLOCKTYPE line, int count)
++{
++ int i;
++ for( i=0; i<count ; i++)
++ {
++ if(GetType(GETCHAR(line, i)) == R || GetType(/*line[i]*/ GETCHAR(line, i)) == AL)
++ return 1;
++ else if(GetType(GETCHAR(line, i)) == L)
++ return 0;
++ }
++ return 0; /* Compiler Nag-Stopper */
++}
++
++/*
++ * Returns character type of ch, by calling RLE table lookup
++ * function
++ */
++unsigned char getCAPRtl(CHARTYPE ch)
++{
++/* CAPRtl Charset */
++int TypesFromChar[] =
++{
++//0 1 2 3 4 5 6 7 8 9 a b c d e f
++ ON, ON, ON, ON, L, R, ON, ON, ON, ON, ON, ON, ON, B, RLO,RLE, /*00-0f*/
++ LRO,LRE,PDF,WS, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, /*10-1f*/
++
++ WS, ON, ON, ON, ET, ON, ON, ON, ON, ON, ON, ET, CS, ON, ES, ES, /*20-2f*/
++ EN, EN, EN, EN, EN, EN, AN, AN, AN, AN, LRE, RLE, RLO, PDF, LRO, ON, /*30-3f*/
++ R, AL, AL, AL, AL, AL, AL, R, R, R, R, R, R, R, R, R, /*40-4f*/
++ R, R, R, R, R, R, R, R, R, R, R, ON, B, ON, ON, ON, /*50-5f*/
++ NSM, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, /*60-6f*/
++ L, L, L, L, L, L, L, L, L, L, L, ON, S, ON, ON, ON, /*70-7f*/
++};
++
++//0 1 2 3 4 5 6 7 8 9 a b c d e f
++// ON, ON, ON, ON, L, R, ON, ON, ON, ON, ON, ON, ON, B, RLO,RLE, /*00-0f*/
++//LRO,LRE,PDF,WS, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, /*10-1f*/
++
++// WS, ON, ON, ON, ET, ON, ON, ON, ON, ON, ON, ET, CS, ON, ES, ES, /*20-2f*/
++// EN, EN, EN, EN, EN, EN, AN, AN, AN, AN, CS, ON, ON, ON, ON, ON, /*30-3f*/
++// R, AL, AL, AL, AL, AL, AL, R, R, R, R, R, R, R, R, R, /*40-4f*/
++// R, R, R, R, R, R, R, R, R, R, R, ON, B, ON, ON, ON, /*50-5f*/
++// NSM, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, /*60-6f*/
++// L, L, L, L, L, L, L, L, L, L, L, ON, S, ON, ON, ON, /*70-7f*/
++//};
++ if(ch <0x7f)
++ return TypesFromChar[ch];
++ else
++ return R;
++}
++
++unsigned char getType(CHARTYPE ch)
++{
++ static const struct {
++ CHARTYPE first, last, type;
++ } lookup[] = {
++ {0x0000, 0x0008, BN},
++ {0x0009, 0x0009, S},
++ {0x000a, 0x000a, B},
++ {0x000b, 0x000b, S},
++ {0x000c, 0x000c, WS},
++ {0x000d, 0x000d, B},
++ {0x000e, 0x001b, BN},
++ {0x001c, 0x001e, B},
++ {0x001f, 0x001f, S},
++ {0x0020, 0x0020, WS},
++ {0x0023, 0x0025, ET},
++ {0x002b, 0x002b, ES},
++ {0x002c, 0x002c, CS},
++ {0x002d, 0x002d, ES},
++ {0x002e, 0x002f, CS},
++ {0x0030, 0x0039, EN},
++ {0x003a, 0x003a, CS},
++ {0x0041, 0x005a, L},
++ {0x0061, 0x007a, L},
++ {0x007f, 0x0084, BN},
++ {0x0085, 0x0085, B},
++ {0x0086, 0x009f, BN},
++ {0x00a0, 0x00a0, CS},
++ {0x00a2, 0x00a5, ET},
++ {0x00aa, 0x00aa, L},
++ {0x00ad, 0x00ad, BN},
++ {0x00b0, 0x00b1, ET},
++ {0x00b2, 0x00b3, EN},
++ {0x00b5, 0x00b5, L},
++ {0x00b9, 0x00b9, EN},
++ {0x00ba, 0x00ba, L},
++ {0x00c0, 0x00d6, L},
++ {0x00d8, 0x00f6, L},
++ {0x00f8, 0x0236, L},
++ {0x0250, 0x02b8, L},
++ {0x02bb, 0x02c1, L},
++ {0x02d0, 0x02d1, L},
++ {0x02e0, 0x02e4, L},
++ {0x02ee, 0x02ee, L},
++ {0x0300, 0x0357, NSM},
++ {0x035d, 0x036f, NSM},
++ {0x037a, 0x037a, L},
++ {0x0386, 0x0386, L},
++ {0x0388, 0x038a, L},
++ {0x038c, 0x038c, L},
++ {0x038e, 0x03a1, L},
++ {0x03a3, 0x03ce, L},
++ {0x03d0, 0x03f5, L},
++ {0x03f7, 0x03fb, L},
++ {0x0400, 0x0482, L},
++ {0x0483, 0x0486, NSM},
++ {0x0488, 0x0489, NSM},
++ {0x048a, 0x04ce, L},
++ {0x04d0, 0x04f5, L},
++ {0x04f8, 0x04f9, L},
++ {0x0500, 0x050f, L},
++ {0x0531, 0x0556, L},
++ {0x0559, 0x055f, L},
++ {0x0561, 0x0587, L},
++ {0x0589, 0x0589, L},
++ {0x0591, 0x05a1, NSM},
++ {0x05a3, 0x05b9, NSM},
++ {0x05bb, 0x05bd, NSM},
++ {0x05be, 0x05be, R},
++ {0x05bf, 0x05bf, NSM},
++ {0x05c0, 0x05c0, R},
++ {0x05c1, 0x05c2, NSM},
++ {0x05c3, 0x05c3, R},
++ {0x05c4, 0x05c4, NSM},
++ {0x05d0, 0x05ea, R},
++ {0x05f0, 0x05f4, R},
++ {0x0600, 0x0603, AL},
++ {0x060c, 0x060c, CS},
++ {0x060d, 0x060d, AL},
++ {0x0610, 0x0615, NSM},
++ {0x061b, 0x061b, AL},
++ {0x061f, 0x061f, AL},
++ {0x0621, 0x063a, AL},
++ {0x0640, 0x064a, AL},
++ {0x064b, 0x0658, NSM},
++ {0x0660, 0x0669, AN},
++ {0x066a, 0x066a, ET},
++ {0x066b, 0x066c, AN},
++ {0x066d, 0x066f, AL},
++ {0x0670, 0x0670, NSM},
++ {0x0671, 0x06d5, AL},
++ {0x06d6, 0x06dc, NSM},
++ {0x06dd, 0x06dd, AL},
++ {0x06de, 0x06e4, NSM},
++ {0x06e5, 0x06e6, AL},
++ {0x06e7, 0x06e8, NSM},
++ {0x06ea, 0x06ed, NSM},
++ {0x06ee, 0x06ef, AL},
++ {0x06f0, 0x06f9, EN},
++ {0x06fa, 0x070d, AL},
++ {0x070f, 0x070f, BN},
++ {0x0710, 0x0710, AL},
++ {0x0711, 0x0711, NSM},
++ {0x0712, 0x072f, AL},
++ {0x0730, 0x074a, NSM},
++ {0x074d, 0x074f, AL},
++ {0x0780, 0x07a5, AL},
++ {0x07a6, 0x07b0, NSM},
++ {0x07b1, 0x07b1, AL},
++ {0x0901, 0x0902, NSM},
++ {0x0903, 0x0939, L},
++ {0x093c, 0x093c, NSM},
++ {0x093d, 0x0940, L},
++ {0x0941, 0x0948, NSM},
++ {0x0949, 0x094c, L},
++ {0x094d, 0x094d, NSM},
++ {0x0950, 0x0950, L},
++ {0x0951, 0x0954, NSM},
++ {0x0958, 0x0961, L},
++ {0x0962, 0x0963, NSM},
++ {0x0964, 0x0970, L},
++ {0x0981, 0x0981, NSM},
++ {0x0982, 0x0983, L},
++ {0x0985, 0x098c, L},
++ {0x098f, 0x0990, L},
++ {0x0993, 0x09a8, L},
++ {0x09aa, 0x09b0, L},
++ {0x09b2, 0x09b2, L},
++ {0x09b6, 0x09b9, L},
++ {0x09bc, 0x09bc, NSM},
++ {0x09bd, 0x09c0, L},
++ {0x09c1, 0x09c4, NSM},
++ {0x09c7, 0x09c8, L},
++ {0x09cb, 0x09cc, L},
++ {0x09cd, 0x09cd, NSM},
++ {0x09d7, 0x09d7, L},
++ {0x09dc, 0x09dd, L},
++ {0x09df, 0x09e1, L},
++ {0x09e2, 0x09e3, NSM},
++ {0x09e6, 0x09f1, L},
++ {0x09f2, 0x09f3, ET},
++ {0x09f4, 0x09fa, L},
++ {0x0a01, 0x0a02, NSM},
++ {0x0a03, 0x0a03, L},
++ {0x0a05, 0x0a0a, L},
++ {0x0a0f, 0x0a10, L},
++ {0x0a13, 0x0a28, L},
++ {0x0a2a, 0x0a30, L},
++ {0x0a32, 0x0a33, L},
++ {0x0a35, 0x0a36, L},
++ {0x0a38, 0x0a39, L},
++ {0x0a3c, 0x0a3c, NSM},
++ {0x0a3e, 0x0a40, L},
++ {0x0a41, 0x0a42, NSM},
++ {0x0a47, 0x0a48, NSM},
++ {0x0a4b, 0x0a4d, NSM},
++ {0x0a59, 0x0a5c, L},
++ {0x0a5e, 0x0a5e, L},
++ {0x0a66, 0x0a6f, L},
++ {0x0a70, 0x0a71, NSM},
++ {0x0a72, 0x0a74, L},
++ {0x0a81, 0x0a82, NSM},
++ {0x0a83, 0x0a83, L},
++ {0x0a85, 0x0a8d, L},
++ {0x0a8f, 0x0a91, L},
++ {0x0a93, 0x0aa8, L},
++ {0x0aaa, 0x0ab0, L},
++ {0x0ab2, 0x0ab3, L},
++ {0x0ab5, 0x0ab9, L},
++ {0x0abc, 0x0abc, NSM},
++ {0x0abd, 0x0ac0, L},
++ {0x0ac1, 0x0ac5, NSM},
++ {0x0ac7, 0x0ac8, NSM},
++ {0x0ac9, 0x0ac9, L},
++ {0x0acb, 0x0acc, L},
++ {0x0acd, 0x0acd, NSM},
++ {0x0ad0, 0x0ad0, L},
++ {0x0ae0, 0x0ae1, L},
++ {0x0ae2, 0x0ae3, NSM},
++ {0x0ae6, 0x0aef, L},
++ {0x0af1, 0x0af1, ET},
++ {0x0b01, 0x0b01, NSM},
++ {0x0b02, 0x0b03, L},
++ {0x0b05, 0x0b0c, L},
++ {0x0b0f, 0x0b10, L},
++ {0x0b13, 0x0b28, L},
++ {0x0b2a, 0x0b30, L},
++ {0x0b32, 0x0b33, L},
++ {0x0b35, 0x0b39, L},
++ {0x0b3c, 0x0b3c, NSM},
++ {0x0b3d, 0x0b3e, L},
++ {0x0b3f, 0x0b3f, NSM},
++ {0x0b40, 0x0b40, L},
++ {0x0b41, 0x0b43, NSM},
++ {0x0b47, 0x0b48, L},
++ {0x0b4b, 0x0b4c, L},
++ {0x0b4d, 0x0b4d, NSM},
++ {0x0b56, 0x0b56, NSM},
++ {0x0b57, 0x0b57, L},
++ {0x0b5c, 0x0b5d, L},
++ {0x0b5f, 0x0b61, L},
++ {0x0b66, 0x0b71, L},
++ {0x0b82, 0x0b82, NSM},
++ {0x0b83, 0x0b83, L},
++ {0x0b85, 0x0b8a, L},
++ {0x0b8e, 0x0b90, L},
++ {0x0b92, 0x0b95, L},
++ {0x0b99, 0x0b9a, L},
++ {0x0b9c, 0x0b9c, L},
++ {0x0b9e, 0x0b9f, L},
++ {0x0ba3, 0x0ba4, L},
++ {0x0ba8, 0x0baa, L},
++ {0x0bae, 0x0bb5, L},
++ {0x0bb7, 0x0bb9, L},
++ {0x0bbe, 0x0bbf, L},
++ {0x0bc0, 0x0bc0, NSM},
++ {0x0bc1, 0x0bc2, L},
++ {0x0bc6, 0x0bc8, L},
++ {0x0bca, 0x0bcc, L},
++ {0x0bcd, 0x0bcd, NSM},
++ {0x0bd7, 0x0bd7, L},
++ {0x0be7, 0x0bf2, L},
++ {0x0bf9, 0x0bf9, ET},
++ {0x0c01, 0x0c03, L},
++ {0x0c05, 0x0c0c, L},
++ {0x0c0e, 0x0c10, L},
++ {0x0c12, 0x0c28, L},
++ {0x0c2a, 0x0c33, L},
++ {0x0c35, 0x0c39, L},
++ {0x0c3e, 0x0c40, NSM},
++ {0x0c41, 0x0c44, L},
++ {0x0c46, 0x0c48, NSM},
++ {0x0c4a, 0x0c4d, NSM},
++ {0x0c55, 0x0c56, NSM},
++ {0x0c60, 0x0c61, L},
++ {0x0c66, 0x0c6f, L},
++ {0x0c82, 0x0c83, L},
++ {0x0c85, 0x0c8c, L},
++ {0x0c8e, 0x0c90, L},
++ {0x0c92, 0x0ca8, L},
++ {0x0caa, 0x0cb3, L},
++ {0x0cb5, 0x0cb9, L},
++ {0x0cbc, 0x0cbc, NSM},
++ {0x0cbd, 0x0cc4, L},
++ {0x0cc6, 0x0cc8, L},
++ {0x0cca, 0x0ccb, L},
++ {0x0ccc, 0x0ccd, NSM},
++ {0x0cd5, 0x0cd6, L},
++ {0x0cde, 0x0cde, L},
++ {0x0ce0, 0x0ce1, L},
++ {0x0ce6, 0x0cef, L},
++ {0x0d02, 0x0d03, L},
++ {0x0d05, 0x0d0c, L},
++ {0x0d0e, 0x0d10, L},
++ {0x0d12, 0x0d28, L},
++ {0x0d2a, 0x0d39, L},
++ {0x0d3e, 0x0d40, L},
++ {0x0d41, 0x0d43, NSM},
++ {0x0d46, 0x0d48, L},
++ {0x0d4a, 0x0d4c, L},
++ {0x0d4d, 0x0d4d, NSM},
++ {0x0d57, 0x0d57, L},
++ {0x0d60, 0x0d61, L},
++ {0x0d66, 0x0d6f, L},
++ {0x0d82, 0x0d83, L},
++ {0x0d85, 0x0d96, L},
++ {0x0d9a, 0x0db1, L},
++ {0x0db3, 0x0dbb, L},
++ {0x0dbd, 0x0dbd, L},
++ {0x0dc0, 0x0dc6, L},
++ {0x0dca, 0x0dca, NSM},
++ {0x0dcf, 0x0dd1, L},
++ {0x0dd2, 0x0dd4, NSM},
++ {0x0dd6, 0x0dd6, NSM},
++ {0x0dd8, 0x0ddf, L},
++ {0x0df2, 0x0df4, L},
++ {0x0e01, 0x0e30, L},
++ {0x0e31, 0x0e31, NSM},
++ {0x0e32, 0x0e33, L},
++ {0x0e34, 0x0e3a, NSM},
++ {0x0e3f, 0x0e3f, ET},
++ {0x0e40, 0x0e46, L},
++ {0x0e47, 0x0e4e, NSM},
++ {0x0e4f, 0x0e5b, L},
++ {0x0e81, 0x0e82, L},
++ {0x0e84, 0x0e84, L},
++ {0x0e87, 0x0e88, L},
++ {0x0e8a, 0x0e8a, L},
++ {0x0e8d, 0x0e8d, L},
++ {0x0e94, 0x0e97, L},
++ {0x0e99, 0x0e9f, L},
++ {0x0ea1, 0x0ea3, L},
++ {0x0ea5, 0x0ea5, L},
++ {0x0ea7, 0x0ea7, L},
++ {0x0eaa, 0x0eab, L},
++ {0x0ead, 0x0eb0, L},
++ {0x0eb1, 0x0eb1, NSM},
++ {0x0eb2, 0x0eb3, L},
++ {0x0eb4, 0x0eb9, NSM},
++ {0x0ebb, 0x0ebc, NSM},
++ {0x0ebd, 0x0ebd, L},
++ {0x0ec0, 0x0ec4, L},
++ {0x0ec6, 0x0ec6, L},
++ {0x0ec8, 0x0ecd, NSM},
++ {0x0ed0, 0x0ed9, L},
++ {0x0edc, 0x0edd, L},
++ {0x0f00, 0x0f17, L},
++ {0x0f18, 0x0f19, NSM},
++ {0x0f1a, 0x0f34, L},
++ {0x0f35, 0x0f35, NSM},
++ {0x0f36, 0x0f36, L},
++ {0x0f37, 0x0f37, NSM},
++ {0x0f38, 0x0f38, L},
++ {0x0f39, 0x0f39, NSM},
++ {0x0f3e, 0x0f47, L},
++ {0x0f49, 0x0f6a, L},
++ {0x0f71, 0x0f7e, NSM},
++ {0x0f7f, 0x0f7f, L},
++ {0x0f80, 0x0f84, NSM},
++ {0x0f85, 0x0f85, L},
++ {0x0f86, 0x0f87, NSM},
++ {0x0f88, 0x0f8b, L},
++ {0x0f90, 0x0f97, NSM},
++ {0x0f99, 0x0fbc, NSM},
++ {0x0fbe, 0x0fc5, L},
++ {0x0fc6, 0x0fc6, NSM},
++ {0x0fc7, 0x0fcc, L},
++ {0x0fcf, 0x0fcf, L},
++ {0x1000, 0x1021, L},
++ {0x1023, 0x1027, L},
++ {0x1029, 0x102a, L},
++ {0x102c, 0x102c, L},
++ {0x102d, 0x1030, NSM},
++ {0x1031, 0x1031, L},
++ {0x1032, 0x1032, NSM},
++ {0x1036, 0x1037, NSM},
++ {0x1038, 0x1038, L},
++ {0x1039, 0x1039, NSM},
++ {0x1040, 0x1057, L},
++ {0x1058, 0x1059, NSM},
++ {0x10a0, 0x10c5, L},
++ {0x10d0, 0x10f8, L},
++ {0x10fb, 0x10fb, L},
++ {0x1100, 0x1159, L},
++ {0x115f, 0x11a2, L},
++ {0x11a8, 0x11f9, L},
++ {0x1200, 0x1206, L},
++ {0x1208, 0x1246, L},
++ {0x1248, 0x1248, L},
++ {0x124a, 0x124d, L},
++ {0x1250, 0x1256, L},
++ {0x1258, 0x1258, L},
++ {0x125a, 0x125d, L},
++ {0x1260, 0x1286, L},
++ {0x1288, 0x1288, L},
++ {0x128a, 0x128d, L},
++ {0x1290, 0x12ae, L},
++ {0x12b0, 0x12b0, L},
++ {0x12b2, 0x12b5, L},
++ {0x12b8, 0x12be, L},
++ {0x12c0, 0x12c0, L},
++ {0x12c2, 0x12c5, L},
++ {0x12c8, 0x12ce, L},
++ {0x12d0, 0x12d6, L},
++ {0x12d8, 0x12ee, L},
++ {0x12f0, 0x130e, L},
++ {0x1310, 0x1310, L},
++ {0x1312, 0x1315, L},
++ {0x1318, 0x131e, L},
++ {0x1320, 0x1346, L},
++ {0x1348, 0x135a, L},
++ {0x1361, 0x137c, L},
++ {0x13a0, 0x13f4, L},
++ {0x1401, 0x1676, L},
++ {0x1680, 0x1680, WS},
++ {0x1681, 0x169a, L},
++ {0x16a0, 0x16f0, L},
++ {0x1700, 0x170c, L},
++ {0x170e, 0x1711, L},
++ {0x1712, 0x1714, NSM},
++ {0x1720, 0x1731, L},
++ {0x1732, 0x1734, NSM},
++ {0x1735, 0x1736, L},
++ {0x1740, 0x1751, L},
++ {0x1752, 0x1753, NSM},
++ {0x1760, 0x176c, L},
++ {0x176e, 0x1770, L},
++ {0x1772, 0x1773, NSM},
++ {0x1780, 0x17b6, L},
++ {0x17b7, 0x17bd, NSM},
++ {0x17be, 0x17c5, L},
++ {0x17c6, 0x17c6, NSM},
++ {0x17c7, 0x17c8, L},
++ {0x17c9, 0x17d3, NSM},
++ {0x17d4, 0x17da, L},
++ {0x17db, 0x17db, ET},
++ {0x17dc, 0x17dc, L},
++ {0x17dd, 0x17dd, NSM},
++ {0x17e0, 0x17e9, L},
++ {0x180b, 0x180d, NSM},
++ {0x180e, 0x180e, WS},
++ {0x1810, 0x1819, L},
++ {0x1820, 0x1877, L},
++ {0x1880, 0x18a8, L},
++ {0x18a9, 0x18a9, NSM},
++ {0x1900, 0x191c, L},
++ {0x1920, 0x1922, NSM},
++ {0x1923, 0x1926, L},
++ {0x1927, 0x192b, NSM},
++ {0x1930, 0x1931, L},
++ {0x1932, 0x1932, NSM},
++ {0x1933, 0x1938, L},
++ {0x1939, 0x193b, NSM},
++ {0x1946, 0x196d, L},
++ {0x1970, 0x1974, L},
++ {0x1d00, 0x1d6b, L},
++ {0x1e00, 0x1e9b, L},
++ {0x1ea0, 0x1ef9, L},
++ {0x1f00, 0x1f15, L},
++ {0x1f18, 0x1f1d, L},
++ {0x1f20, 0x1f45, L},
++ {0x1f48, 0x1f4d, L},
++ {0x1f50, 0x1f57, L},
++ {0x1f59, 0x1f59, L},
++ {0x1f5b, 0x1f5b, L},
++ {0x1f5d, 0x1f5d, L},
++ {0x1f5f, 0x1f7d, L},
++ {0x1f80, 0x1fb4, L},
++ {0x1fb6, 0x1fbc, L},
++ {0x1fbe, 0x1fbe, L},
++ {0x1fc2, 0x1fc4, L},
++ {0x1fc6, 0x1fcc, L},
++ {0x1fd0, 0x1fd3, L},
++ {0x1fd6, 0x1fdb, L},
++ {0x1fe0, 0x1fec, L},
++ {0x1ff2, 0x1ff4, L},
++ {0x1ff6, 0x1ffc, L},
++ {0x2000, 0x200a, WS},
++ {0x200b, 0x200d, BN},
++ {0x200e, 0x200e, L},
++ {0x200f, 0x200f, R},
++ {0x2028, 0x2028, WS},
++ {0x2029, 0x2029, B},
++ {0x202a, 0x202a, LRE},
++ {0x202b, 0x202b, RLE},
++ {0x202c, 0x202c, PDF},
++ {0x202d, 0x202d, LRO},
++ {0x202e, 0x202e, RLO},
++ {0x202f, 0x202f, WS},
++ {0x2030, 0x2034, ET},
++ {0x2044, 0x2044, CS},
++ {0x205f, 0x205f, WS},
++ {0x2060, 0x2063, BN},
++ {0x206a, 0x206f, BN},
++ {0x2070, 0x2070, EN},
++ {0x2071, 0x2071, L},
++ {0x2074, 0x2079, EN},
++ {0x207a, 0x207b, ET},
++ {0x207f, 0x207f, L},
++ {0x2080, 0x2089, EN},
++ {0x208a, 0x208b, ET},
++ {0x20a0, 0x20b1, ET},
++ {0x20d0, 0x20ea, NSM},
++ {0x2102, 0x2102, L},
++ {0x2107, 0x2107, L},
++ {0x210a, 0x2113, L},
++ {0x2115, 0x2115, L},
++ {0x2119, 0x211d, L},
++ {0x2124, 0x2124, L},
++ {0x2126, 0x2126, L},
++ {0x2128, 0x2128, L},
++ {0x212a, 0x212d, L},
++ {0x212e, 0x212e, ET},
++ {0x212f, 0x2131, L},
++ {0x2133, 0x2139, L},
++ {0x213d, 0x213f, L},
++ {0x2145, 0x2149, L},
++ {0x2160, 0x2183, L},
++ {0x2212, 0x2213, ET},
++ {0x2336, 0x237a, L},
++ {0x2395, 0x2395, L},
++ {0x2488, 0x249b, EN},
++ {0x249c, 0x24e9, L},
++ {0x2800, 0x28ff, L},
++ {0x3000, 0x3000, WS},
++ {0x3005, 0x3007, L},
++ {0x3021, 0x3029, L},
++ {0x302a, 0x302f, NSM},
++ {0x3031, 0x3035, L},
++ {0x3038, 0x303c, L},
++ {0x3041, 0x3096, L},
++ {0x3099, 0x309a, NSM},
++ {0x309d, 0x309f, L},
++ {0x30a1, 0x30fa, L},
++ {0x30fc, 0x30ff, L},
++ {0x3105, 0x312c, L},
++ {0x3131, 0x318e, L},
++ {0x3190, 0x31b7, L},
++ {0x31f0, 0x321c, L},
++ {0x3220, 0x3243, L},
++ {0x3260, 0x327b, L},
++ {0x327f, 0x32b0, L},
++ {0x32c0, 0x32cb, L},
++ {0x32d0, 0x32fe, L},
++ {0x3300, 0x3376, L},
++ {0x337b, 0x33dd, L},
++ {0x33e0, 0x33fe, L},
++ {0x3400, 0x4db5, L},
++ {0x4e00, 0x9fa5, L},
++ {0xa000, 0xa48c, L},
++ {0xac00, 0xd7a3, L},
++ {0xd800, 0xfa2d, L},
++ {0xfa30, 0xfa6a, L},
++ {0xfb00, 0xfb06, L},
++ {0xfb13, 0xfb17, L},
++ {0xfb1d, 0xfb1d, R},
++ {0xfb1e, 0xfb1e, NSM},
++ {0xfb1f, 0xfb28, R},
++ {0xfb29, 0xfb29, ET},
++ {0xfb2a, 0xfb36, R},
++ {0xfb38, 0xfb3c, R},
++ {0xfb3e, 0xfb3e, R},
++ {0xfb40, 0xfb41, R},
++ {0xfb43, 0xfb44, R},
++ {0xfb46, 0xfb4f, R},
++ {0xfb50, 0xfbb1, AL},
++ {0xfbd3, 0xfd3d, AL},
++ {0xfd50, 0xfd8f, AL},
++ {0xfd92, 0xfdc7, AL},
++ {0xfdf0, 0xfdfc, AL},
++ {0xfe00, 0xfe0f, NSM},
++ {0xfe20, 0xfe23, NSM},
++ {0xfe50, 0xfe50, CS},
++ {0xfe52, 0xfe52, CS},
++ {0xfe55, 0xfe55, CS},
++ {0xfe5f, 0xfe5f, ET},
++ {0xfe62, 0xfe63, ET},
++ {0xfe69, 0xfe6a, ET},
++ {0xfe70, 0xfe74, AL},
++ {0xfe76, 0xfefc, AL},
++ {0xfeff, 0xfeff, BN},
++ {0xff03, 0xff05, ET},
++ {0xff0b, 0xff0b, ET},
++ {0xff0c, 0xff0c, CS},
++ {0xff0d, 0xff0d, ET},
++ {0xff0e, 0xff0e, CS},
++ {0xff0f, 0xff0f, ES},
++ {0xff10, 0xff19, EN},
++ {0xff1a, 0xff1a, CS},
++ {0xff21, 0xff3a, L},
++ {0xff41, 0xff5a, L},
++ {0xff66, 0xffbe, L},
++ {0xffc2, 0xffc7, L},
++ {0xffca, 0xffcf, L},
++ {0xffd2, 0xffd7, L},
++ {0xffda, 0xffdc, L},
++ {0xffe0, 0xffe1, ET},
++ {0xffe5, 0xffe6, ET},
++ };
++
++ int i, j, k;
++
++ i = -1;
++ j = lenof(lookup);
++
++ while (j - i > 1) {
++ k = (i + j) / 2;
++ if (ch < lookup[k].first)
++ j = k;
++ else if (ch > lookup[k].last)
++ i = k;
++ else
++ return (unsigned char)lookup[k].type;
++ }
++
++ /*
++ * If we reach here, the character was not in any of the
++ * intervals listed in the lookup table. This means we return
++ * ON (`Other Neutrals'). This is the appropriate code for any
++ * character genuinely not listed in the Unicode table, and
++ * also the table above has deliberately left out any
++ * characters _explicitly_ listed as ON (to save space!).
++ */
++ return ON;
++}
++
++unsigned char getPreviousLevel(unsigned char* types, unsigned char* level, int from)
++{
++ int skip = 0;
++
++ while(--from > 0)
++ {
++
++ switch(types[from])
++ {
++ case LRE:
++ case LRO:
++ case RLE:
++ case RLO:
++ if(skip>0)
++ {
++ skip--;
++ break;
++ }else
++ return level[from-1];
++ case PDF:
++ skip++;
++ break;
++ }
++ }
++ return 0; /* Compiler Nag-Stopper */
++}
++
++unsigned char getPreviousOverride(unsigned char* types, unsigned char* level, int from)
++{
++ int skip = 1;
++
++ from--;
++ while(from-- > 0)
++ {
++ switch(types[from])
++ {
++ case LRE:
++ case RLE:
++ skip++;
++ break;
++
++ case LRO:
++ if(skip>0)
++ {
++ skip--;
++ break;
++ }else
++ return L;
++ case RLO:
++ if(skip>0)
++ {
++ skip--;
++ break;
++ }else
++ return R;
++ case PDF:
++ skip++;
++ break;
++ }
++ }
++ return ON;
++}
++
++
++
++/* The Main shaping function, and the only one to be used
++ * by the outside world.
++ *
++ * line: buffer to apply shaping to. this must be passed by doBidi() first
++ * to: output buffer for the shaped data
++ * from: start bidi at this index
++ * count: number of characters in line
++ */
++int doShape(BLOCKTYPE line, CHARTYPE* to, int from, int count)
++{
++ int i, j, ligFlag;
++ unsigned char prevTemp, nextTemp;
++ CHARTYPE tempChar;
++
++ ligFlag = 0;
++ prevTemp = SU;
++ nextTemp = SU;
++ for(i=from; i<count; i++)
++ {
++ /* Get Previous and next Characters type */
++ j=i;
++ while(--j >= 0)
++ {
++ //assert(j<count);
++ //assert(i<count);
++ if(GetType(GETCHAR(line, j)) != NSM)
++ {
++ prevTemp = STYPE(GETCHAR(line, j));
++ break;
++ }
++ }
++ j=i;
++ while(++j < count)
++ {
++ //assert(j<count);
++ //assert(i<count);
++ if(GetType(GETCHAR(line, j)) != NSM)
++ {
++ nextTemp = STYPE(GETCHAR(line, j));
++ break;
++ //HAQ
++ } else if(j == count-1) {
++ nextTemp = SU;
++ break;
++ }
++ }
++
++ switch(STYPE(GETCHAR(line, i)))
++ {
++ case SC:
++ case SU:
++ to[i] = GETCHAR(line, i);
++ break;
++
++ case SR:
++ if(prevTemp == SD || prevTemp == SC)
++ to[i] = SFINAL(SISOLATED(GETCHAR(line, i)));
++ else
++ to[i] = SISOLATED(GETCHAR(line, i));
++ break;
++
++ case SD:
++ /* Make Ligatures */
++ if(GETCHAR(line, i) == 0x644)
++ {
++ j=i;
++ while(j++<count)
++ {
++ if(GetType(GETCHAR(line, j)) != NSM)
++ {
++ tempChar = GETCHAR(line, j);
++ break;
++ }
++ }
++ switch(tempChar)
++ {
++ case 0x622:
++ ligFlag = 1;
++ if(prevTemp == SD || prevTemp == SC)
++ to[i] = 0xFEF6;
++ else
++ to[i] = 0xFEF5;
++ break;
++ case 0x623:
++ ligFlag = 1;
++ if(prevTemp == SD || prevTemp == SC)
++ to[i] = 0xFEF8;
++ else
++ to[i] = 0xFEF7;
++ break;
++ case 0x625:
++ ligFlag = 1;
++ if(prevTemp == SD || prevTemp == SC)
++ to[i] = 0xFEFA;
++ else
++ to[i] = 0xFEF9;
++ break;
++ case 0x627:
++ ligFlag = 1;
++ if(prevTemp == SD || prevTemp == SC)
++ to[i] = 0xFEFC;
++ else
++ to[i] = 0xFEFB;
++ break;
++ }
++ if(ligFlag)
++ {
++ to[j] = 0x20;
++ i = j;
++ ligFlag = 0;
++ break;
++ }
++ }
++ //assert(j<count);
++ //assert(i<count);
++ if((prevTemp == SD) || (prevTemp == SC))
++ {
++ if(nextTemp == SR || nextTemp == SD || nextTemp == SC)
++ to[i] = SMEDIAL(SISOLATED(GETCHAR(line, i)));
++ else
++ to[i] = SFINAL(SISOLATED(GETCHAR(line, i)));
++ break;
++ }else
++ {
++ if(nextTemp == SR || nextTemp == SD || nextTemp == SC)
++ to[i] = SINITIAL(SISOLATED(GETCHAR(line, i)));
++ else
++ to[i] = SISOLATED(GETCHAR(line, i));
++ break;
++ }
++
++ }
++ nextTemp = SU;
++ }
++ return 1;
++}
++
++/* Rule (X1), (X2), (X3), (X4), (X5), (X6), (X7), (X8), (X9) */
++void doTypes(BLOCKTYPE line, unsigned char paragraphLevel, unsigned char* types,
++ unsigned char* levels, int count, int fX)
++{
++
++ unsigned char tempType;
++ unsigned char currentEmbedding = paragraphLevel;
++ unsigned char currentOverride = ON;
++ int i;
++
++ if(fX)
++ {
++ for( i=0; i<count; i++)
++ {
++ tempType = GetType(GETCHAR(line, i));
++ switch(tempType)
++ {
++ case RLE:
++ currentEmbedding = levels[i] = leastGreaterOdd(currentEmbedding);
++ currentOverride = ON;
++ types[i] = BN;
++ break;
++
++ case LRE:
++ currentEmbedding = levels[i] = leastGreaterEven(currentEmbedding);
++ currentOverride = ON;
++ types[i] = BN;
++ break;
++
++ case RLO:
++ currentEmbedding = levels[i] = leastGreaterOdd(currentEmbedding);
++ currentOverride = R;
++ types[i] = BN;
++ break;
++
++ case LRO:
++ currentEmbedding = levels[i] = leastGreaterEven(currentEmbedding);
++ currentOverride = L;
++ types[i] = BN;
++ break;
++
++ case PDF:
++ levels[i] = currentEmbedding;
++ currentEmbedding = getPreviousLevel(types, levels, i);
++ currentOverride = getPreviousOverride(types, levels, i);
++ types[i] = BN;
++ break;
++
++ /* Whitespace is treated as neutral for now */
++ case WS:
++ case B:
++ case S:
++ levels[i] = currentEmbedding;
++ tempType = ON;
++ if(currentOverride != ON)
++ tempType = currentOverride;
++ break;
++
++ default:
++ levels[i] = currentEmbedding;
++ if(currentOverride != ON)
++ tempType = currentOverride;
++ break;
++
++ }
++ types[i] = tempType;
++ }
++ }else
++ {
++ for( i=0; i<count; i++)
++ {
++ tempType = GetType(GETCHAR(line, i));
++ switch(tempType)
++ {
++ case WS:
++ case B:
++ case S:
++ levels[i] = currentEmbedding;
++ tempType = ON;
++ if(currentOverride != ON)
++ tempType = currentOverride;
++ break;
++
++ default:
++ levels[i] = currentEmbedding;
++ if(currentOverride != ON)
++ tempType = currentOverride;
++ break;
++
++ }
++ types[i] = tempType;
++ }
++
++ }
++
++}
++
++/* Rule (W3) */
++void doALtoR(unsigned char* types, int count)
++{
++ int i=0;
++ for(; i<count; i++)
++ {
++ if(types[i] == AL)
++ types[i] = R;
++ }
++
++}
++/*
++ * The Main Bidi Function, and the only function that should
++ * be used by the outside world.
++ *
++ * line: a buffer of size count containing text to apply
++ * the Bidirectional algorithm to.
++ */
++int doBidi(BLOCKTYPE line, int count, int applyShape, int reorderCombining, int removeMarks)
++{
++ unsigned char* types;
++ unsigned char* levels;
++ unsigned char paragraphLevel;
++ unsigned char tempType, tempTypeSec;
++ int i, j, imax, fX, fAL, fET, fNSM;
++ CHARTYPE* shapeTo;
++
++
++ fX = fAL = fET = fNSM = 0;
++ for(i=0; i<count; i++)
++ {
++ switch(GetType(line[i]))
++ {
++ case AL:
++ case R:
++ fAL = 1;
++ break;
++ case LRE:
++ case LRO:
++ case RLE:
++ case RLO:
++ case PDF:
++ case BN:
++ fX = 1;
++ break;
++ case ET:
++ fET = 1;
++ break;
++ case NSM:
++ fNSM = 1;
++ break;
++ }
++ }
++
++ if(!fAL && !fX)
++ return 0;
++
++ /* Initialize types, levels */
++ types = (unsigned char*)malloc(sizeof(unsigned char) * count);
++ levels = (unsigned char*)malloc(sizeof(unsigned char) * count);
++ if(applyShape)
++ shapeTo = (CHARTYPE*)malloc(sizeof(CHARTYPE) * count);
++
++ /* Rule (P1) NOT IMPLEMENTED
++ * P1. Split the text into separate paragraphs. A paragraph separator is
++ * kept with the previous paragraph. Within each paragraph, apply all the
++ * other rules of this algorithm.
++ */
++
++ /* Rule (P2), (P3)
++ * P2. In each paragraph, find the first character of type L, AL, or R.
++ * P3. If a character is found in P2 and it is of type AL or R, then set
++ * the paragraph embedding level to one; otherwise, set it to zero.
++ */
++ paragraphLevel = GetParagraphLevel(line, count);
++
++ /* Rule (X1), (X2), (X3), (X4), (X5), (X6), (X7), (X8), (X9)
++ * X1. Begin by setting the current embedding level to the paragraph
++ * embedding level. Set the directional override status to neutral.
++ * X2. With each RLE, compute the least greater odd embedding level.
++ * X3. With each LRE, compute the least greater even embedding level.
++ * X4. With each RLO, compute the least greater odd embedding level.
++ * X5. With each LRO, compute the least greater even embedding level.
++ * X6. For all types besides RLE, LRE, RLO, LRO, and PDF:
++ * a. Set the level of the current character to the current
++ * embedding level.
++ * b. Whenever the directional override status is not neutral,
++ * reset the current character type to the directional
++ * override status.
++ * X7. With each PDF, determine the matching embedding or override code.
++ * If there was a valid matching code, restore (pop) the last
++ * remembered (pushed) embedding level and directional override.
++ * X8. All explicit directional embeddings and overrides are completely
++ * terminated at the end of each paragraph. Paragraph separators are not
++ * included in the embedding. (Useless here) NOT IMPLEMENTED
++ * X9. Remove all RLE, LRE, RLO, LRO, PDF, and BN codes.
++ * Here, they're converted to BN.
++ */
++
++ doTypes(line, paragraphLevel, types, levels, count, fX);
++
++
++ /* Rule (W1)
++ * W1. Examine each non-spacing mark (NSM) in the level run, and change
++ * the type of the NSM to the type of the previous character. If the NSM
++ * is at the start of the level run, it will get the type of sor.
++ */
++
++ /*
++ * Clear BNs first
++ */
++ if(fX)
++ {
++ for(i=0; i<count; i++)
++ {
++ if(types[i] == BN)
++ {
++ j=i;
++ while(types[--j] == ON);
++ levels[i] = levels[j];
++
++ j=i;
++ while(types[++j] == BN);
++
++ if(levels[j] > levels[i])
++ levels[i] = levels[j];
++
++
++
++ if((levels[i] % 2) == 0)
++ {
++ types[i] = L;
++ }
++ else
++ {
++ types[i] = R;
++ }
++
++ }
++ }
++ }
++
++
++ if(fNSM)
++ {
++ if(types[0] == NSM)
++ types[0] = paragraphLevel;
++
++ for(i=1; i<count; i++)
++ {
++ if(types[i] == NSM)
++ types[i] = types[i-1];
++ /* Is this a safe assumption?
++ * I assumed the previous, IS a character.
++ */
++ }
++ }
++
++ /* BN TYPES !!!! */
++
++ if(fX)
++ {
++ for(i=0; i<count; i++)
++ {
++ if(types[i] == BN)
++ {
++ j=i;
++ while(--j>=0 && types[j] == ON);
++ tempType = types[j];
++ j=i;
++ while(++j<count && types[j] == BN || types[j] == ON);
++ if(tempType != types[j])
++ types[i] = tempType;
++
++ }
++ }
++ }
++
++
++ /* Rule (W2)
++ * W2. Search backwards from each instance of a European number until the
++ * first strong type (R, L, AL, or sor) is found. If an AL is found,
++ * change the type of the European number to Arabic number.
++ */
++ for(i=0; i<count; i++)
++ {
++ if(types[i] == EN)
++ {
++ j=i;
++ while(--j >= 0)
++ {
++ if(types[j] == AL)
++ {
++ types[i] = AN;
++ break;
++ }
++ else if(types[j] == R || types[j] == L)
++ {
++ break;
++ }
++ }
++ }
++ }
++
++ /* Rule (W3)
++ * W3. Change all ALs to R.
++ *
++ * Optimization: on Rule Xn, we might set a flag on AL type
++ * to prevent this loop in L R lines only...
++ */
++ doALtoR(types, count);
++
++ /* Rule (W4)
++ * W4. A single European separator between two European numbers changes
++ * to a European number. A single common separator between two numbers
++ * of the same type changes to that type.
++ */
++ for( i=0; i<(count-1); i++)
++ {
++ if(types[i] == ES)
++ {
++ if(types[i-1] == EN && types[i+1] == EN)
++ types[i] = EN;
++ }else if(types[i] == CS)
++ {
++ if(types[i-1] == EN && types[i+1] == EN)
++ types[i] = EN;
++ else if(types[i-1] == AN && types[i+1] == AN)
++ types[i] = AN;
++ }
++ }
++
++ /* Rule (W5)
++ * W5. A sequence of European terminators adjacent to European numbers
++ * changes to all European numbers.
++ *
++ * Optimization: lots here... else ifs need rearrangement
++ */
++ if(fET)
++ {
++ for(i=0; i<count; i++)
++ {
++ if(types[i] == ET)
++ {
++ if(types[i-1] == EN)
++ {
++ types[i] = EN;
++ continue;
++ }else if(types[i+1] == EN)
++ {
++ types[i] = EN;
++ continue;
++ }else if(types[i+1] == ET)
++ {
++ j=i;
++ while(j <count && types[j] == ET)
++ {
++ j++;
++ }
++ if(types[j] == EN)
++ types[i] = EN;
++ }
++ }
++ }
++ }
++
++ /* Rule (W6)
++ * W6. Otherwise, separators and terminators change to Other Neutral:
++ */
++ for(i=0; i<count; i++)
++ {
++ switch(types[i])
++ {
++ case ES:
++ case ET:
++ case CS:
++ types[i] = ON;
++ break;
++ }
++ }
++
++ /* Rule (W7)
++ * W7. Search backwards from each instance of a European number until
++ * the first strong type (R, L, or sor) is found. If an L is found,
++ * then change the type of the European number to L.
++ */
++
++ for(i=0; i<count; i++)
++ {
++ if(types[i] == EN)
++ {
++ j=i;
++ while(--j >= 0)
++ {
++ if(types[j] == L)
++ {
++ types[i] = L;
++ break;
++ }
++ else if(types[j] == R || types[j] == AL)
++ {
++ break;
++ }
++
++ }
++ }
++ }
++
++
++ /* Rule (N1)
++ * N1. A sequence of neutrals takes the direction of the surrounding
++ * strong text if the text on both sides has the same direction. European
++ * and Arabic numbers are treated as though they were R.
++ */
++ tempType = paragraphLevel;
++ for(i=0; i<count; i++)
++ {
++ if(types[i] == ON)
++ {
++ if(types[i-1] == R || types[i-1] == EN || types[i-1] == AN)
++ tempType = R;
++ else
++ tempType = L;
++ j=i;
++
++ while(j < count)
++ {
++ tempTypeSec = types[j];
++ if(tempTypeSec == ON || tempTypeSec == BN)
++ j++;
++ else
++ break;
++ }
++
++ if(((types[j] == L || types[j] == LRE) && (tempType == L)) ||
++ (((types[j] == R) || (types[j] == EN) || (types[j] == AN)) && (tempType == R)))
++ {
++ while(i<j)
++ {
++ types[i++] = tempType;
++ }
++ }
++ }
++ }
++
++
++ /* Rule (N2)
++ * N2. Any remaining neutrals take the embedding direction.
++ */
++ for(i=0; i<count; i++)
++ {
++ if(types[i] == ON || types[i] == BN)
++ {
++ if((levels[i] % 2) == 0)
++ types[i] = L;
++ else
++ types[i] = R;
++ }
++ }
++
++ /* Rule (I1)
++ * I1. For all characters with an even (left-to-right) embedding
++ * direction, those of type R go up one level and those of type AN or
++ * EN go up two levels.
++ */
++ for(i=0; i<count; i++)
++ {
++ if((levels[i] % 2) == 0)
++ {
++ if(types[i] == R)
++ levels[i] += 1;
++ else if((types[i] == AN) || (types[i] == EN))
++ levels[i] += 2;
++ }else
++ {
++ if((types[i] == L) ||
++ (types[i] == EN) ||
++ (types[i] == AN))
++ levels[i] += 1;
++ }
++ }
++
++ /* Rule (I2)
++ * I2. For all characters with an odd (right-to-left) embedding direction,
++ * those of type L, EN or AN go up one level.
++ */
++/*
++ for(i=0; i<count; i++)
++ {
++ if((levels[i] % 2) == 1)
++ {
++ if(types[i] == L || types[i] == EN || types[i] == AN)
++ levels[i] += 1;
++ }
++ }
++*/
++ /* Rule (L1)
++ * L1. On each line, reset the embedding level of the following characters
++ * to the paragraph embedding level:
++ * (1)segment separators, (2)paragraph separators,
++ * (3)any sequence of whitespace characters preceding
++ * a segment separator or paragraph separator,
++ * (4)and any sequence of white space characters
++ * at the end of the line.
++ * The types of characters used here are the original types, not those
++ * modified by the previous phase.
++ */
++
++
++
++ j=count-1;
++ while(j>0 && (GetType(GETCHAR(line, j)) == WS))
++ {
++ j--;
++ }
++ if(j < (count-1))
++ {
++ for(j++; j<count; j++)
++ levels[j] = paragraphLevel;
++ }
++
++ for(i=0; i<count; i++)
++ {
++ tempType = GetType(GETCHAR(line, i));
++ if(tempType == WS)
++ {
++ j=i;
++ while((++j < count) && ((tempType == WS) || (tempType == RLE)) )
++ {
++ tempType = GetType(line[j]);
++ }
++
++ if(GetType(GETCHAR(line, j)) == B || GetType(GETCHAR(line, j)) == S)
++ {
++ for(j--; j>=i ; j--)
++ {
++ levels[j] = paragraphLevel;
++ }
++ }
++ }else if(tempType == B || tempType == S)
++ levels[i] = paragraphLevel;
++ }
++
++ /* Rule (L4)
++ * L4. A character that possesses the mirrored property as specified by
++ * Section 4.7, Mirrored, must be depicted by a mirrored glyph if the
++ * resolved directionality of that character is R.
++ */
++ /* Note: this is implemented before L2 for efficiency */
++ for(i=0; i<count; i++)
++ {
++ if((levels[i] % 2) == 1)
++ doMirror(&line[i]);
++ }
++
++
++
++ /* Rule (L3)
++ * L3. Combining marks applied to a right-to-left base character will at
++ * this point precede their base character. If the rendering engine
++ * expects them to follow the base characters in the final display
++ * process, then the ordering of the marks and the base character must
++ * be reversed.
++ * Combining marks are reordered to the right of each character on an
++ * odd level.
++ */
++
++ if(fNSM && reorderCombining)
++ {
++ CHARTYPE temp;
++ int it;
++ for(i=0; i<count; i++)
++ {
++ if(GetType(GETCHAR(line, i)) == NSM && odd(levels[i]))
++ {
++ j=i;
++ while((++j < count) && (GetType(GETCHAR(line, j)) == NSM));
++ j--; i--;
++ for(it=j; j>i; i++, j--)
++ {
++ temp = GETCHAR(line, i);
++ GETCHAR(line, i) = GETCHAR(line, j);
++ GETCHAR(line, j) = temp;
++ }
++ i=it+1;
++ }
++ }
++ }
++
++ /* Shaping
++ * Shaping is Applied to each run of levels separately....
++ */
++
++ if(applyShape)
++ {
++
++ for(i=0; i<count; i++)
++ {
++ shapeTo[i] = GETCHAR(line, i);
++ }
++
++ j=i=0;
++ while(j < count)
++ {
++ if(GetType(GETCHAR(line, j)) == AL)
++ {
++ if(j<count && j >= i )
++ {
++ tempType = levels[j];
++ i=j;
++ while((i++ < count) && (levels[i] == tempType));
++ doShape(line, shapeTo, j, i);
++ j=i;
++ tempType = levels[j];
++
++ }
++ }
++ j++;
++ }
++ for(i=0; i<count; i++)
++ {
++ GETCHAR(line, i) = shapeTo[i];
++ }
++ free(shapeTo);
++ }
++
++
++
++ /* Rule (L2)
++ * L2. From the highest level found in the text to the lowest odd level on
++ * each line, including intermediate levels not actually present in the
++ * text, reverse any contiguous sequence of characters that are at that
++ * level or higher
++ */
++ /* we flip the character string and leave the level array */
++ imax = 0;
++ i=0;
++ tempType = levels[0];
++ while(i < count)
++ {
++ if(levels[i] > tempType)
++ {
++ tempType = levels[i];
++ imax=i;
++ }
++ i++;
++ }
++ /* maximum level in tempType, its index in imax. */
++ while(tempType > 0) /* loop from highest level to the least odd, */
++ { /* which i assume is 1 */
++ flipThisRun(line, levels, tempType, count);
++ tempType--;
++ }
++
++ /* The line should be reordered correctly, check for Explicits marks
++ * and remove them if removeMarks
++ */
++ if(fX && removeMarks)
++ {
++ if(!GetParagraphLevel(line, count))
++ {
++ for(i=0, j=0; i<count; i++)
++ {
++ tempType = GetType(GETCHAR(line, i));
++ if(tempType != RLE &&
++ tempType != LRE &&
++ tempType != RLO &&
++ tempType != LRO &&
++ tempType != PDF)
++ GETCHAR(line, j++) = GETCHAR(line, i);
++ }
++ for(i=j; j<count; j++)
++ GETCHAR(line, j) = 0x20;
++ }else
++ {
++ for(j=i=count-1; i>=0; i--)
++ {
++ tempType = GetType(GETCHAR(line, i));
++ if(tempType != RLE &&
++ tempType != LRE &&
++ tempType != RLO &&
++ tempType != LRO &&
++ tempType != PDF)
++ GETCHAR(line, j--) = GETCHAR(line, i);
++ }
++ for(i=j; j>=0; j--)
++ GETCHAR(line, j) = 0x20;
++ }
++ }
++
++
++ free(types);
++ free(levels);
++ /* if removeMarks is 1 and there were actual marks then return the new size */
++ if(fX && removeMarks) return i;
++ return count;
++}
++
++
++/*
++ * Bad, Horrible function
++ * takes a pointer to a character that is checked for
++ * having a mirror glyph.
++ */
++void doMirror(CHARTYPE* ch)
++{
++ if ((*ch & 0xFF00) == 0) {
++ switch (*ch) {
++ case 0x0028: *ch = 0x0029; break;
++ case 0x0029: *ch = 0x0028; break;
++ case 0x003C: *ch = 0x003E; break;
++ case 0x003E: *ch = 0x003C; break;
++ case 0x005B: *ch = 0x005D; break;
++ case 0x005D: *ch = 0x005B; break;
++ case 0x007B: *ch = 0x007D; break;
++ case 0x007D: *ch = 0x007B; break;
++ case 0x00AB: *ch = 0x00BB; break;
++ case 0x00BB: *ch = 0x00AB; break;
++ }
++ } else if ((*ch & 0xFF00) == 0x2000) {
++ switch (*ch) {
++ case 0x2039: *ch = 0x203A; break;
++ case 0x203A: *ch = 0x2039; break;
++ case 0x2045: *ch = 0x2046; break;
++ case 0x2046: *ch = 0x2045; break;
++ case 0x207D: *ch = 0x207E; break;
++ case 0x207E: *ch = 0x207D; break;
++ case 0x208D: *ch = 0x208E; break;
++ case 0x208E: *ch = 0x208D; break;
++ }
++ } else if ((*ch & 0xFF00) == 0x2200) {
++ switch (*ch) {
++ case 0x2208: *ch = 0x220B; break;
++ case 0x2209: *ch = 0x220C; break;
++ case 0x220A: *ch = 0x220D; break;
++ case 0x220B: *ch = 0x2208; break;
++ case 0x220C: *ch = 0x2209; break;
++ case 0x220D: *ch = 0x220A; break;
++ case 0x2215: *ch = 0x29F5; break;
++ case 0x223C: *ch = 0x223D; break;
++ case 0x223D: *ch = 0x223C; break;
++ case 0x2243: *ch = 0x22CD; break;
++ case 0x2252: *ch = 0x2253; break;
++ case 0x2253: *ch = 0x2252; break;
++ case 0x2254: *ch = 0x2255; break;
++ case 0x2255: *ch = 0x2254; break;
++ case 0x2264: *ch = 0x2265; break;
++ case 0x2265: *ch = 0x2264; break;
++ case 0x2266: *ch = 0x2267; break;
++ case 0x2267: *ch = 0x2266; break;
++ case 0x2268: *ch = 0x2269; break;
++ case 0x2269: *ch = 0x2268; break;
++ case 0x226A: *ch = 0x226B; break;
++ case 0x226B: *ch = 0x226A; break;
++ case 0x226E: *ch = 0x226F; break;
++ case 0x226F: *ch = 0x226E; break;
++ case 0x2270: *ch = 0x2271; break;
++ case 0x2271: *ch = 0x2270; break;
++ case 0x2272: *ch = 0x2273; break;
++ case 0x2273: *ch = 0x2272; break;
++ case 0x2274: *ch = 0x2275; break;
++ case 0x2275: *ch = 0x2274; break;
++ case 0x2276: *ch = 0x2277; break;
++ case 0x2277: *ch = 0x2276; break;
++ case 0x2278: *ch = 0x2279; break;
++ case 0x2279: *ch = 0x2278; break;
++ case 0x227A: *ch = 0x227B; break;
++ case 0x227B: *ch = 0x227A; break;
++ case 0x227C: *ch = 0x227D; break;
++ case 0x227D: *ch = 0x227C; break;
++ case 0x227E: *ch = 0x227F; break;
++ case 0x227F: *ch = 0x227E; break;
++ case 0x2280: *ch = 0x2281; break;
++ case 0x2281: *ch = 0x2280; break;
++ case 0x2282: *ch = 0x2283; break;
++ case 0x2283: *ch = 0x2282; break;
++ case 0x2284: *ch = 0x2285; break;
++ case 0x2285: *ch = 0x2284; break;
++ case 0x2286: *ch = 0x2287; break;
++ case 0x2287: *ch = 0x2286; break;
++ case 0x2288: *ch = 0x2289; break;
++ case 0x2289: *ch = 0x2288; break;
++ case 0x228A: *ch = 0x228B; break;
++ case 0x228B: *ch = 0x228A; break;
++ case 0x228F: *ch = 0x2290; break;
++ case 0x2290: *ch = 0x228F; break;
++ case 0x2291: *ch = 0x2292; break;
++ case 0x2292: *ch = 0x2291; break;
++ case 0x2298: *ch = 0x29B8; break;
++ case 0x22A2: *ch = 0x22A3; break;
++ case 0x22A3: *ch = 0x22A2; break;
++ case 0x22A6: *ch = 0x2ADE; break;
++ case 0x22A8: *ch = 0x2AE4; break;
++ case 0x22A9: *ch = 0x2AE3; break;
++ case 0x22AB: *ch = 0x2AE5; break;
++ case 0x22B0: *ch = 0x22B1; break;
++ case 0x22B1: *ch = 0x22B0; break;
++ case 0x22B2: *ch = 0x22B3; break;
++ case 0x22B3: *ch = 0x22B2; break;
++ case 0x22B4: *ch = 0x22B5; break;
++ case 0x22B5: *ch = 0x22B4; break;
++ case 0x22B6: *ch = 0x22B7; break;
++ case 0x22B7: *ch = 0x22B6; break;
++ case 0x22C9: *ch = 0x22CA; break;
++ case 0x22CA: *ch = 0x22C9; break;
++ case 0x22CB: *ch = 0x22CC; break;
++ case 0x22CC: *ch = 0x22CB; break;
++ case 0x22CD: *ch = 0x2243; break;
++ case 0x22D0: *ch = 0x22D1; break;
++ case 0x22D1: *ch = 0x22D0; break;
++ case 0x22D6: *ch = 0x22D7; break;
++ case 0x22D7: *ch = 0x22D6; break;
++ case 0x22D8: *ch = 0x22D9; break;
++ case 0x22D9: *ch = 0x22D8; break;
++ case 0x22DA: *ch = 0x22DB; break;
++ case 0x22DB: *ch = 0x22DA; break;
++ case 0x22DC: *ch = 0x22DD; break;
++ case 0x22DD: *ch = 0x22DC; break;
++ case 0x22DE: *ch = 0x22DF; break;
++ case 0x22DF: *ch = 0x22DE; break;
++ case 0x22E0: *ch = 0x22E1; break;
++ case 0x22E1: *ch = 0x22E0; break;
++ case 0x22E2: *ch = 0x22E3; break;
++ case 0x22E3: *ch = 0x22E2; break;
++ case 0x22E4: *ch = 0x22E5; break;
++ case 0x22E5: *ch = 0x22E4; break;
++ case 0x22E6: *ch = 0x22E7; break;
++ case 0x22E7: *ch = 0x22E6; break;
++ case 0x22E8: *ch = 0x22E9; break;
++ case 0x22E9: *ch = 0x22E8; break;
++ case 0x22EA: *ch = 0x22EB; break;
++ case 0x22EB: *ch = 0x22EA; break;
++ case 0x22EC: *ch = 0x22ED; break;
++ case 0x22ED: *ch = 0x22EC; break;
++ case 0x22F0: *ch = 0x22F1; break;
++ case 0x22F1: *ch = 0x22F0; break;
++ case 0x22F2: *ch = 0x22FA; break;
++ case 0x22F3: *ch = 0x22FB; break;
++ case 0x22F4: *ch = 0x22FC; break;
++ case 0x22F6: *ch = 0x22FD; break;
++ case 0x22F7: *ch = 0x22FE; break;
++ case 0x22FA: *ch = 0x22F2; break;
++ case 0x22FB: *ch = 0x22F3; break;
++ case 0x22FC: *ch = 0x22F4; break;
++ case 0x22FD: *ch = 0x22F6; break;
++ case 0x22FE: *ch = 0x22F7; break;
++ }
++ } else if ((*ch & 0xFF00) == 0x2300) {
++ switch (*ch) {
++ case 0x2308: *ch = 0x2309; break;
++ case 0x2309: *ch = 0x2308; break;
++ case 0x230A: *ch = 0x230B; break;
++ case 0x230B: *ch = 0x230A; break;
++ case 0x2329: *ch = 0x232A; break;
++ case 0x232A: *ch = 0x2329; break;
++ }
++ } else if ((*ch & 0xFF00) == 0x2700) {
++ switch (*ch) {
++ case 0x2768: *ch = 0x2769; break;
++ case 0x2769: *ch = 0x2768; break;
++ case 0x276A: *ch = 0x276B; break;
++ case 0x276B: *ch = 0x276A; break;
++ case 0x276C: *ch = 0x276D; break;
++ case 0x276D: *ch = 0x276C; break;
++ case 0x276E: *ch = 0x276F; break;
++ case 0x276F: *ch = 0x276E; break;
++ case 0x2770: *ch = 0x2771; break;
++ case 0x2771: *ch = 0x2770; break;
++ case 0x2772: *ch = 0x2773; break;
++ case 0x2773: *ch = 0x2772; break;
++ case 0x2774: *ch = 0x2775; break;
++ case 0x2775: *ch = 0x2774; break;
++ case 0x27D5: *ch = 0x27D6; break;
++ case 0x27D6: *ch = 0x27D5; break;
++ case 0x27DD: *ch = 0x27DE; break;
++ case 0x27DE: *ch = 0x27DD; break;
++ case 0x27E2: *ch = 0x27E3; break;
++ case 0x27E3: *ch = 0x27E2; break;
++ case 0x27E4: *ch = 0x27E5; break;
++ case 0x27E5: *ch = 0x27E4; break;
++ case 0x27E6: *ch = 0x27E7; break;
++ case 0x27E7: *ch = 0x27E6; break;
++ case 0x27E8: *ch = 0x27E9; break;
++ case 0x27E9: *ch = 0x27E8; break;
++ case 0x27EA: *ch = 0x27EB; break;
++ case 0x27EB: *ch = 0x27EA; break;
++ }
++ } else if ((*ch & 0xFF00) == 0x2900) {
++ switch (*ch) {
++ case 0x2983: *ch = 0x2984; break;
++ case 0x2984: *ch = 0x2983; break;
++ case 0x2985: *ch = 0x2986; break;
++ case 0x2986: *ch = 0x2985; break;
++ case 0x2987: *ch = 0x2988; break;
++ case 0x2988: *ch = 0x2987; break;
++ case 0x2989: *ch = 0x298A; break;
++ case 0x298A: *ch = 0x2989; break;
++ case 0x298B: *ch = 0x298C; break;
++ case 0x298C: *ch = 0x298B; break;
++ case 0x298D: *ch = 0x2990; break;
++ case 0x298E: *ch = 0x298F; break;
++ case 0x298F: *ch = 0x298E; break;
++ case 0x2990: *ch = 0x298D; break;
++ case 0x2991: *ch = 0x2992; break;
++ case 0x2992: *ch = 0x2991; break;
++ case 0x2993: *ch = 0x2994; break;
++ case 0x2994: *ch = 0x2993; break;
++ case 0x2995: *ch = 0x2996; break;
++ case 0x2996: *ch = 0x2995; break;
++ case 0x2997: *ch = 0x2998; break;
++ case 0x2998: *ch = 0x2997; break;
++ case 0x29B8: *ch = 0x2298; break;
++ case 0x29C0: *ch = 0x29C1; break;
++ case 0x29C1: *ch = 0x29C0; break;
++ case 0x29C4: *ch = 0x29C5; break;
++ case 0x29C5: *ch = 0x29C4; break;
++ case 0x29CF: *ch = 0x29D0; break;
++ case 0x29D0: *ch = 0x29CF; break;
++ case 0x29D1: *ch = 0x29D2; break;
++ case 0x29D2: *ch = 0x29D1; break;
++ case 0x29D4: *ch = 0x29D5; break;
++ case 0x29D5: *ch = 0x29D4; break;
++ case 0x29D8: *ch = 0x29D9; break;
++ case 0x29D9: *ch = 0x29D8; break;
++ case 0x29DA: *ch = 0x29DB; break;
++ case 0x29DB: *ch = 0x29DA; break;
++ case 0x29F5: *ch = 0x2215; break;
++ case 0x29F8: *ch = 0x29F9; break;
++ case 0x29F9: *ch = 0x29F8; break;
++ case 0x29FC: *ch = 0x29FD; break;
++ case 0x29FD: *ch = 0x29FC; break;
++ }
++ } else if ((*ch & 0xFF00) == 0x2A00) {
++ switch (*ch) {
++ case 0x2A2B: *ch = 0x2A2C; break;
++ case 0x2A2C: *ch = 0x2A2B; break;
++ case 0x2A2D: *ch = 0x2A2C; break;
++ case 0x2A2E: *ch = 0x2A2D; break;
++ case 0x2A34: *ch = 0x2A35; break;
++ case 0x2A35: *ch = 0x2A34; break;
++ case 0x2A3C: *ch = 0x2A3D; break;
++ case 0x2A3D: *ch = 0x2A3C; break;
++ case 0x2A64: *ch = 0x2A65; break;
++ case 0x2A65: *ch = 0x2A64; break;
++ case 0x2A79: *ch = 0x2A7A; break;
++ case 0x2A7A: *ch = 0x2A79; break;
++ case 0x2A7D: *ch = 0x2A7E; break;
++ case 0x2A7E: *ch = 0x2A7D; break;
++ case 0x2A7F: *ch = 0x2A80; break;
++ case 0x2A80: *ch = 0x2A7F; break;
++ case 0x2A81: *ch = 0x2A82; break;
++ case 0x2A82: *ch = 0x2A81; break;
++ case 0x2A83: *ch = 0x2A84; break;
++ case 0x2A84: *ch = 0x2A83; break;
++ case 0x2A8B: *ch = 0x2A8C; break;
++ case 0x2A8C: *ch = 0x2A8B; break;
++ case 0x2A91: *ch = 0x2A92; break;
++ case 0x2A92: *ch = 0x2A91; break;
++ case 0x2A93: *ch = 0x2A94; break;
++ case 0x2A94: *ch = 0x2A93; break;
++ case 0x2A95: *ch = 0x2A96; break;
++ case 0x2A96: *ch = 0x2A95; break;
++ case 0x2A97: *ch = 0x2A98; break;
++ case 0x2A98: *ch = 0x2A97; break;
++ case 0x2A99: *ch = 0x2A9A; break;
++ case 0x2A9A: *ch = 0x2A99; break;
++ case 0x2A9B: *ch = 0x2A9C; break;
++ case 0x2A9C: *ch = 0x2A9B; break;
++ case 0x2AA1: *ch = 0x2AA2; break;
++ case 0x2AA2: *ch = 0x2AA1; break;
++ case 0x2AA6: *ch = 0x2AA7; break;
++ case 0x2AA7: *ch = 0x2AA6; break;
++ case 0x2AA8: *ch = 0x2AA9; break;
++ case 0x2AA9: *ch = 0x2AA8; break;
++ case 0x2AAA: *ch = 0x2AAB; break;
++ case 0x2AAB: *ch = 0x2AAA; break;
++ case 0x2AAC: *ch = 0x2AAD; break;
++ case 0x2AAD: *ch = 0x2AAC; break;
++ case 0x2AAF: *ch = 0x2AB0; break;
++ case 0x2AB0: *ch = 0x2AAF; break;
++ case 0x2AB3: *ch = 0x2AB4; break;
++ case 0x2AB4: *ch = 0x2AB3; break;
++ case 0x2ABB: *ch = 0x2ABC; break;
++ case 0x2ABC: *ch = 0x2ABB; break;
++ case 0x2ABD: *ch = 0x2ABE; break;
++ case 0x2ABE: *ch = 0x2ABD; break;
++ case 0x2ABF: *ch = 0x2AC0; break;
++ case 0x2AC0: *ch = 0x2ABF; break;
++ case 0x2AC1: *ch = 0x2AC2; break;
++ case 0x2AC2: *ch = 0x2AC1; break;
++ case 0x2AC3: *ch = 0x2AC4; break;
++ case 0x2AC4: *ch = 0x2AC3; break;
++ case 0x2AC5: *ch = 0x2AC6; break;
++ case 0x2AC6: *ch = 0x2AC5; break;
++ case 0x2ACD: *ch = 0x2ACE; break;
++ case 0x2ACE: *ch = 0x2ACD; break;
++ case 0x2ACF: *ch = 0x2AD0; break;
++ case 0x2AD0: *ch = 0x2ACF; break;
++ case 0x2AD1: *ch = 0x2AD2; break;
++ case 0x2AD2: *ch = 0x2AD1; break;
++ case 0x2AD3: *ch = 0x2AD4; break;
++ case 0x2AD4: *ch = 0x2AD3; break;
++ case 0x2AD5: *ch = 0x2AD6; break;
++ case 0x2AD6: *ch = 0x2AD5; break;
++ case 0x2ADE: *ch = 0x22A6; break;
++ case 0x2AE3: *ch = 0x22A9; break;
++ case 0x2AE4: *ch = 0x22A8; break;
++ case 0x2AE5: *ch = 0x22AB; break;
++ case 0x2AEC: *ch = 0x2AED; break;
++ case 0x2AED: *ch = 0x2AEC; break;
++ case 0x2AF7: *ch = 0x2AF8; break;
++ case 0x2AF8: *ch = 0x2AF7; break;
++ case 0x2AF9: *ch = 0x2AFA; break;
++ case 0x2AFA: *ch = 0x2AF9; break;
++ }
++ } else if ((*ch & 0xFF00) == 0x3000) {
++ switch (*ch) {
++ case 0x3008: *ch = 0x3009; break;
++ case 0x3009: *ch = 0x3008; break;
++ case 0x300A: *ch = 0x300B; break;
++ case 0x300B: *ch = 0x300A; break;
++ case 0x300C: *ch = 0x300D; break;
++ case 0x300D: *ch = 0x300C; break;
++ case 0x300E: *ch = 0x300F; break;
++ case 0x300F: *ch = 0x300E; break;
++ case 0x3010: *ch = 0x3011; break;
++ case 0x3011: *ch = 0x3010; break;
++ case 0x3014: *ch = 0x3015; break;
++ case 0x3015: *ch = 0x3014; break;
++ case 0x3016: *ch = 0x3017; break;
++ case 0x3017: *ch = 0x3016; break;
++ case 0x3018: *ch = 0x3019; break;
++ case 0x3019: *ch = 0x3018; break;
++ case 0x301A: *ch = 0x301B; break;
++ case 0x301B: *ch = 0x301A; break;
++ }
++ } else if ((*ch & 0xFF00) == 0xFF00) {
++ switch (*ch) {
++ case 0xFF08: *ch = 0xFF09; break;
++ case 0xFF09: *ch = 0xFF08; break;
++ case 0xFF1C: *ch = 0xFF1E; break;
++ case 0xFF1E: *ch = 0xFF1C; break;
++ case 0xFF3B: *ch = 0xFF3D; break;
++ case 0xFF3D: *ch = 0xFF3B; break;
++ case 0xFF5B: *ch = 0xFF5D; break;
++ case 0xFF5D: *ch = 0xFF5B; break;
++ case 0xFF5F: *ch = 0xFF60; break;
++ case 0xFF60: *ch = 0xFF5F; break;
++ case 0xFF62: *ch = 0xFF63; break;
++ case 0xFF63: *ch = 0xFF62; break;
++ }
++ }
++}
+Index: qt-2.3.10/src/qt.pro
+===================================================================
+--- qt-2.3.10.orig/src/qt.pro 2005-01-23 15:00:39.000000000 +0100
++++ qt-2.3.10/src/qt.pro 2005-05-13 22:22:13.000000000 +0200
+@@ -182,6 +182,7 @@
+ $$KERNEL_H/qasyncimageio.h \
+ $$KERNEL_H/qasyncio.h \
+ $$KERNEL_H/qbitmap.h \
++ $$KERNEL_H/qbidi.h \
+ $$KERNEL_H/qbrush.h \
+ $$KERNEL_H/qclipboard.h \
+ $$KERNEL_H/qcolor.h \
+@@ -527,6 +528,8 @@
+ kernel/qapplication.cpp \
+ kernel/qasyncimageio.cpp \
+ kernel/qasyncio.cpp \
++ kernel/qbidi.cpp \
++ kernel/minibidi.cpp \
+ kernel/qbitmap.cpp \
+ kernel/qclipboard.cpp \
+ kernel/qcolor.cpp \
+Index: qt-2.3.10/src/Makefile.in
+===================================================================
+--- qt-2.3.10.orig/src/Makefile.in 2005-05-13 22:22:11.000000000 +0200
++++ qt-2.3.10/src/Makefile.in 2005-05-13 22:29:52.000000000 +0200
+@@ -168,6 +168,8 @@
+ kernel/qabstractlayout.o \
+ kernel/qaccel.o \
+ kernel/qapplication.o \
++ kernel/qbidi.o \
++ kernel/minibidi.o \
+ kernel/qasyncimageio.o \
+ kernel/qasyncio.o \
+ kernel/qbitmap.o \
+@@ -4107,6 +4109,12 @@
+ kernel/qthread.h \
+ tools/qvaluestack.h
+
++kernel/qbidi.o: kernel/qbidi.cpp \
++ kernel/qbidi.h \
++ tools/qstring.h
++
++kernel/minibidi.o: kernel/minibidi.c
++
+ kernel/qasyncimageio.o: kernel/qasyncimageio.cpp \
+ kernel/qasyncimageio.h \
+ kernel/qimage.h \
diff --git a/packages/qte/qte-2.3.10/c700-hardware.patch b/packages/qte/qte-2.3.10/c700-hardware.patch
index e69de29bb2..5527ab4a88 100644
--- a/packages/qte/qte-2.3.10/c700-hardware.patch
+++ b/packages/qte/qte-2.3.10/c700-hardware.patch
@@ -0,0 +1,110 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.cpp~c700-hardware
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.cpp
+@@ -178,7 +178,7 @@
+ static QRect maxwindow_rect;
+ extern Q_EXPORT QRect qt_maxWindowRect;
+ static const char *defaultMouse =
+-#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_YOPY) || defined(QWS_CUSTOMTOUCHPANEL)
++#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_SLC700) || defined(QT_QWS_YOPY) || defined(QWS_CUSTOMTOUCHPANEL)
+ "TPanel"
+ #elif defined(QT_KEYPAD_MODE)
+ "None"
+@@ -3308,7 +3308,7 @@
+ void QWSServer::screenSaverSleep()
+ {
+ qt_screen->blank(TRUE);
+-#if !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX)
++#if !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) && !defined(QT_QWS_SLC700)
+ d->screensavertimer->stop();
+ #else
+ if ( screensaverinterval ) {
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwsmouse_qws.cpp~c700-hardware
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwsmouse_qws.cpp
+@@ -87,6 +87,19 @@
+ #define QT_QWS_TP_PRESSURE_THRESHOLD 500
+ #define QT_QWS_TP_MOVE_LIMIT 50
+ #define QT_QWS_TP_JITTER_LIMIT 2
++#elif defined(QT_QWS_SLC700)
++#define QT_QWS_SLC700_RAW
++typedef struct {
++ unsigned short pressure;
++ unsigned short x;
++ unsigned short y;
++ unsigned short millisecs;
++} TS_EVENT;
++#define QT_QWS_TP_SAMPLE_SIZE 10
++#define QT_QWS_TP_MINIMUM_SAMPLES 4
++#define QT_QWS_TP_PRESSURE_THRESHOLD 500
++#define QT_QWS_TP_MOVE_LIMIT 50
++#define QT_QWS_TP_JITTER_LIMIT 2
+ #endif
+
+ #ifndef QT_QWS_TP_SAMPLE_SIZE
+@@ -592,7 +605,7 @@
+ sub[nsub++] = new QAutoMouseSubHandler_intellimouse(fd);
+ notify(fd);
+ }
+-#if !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) && !defined(QT_QWS_K2)
++#if !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) && !defined(QT_QWS_K2) && !defined(QT_QWS_SLC700)
+ char fn[] = "/dev/ttyS?";
+ for (int ch='0'; ch<='3'; ch++) {
+ fn[9] = ch;
+@@ -1274,7 +1287,7 @@
+ numSamples(0), skipCount(0)
+ {
+ Q_UNUSED(dev);
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2)
++#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
+ #if defined(QT_QWS_IPAQ)
+ # ifdef QT_QWS_IPAQ_RAW
+ if ((mouseFD = open( "/dev/h3600_tsraw", O_RDONLY | O_NDELAY)) < 0) {
+@@ -1284,7 +1297,7 @@
+ qWarning( "Cannot open /dev/h3600_ts (%s)", strerror(errno));
+ return;
+ }
+-#elif defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2)
++#elif defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
+ //# ifdef QT_QWS_SL5XXX_TSRAW
+ # if 0
+ if ((mouseFD = open( "/dev/tsraw", O_RDONLY | O_NDELAY)) < 0) {
+@@ -1310,7 +1323,7 @@
+
+ QTPanelHandlerPrivate::~QTPanelHandlerPrivate()
+ {
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2)
++#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
+ if (mouseFD >= 0)
+ close(mouseFD);
+ #endif
+@@ -1318,7 +1331,7 @@
+
+ void QTPanelHandlerPrivate::readMouseData()
+ {
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2)
++#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
+ if(!qt_screen)
+ return;
+
+@@ -1337,7 +1350,7 @@
+ uchar *mb = mouseBuf+idx;
+ data = (TS_EVENT *) mb;
+ if(data->pressure >= QT_QWS_TP_PRESSURE_THRESHOLD) {
+-#ifdef QT_QWS_SL5XXX
++#if defined(QT_QWS_SL5XXX) || defined(QT_QWS_SLC700)
+ samples[currSample] = QPoint( 1000 - data->x, data->y );
+ #else
+ samples[currSample] = QPoint( data->x, data->y );
+@@ -1997,7 +2010,7 @@
+ handler = new QTSLibHandlerPrivate();
+ #elif defined(QT_QWS_YOPY)
+ handler = new QYopyTPanelHandlerPrivate(mouseProtocol,mouseDev);
+-#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2)
++#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
+ handler = new QTPanelHandlerPrivate(mouseProtocol,mouseDev);
+ #elif defined(QT_QWS_CASSIOPEIA)
+ handler = new QVrTPanelHandlerPrivate( mouseProtocol, mouseDev );
diff --git a/packages/qte/qte-2.3.10/daemonize.patch b/packages/qte/qte-2.3.10/daemonize.patch
index e69de29bb2..487a18c32a 100644
--- a/packages/qte/qte-2.3.10/daemonize.patch
+++ b/packages/qte/qte-2.3.10/daemonize.patch
@@ -0,0 +1,113 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20041211/src/kernel/qapplication_qws.cpp~daemonize
++++ qt-2.3.9-snapshot-20041211/src/kernel/qapplication_qws.cpp
+@@ -104,6 +104,7 @@
+ #endif
+
+ #include <sys/time.h>
++#include <syslog.h>
+
+ #if defined(_OS_AIX_) && defined(_CC_GNU_)
+ #include <sys/select.h>
+@@ -163,6 +164,7 @@
+ //these used to be environment variables, they are initialized from
+ //environment variables in
+
++bool qws_daemon = TRUE;
+ bool qws_savefonts = FALSE;
+ bool qws_screen_is_interlaced=FALSE; //### should be detected
+ bool qws_shared_memory = FALSE;
+@@ -1686,6 +1688,10 @@
+ mwGeometry = argv[i];
+ } else if ( arg == "-shared" ) {
+ qws_shared_memory = TRUE;
++ } else if ( arg == "-daemon" ) {
++ qws_daemon = TRUE;
++ } else if ( arg == "-nodaemon" ) {
++ qws_daemon = FALSE;
+ } else if ( arg == "-noshared" ) {
+ qws_shared_memory = FALSE;
+ } else if ( arg == "-savefonts" ) {
+@@ -1742,6 +1748,78 @@
+ qt_appType = type;
+ qws_single_process = TRUE;
+
++ /* Daemonize the server process -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
++ * Added a new command line option which only is relevant if the application is created as a GuiServer.
++ * The option is -daemon respectively -nodaemon. If in daemon mode (which is the default now), the
++ * server will detach from the controlling terminal and continue as a daemon. This is done via the standard
++ * UNIX double fork magic.
++ */
++ if ( qws_daemon )
++ {
++ qWarning( "qt_init() - starting in daemon mode..." );
++
++ int pid1 = fork();
++ if ( pid1 == -1 )
++ {
++ qWarning( "qt_init() - can't perform initial fork: %s", strerror( errno ) );
++ exit( -1 );
++ }
++ if ( pid1 ) _exit( 0 ); // ok, first fork performed
++
++ chdir( "/" );
++ setsid();
++ umask(0);
++ close(0);
++ close(1);
++ close(2);
++
++ int fdnull = ::open( "/dev/null", O_RDWR );
++ if ( fdnull == -1 )
++ {
++ syslog( 3, "qt_init() - can't open /dev/null to redirect std{in|out|err}: %s", strerror( errno ) );
++ exit( -1 );
++ }
++ dup2( fdnull, 0 ); // stdin
++ dup2( fdnull, 1 ); // stdout
++ dup2( fdnull, 2 ); // stderr
++
++ int pid2 = fork();
++ if ( pid2 == -1 )
++ {
++ syslog( 3, "qt_init() - can't perform initial fork: %s", strerror( errno ) );
++ exit( -1 );
++ }
++ if ( pid2 )
++ {
++ syslog( 4, "qt_init() [%d] - successfully entered daemon mode", pid2 );
++ _exit( 0 ); // ok, second fork performed
++ }
++ }
++
++ /*
++ * , ,
++ * /( )`
++ * \ \___ / | B E W A R E !
++ * /- _ `-/ ' We are a DAEMON now!
++ * (/\/ \ \ /\
++ * / / | ` \
++ * O O ) / |
++ * `-^--'`< '
++ * (_.) _ ) /
++ * `.___/` /
++ * `-----' /
++ * <----. __ / __ \
++ * <----|====O)))==) \) /====
++ * <----' `--' `.__,' \
++ * | |
++ * \ /
++ * ______( (_ / \______
++ * (FL) ,' ,-----' | \
++ * `--{__________) \/
++ *
++ */
++
++
+ /* Allocate a dedicated virtual terminal -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+ * Added a new command line option which only is relevant if the application is created as a GuiServer.
+ * The option is -terminal <num>, where <num> specifies the virtual terminal to be occupied by the server.
diff --git a/packages/qte/qte-2.3.10/devfs.patch b/packages/qte/qte-2.3.10/devfs.patch
index e69de29bb2..27ea4239c7 100644
--- a/packages/qte/qte-2.3.10/devfs.patch
+++ b/packages/qte/qte-2.3.10/devfs.patch
@@ -0,0 +1,163 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20050114/configure~devfs
++++ qt-2.3.9-snapshot-20050114/configure
+@@ -412,6 +412,9 @@
+ -visibility-hidden)
+ VISIBILITY=YES
+ ;;
++ -devfs)
++ DEVFS=yes
++ ;;
+ -no-g++-exceptions)
+ GPLUSPLUS_EXCEPTIONS=no
+ ;;
+@@ -1302,6 +1305,8 @@
+ -visibility-hidden . Use -fvisibility=hidden as default. This requires GCC 4.0
+ or a special patched GCC to support the visibility attribute
+
++ -devfs ............. Use devfs /dev paths.
++
+ -no-g++-exceptions . Disable exceptions on platforms using the GNU C++
+ compiler by using the -fno-exceptions flag.
+
+@@ -1374,6 +1379,10 @@
+ then
+ QT_CXX="${QT_CXX} -DGCC_SUPPORTS_VISIBILITY -fvisibility=hidden"
+ fi
++if [ "x$DEVFS" = "xyes" ]
++then
++ QT_CXX="${QT_CXX} -DQT_QWS_DEVFS"
++fi
+ if [ "x$THREAD" = "xyes" ]
+ then
+ cat >src-mt.mk <<EOF
+--- qt-2.3.9-snapshot-20050114/src/kernel/qgfxlinuxfb_qws.cpp~devfs
++++ qt-2.3.9-snapshot-20050114/src/kernel/qgfxlinuxfb_qws.cpp
+@@ -101,11 +101,19 @@
+ bool QLinuxFbScreen::connect( const QString &displaySpec )
+ {
+ // Check for explicitly specified device
++#ifdef QT_QWS_DEVFS
++ QRegExp r( "/dev/fb/[0-9]+" );
++#else
+ QRegExp r( "/dev/fb[0-9]+" );
++#endif
+ int len;
+ int m = r.match( displaySpec, 0, &len );
+
++#ifdef QT_QWS_DEVFS
++ QString dev = (m>=0) ? displaySpec.mid( m, len ) : QString("/dev/fb/0");
++#else
+ QString dev = (m>=0) ? displaySpec.mid( m, len ) : QString("/dev/fb0");
++#endif
+
+ fd=open( dev.latin1(), O_RDWR );
+ if (fd<0) {
+@@ -121,14 +129,22 @@
+
+ /* Get fixed screen information */
+ if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo)) {
++#ifdef QT_QWS_DEVFS
++ perror("reading /dev/fb/0");
++#else
+ perror("reading /dev/fb0");
++#endif
+ qWarning("Error reading fixed information");
+ return FALSE;
+ }
+
+ /* Get variable screen information */
+ if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo)) {
++#ifdef QT_QWS_DEVFS
++ perror("reading /dev/fb/0");
++#else
+ perror("reading /dev/fb0");
++#endif
+ qWarning("Error reading variable information");
+ return FALSE;
+ }
+@@ -165,7 +181,11 @@
+ data += dataoffset;
+
+ if ((int)data == -1) {
+- perror("mapping /dev/fb0");
++#ifdef QT_QWS_DEVFS
++ perror("reading /dev/fb/0");
++#else
++ perror("reading /dev/fb0");
++#endif
+ qWarning("Error: failed to map framebuffer device to memory.");
+ return FALSE;
+ }
+@@ -229,7 +249,11 @@
+
+ static void writeTerm(const char* termctl, int sizeof_termctl)
+ {
++#ifdef QT_QWS_DEVFS
++ const char* tt[]={"/dev/vc/1","/dev/console","/dev/tty",0};
++#else
+ const char* tt[]={"/dev/console","/dev/tty","/dev/tty0",0};
++#endif
+ const char** dev=tt;
+ while (*dev) {
+ int tty=::open(*dev,O_WRONLY);
+@@ -792,7 +816,11 @@
+ fb_var_screeninfo vinfo;
+
+ if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo)) {
++#ifdef QT_QWS_DEVFS
++ perror("reading /dev/fb/0");
++#else
+ perror("reading /dev/fb0");
++#endif
+ qFatal("Error reading fixed information");
+ }
+
+--- qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp~devfs
++++ qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp
+@@ -1192,7 +1192,11 @@
+
+ QWSTtyKeyboardHandler::QWSTtyKeyboardHandler(const QString& device)
+ {
++#ifdef QT_QWS_DEVFS
++ kbdFD=open(device.isEmpty() ? "/dev/vc/1" : device.latin1(), O_RDWR | O_NDELAY, 0);
++#else
+ kbdFD=open(device.isEmpty() ? "/dev/tty0" : device.latin1(), O_RDWR | O_NDELAY, 0);
++#endif
+
+ if ( kbdFD >= 0 ) {
+ QSocketNotifier *notifier;
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.cpp~devfs
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.cpp
+@@ -836,7 +836,11 @@
+ void openDevice()
+ {
+ if ( !sn ) {
++#ifdef QT_QWS_DEVFS
++ int fd = ::open("/dev/sound/dsp",O_RDWR);
++#else
+ int fd = ::open("/dev/dsp",O_RDWR);
++#endif
+ if ( fd < 0 ) {
+ // For debugging purposes - defined QT_NO_SOUND if you
+ // don't have sound hardware!
+--- qt-2.3.9-snapshot-20050114/src/kernel/qsoundqss_qws.cpp~devfs
++++ qt-2.3.9-snapshot-20050114/src/kernel/qsoundqss_qws.cpp
+@@ -1088,7 +1088,12 @@
+ // Don't block open right away.
+ //
+ bool openOkay = false;
+- if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) {
++#ifdef QT_QWS_DEVFS
++ if ((fd = ::open("/dev/sound/dsp", O_WRONLY|O_NONBLOCK)) != -1)
++#else
++ if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1)
++#endif
++ {
+ int flags = fcntl(fd, F_GETFL);
+ flags &= ~O_NONBLOCK;
+ openOkay = (fcntl(fd, F_SETFL, flags) == 0);
diff --git a/packages/qte/qte-2.3.10/encoding.patch b/packages/qte/qte-2.3.10/encoding.patch
index e69de29bb2..13a48282d1 100644
--- a/packages/qte/qte-2.3.10/encoding.patch
+++ b/packages/qte/qte-2.3.10/encoding.patch
@@ -0,0 +1,34 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20041211/src/tools/qstring.cpp~encoding
++++ qt-2.3.9-snapshot-20041211/src/tools/qstring.cpp
+@@ -14469,7 +14469,11 @@
+ return qt_winQString2MB( *this );
+ #endif
+ #ifdef _WS_QWS_
+- return utf8(); // ##### if there is ANY 8 bit format supported?
++ QTextCodec* codec = QTextCodec::codecForLocale();
++ return codec
++ ? codec->fromUnicode(*this)
++ : utf8();
++ //return latin1(); // ##### if there is ANY 8 bit format supported?
+ #endif
+ #endif
+ }
+@@ -14515,7 +14519,12 @@
+ return qt_winMB2QString( local8Bit );
+ #endif
+ #ifdef _WS_QWS_
+- return fromUtf8(local8Bit,len);
++ QTextCodec* codec = QTextCodec::codecForLocale();
++ if( len < 0) len = qstrlen(local8Bit);
++ return codec
++ ? codec->toUnicode(local8Bit, len)
++ : QString::fromUtf8(local8Bit,len);
++// return fromLatin1(local8Bit,len);
+ #endif
+ #endif // QT_NO_TEXTCODEC
+ }
diff --git a/packages/qte/qte-2.3.10/fix-linuxfb-setmode.patch b/packages/qte/qte-2.3.10/fix-linuxfb-setmode.patch
index e69de29bb2..212463cb03 100644
--- a/packages/qte/qte-2.3.10/fix-linuxfb-setmode.patch
+++ b/packages/qte/qte-2.3.10/fix-linuxfb-setmode.patch
@@ -0,0 +1,32 @@
+Set lstep properly on a mode change
+Manuel Teira <manuel.teira@telefonica.net>
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp~fix-linuxfb-setmode
++++ qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp
+@@ -791,11 +791,6 @@
+ fb_fix_screeninfo finfo;
+ fb_var_screeninfo vinfo;
+
+- if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo)) {
+- perror("reading /dev/fb0");
+- qFatal("Error reading fixed information");
+- }
+-
+ if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo)) {
+ qFatal("Error reading variable information in mode change");
+ }
+@@ -812,6 +807,10 @@
+ qFatal("Error reading changed variable information in mode change");
+ }
+
++ if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo)) {
++ qFatal("Error reading changed fixed information in mode change");
++ }
++
+ w=vinfo.xres;
+ h=vinfo.yres;
+ d=vinfo.bits_per_pixel;
diff --git a/packages/qte/qte-2.3.10/fix-qgfxraster.patch b/packages/qte/qte-2.3.10/fix-qgfxraster.patch
index e69de29bb2..7bc1e2af56 100644
--- a/packages/qte/qte-2.3.10/fix-qgfxraster.patch
+++ b/packages/qte/qte-2.3.10/fix-qgfxraster.patch
@@ -0,0 +1,28 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20041211/src/kernel/qgfxraster_qws.cpp~fix-qgfxraster
++++ qt-2.3.9-snapshot-20041211/src/kernel/qgfxraster_qws.cpp
+@@ -4037,13 +4037,14 @@
+ for( loopc2=0;loopc2<frontadd;loopc2++ )
+ *(alphaptr++)=get_value_32(16,(unsigned char **)&temppos);
+
+- PackType temp2;
+- unsigned char * cp;
++ volatile PackType temp2;
++ volatile unsigned short int * cp;
+ for( loopc2=0;loopc2<count;loopc2++ ) {
+- temp2=*((PackType *)temppos);
+- cp=(unsigned char *)&temp2;
+- *(alphaptr++)=get_value_32(16,&cp);
+- *(alphaptr++)=get_value_32(16,&cp);
++ temp2=*reinterpret_cast<PackType *>(temppos);
++ cp=reinterpret_cast<volatile unsigned short int *>(&temp2);
++ *(alphaptr++)=qt_conv16ToRgb(*cp);
++ cp++;
++ *(alphaptr++)=qt_conv16ToRgb(*cp);
+ temppos += 2;
+ }
+
diff --git a/packages/qte/qte-2.3.10/gcc3.patch b/packages/qte/qte-2.3.10/gcc3.patch
index e69de29bb2..fc1656aa24 100644
--- a/packages/qte/qte-2.3.10/gcc3.patch
+++ b/packages/qte/qte-2.3.10/gcc3.patch
@@ -0,0 +1,27 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20041211/src/tools/qcstring.h~gcc3
++++ qt-2.3.9-snapshot-20041211/src/tools/qcstring.h
+@@ -119,7 +119,7 @@
+ // We want to keep source compatibility for 2.x
+ // ### TODO for 4.0: completely remove these and the cstr* functions
+
+-#if !defined(QT_GENUINE_STR)
++#if 0
+
+ #undef strlen
+ #define strlen qstrlen
+--- qt-2.3.9-snapshot-20041211/src/kernel/qwsdecoration_qws.h~gcc3
++++ qt-2.3.9-snapshot-20041211/src/kernel/qwsdecoration_qws.h
+@@ -50,7 +50,7 @@
+ enum Region { None=0, All=1, Title=2, Top=3, Bottom=4, Left=5, Right=6,
+ TopLeft=7, TopRight=8, BottomLeft=9, BottomRight=10,
+ Close=11, Minimize=12, Maximize=13, Normalize=14,
+- Menu=15, LastRegion=Menu };
++ Menu=15, LastRegion=Menu, UserDefined = 100 };
+
+ virtual QRegion region(const QWidget *, const QRect &rect, Region r=All) = 0;
+ virtual void close( QWidget * );
diff --git a/packages/qte/qte-2.3.10/increase-qxml-robustness.patch b/packages/qte/qte-2.3.10/increase-qxml-robustness.patch
index e69de29bb2..3a29b4ab03 100644
--- a/packages/qte/qte-2.3.10/increase-qxml-robustness.patch
+++ b/packages/qte/qte-2.3.10/increase-qxml-robustness.patch
@@ -0,0 +1,17 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/src/xml/qxml.cpp~xml
++++ qt-2.3.10/src/xml/qxml.cpp
+@@ -809,6 +809,9 @@
+ // ### The input source should not do the encoding detection!
+ void QXmlInputSource::readInput( QByteArray& rawData )
+ {
++ // avoid crash if the array has less than 5 characters (skyhusker@handhelds.org)
++ if ( rawData.size() < 6 )
++ return;
+ QBuffer buf( rawData );
+ buf.open( IO_ReadOnly );
+ QTextStream *stream = new QTextStream( &buf );
diff --git a/packages/qte/qte-2.3.10/ipaq-keyboard.patch b/packages/qte/qte-2.3.10/ipaq-keyboard.patch
index e69de29bb2..47474f698e 100644
--- a/packages/qte/qte-2.3.10/ipaq-keyboard.patch
+++ b/packages/qte/qte-2.3.10/ipaq-keyboard.patch
@@ -0,0 +1,27 @@
+Index: qt-2.3.10/src/kernel/qkeyboard_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qkeyboard_qws.cpp 2005-02-20 13:20:03.285091763 +0100
++++ qt-2.3.10/src/kernel/qkeyboard_qws.cpp 2005-02-20 13:21:49.668213425 +0100
+@@ -527,17 +527,17 @@
+ { Qt::Key_Plus, '+' , '-' , 0xffff },
+ { Qt::Key_Pause, 0xffff , 0xffff , 0xffff }, // 120
+ { Qt::Key_F31, 0xffff , 0xffff , 0xffff }, // IM toggle
+- { Qt::Key_F32, 0xffff , 0xffff , 0xffff }, // Sync
+- { Qt::Key_F34, 0xffff , 0xffff , 0xffff }, // Power
+- { Qt::Key_F35, 0xffff , 0xffff , 0xffff }, // Backlight
++ { Qt::Key_SysReq, 0xffff , 0xffff , 0xffff }, // iPAQ
++ { Qt::Key_F9, 0xffff , 0xffff , 0xffff }, // iPAQ
++ { Qt::Key_F10, 0xffff , 0xffff , 0xffff }, // iPAQ
+ #if defined(QT_KEYPAD_MODE)
+ { Qt::Key_Context1, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_Context2, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_Context3, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_Context4, 0xffff , 0xffff , 0xffff },
+ #else
+- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
+- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
++ { Qt::Key_F13, 0xffff , 0xffff , 0xffff }, // iPAQ
++ { Qt::Key_F12, 0xffff , 0xffff , 0xffff }, // iPAQ
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
+ #endif
diff --git a/packages/qte/qte-2.3.10/kernel-keymap-CXK.patch b/packages/qte/qte-2.3.10/kernel-keymap-CXK.patch
index e69de29bb2..6aca81e97d 100644
--- a/packages/qte/qte-2.3.10/kernel-keymap-CXK.patch
+++ b/packages/qte/qte-2.3.10/kernel-keymap-CXK.patch
@@ -0,0 +1,19 @@
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+--- qt-2.3.10/src/kernel/qkeyboard_qws.cpp~kernel-keymap-CXK.patch 2005-05-05 19:34:05.000000000 +0200
++++ qt-2.3.10/src/kernel/qkeyboard_qws.cpp 2005-05-05 19:35:47.000000000 +0200
+@@ -1809,7 +1809,11 @@
+ case Qt::Key_Up:
+ case Qt::Key_Down:
+ mod_key = false;
++#if QT_QWS_SLCXK
++ if (qt_screen->transformOrientation() != 3)
++#else
+ if (qt_screen->isTransformed())
++#endif
+ qtKeyCode = static_cast<Qt::Key>( xform_dirkey(static_cast<int>( qtKeyCode ) ) );
+ break;
+ /*
diff --git a/packages/qte/qte-2.3.10/kernel-keymap-corgi.patch b/packages/qte/qte-2.3.10/kernel-keymap-corgi.patch
index e69de29bb2..0fabd78fac 100644
--- a/packages/qte/qte-2.3.10/kernel-keymap-corgi.patch
+++ b/packages/qte/qte-2.3.10/kernel-keymap-corgi.patch
@@ -0,0 +1,23 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp~kernel-keymap-corgi
++++ qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp
+@@ -410,6 +410,15 @@
+ { 0x20ac, 0xffff , 0x20ac , 0x20ac }, // 73 Euro sign
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 74
+ { Qt::Key_F32, 0xffff , 0xffff , 0xffff }, // 75 Sync
++ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 76
++ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 77
++ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 78
++ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 79
++ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 7a
++ { Qt::Key_Return, 0xffff , 0xffff , 0xffff }, // 7b
++ { Qt::Key_Escape, 0xffff , 0xffff , 0xffff }, // 7c
++ { Qt::Key_Up, 0xffff , 0xffff , 0xffff }, // 7d
++ { Qt::Key_Down, 0xffff , 0xffff , 0xffff }, // 7e
+ { 0, 0xffff , 0xffff , 0xffff }
+ };
+ #else
diff --git a/packages/qte/qte-2.3.10/kernel-keymap-tosa.patch b/packages/qte/qte-2.3.10/kernel-keymap-tosa.patch
index e69de29bb2..ca445f4d1d 100644
--- a/packages/qte/qte-2.3.10/kernel-keymap-tosa.patch
+++ b/packages/qte/qte-2.3.10/kernel-keymap-tosa.patch
@@ -0,0 +1,81 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp~kernel-keymap-tosa
++++ qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp
+@@ -355,14 +355,24 @@
+ { Qt::Key_CapsLock, 0xffff , 0xffff , 0xffff }, // 3c 60
+ { Qt::Key_At, '@' , 's' , 'S'-64 }, // 3d
+ { Qt::Key_Question, '?' , '?' , 0xffff }, // 3e
++#ifdef QT_QWS_SL6000
++ { Qt::Key_Comma, ',' , ';' , 0xffff }, // 3f
++ { Qt::Key_Period, '.' , ':' , 0xffff }, // 40
++#else
+ { Qt::Key_Comma, ',' , ',' , 0xffff }, // 3f
+ { Qt::Key_Period, '.' , '.' , 0xffff }, // 40
++#endif
+ { Qt::Key_Tab, 9 , '\\' , 0xffff }, // 41
+ { Qt::Key_X, 0xffff , 'x' , 'X'-64 }, // 42
+ { Qt::Key_C, 0xffff , 'c' , 'C'-64 }, // 43
+ { Qt::Key_V, 0xffff , 'v' , 'V'-64 }, // 44
++#ifdef QT_QWS_SL6000
++ { Qt::Key_Slash, '/' , '?' , 0xffff }, // 45
++ { Qt::Key_Apostrophe, '\'' , '"' , 0xffff }, // 46 70
++#else
+ { Qt::Key_Slash, '/' , '/' , 0xffff }, // 45
+ { Qt::Key_Apostrophe, '\'' , '\'' , 0xffff }, // 46 70
++#endif
+ { Qt::Key_Semicolon, ';' , ';' , 0xffff }, // 47
+ { Qt::Key_QuoteDbl, '\"' , '\"' , 0xffff }, // 48
+ { Qt::Key_Colon, ':' , ':' , 0xffff }, // 49
+@@ -572,6 +582,32 @@
+ static const int keyMSize = sizeof(keyM)/sizeof(QWSServer::KeyMap)-1;
+ static QIntDict<QWSServer::KeyMap> *overrideMap = 0;
+
++#if defined(QT_QWS_SL6000)
++/* Translation table to obtain a 'legacy' keycode corresponding to
++ Fn+key on tosa
++ Other devices obviously send different keycodes while Fn is down, tosa sends
++ the same keys as usual bracketed by Fn-down/Fn-up.
++ This table is used while Fn is down to obtain the key-code the SL-5xxx would
++ send, so the rest of keyboard processing does not need to be adjusted. */
++static const uchar sl6kFnTrans[] = { 0x00,
++ 0x5e, 0x3a, 0x43, 0x4a, 0x2b, 0x4b, 0x4c, 0x4d, 0x30, 0x4e, 0x4f, 0x50,
++ // !, -, cpy, #, 3, $, %, _, 8, &, *, (,
++ 0x53, 0x3b, 0x31, 0x32, 0x29, 0x2c, 0x3d, 0x2d, 0x2f, 0x44, 0x2a, 0x42,
++ // =, +, 9, 0, 1, 4, @, 5, 7, pste, 2, cut,
++ // padding for keycodes which don't ever get directly sent on tosa
++ // except for y->6, ret->'>', BS->DEL
++ 0x2e, 0x00, 0x00, 0x57, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00,
++ // 6, _Z, shft, ret, F11, fn, BS?, F31, lght, cncl, lft, up,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ // dn, rght, OK, home, 1, 2, 3, 4, 5, 6, 7, 8,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ // 9, 0, UNK, UNK, UNK, UNK, UNK, UNK, UNK, -, +, caps,
++ // here are a few translatable codes again...
++ 0x00, 0x00, 0x54, 0x56, 0x3c, 0x00, 0x00, 0x00, 0x70, 0x55 };
++ // @, ?, ,, ., tab, cut, cpy, pste, /, '
++static const int sl6kFnSize = sizeof(sl6kFnTrans);
++#endif
++
+ /*!
+ Changes the mapping of the keyboard; adding the scancode to Unicode
+ mappings from \a map. The server takes over ownership of \a map
+@@ -882,6 +918,15 @@
+ int keypad = 0;
+
+ #ifndef QT_QWS_USE_KEYCODES
++#if defined(QT_QWS_SL6000)
++ qDebug("Key pressed: %x", code);
++ if (fn)
++ if (code < sl6kFnSize) {
++ code = sl6kFnTrans[code];
++ qDebug("Translated Fn: %x", code);
++ } else
++ qDebug("Untranslatable Fn: %x", code);
++#endif
+ #if defined(QT_QWS_IPAQ)
+ // map ipaq 'action' key (0x60, 0xe0)
+ if ((code & 0x7f) == 0x60) {
diff --git a/packages/qte/qte-2.3.10/kernel-keymap.patch b/packages/qte/qte-2.3.10/kernel-keymap.patch
index e69de29bb2..7b786eb294 100644
--- a/packages/qte/qte-2.3.10/kernel-keymap.patch
+++ b/packages/qte/qte-2.3.10/kernel-keymap.patch
@@ -0,0 +1,1038 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10-snapshot-20050131/src/kernel/qkeyboard_qws.cpp~kernel-keymap
++++ qt-2.3.10-snapshot-20050131/src/kernel/qkeyboard_qws.cpp
+@@ -30,6 +30,42 @@
+ **
+ **********************************************************************/
+
++/****************************************************************************
++**
++** Keyboard Handling Redesign
++** Copyright 2003, Chris Larson <kergoth@handhelds.org>
++** Copyright 2004,2005 Holger Hans Peter Frether <freyther@handhelds.org>
++**
++** TODO: (key: . = in progress, x = completed)
++**
++** [.] Tty driver should load its initial keymap from the kernel,
++** thereby ensuring keymap consistency between X, console, and qt/e
++** [x] Read kernel keymappings.
++** [x] Read kernel keycode -> unicode map.
++** [x] Use them, along with the existing keyM, to push events up.
++** [x] Create a new table, from transformed keycode -> qt keycode, rather
++** than the existing raw keycode -> qt keycode.
++** [ ] Adapt handleKey to deal with keys that have no unicode value, such as
++** keypresses that are mapped to strings in the string table. (e.g. F keys)
++** [x] Cursor orientation change based on display rotation should not
++** be bound to Ipaq or 5xxx, but instead as a runtime choice based
++** on whether or not we're using a Transformed display driver.
++** [.] Double check that VT handling, particularly with regard to switching,
++** is handled properly.
++** [ ] Add a generic means of dealing with additional (outside the realm of
++** ctrl, alt, shift, altgr) modifiers. Also ensure a means of binding
++** a keypress/combination to a 'lock' of said additional modifiers.
++**
++** Holgers Todo
++**
++** [ ] Fix NumLock handling
++** [ ] Fix Keypad handling
++** [ ] Fix LED handling (LED_NUM and LED_CAP) don't seem to work
++** [ ] Fix CTRL+ALT+H (somehow takes the function of CTRL+ALT+BACKSPACE)
++**
++**********************************************************************/
++
++
+ #include "qwindowsystem_qws.h"
+ #include "qwsutils_qws.h"
+ #include "qgfx_qws.h"
+@@ -45,15 +81,18 @@
+ #include <ctype.h>
+
+ #include <unistd.h>
+-#ifdef _OS_LINUX_
+-#include <linux/kd.h>
+-#endif
++#include <sys/wait.h>
+ #include <sys/ioctl.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <signal.h>
++#include <termios.h>
++#ifdef _OS_LINUX_
++#include <linux/kd.h>
++#include <linux/keyboard.h>
++#endif
+
+ #ifdef QT_QWS_TIP2
+ #include <qcopchannel_qws.h>
+@@ -135,17 +174,6 @@
+ };
+ #endif
+
+-#ifdef QT_QWS_SL5XXX
+-#include <asm/sharp_char.h>
+-#endif
+-
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
+-#define QT_QWS_AUTOREPEAT_MANUALLY
+-#endif
+-
+-
+-
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
+ static int dir_keyrot = -1;
+
+ static int xform_dirkey(int key)
+@@ -169,7 +197,6 @@
+ int xf = qt_screen->transformOrientation() + dir_keyrot;
+ return (key-Qt::Key_Left+xf)%4+Qt::Key_Left;
+ }
+-#endif
+
+ #define VTSWITCHSIG SIGUSR2
+
+@@ -300,11 +327,19 @@
+ { Qt::Key_F35, 0xffff , 0xffff , 0xffff }, // 21 light
+ { Qt::Key_Escape, 0xffff , 0xffff , 0xffff }, // 22
+
++#ifdef QT_QWS_SL6000
+ // Direction key code are for *UNROTATED* display.
+- { Qt::Key_Up, 0xffff , 0xffff , 0xffff }, // 23
+- { Qt::Key_Right, 0xffff , 0xffff , 0xffff }, // 24
+- { Qt::Key_Left, 0xffff , 0xffff , 0xffff }, // 25
+- { Qt::Key_Down, 0xffff , 0xffff , 0xffff }, // 26
++ { Qt::Key_Left, 0xffff , 0xffff , 0xffff }, // 23
++ { Qt::Key_Up, 0xffff , 0xffff , 0xffff }, // 24
++ { Qt::Key_Down, 0xffff , 0xffff , 0xffff }, // 25
++ { Qt::Key_Right, 0xffff , 0xffff , 0xffff }, // 26
++#else
++ // Direction key code are for *UNROTATED* display.
++ { Qt::Key_Up, 0xffff , 0xffff , 0xffff }, // 23
++ { Qt::Key_Right, 0xffff , 0xffff , 0xffff }, // 24
++ { Qt::Key_Left, 0xffff , 0xffff , 0xffff }, // 25
++ { Qt::Key_Down, 0xffff , 0xffff , 0xffff }, // 26
++#endif
+
+ { Qt::Key_F33, 0xffff , 0xffff , 0xffff }, // 27 OK
+ { Qt::Key_F12, 0xffff , 0xffff , 0xffff }, // 28 40 home
+@@ -369,7 +404,7 @@
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 63
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 64
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 65
+- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 66
++ { Qt::Key_F14, 0xffff , 0xffff , 0xffff }, // 66
+ { Qt::Key_Meta, 0xffff , 0xffff , 0xffff }, // 67
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 68
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 69
+@@ -649,12 +684,61 @@
+ public:
+ QWSTtyKeyboardHandler(const QString&);
+ virtual ~QWSTtyKeyboardHandler();
++ void readKeyboardMap();
++ void readUnicodeMap();
++ void handleKey(unsigned char code);
+
+ private slots:
+ void readKeyboardData();
+
+ private:
++ void modifyModifier( int map, int modify, bool release );
++ void modifyLock( unsigned int lock, bool release );
++ void handleExtra( unsigned int key, bool release );
++ static void restoreLeds();
++ static void toggleLed(unsigned int);
++ int map_to_modif ();
++
++private:
+ struct termios origTermData;
++ unsigned short acm[E_TABSZ];
++ struct KeyMap {
++ enum ExtraKey{
++ Key_AltGr = 0x01ffff,
++ Key_Console1 = 0x02ffff,
++ Key_Console2 = 0x03ffff,
++ Key_Console3 = 0x04ffff,
++ Key_Console4 = 0x05ffff,
++ Key_Console5 = 0x06ffff,
++ Key_Console6 = 0x07ffff,
++ Key_Console7 = 0x08ffff,
++ Key_Console8 = 0x09ffff,
++ Key_Console9 = 0x0affff,
++ Key_Console10 = 0x0bffff,
++ Key_Console11 = 0x0cffff,
++ Key_Console12 = 0x0dffff,
++ Key_NumLock = 0x0effff,
++ Key_ShiftLock = 0x0fffff,
++ Key_CtrlLock = 0x10ffff,
++ Key_AltLock = 0x11ffff,
++ Key_AltGrLock = 0x12ffff
++ };
++
++ KeyMap( Qt::Key _key = Qt::Key_unknown, unsigned short _code = 0 )
++ : key( _key ), code( _code )
++ {}
++ KeyMap( ExtraKey _key, unsigned short _code )
++ : key( _key ), code( _code )
++ {}
++ unsigned int key; // 16 Bit
++ unsigned short code;
++ };
++
++ KeyMap kernel_map[(1<<KG_CAPSSHIFT)][NR_KEYS];
++ int current_map;
++ int modifier;
++ bool numlock : 1;
++ bool capslock : 1;
+ };
+
+
+@@ -814,6 +898,7 @@
+ fn = FALSE;
+
+ numLock = FALSE;
++#if 0
+ sharp_kbdctl_modifstat st;
+ int dev = ::open("/dev/sharp_kbdctl", O_RDWR);
+ if( dev >= 0 ) {
+@@ -825,6 +910,7 @@
+ ::close(dev);
+ }
+ #endif
++#endif
+ #if defined(QT_QWS_IPAQ)
+ // iPAQ Action Key has ScanCode 0x60: 0x60|0x80 = 0xe0 == extended mode 1 !
+ ipaq_return_pressed = FALSE;
+@@ -954,7 +1040,7 @@
+ }
+ } else if ( extended == 2 ) {
+ switch (code) {
+- case 0x1d:
++ case 0x1d:
+ return;
+ case 0x45:
+ keyCode = Qt::Key_Pause;
+@@ -1199,7 +1285,7 @@
+ unicode = '`';
+ } else
+ #endif
+-
++
+ if (bCtrl)
+ unicode = currentKey->ctrl_unicode;
+ else if (bCaps)
+@@ -1244,9 +1330,12 @@
+ //
+ // Tty keyboard
+ //
++#include "keyboard_linux_to_qt.h"
+
+ QWSTtyKeyboardHandler::QWSTtyKeyboardHandler(const QString& device)
++ : current_map(0), modifier( 0 ), numlock( false ), capslock( false )
+ {
++ restoreLeds();
+ kbdFD=open(device.isEmpty() ? "/dev/tty0" : device.latin1(), O_RDWR | O_NDELAY, 0);
+
+ if ( kbdFD >= 0 ) {
+@@ -1262,11 +1351,7 @@
+ tcgetattr( kbdFD, &termdata );
+
+ #if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
+-# ifdef QT_QWS_USE_KEYCODES
+- ioctl(kbdFD, KDSKBMODE, K_MEDIUMRAW);
+-# else
+- ioctl(kbdFD, KDSKBMODE, K_RAW);
+-# endif
++ ioctl(kbdFD, KDSKBMODE, K_MEDIUMRAW);
+ #endif
+
+ termdata.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+@@ -1279,6 +1364,9 @@
+ cfsetospeed(&termdata, 9600);
+ tcsetattr(kbdFD, TCSANOW, &termdata);
+
++ readUnicodeMap();
++ readKeyboardMap();
++
+ signal(VTSWITCHSIG, vtSwitchHandler);
+
+ #if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
+@@ -1300,6 +1388,7 @@
+
+ QWSTtyKeyboardHandler::~QWSTtyKeyboardHandler()
+ {
++ restoreLeds();
+ if (kbdFD >= 0)
+ {
+
+@@ -1328,13 +1417,451 @@
+ kbdFD = -1;
+ }
+ }
++void QWSTtyKeyboardHandler::readUnicodeMap()
++{
++ if (kbdFD < 0)
++ return;
++ if (ioctl(kbdFD,GIO_UNISCRNMAP,acm) != 0)
++ return;
++}
++
++
++void QWSTtyKeyboardHandler::readKeyboardMap()
++{
++ struct kbentry kbe;
++ if (kbdFD < 0)
++ return;
++
++ for (int map = 0; map < (1<<KG_CAPSSHIFT); ++map) {
++ unsigned short kval;
++ kbe.kb_table = map;
++
++ for (int key = 0; key < NR_KEYS; ++key) {
++ kbe.kb_index = key;
++
++ if (ioctl(kbdFD, KDGKBENT, &kbe) != 0)
++ continue;
++
++ if ((kbe.kb_value == K_HOLE) || (kbe.kb_value == K_NOSUCHMAP))
++ continue;
++
++ kval = KVAL(kbe.kb_value);
++ switch (KTYP(kbe.kb_value)) {
++ /*
++ * Map asciis and letters to Qt KeyCodes
++ * via the map (0-255)
++ */
++ case KT_LETTER:
++ case KT_LATIN:
++ kernel_map[map][key] = KeyMap( linux_to_qt[kval], kval );
++ break;
++
++ /*
++ * Handle the F Keys and map them
++ * to Qt
++ */
++ case KT_FN:
++ if ( kval <= 19 )
++ kernel_map[map][key] = KeyMap( static_cast<Qt::Key>( Qt::Key_F1 + kval ), kval );
++ else if ( kval >= 31 && kval <= 33)
++ kernel_map[map][key] = KeyMap( static_cast<Qt::Key>( Qt::Key_F21 + kval ), kval );
++ else if ( kval >= 34 && kval <= 45 ) {
++ int off = kval-34;
++ kernel_map[map][key] = KeyMap(static_cast<KeyMap::ExtraKey>( KeyMap::Key_Console1+off ), kval );
++ }else
++ switch(kbe.kb_value ) {
++ case K_INSERT:
++ kernel_map[map][key] = KeyMap( Qt::Key_Insert, kval );
++ break;
++ case K_REMOVE:
++ kernel_map[map][key] = KeyMap( Qt::Key_Delete, kval ); // right?
++ break;
++ case K_SELECT:
++ kernel_map[map][key] = KeyMap( Qt::Key_End , kval );
++ break;
++ case K_PGUP:
++ kernel_map[map][key] = KeyMap( Qt::Key_Prior, kval );
++ break;
++ case K_PGDN:
++ kernel_map[map][key] = KeyMap( Qt::Key_Next, kval );
++ break;
++ case K_MACRO:
++ kernel_map[map][key] = KeyMap( Qt::Key_Menu, kval );
++ break;
++ case K_HELP:
++ kernel_map[map][key] = KeyMap( Qt::Key_Help, kval );
++ break;
++ case K_PAUSE:
++ kernel_map[map][key] = KeyMap( Qt::Key_Pause, kval );
++ break;
++ case K_FIND:
++ case K_DO:
++ default:
++ kernel_map[map][key] = KeyMap( Qt::Key_unknown, kval );
++ break;
++ }
++ break;
++
++ case KT_SPEC:
++ switch ( kbe.kb_value ) {
++ case K_ENTER:
++ kernel_map[map][key] = KeyMap( Qt::Key_Enter, kval );
++ break;
++ case K_CAPS:
++ kernel_map[map][key] = KeyMap( Qt::Key_CapsLock, kval );
++ break;
++ case K_NUM:
++ kernel_map[map][key] = KeyMap( Qt::Key_NumLock, kval );
++ break;
++ case K_HOLD:
++ kernel_map[map][key] = KeyMap( Qt::Key_ScrollLock, kval );
++ break;
++ case K_HOLE:
++ case K_SH_REGS:
++ case K_SH_MEM:
++ case K_SH_STAT:
++ case K_BREAK:
++ case K_CONS:
++ case K_SCROLLFORW:
++ case K_SCROLLBACK:
++ case K_BOOT:
++ case K_CAPSON:
++ case K_COMPOSE:
++ case K_SAK:
++ case K_DECRCONSOLE:
++ case K_INCRCONSOLE:
++ case K_SPAWNCONSOLE:
++ case K_BARENUMLOCK:
++ default:
++ kernel_map[map][key] = KeyMap( Qt::Key_unknown, kval );
++ break;
++ }
++ break;
++ case KT_PAD:
++ /*
++ * Number Values might be wrong
++ */
++ switch(kbe.kb_value ) {
++ case K_P0:
++ kernel_map[map][key] = KeyMap( Qt::Key_0, kval );
++ break;
++ case K_P1:
++ kernel_map[map][key] = KeyMap( Qt::Key_1, kval );
++ break;
++ case K_P2:
++ kernel_map[map][key] = KeyMap( Qt::Key_2, kval );
++ break;
++ case K_P3:
++ kernel_map[map][key] = KeyMap( Qt::Key_3, kval );
++ break;
++ case K_P4:
++ kernel_map[map][key] = KeyMap( Qt::Key_4, kval );
++ break;
++ case K_P5:
++ kernel_map[map][key] = KeyMap( Qt::Key_5, kval );
++ break;
++ case K_P6:
++ kernel_map[map][key] = KeyMap( Qt::Key_6, kval );
++ break;
++ case K_P7:
++ kernel_map[map][key] = KeyMap( Qt::Key_7, kval );
++ break;
++ case K_P8:
++ kernel_map[map][key] = KeyMap( Qt::Key_8, kval );
++ break;
++ case K_P9:
++ kernel_map[map][key] = KeyMap( Qt::Key_9, kval );
++ break;
++ case K_PPLUS:
++ kernel_map[map][key] = KeyMap( Qt::Key_Plus, kval );
++ break;
++ case K_PMINUS:
++ kernel_map[map][key] = KeyMap( Qt::Key_Minus, kval );
++ break;
++ case K_PSTAR:
++ kernel_map[map][key] = KeyMap( Qt::Key_multiply, kval );
++ break;
++ case K_PSLASH:
++ kernel_map[map][key] = KeyMap( Qt::Key_division, kval );
++ break;
++ case K_PENTER:
++ kernel_map[map][key] = KeyMap( Qt::Key_Enter, kval );
++ break;
++ case K_PCOMMA:
++ kernel_map[map][key] = KeyMap( Qt::Key_Comma, kval ) ;
++ break;
++ case K_PPLUSMINUS:
++ kernel_map[map][key] = KeyMap( Qt::Key_plusminus, kval );
++ case K_PDOT:
++ break;
++ case K_PPARENL:
++ kernel_map[map][key] = KeyMap( Qt::Key_ParenLeft, kval );
++ break;
++ case K_PPARENR:
++ kernel_map[map][key] = KeyMap( Qt::Key_ParenRight, kval );
++ break;
++ default:
++ kernel_map[map][key] = KeyMap( Qt::Key_unknown, kval );
++ break;
++ }
++ break;
++ case KT_DEAD:
++ switch(kbe.kb_value ) {
++ case K_DGRAVE:
++ case K_DACUTE:
++ case K_DCIRCM:
++ case K_DTILDE:
++ case K_DDIERE:
++ case K_DCEDIL:
++ default:
++ kernel_map[map][key] = KeyMap( Qt::Key_unknown, kval );
++ break;
++ }
++ break;
++
++ case KT_CONS:
++ kernel_map[map][key] = KeyMap( Qt::Key_unknown, kval );
++ break;
++
++ case KT_CUR:
++ switch(kbe.kb_value ) {
++ case K_DOWN:
++ kernel_map[map][key] = KeyMap( Qt::Key_Down, kval );
++ break;
++ case K_LEFT:
++ kernel_map[map][key] = KeyMap( Qt::Key_Left, kval );
++ break;
++ case K_RIGHT:
++ kernel_map[map][key] = KeyMap( Qt::Key_Right, kval );
++ break;
++ case K_UP:
++ kernel_map[map][key] = KeyMap( Qt::Key_Up, kval );
++ break;
++ }
++ break;
++
++ case KT_SHIFT:
++ switch( kbe.kb_value ) {
++ case K_SHIFT:
++ kernel_map[map][key] = KeyMap( Qt::Key_Shift, kval );
++ break;
++ case K_ALT:
++ kernel_map[map][key] = KeyMap( Qt::Key_Alt, kval );
++ break;
++ case K_CTRL:
++ kernel_map[map][key] = KeyMap( Qt::Key_Control, kval );
++ break;
++ case K_ALTGR:
++ kernel_map[map][key] = KeyMap( KeyMap::Key_AltGr, kval );
++ break;
++ case K_SHIFTL:
++ case K_SHIFTR:
++ case K_CTRLL:
++ case K_CTRLR:
++ case K_CAPSSHIFT:
++ default:
++ kernel_map[map][key] = KeyMap( Qt::Key_unknown, kval );
++ break;
++ }
++ break;
++ /*
++ * What is this for?
++ */
++ case KT_ASCII:
++ case KT_LOCK:
++ case KT_SLOCK:
++ default:
++ kernel_map[map][key] = KeyMap( Qt::Key_unknown, kval );
++ //qWarning("keycode %d, map %d, type %d, val %d, acm %c\n", key, map, KTYP(kbe.kb_value), kval, acm[kval]);
++ break;
++ }
++ }
++ }
++}
++int QWSTtyKeyboardHandler::map_to_modif()
++{
++ int modifiers = 0;
++
++ if (current_map & (1<<KG_ALT))
++ modifiers |= Qt::AltButton;
++ else if (current_map & (1<<KG_CTRL))
++ modifiers |= Qt::ControlButton;
++ else if (current_map & (1<<KG_SHIFT))
++ modifiers |= Qt::ShiftButton;
++
++ return modifiers;
++}
++
++/*
++ * Handle Extra Keys for VT switching and Quitting
++ */
++void QWSTtyKeyboardHandler::handleExtra( unsigned int key, bool release ) {
++ if ( !release ) {
++ int term = 0;
++ if ( (modifier & (1<<KG_ALT)) && (modifier & (1<<KG_CTRL)) ) {
++ if ( key == Qt::Key_Left )
++ term = QMAX(vtQws -1, 1 );
++ else if ( key == Qt::Key_Right )
++ term = QMIN(vtQws +1, 12 );
++ }
++
++ if ( key >= KeyMap::Key_Console1 && key <= KeyMap::Key_Console12 )
++ term = key - KeyMap::Key_Console1 + 1;
++
++ if ( term != 0 ) {
++ current_map = modifier = 0;
++ numlock = capslock = false;
++ ioctl(kbdFD, VT_ACTIVATE, term );
++ return;
++ }
++ }
++
++ if ( (modifier & (1<<KG_ALT)) && (modifier & (1<<KG_CTRL) ) )
++ if ( key == Qt::Key_Delete || key == Qt::Key_Backspace ) {
++ qWarning( "Instructed to quit on %d", key );
++ qApp->quit();
++ }
++}
++
++/*
++ * apply modifier
++ */
++void QWSTtyKeyboardHandler::modifyModifier( int map, int modify, bool release ) {
++ if (map != -1) {
++ if (release)
++ current_map &= ~map;
++ else
++ current_map |= map;
++ }
++
++ if ( modify != -1 ) {
++ if (release)
++ modifier &= ~modify;
++ else
++ modifier |= modify;
++ }
++}
++
++void QWSTtyKeyboardHandler::handleKey(unsigned char code)
++{
++ int old_modifier = modifier;
++ bool release = false;
++ bool mod_key = true;
++
++ if (code & 0x80)
++ {
++ release = true;
++ code &= 0x7f;
++ }
++
++ KeyMap key_map = kernel_map[current_map][code];
++ unsigned short unicode = acm[key_map.code];
++ unsigned int qtKeyCode = key_map.key;
++
++ if ( !release )
++ qWarning( "KeyCode: %d KVAL: %d", qtKeyCode, key_map.code );
++// qWarning( "Alt:%d Ctrl:%d Shift:%d Key = %d", modifier & (1<<KG_ALT),
++// modifier & (1<<KG_CTRL),
++// modifier & (1<<KG_SHIFT), key_map.key );
++// qDebug("code %d, mCode %d, uni '%c', qtKeyCode %d", code, map.code,
++// QChar(unicode ).isPrint() ?
++// unicode : '?' , qtKeyCode);
++
++ // Handle map changes based on press/release of modifiers
++ // hardcoded for now
++ int modif = -1;
++ int map = -1;
++ bool lock = false;
++ switch (qtKeyCode)
++ {
++ case Qt::Key_Alt:
++ case Qt::Key_F22:
++ modif = (1<<KG_ALT);
++ break;
++ case Qt::Key_Control:
++ modif = (1<<KG_CTRL);
++ map = modif;
++ break;
++ case Qt::Key_Shift:
++ modif = (1<<KG_SHIFT);
++ map = modif;
++ break;
++ case KeyMap::Key_AltGr:
++ map = (1<<KG_ALTGR );
++ break;
++ case Qt::Key_Left:
++ case Qt::Key_Right:
++ case Qt::Key_Up:
++ case Qt::Key_Down:
++ mod_key = false;
++ if (qt_screen->isTransformed())
++ qtKeyCode = static_cast<Qt::Key>( xform_dirkey(static_cast<int>( qtKeyCode ) ) );
++ break;
++ /*
++ * handle lock, we don't handle scroll lock!
++ */
++ case Qt::Key_CapsLock:
++ case Qt::Key_NumLock:
++ lock = true;
++ default:
++ mod_key = false;
++ break;
++ }
++
++
++ /*
++ * Change the Map. We handle locks a bit different
++ */
++ if ( lock )
++ modifyLock( qtKeyCode, release );
++ else
++ modifyModifier( map, modif, release );
++
++ handleExtra( qtKeyCode, release );
++
++ /*
++ * do not repeat modifier keys
++ */
++ if ( modifier == old_modifier && mod_key )
++ return;
++
++ processKeyEvent(unicode & 0xff, qtKeyCode, map_to_modif(), !release, 0);
++}
+
+ void QWSTtyKeyboardHandler::readKeyboardData()
+ {
+ unsigned char buf[81];
+ int n = ::read(kbdFD, buf, 80 );
+ for ( int loop = 0; loop < n; loop++ )
+- doKey(buf[loop]);
++ handleKey(buf[loop]);
++}
++
++void QWSTtyKeyboardHandler::modifyLock( unsigned int lock, bool release ) {
++ if ( !release )
++ return;
++
++ if ( lock == Qt::Key_CapsLock ) {
++ toggleLed( LED_CAP );
++ capslock = !capslock;
++ }else if ( lock == Qt::Key_NumLock ) {
++ toggleLed( LED_NUM );
++ numlock = !numlock;
++ }
++}
++
++void QWSTtyKeyboardHandler::restoreLeds() {
++ unsigned int leds;
++ ioctl(kbdFD, KDGETLED, &leds );
++ leds &= ~LED_CAP;
++ leds &= ~LED_NUM;
++ ioctl(kbdFD, KDSETLED, &leds );
++}
++
++void QWSTtyKeyboardHandler::toggleLed(unsigned int led) {
++ unsigned int leds;
++ int ret = ioctl(kbdFD, KDGETLED, &leds );
++ leds = leds & led ? (leds & ~led) : (leds | led);
++ ret = ioctl(kbdFD, KDSETLED, &leds );
+ }
+
+ typedef struct {
+@@ -1439,13 +1966,13 @@
+ return;
+ #ifdef QT_QWS_TIP2
+ // custom scan codes - translate them and create a key event immediately
+- if( overrideMap && event.value == 0 || overrideMap->find( event.value ) )
++ if( overrideMap && event.value == 0 || overrideMap->find( event.value ) )
+ {
+ if( event.value )
+ {
+ int modifiers = 0;
+ QWSServer::KeyMap *km = overrideMap->find( event.value );
+- switch( km->unicode )
++ switch( km->unicode )
+ {
+ case Key_Menu:
+ case Key_Back:
+@@ -1473,14 +2000,14 @@
+ TRUE, FALSE );
+ }
+ lastPress = km;
+- }
+- else if( lastPress )
++ }
++ else if( lastPress )
+ {
+- processKeyEvent( lastPress->unicode, lastPress->key_code, 0,
++ processKeyEvent( lastPress->unicode, lastPress->key_code, 0,
+ FALSE, FALSE );
+ lastPress = 0;
+ }
+- }
++ }
+ else
+ #endif
+ {
+@@ -1845,10 +2372,10 @@
+ handler = new QWSUsbKeyboardHandler(device);
+ } else if ( type == "TTY" ) {
+ handler = new QWSTtyKeyboardHandler(device);
+- }
++ }
+ else if( type == "Samsung" ) {
+ handler = new QWSSamsungKeypadHandler(device);
+- }
++ }
+ else {
+ qWarning( "Keyboard type %s:%s unsupported", spec.latin1(), device.latin1() );
+ }
+--- /dev/null
++++ qt-2.3.10-snapshot-20050131/src/kernel/keyboard_linux_to_qt.h
+@@ -0,0 +1,263 @@
++/*
++ * Generated with a small python utility found at
++ * http://handhelds.org/~zecke/downloads/python_keytable_creator.py
++ */
++
++static const Qt::Key linux_to_qt[] = {
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_Backspace,
++Qt::Key_Tab,
++Qt::Key_unknown, // LineFeed
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown, // No Symbol
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown, // No Symbol
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_Escape,
++Qt::Key_unknown,
++Qt::Key_unknown, // No symbol
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_Space,
++Qt::Key_Exclam,
++Qt::Key_QuoteDbl,
++Qt::Key_NumberSign,
++Qt::Key_Dollar,
++Qt::Key_Percent,
++Qt::Key_Ampersand,
++Qt::Key_Apostrophe,
++Qt::Key_ParenLeft,
++Qt::Key_ParenRight,
++Qt::Key_Asterisk,
++Qt::Key_Plus,
++Qt::Key_Comma,
++Qt::Key_Minus,
++Qt::Key_Period,
++Qt::Key_Slash,
++Qt::Key_0,
++Qt::Key_1,
++Qt::Key_2,
++Qt::Key_3,
++Qt::Key_4,
++Qt::Key_5,
++Qt::Key_6,
++Qt::Key_7,
++Qt::Key_8,
++Qt::Key_9,
++Qt::Key_Colon,
++Qt::Key_Semicolon,
++Qt::Key_Less,
++Qt::Key_Equal,
++Qt::Key_Greater,
++Qt::Key_Question,
++Qt::Key_At,
++Qt::Key_A,
++Qt::Key_B,
++Qt::Key_C,
++Qt::Key_D,
++Qt::Key_E,
++Qt::Key_F,
++Qt::Key_G,
++Qt::Key_H,
++Qt::Key_I,
++Qt::Key_J,
++Qt::Key_K,
++Qt::Key_L,
++Qt::Key_M,
++Qt::Key_N,
++Qt::Key_O,
++Qt::Key_P,
++Qt::Key_Q,
++Qt::Key_R,
++Qt::Key_S,
++Qt::Key_T,
++Qt::Key_U,
++Qt::Key_V,
++Qt::Key_W,
++Qt::Key_X,
++Qt::Key_Y,
++Qt::Key_Z,
++Qt::Key_BracketLeft,
++Qt::Key_Backslash,
++Qt::Key_BracketRight,
++Qt::Key_AsciiCircum,
++Qt::Key_Underscore,
++Qt::Key_QuoteLeft, // grave
++Qt::Key_A,
++Qt::Key_B,
++Qt::Key_C,
++Qt::Key_D,
++Qt::Key_E,
++Qt::Key_F,
++Qt::Key_G,
++Qt::Key_H,
++Qt::Key_I,
++Qt::Key_J,
++Qt::Key_K,
++Qt::Key_L,
++Qt::Key_M,
++Qt::Key_N,
++Qt::Key_O,
++Qt::Key_P,
++Qt::Key_Q,
++Qt::Key_R,
++Qt::Key_S,
++Qt::Key_T,
++Qt::Key_U,
++Qt::Key_V,
++Qt::Key_W,
++Qt::Key_X,
++Qt::Key_Y,
++Qt::Key_Z,
++Qt::Key_BraceLeft,
++Qt::Key_Bar,
++Qt::Key_BraceRight,
++Qt::Key_AsciiTilde,
++Qt::Key_BackSpace,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_unknown,
++Qt::Key_nobreakspace,
++Qt::Key_exclamdown,
++Qt::Key_cent,
++Qt::Key_sterling,
++Qt::Key_currency,
++Qt::Key_yen,
++Qt::Key_brokenbar,
++Qt::Key_section,
++Qt::Key_diaeresis,
++Qt::Key_copyright,
++Qt::Key_ordfeminine,
++Qt::Key_guillemotleft,
++Qt::Key_notsign,
++Qt::Key_hyphen,
++Qt::Key_registered,
++Qt::Key_macron,
++Qt::Key_degree,
++Qt::Key_plusminus,
++Qt::Key_twosuperior,
++Qt::Key_threesuperior,
++Qt::Key_acute,
++Qt::Key_mu,
++Qt::Key_paragraph,
++Qt::Key_periodcentered,
++Qt::Key_cedilla,
++Qt::Key_onesuperior,
++Qt::Key_masculine,
++Qt::Key_guillemotright,
++Qt::Key_onequarter,
++Qt::Key_onehalf,
++Qt::Key_threequarters,
++Qt::Key_questiondown,
++Qt::Key_Agrave,
++Qt::Key_Aacute,
++Qt::Key_Acircumflex,
++Qt::Key_Atilde,
++Qt::Key_Adiaeresis,
++Qt::Key_Aring,
++Qt::Key_AE,
++Qt::Key_Ccedilla,
++Qt::Key_Egrave,
++Qt::Key_Eacute,
++Qt::Key_Ecircumflex,
++Qt::Key_Ediaeresis,
++Qt::Key_Igrave,
++Qt::Key_Iacute,
++Qt::Key_Icircumflex,
++Qt::Key_Idiaeresis,
++Qt::Key_ETH,
++Qt::Key_Ntilde,
++Qt::Key_Ograve,
++Qt::Key_Oacute,
++Qt::Key_Ocircumflex,
++Qt::Key_Otilde,
++Qt::Key_Odiaeresis,
++Qt::Key_multiply,
++Qt::Key_Ooblique,
++Qt::Key_Ugrave,
++Qt::Key_Uacute,
++Qt::Key_Ucircumflex,
++Qt::Key_Udiaeresis,
++Qt::Key_Yacute,
++Qt::Key_THORN,
++Qt::Key_ssharp,
++Qt::Key_agrave,
++Qt::Key_aacute,
++Qt::Key_acircumflex,
++Qt::Key_atilde,
++Qt::Key_adiaeresis,
++Qt::Key_aring,
++Qt::Key_ae,
++Qt::Key_ccedilla,
++Qt::Key_egrave,
++Qt::Key_eacute,
++Qt::Key_ecircumflex,
++Qt::Key_ediaeresis,
++Qt::Key_igrave,
++Qt::Key_iacute,
++Qt::Key_icircumflex,
++Qt::Key_idiaeresis,
++Qt::Key_eth,
++Qt::Key_ntilde,
++Qt::Key_ograve,
++Qt::Key_oacute,
++Qt::Key_ocircumflex,
++Qt::Key_otilde,
++Qt::Key_odiaeresis,
++Qt::Key_division,
++Qt::Key_oslash,
++Qt::Key_ugrave,
++Qt::Key_uacute,
++Qt::Key_ucircumflex,
++Qt::Key_udiaeresis,
++Qt::Key_yacute,
++Qt::Key_thorn,
++Qt::Key_ydiaeresis
++};
diff --git a/packages/qte/qte-2.3.10/mnci-touchscreen.patch b/packages/qte/qte-2.3.10/mnci-touchscreen.patch
index e69de29bb2..570c2ff290 100644
--- a/packages/qte/qte-2.3.10/mnci-touchscreen.patch
+++ b/packages/qte/qte-2.3.10/mnci-touchscreen.patch
@@ -0,0 +1,1987 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/src/kernel/qwsmouse_qws.cpp~ramses-touchscreen
++++ qt-2.3.10/src/kernel/qwsmouse_qws.cpp
+@@ -1,5 +1,5 @@
+ /****************************************************************************
+-** $Id: qt/src/kernel/qwsmouse_qws.cpp 2.3.10 edited 2005-01-24 $
++** $Id: qt/src/kernel/qwsmouse_qws.cpp 2.3.7 edited 2003-02-04 $
+ **
+ ** Implementation of Qt/Embedded mouse drivers
+ **
+@@ -47,85 +47,32 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <sys/ioctl.h>
+-#include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <termios.h>
+
++
+ #include <qgfx_qws.h>
+ #if !defined(_OS_QNX6_)
+
+-#ifdef QT_QWS_CASSIOPEIA
+-#include <linux/tpanel.h>
+-#endif
+-#ifdef QT_QWS_TSLIB
+-#include <tslib.h>
+-#endif
+-
+-
+-//#define QT_QWS_K2
+-
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_K2)
+-#define QT_QWS_IPAQ_RAW
+-typedef struct {
+- unsigned short pressure;
+- unsigned short x;
+- unsigned short y;
+- unsigned short pad;
+- struct timeval stamp;
+-} TS_EVENT;
+-#elif defined(QT_QWS_SL5XXX)
+-#define QT_QWS_SL5XXX_RAW
+-typedef struct {
+- long y;
+- long x;
+- long pressure;
+- long long millisecs;
+-} TS_EVENT;
+-#define QT_QWS_TP_SAMPLE_SIZE 10
+-#define QT_QWS_TP_MINIMUM_SAMPLES 4
+-#define QT_QWS_TP_PRESSURE_THRESHOLD 500
+-#define QT_QWS_TP_MOVE_LIMIT 50
+-#define QT_QWS_TP_JITTER_LIMIT 2
+-#elif defined(QT_QWS_SLC700)
+-#define QT_QWS_SLC700_RAW
+-typedef struct {
+- unsigned short pressure;
+- unsigned short x;
+- unsigned short y;
+- unsigned short millisecs;
+-} TS_EVENT;
+-#define QT_QWS_TP_SAMPLE_SIZE 10
+-#define QT_QWS_TP_MINIMUM_SAMPLES 4
+-#define QT_QWS_TP_PRESSURE_THRESHOLD 500
+-#define QT_QWS_TP_MOVE_LIMIT 50
+-#define QT_QWS_TP_JITTER_LIMIT 2
+-#endif
+-
+-#ifndef QT_QWS_TP_SAMPLE_SIZE
+-#define QT_QWS_TP_SAMPLE_SIZE 5
+-#endif
+-
+-#ifndef QT_QWS_TP_MINIMUM_SAMPLES
+-#define QT_QWS_TP_MINIMUM_SAMPLES 5
++#ifndef QT_QWS_TP_PRESSURE_DOWN_THRESHOLD
++#define QT_QWS_TP_PRESSURE_DOWN_THRESHOLD 500
+ #endif
+
+-#ifndef QT_QWS_TP_PRESSURE_THRESHOLD
+-#define QT_QWS_TP_PRESSURE_THRESHOLD 1
++#ifndef QT_QWS_TP_PRESSURE_UP_THRESHOLD
++#define QT_QWS_TP_PRESSURE_UP_THRESHOLD 450
+ #endif
+
+-#ifndef QT_QWS_TP_MOVE_LIMIT
+-#define QT_QWS_TP_MOVE_LIMIT 100
++#ifndef QT_QWS_TP_TABLE_SIZE
++#define QT_QWS_TP_TABLE_SIZE 2
+ #endif
+
+-#ifndef QT_QWS_TP_JITTER_LIMIT
+-#define QT_QWS_TP_JITTER_LIMIT 2
++#ifndef QT_QWS_TP_MOVE_MAX
++#define QT_QWS_TP_MOVE_MAX 100
+ #endif
+
+-//#define QWS_CUSTOMTOUCHPANEL
+-
+ /*!
+ \class QWSMouseHandler qwsmouse_qws.h
+ \brief Mouse driver/handler for Qt/Embedded
+@@ -168,8 +115,7 @@
+ enum MouseProtocol { Unknown = -1, Auto = 0,
+ MouseMan, IntelliMouse, Microsoft,
+ QVFBMouse, TPanel, BusMouse,
+- FirstAuto = MouseMan,
+- LastAuto = Microsoft };
++ };
+
+ static void limitToScreen( QPoint &pt )
+ {
+@@ -186,810 +132,14 @@
+ } MouseConfig;
+
+ static const MouseConfig mouseConfig[] = {
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+ { "Auto", Auto },
+-#endif
+-#ifndef QT_NO_QWS_MOUSE_PC
+- { "MouseMan", MouseMan },
+- { "IntelliMouse", IntelliMouse },
+- { "USB", IntelliMouse },
+- { "Microsoft", Microsoft },
+-#endif
+-#ifndef QT_NO_QWS_VFB
+ { "QVFbMouse", QVFBMouse },
+-#endif
+ { "TPanel", TPanel },
+- { "BusMouse", BusMouse },
+ { 0, Unknown }
+ };
+
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+-/*
+- * Automatic-detection mouse driver
+- */
+-
+-class QAutoMouseSubHandler {
+-protected:
+- enum { max_buf=32 };
+-
+- int fd;
+-
+- uchar buffer[max_buf];
+- int nbuf;
+-
+- QPoint motion;
+- int bstate;
+-
+- int goodness;
+- int badness;
+-
+- virtual int tryData()=0;
+-
+-public:
+- QAutoMouseSubHandler(int f) : fd(f)
+- {
+- nbuf = bstate = goodness = badness = 0;
+- }
+-
+- int file() const { return fd; }
+-
+- void closeIfNot(int& f)
+- {
+- if ( fd != f ) {
+- f = fd;
+- close(fd);
+- }
+- }
+-
+- void worse(int by=1) { badness+=by; }
+- bool reliable() const { return goodness >= 5 && badness < 50; }
+- int buttonState() const { return bstate; }
+- bool motionPending() const { return motion!=QPoint(0,0); }
+- QPoint takeMotion() { QPoint r=motion; motion=QPoint(0,0); return r; }
+-
+- void appendData(uchar* data, int length)
+- {
+- memcpy(buffer+nbuf, data, length);
+- nbuf += length;
+- }
+-
+- enum UsageResult { Insufficient, Motion, Button };
+-
+- UsageResult useData()
+- {
+- int pbstate = bstate;
+- int n = tryData();
+- if ( n > 0 ) {
+- if ( n<nbuf )
+- memmove( buffer, buffer+n, nbuf-n );
+- nbuf -= n;
+- return pbstate == bstate ? Motion : Button;
+- }
+- return Insufficient;
+- }
+-};
+-
+-class QAutoMouseSubHandler_intellimouse : public QAutoMouseSubHandler {
+- int packetsize;
+-public:
+- QAutoMouseSubHandler_intellimouse(int f) : QAutoMouseSubHandler(f)
+- {
+- init();
+- }
+-
+- void init()
+- {
+- int n;
+- uchar reply[20];
+-
+- tcflush(fd,TCIOFLUSH);
+- static const uchar initseq[] = { 243, 200, 243, 100, 243, 80 };
+- static const uchar query[] = { 0xf2 };
+- if (write(fd, initseq, sizeof(initseq))!=sizeof(initseq)) {
+- badness = 100;
+- return;
+- }
+- usleep(10000);
+- tcflush(fd,TCIOFLUSH);
+- if (write(fd, query, sizeof(query))!=sizeof(query)) {
+- badness = 100;
+- return;
+- }
+- usleep(10000);
+- n = read(fd, reply, 20);
+- if ( n > 0 ) {
+- goodness = 10;
+- switch ( reply[n-1] ) {
+- case 3:
+- case 4:
+- packetsize = 4;
+- break;
+- default:
+- packetsize = 3;
+- }
+- } else {
+- badness = 100;
+- }
+- }
+-
+- int tryData()
+- {
+- if ( nbuf >= packetsize ) {
+- //int overflow = (buffer[0]>>6 )& 0x03;
+-
+- if ( /*overflow ||*/ !(buffer[0] & 8) ) {
+- badness++;
+- return 1;
+- } else {
+- motion +=
+- QPoint((buffer[0] & 0x10) ? buffer[1]-256 : buffer[1],
+- (buffer[0] & 0x20) ? 256-buffer[2] : -buffer[2]);
+- int nbstate = buffer[0] & 0x7;
+- if ( motion.x() || motion.y() || bstate != nbstate ) {
+- bstate = nbstate;
+- goodness++;
+- } else {
+- badness++;
+- return 1;
+- }
+- }
+- return packetsize;
+- }
+- return 0;
+- }
+-};
+-
+-class QAutoMouseSubHandler_serial : public QAutoMouseSubHandler {
+-public:
+- QAutoMouseSubHandler_serial(int f) : QAutoMouseSubHandler(f)
+- {
+- initSerial();
+- }
+-
+-protected:
+- void setflags(int f)
+- {
+- termios tty;
+- tcgetattr(fd, &tty);
+- tty.c_iflag = IGNBRK | IGNPAR;
+- tty.c_oflag = 0;
+- tty.c_lflag = 0;
+- tty.c_cflag = f | CREAD | CLOCAL | HUPCL;
+-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
+- tty.c_line = 0;
+-#endif
+- tty.c_cc[VTIME] = 0;
+- tty.c_cc[VMIN] = 1;
+- tcsetattr(fd, TCSANOW, &tty);
+- }
+-
+-private:
+- void initSerial()
+- {
+- int speed[4] = { B9600, B4800, B2400, B1200 };
+-
+- for (int n = 0; n < 4; n++) {
+- setflags(CSTOPB | speed[n]);
+- write(fd, "*q", 2);
+- usleep(10000);
+- }
+- }
+-};
+-
+-class QAutoMouseSubHandler_mousesystems : public QAutoMouseSubHandler_serial {
+-public:
+- // ##### This driver has not been tested
+-
+- QAutoMouseSubHandler_mousesystems(int f) : QAutoMouseSubHandler_serial(f)
+- {
+- init();
+- }
+-
+- void init()
+- {
+- setflags(B1200|CS8|CSTOPB);
+- // 60Hz
+- if (write(fd, "R", 1)!=1) {
+- badness = 100;
+- return;
+- }
+- tcflush(fd,TCIOFLUSH);
+- }
+-
+- int tryData()
+- {
+- if ( nbuf >= 5 ) {
+- if ( (buffer[0] & 0xf8) != 0x80 ) {
+- badness++;
+- return 1;
+- }
+- motion +=
+- QPoint((signed char)buffer[1] + (signed char)buffer[3],
+- -(signed char)buffer[2] + (signed char)buffer[4]);
+- int t = ~buffer[0];
+- int nbstate = ((t&3) << 1) | ((t&4) >> 2);
+- if ( motion.x() || motion.y() || bstate != nbstate ) {
+- bstate = nbstate;
+- goodness++;
+- } else {
+- badness++;
+- return 1;
+- }
+- return 5;
+- }
+- return 0;
+- }
+-};
+-
+-class QAutoMouseSubHandler_ms : public QAutoMouseSubHandler_serial {
+- int mman;
+-public:
+- QAutoMouseSubHandler_ms(int f) : QAutoMouseSubHandler_serial(f)
+- {
+- mman=0;
+- init();
+- }
+-
+- void init()
+- {
+- setflags(B1200|CS7);
+- // 60Hz
+- if (write(fd, "R", 1)!=1) {
+- badness = 100;
+- return;
+- }
+- tcflush(fd,TCIOFLUSH);
+- }
+-
+- int tryData()
+- {
+- if ( !(buffer[0] & 0x40) ) {
+- if ( buffer[0] == 0x20 && (bstate & Qt::MidButton) ) {
+- mman=1; // mouseman extension
+- }
+- return 1;
+- }
+- int extra = mman&&(bstate & Qt::MidButton);
+- if ( nbuf >= 3+extra ) {
+- int nbstate = 0;
+- if ( buffer[0] == 0x40 && !bstate && !buffer[1] && !buffer[2] ) {
+- nbstate = Qt::MidButton;
+- } else {
+- nbstate = ((buffer[0] & 0x20) >> 5)
+- | ((buffer[0] & 0x10) >> 3);
+- if ( extra && buffer[3] == 0x20 )
+- nbstate = Qt::MidButton;
+- }
+-
+- if ( buffer[1] & 0x40 ) {
+- badness++;
+- return 1;
+- } else {
+- motion +=
+- QPoint((signed char)((buffer[0]&0x3)<<6)
+- |(signed char)(buffer[1]&0x3f),
+- (signed char)((buffer[0]&0xc)<<4)
+- |(signed char)(buffer[2]&0x3f));
+- if ( motion.x() || motion.y() || bstate != nbstate ) {
+- bstate = nbstate;
+- goodness++;
+- } else {
+- badness++;
+- return 1;
+- }
+- return 3+extra;
+- }
+- }
+- return 0;
+- }
+-};
+-
+-/*
+-QAutoMouseHandler::UsageResult QAutoMouseHandler::useDev(Dev& d)
+-{
+- if ( d.nbuf >= mouseData[d.protocol].bytesPerPacket ) {
+- uchar *mb = d.buf;
+- int bstate = 0;
+- int dx = 0;
+- int dy = 0;
+-
+- switch (mouseProtocol) {
+- case MouseMan:
+- case IntelliMouse:
+- {
+- bstate = mb[0] & 0x7; // assuming Qt::*Button order
+-
+- int overflow = (mb[0]>>6 )& 0x03;
+- if (mouseProtocol == MouseMan && overflow) {
+- //### wheel events signalled with overflow bit, ignore for now
+- }
+- else {
+- bool xs = mb[0] & 0x10;
+- bool ys = mb[0] & 0x20;
+- dx = xs ? mb[1]-256 : mb[1];
+- dy = ys ? mb[2]-256 : mb[2];
+- }
+- break;
+- }
+- case Microsoft:
+- if ( ((mb[0] & 0x20) >> 3) ) {
+- bstate |= Qt::LeftButton;
+- }
+- if ( ((mb[0] & 0x10) >> 4) ) {
+- bstate |= Qt::RightButton;
+- }
+-
+- dx=(signed char)(((mb[0] & 0x03) << 6) | (mb[1] & 0x3f));
+- dy=-(signed char)(((mb[0] & 0x0c) << 4) | (mb[2] & 0x3f));
+-
+- break;
+- }
+- }
+- }
+-*/
+-
+-#endif
+-
+-class QAutoMouseHandler : public QWSMouseHandler {
+- Q_OBJECT
+-
+-public:
+- QAutoMouseHandler();
+- ~QAutoMouseHandler();
+-
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+-private:
+- enum { max_dev=32 };
+- QAutoMouseSubHandler *sub[max_dev];
+- QList<QSocketNotifier> notifiers;
+- int nsub;
+- int retries;
+-#endif
+-
+-private slots:
+- void readMouseData(int);
+-
+-private:
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+- void openDevices();
+- void closeDevices();
+- void notify(int fd);
+- bool sendEvent(QAutoMouseSubHandler& h)
+- {
+- if ( h.reliable() ) {
+- mousePos += h.takeMotion();
+- limitToScreen( mousePos );
+-/*
+-qDebug("%d,%d %c%c%c",
+-mousePos.x(),mousePos.y(),
+-(h.buttonState()&Qt::LeftButton)?'L':'.',
+-(h.buttonState()&Qt::MidButton)?'M':'.',
+-(h.buttonState()&Qt::RightButton)?'R':'.');
+-*/
+- emit mouseChanged(mousePos,h.buttonState());
+- return TRUE;
+- } else {
+- h.takeMotion();
+- if ( h.buttonState() & (Qt::RightButton|Qt::MidButton) ) {
+- // Strange for the user to press right or middle without
+- // a moving mouse!
+- h.worse();
+- }
+- return FALSE;
+- }
+- }
+-#endif
+-};
+-
+-QAutoMouseHandler::QAutoMouseHandler()
+-{
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+- notifiers.setAutoDelete( TRUE );
+- retries = 0;
+- openDevices();
+-#endif
+-}
+-
+-QAutoMouseHandler::~QAutoMouseHandler()
+-{
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+- closeDevices();
+-#endif
+-}
+-
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+-void QAutoMouseHandler::openDevices()
+-{
+- nsub=0;
+- int fd;
+- fd = open( "/dev/psaux", O_RDWR | O_NDELAY );
+- if ( fd >= 0 ) {
+- sub[nsub++] = new QAutoMouseSubHandler_intellimouse(fd);
+- notify(fd);
+- }
+-#if !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) && !defined(QT_QWS_K2) && !defined(QT_QWS_SLC700)
+- char fn[] = "/dev/ttyS?";
+- for (int ch='0'; ch<='3'; ch++) {
+- fn[9] = ch;
+- fd = open( fn, O_RDWR | O_NDELAY );
+- if ( fd >= 0 ) {
+- //sub[nsub++] = new QAutoMouseSubHandler_intellimouse(fd);
+- sub[nsub++] = new QAutoMouseSubHandler_mousesystems(fd);
+- sub[nsub++] = new QAutoMouseSubHandler_ms(fd);
+- notify(fd);
+- }
+- }
+-#endif
+- // ...
+-}
+-
+-void QAutoMouseHandler::closeDevices()
+-{
+- int pfd=-1;
+- for (int i=0; i<nsub; i++) {
+- sub[i]->closeIfNot(pfd);
+- delete sub[i];
+- }
+- notifiers.clear();
+-}
+-
+-void QAutoMouseHandler::notify(int fd)
+-{
+- QSocketNotifier *mouseNotifier
+- = new QSocketNotifier( fd, QSocketNotifier::Read, this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData(int)));
+- notifiers.append( mouseNotifier );
+-}
+-#endif
+-
+-void QAutoMouseHandler::readMouseData(int fd)
+-{
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+- for (;;) {
+- uchar buf[8];
+- int n = read(fd, buf, 8);
+- if ( n<=0 )
+- break;
+- for (int i=0; i<nsub; i++) {
+- QAutoMouseSubHandler& h = *sub[i];
+- if ( h.file() == fd ) {
+- h.appendData(buf,n);
+- for (;;) {
+- switch ( h.useData() ) {
+- case QAutoMouseSubHandler::Button:
+- sendEvent(h);
+- break;
+- case QAutoMouseSubHandler::Insufficient:
+- goto breakbreak;
+- case QAutoMouseSubHandler::Motion:
+- break;
+- }
+- }
+- breakbreak:
+- ;
+- }
+- }
+- }
+- bool any_reliable=FALSE;
+- for (int i=0; i<nsub; i++) {
+- QAutoMouseSubHandler& h = *sub[i];
+- if ( h.motionPending() )
+- sendEvent(h);
+- any_reliable = any_reliable || h.reliable();
+- }
+- if ( any_reliable ) {
+- // ... get rid of all unreliable ones? All bad ones?
+- } else if ( retries < 2 ) {
+- // Try again - maybe the mouse was being moved when we tried to init.
+- closeDevices();
+- openDevices();
+- retries++;
+- }
+-#else
+- Q_UNUSED( fd );
+-#endif
+-}
+-
+-
+-
+-
+-/*
+- * Standard mouse driver
+- */
+-
+-typedef struct {
+- int bytesPerPacket;
+-} MouseData;
+-
+-static const MouseData mouseData[] = {
+- { 3 }, // dummy for auto protocal, correction made by add by YYD
+- { 3 }, // MouseMan
+- { 4 }, // intelliMouse
+- { 3 }, // Microsoft
+- { 0 }, // QVFBMouse,
+- { 0 }, // TPanel,
+- { 3 }, // BusMouse,
+-};
+-
+-
+-class QWSMouseHandlerPrivate : public QWSMouseHandler {
+- Q_OBJECT
+-public:
+- QWSMouseHandlerPrivate( MouseProtocol protocol, QString mouseDev );
+- ~QWSMouseHandlerPrivate();
+-
+-#ifndef QT_NO_QWS_MOUSE_PC
+-private:
+- static const int mouseBufSize = 128;
+- int mouseFD;
+- int mouseIdx;
+- uchar mouseBuf[mouseBufSize];
+- MouseProtocol mouseProtocol;
+- void handleMouseData();
+-#endif
+-
+-private slots:
+- void readMouseData();
+-
+-private:
+- int obstate;
+-};
+-
+-
+-void QWSMouseHandlerPrivate::readMouseData()
+-{
+-#ifndef QT_NO_QWS_MOUSE_PC
+- int n;
+- if ( BusMouse == mouseProtocol ) {
+- // a workaround of linux busmouse driver interface.
+- // It'll only read 3 bytes a time and return all other buffer zeroed, thus cause protocol errors
+- for (;;) {
+- if ( mouseBufSize - mouseIdx < 3 )
+- break;
+- n = read( mouseFD, mouseBuf+mouseIdx, 3 );
+- if ( n != 3 )
+- break;
+- mouseIdx += 3;
+- }
+- } else {
+- do {
+- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx );
+- if ( n > 0 )
+- mouseIdx += n;
+- } while ( n > 0 );
+- }
+- handleMouseData();
+-#endif
+-}
+-
+-
+-#ifndef QT_NO_QWS_MOUSE_PC
+-/*
+-*/
+-
+-void QWSMouseHandlerPrivate::handleMouseData()
+-{
+- static const int accel_limit = 5;
+- static const int accel = 2;
+-
+- int idx = 0;
+- int bstate = 0;
+- int dx = 0, dy = 0;
+- bool sendEvent = false;
+- int tdx = 0, tdy = 0;
+-
+- while ( mouseIdx-idx >= mouseData[mouseProtocol].bytesPerPacket ) {
+- //qDebug( "Got mouse data" );
+- uchar *mb = mouseBuf+idx;
+- bstate = 0;
+- dx = 0;
+- dy = 0;
+- sendEvent = false;
+- switch (mouseProtocol) {
+- case MouseMan:
+- case IntelliMouse:
+- {
+- if (mb[0] & 0x01)
+- bstate |= Qt::LeftButton;
+- if (mb[0] & 0x02)
+- bstate |= Qt::RightButton;
+- if (mb[0] & 0x04)
+- bstate |= Qt::MidButton;
+-
+- int overflow = (mb[0]>>6 )& 0x03;
+- if (mouseProtocol == MouseMan && overflow) {
+- //### wheel events signalled with overflow bit, ignore for now
+- }
+- else {
+- bool xs = mb[0] & 0x10;
+- bool ys = mb[0] & 0x20;
+- dx = xs ? mb[1]-256 : mb[1];
+- dy = ys ? mb[2]-256 : mb[2];
+
+- sendEvent = true;
+- }
+-#if 0 //debug
+- if (mouseProtocol == MouseMan)
+- printf("(%2d) %02x %02x %02x ", idx, mb[0], mb[1], mb[2]);
+- else
+- printf("(%2d) %02x %02x %02x %02x ",idx,mb[0],mb[1],mb[2],mb[3]);
+- const char *b1 = (mb[0] & 0x01) ? "b1":" ";//left
+- const char *b2 = (mb[0] & 0x02) ? "b2":" ";//right
+- const char *b3 = (mb[0] & 0x04) ? "b3":" ";//mid
+
+- if ( overflow )
+- printf( "Overflow%d %s %s %s (%4d,%4d)\n", overflow,
+- b1, b2, b3, mousePos.x(), mousePos.y() );
+- else
+- printf( "%s %s %s (%+3d,%+3d) (%4d,%4d)\n",
+- b1, b2, b3, dx, dy, mousePos.x(), mousePos.y() );
+-#endif
+- break;
+- }
+- case Microsoft:
+- if ( (mb[0] & 0x20) )
+- bstate |= Qt::LeftButton;
+- if ( (mb[0] & 0x10) )
+- bstate |= Qt::RightButton;
+-
+- dx=(signed char)(((mb[0] & 0x03) << 6) | (mb[1] & 0x3f));
+- dy=-(signed char)(((mb[0] & 0x0c) << 4) | (mb[2] & 0x3f));
+- sendEvent=true;
+-
+- break;
+- case BusMouse:
+- if ( !(mb[0] & 0x04) )
+- bstate |= Qt::LeftButton;
+- if ( !(mb[0] & 0x01) )
+- bstate |= Qt::RightButton;
+-
+- dx=(signed char)mb[1];
+- dy=(signed char)mb[2];
+- sendEvent=true;
+- break;
+-
+- default:
+- qWarning( "Unknown mouse protocol in QWSMouseHandlerPrivate" );
+- break;
+- }
+- if (sendEvent) {
+- if ( QABS(dx) > accel_limit || QABS(dy) > accel_limit ) {
+- dx *= accel;
+- dy *= accel;
+- }
+- tdx += dx;
+- tdy += dy;
+- if ( bstate != obstate ) {
+- mousePos += QPoint(tdx,-tdy);
+- limitToScreen( mousePos );
+- emit mouseChanged(mousePos,bstate);
+- sendEvent = FALSE;
+- tdx = 0;
+- tdy = 0;
+- obstate = bstate;
+- }
+- }
+- idx += mouseData[mouseProtocol].bytesPerPacket;
+- }
+- if ( sendEvent ) {
+- mousePos += QPoint(tdx,-tdy);
+- limitToScreen( mousePos );
+- emit mouseChanged(mousePos,bstate);
+- }
+-
+- int surplus = mouseIdx - idx;
+- for ( int i = 0; i < surplus; i++ )
+- mouseBuf[i] = mouseBuf[idx+i];
+- mouseIdx = surplus;
+-}
+-#endif
+-
+-
+-QWSMouseHandlerPrivate::QWSMouseHandlerPrivate( MouseProtocol protocol,
+- QString mouseDev )
+-{
+-#ifndef QT_NO_QWS_MOUSE_PC
+- mouseProtocol = protocol;
+-
+- if ( mouseDev.isEmpty() )
+- mouseDev = "/dev/mouse";
+- obstate = -1;
+- mouseFD = -1;
+- mouseFD = open( mouseDev.local8Bit().data(), O_RDWR | O_NDELAY);
+- if ( mouseFD < 0 ) {
+- mouseFD = open( mouseDev.local8Bit().data(), O_RDONLY | O_NDELAY);
+- if ( mouseFD < 0 )
+- qDebug( "Cannot open %s (%s)", mouseDev.ascii(),
+- strerror(errno));
+- } else {
+- // Clear pending input
+- tcflush(mouseFD,TCIFLUSH);
+-
+- bool ps2 = false;
+-
+- switch (mouseProtocol) {
+- case MouseMan:
+- ps2 = true;
+- write(mouseFD,"",1);
+- usleep(50000);
+- write(mouseFD,"@EeI!",5);
+- break;
+-
+- case IntelliMouse: {
+-// ps2 = true;
+- const unsigned char init1[] = { 243, 200, 243, 100, 243, 80 };
+- const unsigned char init2[] = { 246, 230, 244, 243, 100, 232, 3 };
+- write(mouseFD,init1,sizeof(init1));
+- usleep(50000);
+- write(mouseFD,init2,sizeof(init2));
+- }
+- break;
+-
+- case Microsoft:
+- struct termios tty;
+-
+- tcgetattr(mouseFD, &tty);
+-
+- tty.c_iflag = IGNBRK | IGNPAR;
+- tty.c_oflag = 0;
+- tty.c_lflag = 0;
+-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
+- tty.c_line = 0;
+-#endif // _OS_FREEBSD_
+- tty.c_cc[VTIME] = 0;
+- tty.c_cc[VMIN] = 1;
+- tty.c_cflag = B1200 | CS7 | CREAD | CLOCAL | HUPCL;
+- tcsetattr(mouseFD, TCSAFLUSH, &tty); /* set parameters */
+- break;
+-
+- case BusMouse:
+- usleep(50000);
+- break;
+-
+- default:
+- qDebug("Unknown mouse protocol");
+- exit(1);
+- }
+-
+- if (ps2) {
+- char buf[] = { 246, 244 };
+- write(mouseFD,buf,1);
+- write(mouseFD,buf+1,1);
+- }
+-
+- usleep(50000);
+- tcflush(mouseFD,TCIFLUSH); // ### doesn't seem to work.
+- usleep(50000);
+- tcflush(mouseFD,TCIFLUSH); // ### doesn't seem to work.
+-
+- char buf[100]; // busmouse driver will not read if bufsize < 3, YYD
+- while (read(mouseFD, buf, 100) > 0) { } // eat unwanted replies
+-
+- mouseIdx = 0;
+-
+- QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read, this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+- }
+-#else
+- Q_UNUSED(protocol);
+- Q_UNUSED(mouseDev);
+-#endif
+-}
+-
+-QWSMouseHandlerPrivate::~QWSMouseHandlerPrivate()
+-{
+-#ifndef QT_NO_QWS_MOUSE_PC
+- if (mouseFD >= 0) {
+- tcflush(mouseFD,TCIFLUSH); // yyd.
+- close(mouseFD);
+- }
+-#endif
+-}
+-
+-/*
+- *
+- */
+
+ QCalibratedMouseHandler::QCalibratedMouseHandler()
+ : samples(5), currSample(0), numSamples(0)
+@@ -1030,7 +180,8 @@
+ if ( file.open( IO_WriteOnly ) ) {
+ QTextStream t( &file );
+ t << a << " " << b << " " << c << " ";
+- t << d << " " << e << " " << f << " " << s;
++ t << d << " " << e << " " << f << " " << s << endl;
++ file.close();
+ } else
+ #endif
+ {
+@@ -1046,6 +197,7 @@
+ if ( file.open( IO_ReadOnly ) ) {
+ QTextStream t( &file );
+ t >> a >> b >> c >> d >> e >> f >> s;
++ file.close();
+ } else
+ #endif
+ {
+@@ -1073,12 +225,24 @@
+ writeCalibration();
+ }
+
++void QCalibratedMouseHandler::setCalibration(int aa, int bb, int cc, int dd, int ee, int ff, int ss)
++{
++ a = aa;
++ b = bb;
++ c = cc;
++ d = dd;
++ e = ee;
++ f = ff;
++ s = ss;
++}
++
+ QPoint QCalibratedMouseHandler::transform( const QPoint &p )
+ {
+ QPoint tp;
+
+ tp.setX( (a * p.x() + b * p.y() + c) / s );
+ tp.setY( (d * p.x() + e * p.y() + f) / s );
++//qDebug("QCalibratedMouseHandler::transform(%d,%d) -> %d,%d)", p.x(), p.y(), tp.x(), tp.y() );
+
+ return tp;
+ }
+@@ -1143,814 +307,192 @@
+ return sent;
+ }
+
+-/*
+- * Handler for /dev/tpanel Linux kernel driver
+- */
+
+-class QVrTPanelHandlerPrivate : public QCalibratedMouseHandler {
+- Q_OBJECT
+-public:
+- QVrTPanelHandlerPrivate(MouseProtocol, QString dev);
+- ~QVrTPanelHandlerPrivate();
+
+-private:
+- int mouseFD;
+- MouseProtocol mouseProtocol;
+-private slots:
+- void sendRelease();
+- void readMouseData();
+-private:
+- static const int mouseBufSize = 1280;
+- QTimer *rtimer;
+- int mouseIdx;
+- uchar mouseBuf[mouseBufSize];
+-};
+
+-#ifndef QT_QWS_CASSIOPEIA
+-QVrTPanelHandlerPrivate::QVrTPanelHandlerPrivate( MouseProtocol, QString ) :
+- QCalibratedMouseHandler()
+-{
+-}
+-#else
+-QVrTPanelHandlerPrivate::QVrTPanelHandlerPrivate( MouseProtocol, QString dev ) :
+- QCalibratedMouseHandler()
+-{
+- if ( dev.isEmpty() )
+- dev = "/dev/tpanel";
+-
+- if ((mouseFD = open( dev, O_RDONLY)) < 0) {
+- qFatal( "Cannot open %s (%s)", dev.latin1(), strerror(errno));
+- } else {
+- sleep(1);
+- }
+-
+- struct scanparam s;
+- s.interval = 20000;
+- s.settletime = 480;
+- if ( ioctl(mouseFD, TPSETSCANPARM, &s) < 0
+- || fcntl(mouseFD, F_SETFL, O_NONBLOCK) < 0 )
+- qWarning("Error initializing touch panel.");
+-
+- QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read,
+- this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+-
+- rtimer = new QTimer( this );
+- connect( rtimer, SIGNAL(timeout()), this, SLOT(sendRelease()));
+- mouseIdx = 0;
+- setFilterSize( 3 );
+-
+- printf("\033[?25l"); fflush(stdout); // VT100 cursor off
+-}
+-#endif
+-
+-QVrTPanelHandlerPrivate::~QVrTPanelHandlerPrivate()
+-{
+- if (mouseFD >= 0)
+- close(mouseFD);
+-}
+-
+-void QVrTPanelHandlerPrivate::sendRelease()
+-{
+- sendFiltered( mousePos, 0 );
+-}
+
+-void QVrTPanelHandlerPrivate::readMouseData()
+-{
+-#ifdef QT_QWS_CASSIOPEIA
+- if(!qt_screen)
+- return;
+- static bool pressed = FALSE;
+-
+- int n;
+- do {
+- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx );
+- if ( n > 0 )
+- mouseIdx += n;
+- } while ( n > 0 && mouseIdx < mouseBufSize );
+-
+- int idx = 0;
+- while ( mouseIdx-idx >= (int)sizeof( short ) * 6 ) {
+- uchar *mb = mouseBuf+idx;
+- ushort *data = (ushort *) mb;
+- if ( data[0] & 0x8000 ) {
+- if ( data[5] > 750 ) {
+- QPoint t(data[3]-data[4],data[2]-data[1]);
+- if ( sendFiltered( t, Qt::LeftButton ) )
+- pressed = TRUE;
+- if ( pressed )
+- rtimer->start( 200, TRUE ); // release unreliable
+- }
+- } else if ( pressed ) {
+- rtimer->start( 50, TRUE );
+- pressed = FALSE;
+- }
+- idx += sizeof( ushort ) * 6;
+- }
++struct input_event {
++ struct timeval time;
++ unsigned short type;
++ unsigned short code;
++ unsigned int value;
++};
+
+- int surplus = mouseIdx - idx;
+- for ( int i = 0; i < surplus; i++ )
+- mouseBuf[i] = mouseBuf[idx+i];
+- mouseIdx = surplus;
+
+-#endif
+-}
++#define EV_ABS 0x03
++#define ABS_X 0x00
++#define ABS_Y 0x01
++#define ABS_PRESSURE 0x18
+
+
+-class QTPanelHandlerPrivate : public QCalibratedMouseHandler
++class QInputEventHandler : public QCalibratedMouseHandler
+ {
+ Q_OBJECT
+ public:
+- QTPanelHandlerPrivate(MouseProtocol, QString dev);
+- ~QTPanelHandlerPrivate();
++ QInputEventHandler(MouseProtocol, QString dev);
++ ~QInputEventHandler();
++
++ virtual void calibrate( QWSPointerCalibrationData * );
++ virtual void setCalibration(int aa, int bb, int cc, int dd, int ee, int ff, int ss);
+
+ private:
+- static const int mouseBufSize = 2048;
++ void init();
++ void fini();
++
+ int mouseFD;
+- QPoint oldmouse;
+- QPoint oldTotalMousePos;
+- bool waspressed;
+- QPointArray samples;
+- unsigned int currSample;
+- unsigned int lastSample;
+- unsigned int numSamples;
+- int skipCount;
+- int mouseIdx;
+- uchar mouseBuf[mouseBufSize];
++ struct input_event sample;
++ int myX, myY, myP, oldX, oldY, oldP;
++ int xtable[QT_QWS_TP_TABLE_SIZE];
++ int ytable[QT_QWS_TP_TABLE_SIZE];
++ int ptr;
+
+ private slots:
+ void readMouseData();
+ };
+
+
+-QTPanelHandlerPrivate::QTPanelHandlerPrivate( MouseProtocol, QString dev )
+- : samples(QT_QWS_TP_SAMPLE_SIZE), currSample(0), lastSample(0),
+- numSamples(0), skipCount(0)
+-{
+- Q_UNUSED(dev);
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
+-#if defined(QT_QWS_IPAQ)
+-# ifdef QT_QWS_IPAQ_RAW
+- if ((mouseFD = open( "/dev/h3600_tsraw", O_RDONLY | O_NDELAY)) < 0) {
+-# else
+- if ((mouseFD = open( "/dev/h3600_ts", O_RDONLY | O_NDELAY)) < 0) {
+-# endif
+- qWarning( "Cannot open /dev/h3600_ts (%s)", strerror(errno));
+- return;
+- }
+-#elif defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
+-//# ifdef QT_QWS_SL5XXX_TSRAW
+-# if 0
+- if ((mouseFD = open( "/dev/tsraw", O_RDONLY | O_NDELAY)) < 0) {
+- qWarning( "Cannot open /dev/tsraw (%s)", strerror(errno));
+- return;
+- }
+-# else
+- if ((mouseFD = open( "/dev/ts", O_RDONLY | O_NDELAY)) < 0) {
+- qWarning( "Cannot open /dev/ts (%s)", strerror(errno));
+- return;
+- }
+-# endif
+-#elif defined(QT_QWS_SIMPAD )
+- if ((mouseFD = open( "/dev/touchscreen/ucb1x00", O_RDONLY | O_NONBLOCK )) < 0) {
+- qWarning( "Cannot open /dev/touchscreen/ucb1x00 (%s)", strerror(errno));
+- return;
+- }
+-#endif
+-
+- QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read,
+- this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+- waspressed=FALSE;
+- mouseIdx = 0;
+-#endif
+-}
+-
+-QTPanelHandlerPrivate::~QTPanelHandlerPrivate()
++QInputEventHandler::QInputEventHandler( MouseProtocol, QString )
++ : myP(-1)
+ {
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
+- if (mouseFD >= 0)
+- close(mouseFD);
+-#endif
++ init();
+ }
+
+-void QTPanelHandlerPrivate::readMouseData()
++QInputEventHandler::~QInputEventHandler()
+ {
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
+- if(!qt_screen)
+- return;
+-
+- int n;
+- do {
+- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx );
+- if ( n > 0 )
+- mouseIdx += n;
+- } while ( n > 0 && mouseIdx < mouseBufSize );
+-
+- TS_EVENT *data;
+- int idx = 0;
+-
+- // perhaps we shouldn't be reading EVERY SAMPLE.
+- while ( mouseIdx-idx >= (int)sizeof( TS_EVENT ) ) {
+- uchar *mb = mouseBuf+idx;
+- data = (TS_EVENT *) mb;
+- if(data->pressure >= QT_QWS_TP_PRESSURE_THRESHOLD) {
+-#if defined(QT_QWS_SL5XXX) || defined(QT_QWS_SLC700)
+- samples[currSample] = QPoint( 1000 - data->x, data->y );
+-#else
+- samples[currSample] = QPoint( data->x, data->y );
+-#endif
+-
+- numSamples++;
+- if ( numSamples >= QT_QWS_TP_MINIMUM_SAMPLES ) {
+- int sampleCount = QMIN(numSamples + 1,samples.count());
+-
+- // average the rest
+- mousePos = QPoint( 0, 0 );
+- QPoint totalMousePos = oldTotalMousePos;
+- totalMousePos += samples[currSample];
+- if(numSamples >= samples.count())
+- totalMousePos -= samples[lastSample];
+-
+- mousePos = totalMousePos / (sampleCount - 1);
+-
+-# if defined(QT_QWS_IPAQ_RAW) || defined(QT_QWS_SL5XXX_RAW)
+- mousePos = transform( mousePos );
+-# endif
+- if(!waspressed)
+- oldmouse = mousePos;
+- QPoint dp = mousePos - oldmouse;
+- int dxSqr = dp.x() * dp.x();
+- int dySqr = dp.y() * dp.y();
+- if ( dxSqr + dySqr < (QT_QWS_TP_MOVE_LIMIT * QT_QWS_TP_MOVE_LIMIT) ) {
+- if ( waspressed ) {
+- if ( (dxSqr + dySqr > (QT_QWS_TP_JITTER_LIMIT * QT_QWS_TP_JITTER_LIMIT) ) || skipCount > 2) {
+- emit mouseChanged(mousePos,Qt::LeftButton);
+- oldmouse = mousePos;
+- skipCount = 0;
+- } else {
+- skipCount++;
+- }
+- } else {
+- emit mouseChanged(mousePos,Qt::LeftButton);
+- oldmouse=mousePos;
+- waspressed=true;
+- }
+-
+- // save recuring information
+- currSample++;
+- if (numSamples >= samples.count())
+- lastSample++;
+- oldTotalMousePos = totalMousePos;
+- } else {
+- numSamples--; // don't use this sample, it was bad.
+- }
+- } else {
+- // build up the average
+- oldTotalMousePos += samples[currSample];
+- currSample++;
+- }
+- if ( currSample >= samples.count() )
+- currSample = 0;
+- if ( lastSample >= samples.count() )
+- lastSample = 0;
+- } else {
+- currSample = 0;
+- lastSample = 0;
+- numSamples = 0;
+- skipCount = 0;
+- oldTotalMousePos = QPoint(0,0);
+- if ( waspressed ) {
+- emit mouseChanged(oldmouse,0);
+- oldmouse = QPoint( -100, -100 );
+- waspressed=false;
+- }
+- }
+- idx += sizeof( TS_EVENT );
+- }
++ fini();
+
+- int surplus = mouseIdx - idx;
+- for ( int i = 0; i < surplus; i++ )
+- mouseBuf[i] = mouseBuf[idx+i];
+- mouseIdx = surplus;
+-#endif
+ }
+
+-// YOPY touch panel support based on changes contributed by Ron Victorelli
+-// (victorrj at icubed.com) to Custom TP driver.
+-//
+-class QYopyTPanelHandlerPrivate : public QWSMouseHandler {
+- Q_OBJECT
+-public:
+- QYopyTPanelHandlerPrivate(MouseProtocol, QString dev);
+- ~QYopyTPanelHandlerPrivate();
+-
+-private:
+- int mouseFD;
+- int prevstate;
+-private slots:
+- void readMouseData();
+-
+-};
+-
+-QYopyTPanelHandlerPrivate::QYopyTPanelHandlerPrivate( MouseProtocol, QString )
++void QInputEventHandler::setCalibration(int aa, int bb, int cc, int dd, int ee, int ff, int ss)
+ {
+-#ifdef QT_QWS_YOPY
+- if ((mouseFD = open( "/dev/ts", O_RDONLY)) < 0) {
+- qWarning( "Cannot open /dev/ts (%s)", strerror(errno));
+- return;
+- } else {
+- sleep(1);
+- }
+- prevstate=0;
+- QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read,
+- this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+-#endif
+-}
++ QCalibratedMouseHandler::setCalibration(aa, bb, cc, dd, ee, ff, ss);
+
+-QYopyTPanelHandlerPrivate::~QYopyTPanelHandlerPrivate()
+-{
+- if (mouseFD >= 0)
+- close(mouseFD);
++ writeCalibration();
++ fini();
++ init();
+ }
+
+-#define YOPY_XPOS(d) (d[1]&0x3FF)
+-#define YOPY_YPOS(d) (d[2]&0x3FF)
+-#define YOPY_PRES(d) (d[0]&0xFF)
+-#define YOPY_STAT(d) (d[3]&0x01 )
+-
+-struct YopyTPdata {
+-
+- unsigned char status;
+- unsigned short xpos;
+- unsigned short ypos;
+-
+-};
+-
+-void QYopyTPanelHandlerPrivate::readMouseData()
++void QInputEventHandler::calibrate( QWSPointerCalibrationData *cd )
+ {
+-#ifdef QT_QWS_YOPY
+- if(!qt_screen)
+- return;
+- YopyTPdata data;
+-
+- unsigned int yopDat[4];
+-
+- int ret;
+-
+- ret=read(mouseFD,&yopDat,sizeof(yopDat));
++ QCalibratedMouseHandler::calibrate( cd );
+
+- if(ret) {
+- data.status= ( YOPY_PRES(yopDat) ) ? 1 : 0;
+- data.xpos=YOPY_XPOS(yopDat);
+- data.ypos=YOPY_YPOS(yopDat);
+- QPoint q;
+- q.setX(data.xpos);
+- q.setY(data.ypos);
+- mousePos=q;
+- if(data.status && !prevstate) {
+- emit mouseChanged(mousePos,Qt::LeftButton);
+- } else if( !data.status && prevstate ) {
+- emit mouseChanged(mousePos,0);
+- }
+- prevstate = data.status;
+- }
+- if(ret<0) {
+- qDebug("Error %s",strerror(errno));
+- }
+-#endif
++ // write calibration data, and close and reopen
++ // tslib, in order to ensure it uses the new values
++ writeCalibration();
++ fini();
++ init();
+ }
+
+-class QCustomTPanelHandlerPrivate : public QWSMouseHandler {
+- Q_OBJECT
+-public:
+- QCustomTPanelHandlerPrivate(MouseProtocol, QString dev);
+- ~QCustomTPanelHandlerPrivate();
+-
+-private:
+- int mouseFD;
+-private slots:
+- void readMouseData();
+-
+-};
+-
+-QCustomTPanelHandlerPrivate::QCustomTPanelHandlerPrivate( MouseProtocol, QString )
++void QInputEventHandler::init()
+ {
+-#ifdef QWS_CUSTOMTOUCHPANEL
+- if ((mouseFD = open( "/dev/ts", O_RDONLY)) < 0) {
+- qWarning( "Cannot open /dev/ts (%s)", strerror(errno));
++ if ((mouseFD = open( "/dev/input/event1", O_RDONLY)) < 0) {
++ qWarning( "Cannot open /dev/input/event1 (%s)", strerror(errno));
+ return;
+- } else {
+- sleep(1);
+ }
+
+ QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read,
+- this );
++ mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read, this );
++ setFilterSize(2);
+ connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+-#endif
+ }
+
+-QCustomTPanelHandlerPrivate::~QCustomTPanelHandlerPrivate()
++void QInputEventHandler::fini()
+ {
+ if (mouseFD >= 0)
+ close(mouseFD);
+ }
+
+-struct CustomTPdata {
+-
+- unsigned char status;
+- unsigned short xpos;
+- unsigned short ypos;
+-
+-};
+-
+-void QCustomTPanelHandlerPrivate::readMouseData()
++void QInputEventHandler::readMouseData()
+ {
+-#ifdef QWS_CUSTOMTOUCHPANEL
+- if(!qt_screen)
+- return;
+- CustomTPdata data;
+-
+- unsigned char data2[5];
+-
+- int ret;
+-
+- ret=read(mouseFD,data2,5);
++ if (!qt_screen)
++ return;
+
+- if(ret==5) {
+- data.status=data2[0];
+- data.xpos=(data2[1] << 8) | data2[2];
+- data.ypos=(data2[3] << 8) | data2[4];
+- QPoint q;
+- q.setX(data.xpos);
+- q.setY(data.ypos);
+- mousePos=q;
+- if(data.status & 0x40) {
+- emit mouseChanged(mousePos,Qt::LeftButton);
+- } else {
+- emit mouseChanged(mousePos,0);
++ unsigned int size = read(mouseFD, &sample, sizeof(sample));
++ if (size < sizeof(sample)) {
++ qDebug("no input");
++ return;
++ }
++ //qDebug("type,code,val: %d,%d,%d", sample.type, sample.code, sample.value);
++ if (sample.type == EV_ABS) {
++ if (sample.code == ABS_Y) {
++ myY = sample.value;
++ return;
++ } else
++ if (sample.code == ABS_X) {
++ myX = sample.value;
++ return;
++ } else
++ if (sample.code == ABS_PRESSURE) {
++ myP = sample.value;
++ }
+ }
+- }
+- if(ret<0) {
+- qDebug("Error %s",strerror(errno));
+- }
+-#endif
+-}
+-
+-/*
+- * Virtual framebuffer mouse driver
+- */
+-
+-#ifndef QT_NO_QWS_VFB
+-#include "qvfbhdr.h"
+-extern int qws_display_id;
+-#endif
+-
+-class QVFbMouseHandlerPrivate : public QWSMouseHandler {
+- Q_OBJECT
+-public:
+- QVFbMouseHandlerPrivate(MouseProtocol, QString dev);
+- ~QVFbMouseHandlerPrivate();
+-
+-#ifndef QT_NO_QWS_VFB
+- bool isOpen() const { return mouseFD > 0; }
+-
+-private:
+- static const int mouseBufSize = 128;
+- int mouseFD;
+- int mouseIdx;
+- uchar mouseBuf[mouseBufSize];
+-#endif
+-
+-private slots:
+- void readMouseData();
+-};
+-
+-QVFbMouseHandlerPrivate::QVFbMouseHandlerPrivate( MouseProtocol, QString mouseDev )
+-{
+-#ifndef QT_NO_QWS_VFB
+- mouseFD = -1;
+- if ( mouseDev.isEmpty() )
+- mouseDev = QString(QT_VFB_MOUSE_PIPE).arg(qws_display_id);
+-
+- if ((mouseFD = open( mouseDev.local8Bit().data(), O_RDWR | O_NDELAY)) < 0) {
+- qDebug( "Cannot open %s (%s)", mouseDev.ascii(),
+- strerror(errno));
+- } else {
+- // Clear pending input
+- char buf[2];
+- while (read(mouseFD, buf, 1) > 0) { }
+-
+- mouseIdx = 0;
+-
+- QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read, this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+- }
+-#endif
+-}
+-
+-QVFbMouseHandlerPrivate::~QVFbMouseHandlerPrivate()
+-{
+-#ifndef QT_NO_QWS_VFB
+- if (mouseFD >= 0)
+- close(mouseFD);
+-#endif
+-}
+-
+-void QVFbMouseHandlerPrivate::readMouseData()
+-{
+-#ifndef QT_NO_QWS_VFB
+- int n;
+- do {
+- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx );
+- if ( n > 0 )
+- mouseIdx += n;
+- } while ( n > 0 );
+-
+- int idx = 0;
+- while ( mouseIdx-idx >= int(sizeof( QPoint ) + sizeof( int )) ) {
+- uchar *mb = mouseBuf+idx;
+- QPoint *p = (QPoint *) mb;
+- mb += sizeof( QPoint );
+- int *bstate = (int *)mb;
+- mousePos = *p;
+- limitToScreen( mousePos );
+- emit mouseChanged(mousePos, *bstate);
+- idx += sizeof( QPoint ) + sizeof( int );
+- }
+-
+- int surplus = mouseIdx - idx;
+- for ( int i = 0; i < surplus; i++ )
+- mouseBuf[i] = mouseBuf[idx+i];
+- mouseIdx = surplus;
+-#endif
+-}
+-
+-/*
+- mouse handler for tslib
+- see http://cvs.arm.linux.org.uk/
+- */
+-/*
+-
+- Copyright (C) 2003, 2004, 2005 Texas Instruments, Inc.
+- Copyright (C) 2004, 2005 Holger Hans Peter Freyther
+- All rights reserved.
+-
+- Redistribution and use in source and binary forms, with or without
+- modification, are permitted provided that the following conditions are met:
+-
+- Redistributions of source code must retain the above copyright notice,
+- this list of conditions and the following disclaimer.
+-
+- Redistributions in binary form must reproduce the above copyright
+- notice, this list of conditions and the following disclaimer in the
+- documentation and/or other materials provided with the distribution.
+-
+- Neither the name Texas Instruments, Inc nor the names of its
+- contributors may be used to endorse or promote products derived
+- from this software without specific prior written permission.
+-
+- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+- POSSIBILITY OF SUCH DAMAGE.
+-
+-*/
+-class QTSLibHandlerPrivate : public QCalibratedMouseHandler
+-{
+- Q_OBJECT
+-public:
+- QTSLibHandlerPrivate();
+- ~QTSLibHandlerPrivate();
+-
+- virtual void clearCalibration();
+- virtual void calibrate( QWSPointerCalibrationData * );
+- static int sortByX( const void*, const void* );
+- static int sortByY( const void*, const void* );
+-
+-private:
+- bool m_raw : 1;
+- QSocketNotifier *m_notify;
+-
+-#ifdef QT_QWS_TSLIB
+- struct tsdev *m_ts;
+-#endif
+- void openTs();
+- void closeTs();
+- void interpolateSample();
+-
+-private slots:
+- void readMouseData();
+-
+-};
+-
+-QTSLibHandlerPrivate::QTSLibHandlerPrivate()
+- : m_raw(false), m_notify(0 )
+-{
+- openTs();
+-}
+-
+-QTSLibHandlerPrivate::~QTSLibHandlerPrivate()
+-{
+- closeTs();
+-}
+-
+-void QTSLibHandlerPrivate::openTs()
+-{
+-#ifdef QT_QWS_TSLIB
+- char *tsdevice;
+- if((tsdevice = getenv("TSLIB_TSDEVICE")) != NULL) {
+- m_ts = ts_open( tsdevice, 1 ); //1 = nonblocking, 0 = blocking mode
+- } else {
+- m_ts = ts_open( "/dev/ts", 1 );
+- }
+-
+- if (!m_ts) {
+- qWarning( "Cannot open touchscreen (%s)", strerror( errno));
+- return;
+- }
+-
+- if (ts_config( m_ts)) {
+- qWarning( "Cannot configure touchscreen (%s)", strerror( errno));
+- return;
+- }
+- m_notify = new QSocketNotifier( ts_fd(m_ts), QSocketNotifier::Read, this );
+- connect( m_notify, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+-#endif
+-}
+-
+-void QTSLibHandlerPrivate::closeTs()
+-{
+-#ifdef QT_QWS_TSLIB
+- if (m_ts)
+- ts_close(m_ts);
+- m_ts = 0;
+-#endif
+-
+- delete m_notify;
+- m_notify = 0;
+- m_raw = false;
+-}
+-
+-void QTSLibHandlerPrivate::clearCalibration()
+-{
+- m_raw = true;
+-}
+-
+-void QTSLibHandlerPrivate::calibrate( QWSPointerCalibrationData * cd)
+-{
+- QPoint dev_tl = cd->devPoints[ QWSPointerCalibrationData::TopLeft ];
+- QPoint dev_br = cd->devPoints[ QWSPointerCalibrationData::BottomRight ];
+- QPoint screen_tl = cd->screenPoints[ QWSPointerCalibrationData::TopLeft ];
+- QPoint screen_br = cd->screenPoints[ QWSPointerCalibrationData::BottomRight ];
+- int a, b, c, d, e, f, s;
+-
+- s = 1 << 16;
+
+- a = s * (screen_tl.x() - screen_br.x() ) / (dev_tl.x() - dev_br.x());
+- b = 0;
+- c = s * screen_tl.x() - a * dev_tl.x();
++ // up->up
++ if (oldP==0 && myP==0) {
++ //qDebug("uu %d,%d,%d", myX,myY,myP);
++ return;
++ }
+
+- d = 0;
+- e = s * (screen_tl.y() - screen_br.y() ) / (dev_tl.y() - dev_br.y());
+- f = s * screen_tl.y() - e * dev_tl.y();
++ // up->down
++ if (oldP==0 && myP>QT_QWS_TP_PRESSURE_DOWN_THRESHOLD) {
++ //qDebug("ud %d,%d,%d", myX,myY,myP);
+
+- QString calFile = "/etc/pointercal";
+-#ifndef QT_NO_TEXTSTREAM
+- QFile file( calFile );
+- if ( file.open( IO_WriteOnly ) ) {
+- QTextStream t( &file );
+- t << a << " " << b << " " << c << " ";
+- t << d << " " << e << " " << f << " " << s;
+- file.flush(); closeTs();
+- openTs();
+- } else
+-#endif
+- {
+- qDebug( "Could not save calibration: %s", calFile.latin1() );
+- }
+-}
++ xtable[0] = myX;
++ ytable[0] = myY;
++ ptr = 1;
++ oldX = myX;
++ oldY = myY;
++ oldP = myP;
++ return;
++ }
+
+-void QTSLibHandlerPrivate::readMouseData()
+-{
+-#ifdef QT_QWS_TSLIB
+- if(!qt_screen)
+- return;
++ // down->down
++ if (oldP>QT_QWS_TP_PRESSURE_DOWN_THRESHOLD && myP>QT_QWS_TP_PRESSURE_UP_THRESHOLD) {
++ //qDebug("dd %d,%d,%d (%d,%d)", myX,myY,myP, oldX,oldY);
+
+- /*
+- * After clear Calibration
+- * we're in raw mode and do some easy median
+- * search.
+- */
+- if ( m_raw )
+- return interpolateSample();
++ int dxSqr = myX-oldX; dxSqr *= dxSqr;
++ int dySqr = myY-oldY; dySqr *= dySqr;
++ oldX = myX;
++ oldY = myY;
++ if (dxSqr+dySqr > QT_QWS_TP_MOVE_MAX*QT_QWS_TP_MOVE_MAX) {
++ //qWarning("distance too wide %d", dxSqr+dySqr);
++ return;
++ }
+
+- static struct ts_sample sample;
+- static int ret;
++ if (ptr < QT_QWS_TP_TABLE_SIZE) {
++ xtable[ptr] = myX;
++ ytable[ptr++] = myY;
++ }
+
+- /*
+- * Ok. We need to see if we can read more than one event
+- * We do this not to lose an update.
+- */
+- while ( true ) {
+- if ((ret = ts_read(m_ts, &sample, 1)) != 1 )
+- return;
++ if (ptr == QT_QWS_TP_TABLE_SIZE) {
++ int i;
++ int mx = 0;
++ int my = 0;
++ for (i=0; i<QT_QWS_TP_TABLE_SIZE; i++) {
++ mx += xtable[i];
++ my += ytable[i];
++ if (i>0) {
++ xtable[i-1] = xtable[i];
++ ytable[i-1] = ytable[i];
++ }
++ }
++ ptr--;
++ mousePos = transform(QPoint(mx/QT_QWS_TP_TABLE_SIZE, my/QT_QWS_TP_TABLE_SIZE));
+
++ emit mouseChanged(mousePos, Qt::LeftButton);
++ }
++ return;
++ }
+
+- QPoint pos( sample.x, sample.y );
+- mouseChanged( pos, sample.pressure != 0 ? 1 : 0 );
+- }
+-#endif
++ // down->up
++ //qDebug("du %d,%d,%d", myX,myY,myP);
++ emit mouseChanged(mousePos, 0);
++ oldP = 0;
+ }
+
+-/*
+- * Lets take all down events and then sort them
+- * and take the event in the middle.
+- *
+- * inspired by testutils.c
+- */
+-void QTSLibHandlerPrivate::interpolateSample() {
+-#ifdef QT_QWS_TSLIB
+-#define TSLIB_MAX_SAMPLES 25
+- static struct ts_sample samples[TSLIB_MAX_SAMPLES];
+- int index = 0;
+- int read_samples = 0;
+- int ret;
+-
+- do {
+- /* do not access negative arrays */
+- if ( index < 0 )
+- index = 0;
+-
+- /* we're opened non-blocking */
+- if((ret= ts_read_raw(m_ts, &samples[index], 1 ) ) != 1 )
+- /* no event yet, so try again */
+- if (ret==-1 )
+- continue;
+-
+- read_samples++;
+- index = (index+1)%TSLIB_MAX_SAMPLES;
+- }while (samples[index == 0 ? (TSLIB_MAX_SAMPLES-1) : index-1].pressure != 0);
+-
+- /*
+- * If we've wrapped around each sample is used otherwise
+- * we will use the index
+- */
+- index = read_samples >= TSLIB_MAX_SAMPLES ?
+- (TSLIB_MAX_SAMPLES-1 ) : index;
+- int x, y;
+-
+- /*
+- * now let us use the median value
+- * even index does not have an item in the middle
+- * so let us take the average of n/2 and (n/2)-1 as the middle
+- */
+- int m = index/2;
+- ::qsort(samples, index, sizeof(ts_sample), QTSLibHandlerPrivate::sortByX);
+- x = (index % 2 ) ? samples[m].x :
+- ( samples[m-1].x + samples[m].x )/2;
+-
+- ::qsort(samples, index, sizeof(ts_sample), QTSLibHandlerPrivate::sortByY);
+- y = (index % 2 ) ? samples[m].y :
+- ( samples[m-1].y + samples[m].y )/2;
+
+- emit mouseChanged( QPoint(x, y), 1 );
+- emit mouseChanged( QPoint(0, 0), 0 );
+-#endif
+-}
+
+-int QTSLibHandlerPrivate::sortByX( const void* one, const void* two) {
+-#ifdef QT_QWS_TSLIB
+- return reinterpret_cast<const struct ts_sample*>(one)->x -
+- reinterpret_cast<const struct ts_sample*>(two)->x;
+-#else
+- return 0;
+-#endif
+-}
+
+-int QTSLibHandlerPrivate::sortByY( const void* one, const void* two) {
+-#ifdef QT_QWS_TSLIB
+- return reinterpret_cast<const struct ts_sample*>(one)->y -
+- reinterpret_cast<const struct ts_sample*>(two)->y;
+-#else
+- return 0;
+-#endif
+-}
+-//////
+
+ /*
+ * return a QWSMouseHandler that supports /a spec.
+@@ -1977,7 +519,7 @@
+
+ if ( mouseProto == "USB" && mouseDev.isEmpty() )
+ mouseDev = "/dev/input/mice";
+-
++
+ MouseProtocol mouseProtocol = Unknown;
+
+ int idx = 0;
+@@ -1988,50 +530,7 @@
+ idx++;
+ }
+
+-
+- QWSMouseHandler *handler = 0;
+-
+- switch ( mouseProtocol ) {
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+- case Auto:
+- handler = new QAutoMouseHandler();
+- break;
+-#endif
+-
+-#ifndef QT_NO_QWS_MOUSE_PC
+- case MouseMan:
+- case IntelliMouse:
+- case Microsoft:
+- case BusMouse:
+- handler = new QWSMouseHandlerPrivate( mouseProtocol, mouseDev );
+- break;
+-#endif
+-
+-#ifndef QT_NO_QWS_VFB
+- case QVFBMouse:
+- handler = new QVFbMouseHandlerPrivate( mouseProtocol, mouseDev );
+- break;
+-#endif
+-
+- case TPanel:
+-#if defined(QWS_CUSTOMTOUCHPANEL)
+- handler = new QCustomTPanelHandlerPrivate(mouseProtocol,mouseDev);
+-#elif defined(QT_QWS_TSLIB)
+- handler = new QTSLibHandlerPrivate();
+-#elif defined(QT_QWS_YOPY)
+- handler = new QYopyTPanelHandlerPrivate(mouseProtocol,mouseDev);
+-#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
+- handler = new QTPanelHandlerPrivate(mouseProtocol,mouseDev);
+-#elif defined(QT_QWS_CASSIOPEIA)
+- handler = new QVrTPanelHandlerPrivate( mouseProtocol, mouseDev );
+-#endif
+- break;
+-
+- default:
+- qDebug( "Mouse type %s unsupported", spec.latin1() );
+- }
+-
+- return handler;
++ return new QInputEventHandler( mouseProtocol, mouseDev );
+ }
+
+ #include "qwsmouse_qws.moc"
+--- qt-2.3.10/src/kernel/qwsmouse_qws.h~ramses-touchscreen
++++ qt-2.3.10/src/kernel/qwsmouse_qws.h
+@@ -1,5 +1,5 @@
+ /****************************************************************************
+-** $Id: qt/src/kernel/qwsmouse_qws.h 2.3.10 edited 2005-01-24 $
++** $Id: qt/src/kernel/qwsmouse_qws.h 2.3.7 edited 2001-10-03 $
+ **
+ ** Definition of Qt/FB central server classes
+ **
+@@ -70,6 +70,7 @@
+ virtual void clearCalibration();
+ virtual void calibrate( QWSPointerCalibrationData * );
+ virtual void getCalibration( QWSPointerCalibrationData * );
++ virtual void setCalibration(int aa, int bb, int cc, int dd, int ee, int ff, int ss);
+
+ protected:
+ void readCalibration();
diff --git a/packages/qte/qte-2.3.10/mnci.patch b/packages/qte/qte-2.3.10/mnci.patch
index e69de29bb2..c2e0e079d9 100644
--- a/packages/qte/qte-2.3.10/mnci.patch
+++ b/packages/qte/qte-2.3.10/mnci.patch
@@ -0,0 +1,125 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp~ramses.patch
++++ qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp
+@@ -249,20 +249,12 @@
+
+ static void writeTerm(const char* termctl, int sizeof_termctl)
+ {
+-#ifdef QT_QWS_DEVFS
+- const char* tt[]={"/dev/vc/1","/dev/console","/dev/tty",0};
+-#else
+- const char* tt[]={"/dev/console","/dev/tty","/dev/tty0",0};
+-#endif
+- const char** dev=tt;
+- while (*dev) {
+- int tty=::open(*dev,O_WRONLY);
++qWarning("writeTerm");
++ int tty=::open("/dev/vc/2", O_WRONLY);
+ if ( tty>=0 ) {
+ ::write(tty,termctl,sizeof_termctl);
+ ::close(tty);
+ }
+- dev++;
+- }
+ }
+
+ /*!
+@@ -275,6 +267,7 @@
+
+ bool QLinuxFbScreen::initDevice()
+ {
++qWarning("QLinuxFbScreen::initDevice");
+ /* Setting up the VT parameters is done in qapplication_qws.cpp
+ const char termctl[]="\033[9;0]\033[?33l\033[?25l";
+ writeTerm(termctl,sizeof(termctl)); */
+@@ -765,9 +758,12 @@
+ }
+ */
+
++qWarning("QLinuxFbScreen::shutdownDevice");
++/*
+ // Blankin' screen, blinkin' cursor!
+ const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c";
+ writeTerm(termctl,sizeof(termctl));
++*/
+ }
+
+ /*!
+--- qt-2.3.10/src/kernel/qapplication_qws.cpp~ramses.patch
++++ qt-2.3.10/src/kernel/qapplication_qws.cpp
+@@ -1756,8 +1756,6 @@
+ */
+ if ( qws_daemon )
+ {
+- qWarning( "qt_init() - starting in daemon mode..." );
+-
+ int pid1 = fork();
+ if ( pid1 == -1 )
+ {
+@@ -1791,7 +1789,6 @@
+ }
+ if ( pid2 )
+ {
+- syslog( 4, "qt_init() [%d] - successfully entered daemon mode", pid2 );
+ _exit( 0 ); // ok, second fork performed
+ }
+ }
+@@ -1828,9 +1825,12 @@
+ #if defined(_OS_LINUX_)
+ if ( qws_terminal_id )
+ {
+- qDebug( "qt_init() - terminal specification is '%d'.", qws_terminal_id );
+ struct vt_stat console_stat;
++#ifdef QT_QWS_DEVFS
++ int console_fd = ::open( QString().sprintf( "/dev/vc/%d", qws_terminal_id ).latin1(), O_RDWR );
++#else
+ int console_fd = ::open( QString().sprintf( "/dev/tty%d", qws_terminal_id ).latin1(), O_RDWR );
++#endif
+ if ( console_fd == -1)
+ {
+ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
+@@ -1927,7 +1927,11 @@
+ {
+ qDebug( "qt_cleanup() - switching back to virtual terminal #%d", qws_terminal_old );
+
++#ifdef QT_QWS_DEVFS
++ int console_fd = ::open( "/dev/vc/0", O_RDWR );
++#else
+ int console_fd = ::open( "/dev/tty0", O_RDWR );
++#endif
+ if ( console_fd == -1)
+ {
+ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
+--- qt-2.3.10/src/kernel/qwindowsystem_qws.cpp~ramses.patch
++++ qt-2.3.10/src/kernel/qwindowsystem_qws.cpp
+@@ -1791,6 +1791,7 @@
+ }
+
+ #ifndef QT_NO_QWS_KEYBOARD
++#ifndef QT_QWS_RAMSES
+ static int keyUnicode(int keycode)
+ {
+ const QWSServer::KeyMap *km = QWSServer::keyMap();
+@@ -1803,6 +1804,7 @@
+ return 0xffff;
+ }
+ #endif
++#endif
+ /*!
+ Send a key event. You can use this to send key events generated by
+ "virtual keyboards".
+@@ -1845,8 +1847,10 @@
+
+ event.simpleData.unicode =
+ #ifndef QT_NO_QWS_KEYBOARD
++#ifndef QT_QWS_RAMSES
+ unicode < 0 ? keyUnicode(keycode) :
+ #endif
++#endif
+ unicode;
+ event.simpleData.keycode = keycode;
+ event.simpleData.modifiers = modifiers;
diff --git a/packages/qte/qte-2.3.10/no-moc.patch b/packages/qte/qte-2.3.10/no-moc.patch
index e69de29bb2..128f8a6f98 100644
--- a/packages/qte/qte-2.3.10/no-moc.patch
+++ b/packages/qte/qte-2.3.10/no-moc.patch
@@ -0,0 +1,37 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20041211/Makefile~no-moc
++++ qt-2.3.9-snapshot-20041211/Makefile
+@@ -8,7 +8,7 @@
+ init: FORCE
+ @$(MAKE) QTDIR=`pwd` all
+
+-all: symlinks src-moc src-mt sub-src sub-tools sub-tutorial sub-examples
++all: symlinks src-mt sub-src sub-tools sub-tutorial sub-examples
+ @echo
+ @echo "The Qt library is now built in ./lib"
+ @echo "The Qt examples are built in the directories in ./examples"
+@@ -31,10 +31,10 @@
+ symlinks: .buildopts
+ @cd include; rm -f q*.h; for i in ../src/*/q*.h ../src/3rdparty/*/q*.h ../extensions/*/src/q*.h; do ln -s $$i .; done; rm -f q*_p.h
+
+-sub-src: src-moc src-mt .buildopts FORCE
++sub-src: src-mt .buildopts FORCE
+ cd src; $(MAKE)
+
+-src-mt: src-moc .buildopts FORCE
++src-mt: .buildopts FORCE
+ $(MAKE) -f src-mt.mk
+
+ sub-tutorial: sub-src FORCE
+@@ -45,7 +45,6 @@
+
+ clean:
+ -rm .buildopts
+- cd src/moc; $(MAKE) clean
+ cd src; $(MAKE) clean
+ -rm src/tmp/*.o src/tmp/*.a src/allmoc.cpp
+ -find src/3rdparty -name '*.o' | xargs rm
diff --git a/packages/qte/qte-2.3.10/openmn/.mtn2git_empty b/packages/qte/qte-2.3.10/openmn/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/qte/qte-2.3.10/openmn/.mtn2git_empty
diff --git a/packages/qte/qte-2.3.10/openmn/qkeyboard_qws.cpp b/packages/qte/qte-2.3.10/openmn/qkeyboard_qws.cpp
index e69de29bb2..9917675a43 100644
--- a/packages/qte/qte-2.3.10/openmn/qkeyboard_qws.cpp
+++ b/packages/qte/qte-2.3.10/openmn/qkeyboard_qws.cpp
@@ -0,0 +1,584 @@
+/****************************************************************************
+** $Id: qt/src/kernel/qkeyboard_qws.cpp 2.3.7 edited 2003-05-30 $
+**
+** Implementation of Qt/Embedded keyboard drivers
+**
+** Created : 991025
+**
+** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of the kernel module of the Qt GUI Toolkit.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses for Qt/Embedded may use this file in accordance with the
+** Qt Embedded Commercial License Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "qwindowsystem_qws.h"
+#include "qwsutils_qws.h"
+#include "qgfx_qws.h"
+
+#include <qapplication.h>
+#include <qsocketnotifier.h>
+#include <qnamespace.h>
+#include <qtimer.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+
+#include <unistd.h>
+#include <linux/kd.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+
+#ifndef QT_NO_QWS_KEYBOARD
+
+#include <termios.h>
+#include <sys/kd.h>
+#include <sys/vt.h>
+#include <sys/wait.h>
+#include <linux/keyboard.h>
+
+#define VTSWITCHSIG SIGUSR2
+
+static bool vtActive = true;
+static int vtQws = 0;
+static int kbdFD = -1;
+
+static QIntDict<QWSServer::KeyMap> *overrideMap = 0;
+
+/*!
+ Changes the mapping of the keyboard; adding the scancode to Unicode
+ mappings from \a map. The server takes over ownership of \a map
+ and will delete it. Use QCollection::setAutoDelete() to control
+ whether the contents of \a map should be deleted.
+
+ Passing a null pointer for \a map will revert to the default keymap.
+*/
+
+void QWSServer::setOverrideKeys( QIntDict<QWSServer::KeyMap> *map )
+{
+ delete overrideMap;
+ overrideMap = map;
+}
+
+/*!
+ \class QWSKeyboardHandler qkeyboard_qws.h
+ \brief Keyboard driver/handler for Qt/Embedded
+
+ The keyboard driver/handler handles events from system devices and
+ generates key events.
+
+ A QWSKeyboardHandler will usually open some system device in its
+ constructor, create a QSocketNotifier on that opened device and when
+ it receives data, it will call processKeyEvent() to send the event
+ to Qt/Embedded for relaying to clients.
+*/
+
+/*!
+ Subclasses call this to send a key event. The server may additionally
+ filter it before sending it on to applications.
+
+ <ul>
+ <li>\a unicode is the Unicode value for the key, or 0xffff if none is appropriate.
+ <li>\a keycode is the Qt keycode for the key (see Qt::Key).
+ for the list of codes).
+ <li>\a modifiers is the set of modifier keys (see Qt::Modifier).
+ <li>\a isPress says whether this is a press or a release.
+ <li>\a autoRepeat says whether this event was generated by an auto-repeat
+ mechanism, or an actual key press.
+ </ul>
+*/
+void QWSKeyboardHandler::processKeyEvent(int unicode, int keycode, int modifiers,
+ bool isPress, bool autoRepeat)
+{
+ qwsServer->processKeyEvent( unicode, keycode, modifiers, isPress, autoRepeat );
+}
+
+
+bool qwsSetKeyboardAutoRepeat( int /* delay */ , int /* period */ )
+{
+ return FALSE;
+}
+
+bool qwsGetKeyboardAutoRepeat( int /* delay */ , int /* period */ )
+{
+ return FALSE;
+}
+
+void qwsRestoreKeyboardLeds()
+{
+}
+
+
+
+
+
+/*
+ * Virtual framebuffer keyboard driver
+ */
+
+class QWSVFbKeyboardHandler : public QWSKeyboardHandler
+{
+ Q_OBJECT
+public:
+ QWSVFbKeyboardHandler();
+ virtual ~QWSVFbKeyboardHandler();
+
+ bool isOpen() { return fd > 0; }
+
+private slots:
+ void readKeyboardData();
+
+private:
+ QString terminalName;
+ int fd;
+ int kbdIdx;
+ int kbdBufferLen;
+ unsigned char *kbdBuffer;
+ QSocketNotifier *notifier;
+};
+
+#ifndef QT_NO_QWS_VFB
+#include "qvfbhdr.h"
+extern int qws_display_id;
+#endif
+
+QWSVFbKeyboardHandler::QWSVFbKeyboardHandler()
+{
+ kbdFD = -1;
+#ifndef QT_NO_QWS_VFB
+ kbdIdx = 0;
+ kbdBufferLen = sizeof( QVFbKeyData ) * 5;
+ kbdBuffer = new unsigned char [kbdBufferLen];
+
+ terminalName = QString(QT_VFB_KEYBOARD_PIPE).arg(qws_display_id);
+
+ if ((kbdFD = open( terminalName.local8Bit(), O_RDWR | O_NDELAY)) < 0) {
+ qDebug( "Cannot open %s (%s)", terminalName.latin1(),
+ strerror(errno));
+ } else {
+ // Clear pending input
+ char buf[2];
+ while (read(kbdFD, buf, 1) > 0) { }
+
+ notifier = new QSocketNotifier( kbdFD, QSocketNotifier::Read, this );
+ connect(notifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData()));
+ }
+#endif
+}
+
+QWSVFbKeyboardHandler::~QWSVFbKeyboardHandler()
+{
+#ifndef QT_NO_QWS_VFB
+ if ( kbdFD >= 0 )
+ close( kbdFD );
+ delete [] kbdBuffer;
+#endif
+}
+
+
+void QWSVFbKeyboardHandler::readKeyboardData()
+{
+#ifndef QT_NO_QWS_VFB
+ int n;
+ do {
+ n = read(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx );
+ if ( n > 0 )
+ kbdIdx += n;
+ } while ( n > 0 );
+
+ int idx = 0;
+ while ( kbdIdx - idx >= (int)sizeof( QVFbKeyData ) ) {
+ QVFbKeyData *kd = (QVFbKeyData *)(kbdBuffer + idx);
+ if ( kd->unicode == 0 && kd->modifiers == 0 && kd->press ) {
+ // magic exit key
+ qWarning( "Instructed to quit by Virtual Keyboard" );
+ qApp->quit();
+ }
+ processKeyEvent( kd->unicode&0xffff, kd->unicode>>16,
+ kd->modifiers, kd->press, kd->repeat );
+ idx += sizeof( QVFbKeyData );
+ }
+
+ int surplus = kbdIdx - idx;
+ for ( int i = 0; i < surplus; i++ )
+ kbdBuffer[i] = kbdBuffer[idx+i];
+ kbdIdx = surplus;
+#endif
+}
+
+
+
+
+struct termios origTermData;
+
+static void init_kbd(void)
+{
+ struct termios termdata;
+
+ tcgetattr( kbdFD, &origTermData );
+ tcgetattr( kbdFD, &termdata );
+
+ ioctl(kbdFD, KDSKBMODE, K_XLATE);
+
+ termdata.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+ termdata.c_oflag = 0;
+ termdata.c_cflag = CREAD | CS8;
+ termdata.c_lflag = 0;
+ termdata.c_cc[VTIME]=0;
+ termdata.c_cc[VMIN]=1;
+ cfsetispeed(&termdata, 9600);
+ cfsetospeed(&termdata, 9600);
+ tcsetattr(kbdFD, TCSANOW, &termdata);
+}
+
+static void done_kbd(void)
+{
+ if (kbdFD >= 0) {
+ tcsetattr(kbdFD, TCSANOW, &origTermData);
+ }
+}
+
+static void vtSwitchHandler(int /*sig*/)
+{
+ if (vtActive) {
+ qwsServer->enablePainting(false);
+ qt_screen->save();
+ if (ioctl(kbdFD, VT_RELDISP, VT_ACKACQ) == 0) {
+ vtActive = false;
+ qwsServer->closeMouse();
+ done_kbd();
+ }
+ else {
+ qwsServer->enablePainting(true);
+ }
+ usleep(200000);
+ }
+ else {
+ if (ioctl(kbdFD, VT_RELDISP, VT_ACKACQ) == 0) {
+ init_kbd();
+ qwsServer->enablePainting(true);
+ vtActive = true;
+ qt_screen->restore();
+ qwsServer->openMouse();
+ qwsServer->refresh();
+ }
+ }
+ signal(VTSWITCHSIG, vtSwitchHandler);
+}
+
+
+
+class QWSRamsesKbPrivate;
+class QWSRamsesKeyboardHandler : public QWSKeyboardHandler
+{
+public:
+ QWSRamsesKeyboardHandler( const QString& );
+ virtual ~QWSRamsesKeyboardHandler();
+
+ virtual void processKeyEvent(int unicode, int keycode, int modifiers,
+ bool isPress, bool autoRepeat);
+
+private:
+ QWSRamsesKbPrivate *d;
+};
+
+
+class QWSRamsesKbPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QWSRamsesKbPrivate( QWSRamsesKeyboardHandler *, const QString &device );
+ ~QWSRamsesKbPrivate();
+
+private slots:
+ void readKeyboardData();
+
+private:
+ void handleKey(unsigned char code, int n);
+
+ QWSRamsesKeyboardHandler *handler;
+ char rbuf[255];
+ int rptr;
+};
+
+QWSRamsesKbPrivate::QWSRamsesKbPrivate( QWSRamsesKeyboardHandler *h, const QString &device )
+ : handler(h), rptr(0)
+{
+#ifdef QT_QWS_DEVFS
+ kbdFD = ::open(device.isEmpty()?"/dev/vc/2":device.latin1(), O_RDWR|O_NDELAY, 0);
+#else
+ kbdFD = ::open(device.isEmpty()?"/dev/tty2":device.latin1(), O_RDWR|O_NDELAY, 0);
+#endif
+
+ if ( kbdFD >= 0 ) {
+ QSocketNotifier *notifier;
+ notifier = new QSocketNotifier( kbdFD, QSocketNotifier::Read, this );
+ connect( notifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData()) );
+ } else {
+ qDebug( "Cannot open keyboard" );
+ }
+ init_kbd();
+
+ struct vt_mode vtMode;
+ ioctl(kbdFD, VT_GETMODE, &vtMode);
+
+ // let us control VT switching
+ vtMode.mode = VT_PROCESS;
+ vtMode.relsig = VTSWITCHSIG;
+ vtMode.acqsig = VTSWITCHSIG;
+ ioctl(kbdFD, VT_SETMODE, &vtMode);
+
+ struct vt_stat vtStat;
+ ioctl(kbdFD, VT_GETSTATE, &vtStat);
+ vtQws = vtStat.v_active;
+
+ signal(VTSWITCHSIG, vtSwitchHandler);
+}
+
+QWSRamsesKbPrivate::~QWSRamsesKbPrivate()
+{
+ signal(VTSWITCHSIG, 0);
+
+ done_kbd();
+
+ struct vt_mode vtMode;
+ ioctl(kbdFD, VT_GETMODE, &vtMode);
+ /* Mickey says: "Better give up control of VT switching.
+ * Hey, I really hate that OS-will-reacquire-resources on process-death
+ * kind of thinking!
+ */
+ vtMode.mode = VT_AUTO;
+ vtMode.relsig = 0;
+ vtMode.acqsig = 0;
+ ioctl(kbdFD, VT_SETMODE, &vtMode);
+
+ ::close(kbdFD);
+ kbdFD = -1;
+}
+
+
+static inline int map_to_modif(int current_map)
+{
+ int modifiers = 0;
+
+ if (current_map & KG_ALT)
+ modifiers |= Qt::ALT;
+ else if (current_map & KG_CTRL)
+ modifiers |= Qt::CTRL;
+ else if (current_map & KG_SHIFT)
+ modifiers |= Qt::SHIFT;
+
+ return modifiers;
+}
+
+struct {
+ const char *code;
+ unsigned short qtcode;
+} qtesc_lookup[] = {
+ { "\e[A", Qt::Key_Up },
+ { "\e[B", Qt::Key_Down },
+ { "\e[C", Qt::Key_Right },
+ { "\e[D", Qt::Key_Left },
+ { "\e[1~", Qt::Key_Home },
+ { "\e[4~", Qt::Key_End },
+ { "\e[5~", Qt::Key_PageUp },
+ { "\e[6~", Qt::Key_PageDown },
+
+ { "\e[[A", Qt::Key_F1 },
+ { "\e[[B", Qt::Key_F2 },
+ { "\e[[C", Qt::Key_F3 },
+ { "\e[[D", Qt::Key_F4 },
+ { "\e[[E", Qt::Key_F5 },
+ { "\e[17~", Qt::Key_F6 },
+ { "\e[18~", Qt::Key_F7 },
+ { "\e[19~", Qt::Key_F8 },
+ { "\e[20~", Qt::Key_F9 },
+ { "\e[21~", Qt::Key_F10 },
+ { "\e[23~", Qt::Key_F11 },
+ { "\e[24~", Qt::Key_F12 },
+
+ // { "\ex", Qt::FieldExit },
+ // { "\er", Qt::FieldReset },
+
+};
+
+struct {
+ unsigned char code;
+ unsigned short qtcode;
+} qtkey_lookup[] = {
+ { 0x08, Qt::Key_Backspace },
+ { 0x09, Qt::Key_Tab },
+ { 0x0d, Qt::Key_Enter },
+ { 0x1b, Qt::Key_Escape },
+};
+
+void QWSRamsesKbPrivate::handleKey(unsigned char code, int n)
+{
+ int qtKeyCode = Qt::Key_unknown;
+ unsigned int i;
+
+ //qDebug("\nhandleKey %02x %d %c", code, n, code >= ' ' ? code : ' ');
+
+ // Single keys
+ if ((n==1) && (rptr==0)) {
+ qtKeyCode = code;
+ for (i=0; i < sizeof(qtkey_lookup)/sizeof(qtkey_lookup[0]); i++) {
+ if (qtkey_lookup[i].code == code) {
+ qtKeyCode = qtkey_lookup[i].qtcode;
+ code = 0;
+ break;
+ }
+ }
+ } else
+
+ // Alt-<KEY> sequence
+ if ((n==1) && (rptr==1) && (rbuf[0] == '\e')) {
+ //qDebug("alt-key %d", code);
+ handler->processKeyEvent(0, Qt::Key_Alt, 0, 1, 0);
+ handler->processKeyEvent(0, code-32, Qt::ALT, 1, 0);
+ handler->processKeyEvent(0, code-32, Qt::ALT, 0, 0);
+ handler->processKeyEvent(0, Qt::Key_Alt, 0, 0, 0);
+ rptr = 0;
+ return;
+ } else
+
+ // End of a function key sequence
+ if ((n==1) && (rptr!=0)) {
+ rbuf[rptr++] = code;
+ rbuf[rptr] = 0;
+ for (i=0; i < sizeof(qtesc_lookup)/sizeof(qtesc_lookup[0]); i++) {
+ if (strncmp(rbuf, qtesc_lookup[i].code, sizeof(rbuf)) == 0) {
+ qtKeyCode = qtesc_lookup[i].qtcode;
+ code = 0;
+ break;
+ }
+ }
+ if (code != 0) {
+ //qWarning("no entry in key sequence table for %s", &rbuf[1]);
+ int oldrptr = rptr;
+ rptr = 0;
+ for (i=0; i <= oldrptr; i++) {
+ handleKey(rbuf[i], 1);
+ }
+ return;
+ }
+ rptr = 0;
+ } else
+
+ // Middle of a function key sequence
+ {
+ if (rptr < sizeof(rbuf))
+ rbuf[rptr++] = code;
+ return;
+ }
+
+ //qDebug(" code 0x%2x %d -> qtKeyCode 0x%04x", code, code, qtKeyCode);
+
+ handler->processKeyEvent(code, qtKeyCode, 0, 1, 0);
+ handler->processKeyEvent(code, qtKeyCode, 0, 0, 0);
+}
+
+
+void QWSRamsesKbPrivate::readKeyboardData()
+{
+ unsigned char buf[81];
+ int n = read(kbdFD, buf, 80 );
+ for ( int loop = 0; loop < n; loop++ ) {
+ handleKey(buf[loop], n-loop);
+ }
+}
+
+
+
+
+
+QWSRamsesKeyboardHandler::QWSRamsesKeyboardHandler( const QString &device )
+{
+ d = new QWSRamsesKbPrivate( this, device );
+}
+
+QWSRamsesKeyboardHandler::~QWSRamsesKeyboardHandler()
+{
+ delete d;
+}
+
+void QWSRamsesKeyboardHandler::processKeyEvent(int unicode, int keycode,
+ int modifiers, bool isPress, bool autoRepeat)
+{
+ // Virtual console switching
+ int term = 0;
+ bool ctrl = modifiers & Qt::ControlButton;
+ bool alt = modifiers & Qt::AltButton;
+ if (ctrl && alt && keycode >= Qt::Key_F1 && keycode <= Qt::Key_F10)
+ term = keycode - Qt::Key_F1 + 1;
+ else if (ctrl && alt && keycode == Qt::Key_Left)
+ term = QMAX(vtQws - 1, 1);
+ else if (ctrl && alt && keycode == Qt::Key_Right)
+ term = QMIN(vtQws + 1, 10);
+ if (term && !isPress) {
+ ioctl(kbdFD, VT_ACTIVATE, term);
+ return;
+ }
+
+ QWSKeyboardHandler::processKeyEvent( unicode, keycode, modifiers, isPress, autoRepeat );
+}
+
+
+
+/*
+ * keyboard driver instantiation
+ */
+
+QWSKeyboardHandler *QWSServer::newKeyboardHandler( const QString &spec )
+{
+ QWSKeyboardHandler *handler = 0;
+
+ QString device;
+ QString type;
+ int colon=spec.find(':');
+ if ( colon>=0 ) {
+ type = spec.left(colon);
+ device = spec.mid(colon+1);
+ } else {
+ type = spec;
+ }
+
+ if ( type == "QVFbKeyboard" ) {
+ handler = new QWSVFbKeyboardHandler();
+ } else if ( type == "TTY" ) {
+ handler = new QWSRamsesKeyboardHandler(device);
+ } else {
+ qWarning( "Keyboard type %s:%s unsupported", spec.latin1(), device.latin1() );
+ }
+
+ return handler;
+}
+
+#include "qkeyboard_qws.moc"
+
+#endif // QT_NO_QWS_KEYBOARD
+
+
diff --git a/packages/qte/qte-2.3.10/openmn/qkeyboard_qws.h b/packages/qte/qte-2.3.10/openmn/qkeyboard_qws.h
index e69de29bb2..aa459d1448 100644
--- a/packages/qte/qte-2.3.10/openmn/qkeyboard_qws.h
+++ b/packages/qte/qte-2.3.10/openmn/qkeyboard_qws.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+** $Id: qt/src/kernel/qkeyboard_qws.h 2.3.10 edited 2005-01-24 $
+**
+** Definition of Qt/Embedded keyboards
+**
+** Created : 991025
+**
+** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of the kernel module of the Qt GUI Toolkit.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses for Qt/Embedded may use this file in accordance with the
+** Qt Embedded Commercial License Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QKEYBOARD_QWS_H
+#define QKEYBOARD_QWS_H
+
+#ifndef QT_H
+#include "qobject.h"
+#endif // QT_H
+
+#ifndef QT_NO_QWS_KEYBOARD
+class Q_EXPORT QWSKeyboardHandler : public QObject {
+ Q_OBJECT
+public:
+ QWSKeyboardHandler();
+ virtual ~QWSKeyboardHandler();
+
+protected:
+ virtual void processKeyEvent(int unicode, int keycode, int modifiers,
+ bool isPress, bool autoRepeat);
+};
+#endif
+
+Q_EXPORT bool qwsSetKeyboardAutoRepeat( int delay, int period );
+Q_EXPORT bool qwsGetKeyboardAutoRepeat( int *delay, int *period );
+
+#endif
diff --git a/packages/qte/qte-2.3.10/qiconview-speed.patch b/packages/qte/qte-2.3.10/qiconview-speed.patch
index e69de29bb2..bac9b9705f 100644
--- a/packages/qte/qte-2.3.10/qiconview-speed.patch
+++ b/packages/qte/qte-2.3.10/qiconview-speed.patch
@@ -0,0 +1,122 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10-snapshot-20050131/src/iconview/qiconview.cpp~qiconview-speed
++++ qt-2.3.10-snapshot-20050131/src/iconview/qiconview.cpp
+@@ -225,6 +225,7 @@
+ QIconView::SelectionMode selectionMode;
+ QIconViewItem *currentItem, *tmpCurrentItem, *highlightedItem, *startDragItem, *pressedItem, *selectAnchor;
+ QRect *rubber;
++ QPixmap *backBuffer;
+ QTimer *scrollTimer, *adjustTimer, *updateTimer, *inputTimer,
+ *fullRedrawTimer;
+ int rastX, rastY, spacing;
+@@ -2268,6 +2269,7 @@
+ d->currentItem = 0;
+ d->highlightedItem = 0;
+ d->rubber = 0;
++ d->backBuffer = 0;
+ d->scrollTimer = 0;
+ d->startDragItem = 0;
+ d->tmpCurrentItem = 0;
+@@ -2416,6 +2418,8 @@
+ delete item;
+ item = tmp;
+ }
++ delete d->backBuffer;
++ d->backBuffer = 0;
+ delete d->fm;
+ d->fm = 0;
+ #ifndef QT_NO_TOOLTIP
+@@ -2882,6 +2886,48 @@
+ }
+
+ /*!
++ This function grabs all paintevents that otherwise would have been
++ processed by the QScrollView::viewportPaintEvent(). Here we use a
++ doublebuffer to reduce 'on-paint' flickering on QIconView
++ (and of course its childs).
++
++ \sa QScrollView::viewportPaintEvent(), QIconView::drawContents()
++*/
++
++void QIconView::bufferedPaintEvent( QPaintEvent* pe )
++{
++ QWidget* vp = viewport();
++ QRect r = pe->rect() & vp->rect();
++ int ex = r.x() + contentsX();
++ int ey = r.y() + contentsY();
++ int ew = r.width();
++ int eh = r.height();
++
++ if ( !d->backBuffer )
++ d->backBuffer = new QPixmap(vp->size());
++ if ( d->backBuffer->size() != vp->size() ) {
++ //Resize function (with hysteesis). Uses a good compromise between memory
++ //consumption and speed (number) of resizes.
++ float newWidth = (float)vp->width();
++ float newHeight = (float)vp->height();
++ if ( newWidth > d->backBuffer->width() || newHeight > d->backBuffer->height() )
++ {
++ newWidth *= 1.1892;
++ newHeight *= 1.1892;
++ d->backBuffer->resize( (int)newWidth, (int)newHeight );
++ } else if ( 1.5*newWidth < d->backBuffer->width() || 1.5*newHeight < d->backBuffer->height() )
++ d->backBuffer->resize( (int)newWidth, (int)newHeight );
++ }
++
++ QPainter p;
++ p.begin(d->backBuffer, vp);
++ drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh);
++ p.end();
++ bitBlt(vp, r.x(), r.y(), d->backBuffer, r.x(), r.y(), ew, eh);
++}
++
++/*!
++
+ \reimp
+ */
+
+@@ -4939,7 +4985,7 @@
+ if ( !d->rubber )
+ drawDragShapes( d->oldDragPos );
+ }
+- viewportPaintEvent( (QPaintEvent*)e );
++ bufferedPaintEvent ((QPaintEvent*)e );
+ if ( d->dragging ) {
+ if ( !d->rubber )
+ drawDragShapes( d->oldDragPos );
+@@ -5377,11 +5423,19 @@
+ return;
+
+ if ( item->d->container1 && d->firstContainer ) {
+- item->d->container1->items.removeRef( item );
++ //Special-case checking of the last item, since this may be
++ //called a few times for the same item.
++ if (item->d->container1->items.last() == item)
++ item->d->container1->items.removeLast();
++ else
++ item->d->container1->items.removeRef( item );
+ }
+ item->d->container1 = 0;
+ if ( item->d->container2 && d->firstContainer ) {
+- item->d->container2->items.removeRef( item );
++ if (item->d->container2->items.last() == item)
++ item->d->container2->items.removeLast();
++ else
++ item->d->container2->items.removeRef( item );
+ }
+ item->d->container2 = 0;
+
+--- qt-2.3.10-snapshot-20050131/src/iconview/qiconview.h~qiconview-speed
++++ qt-2.3.10-snapshot-20050131/src/iconview/qiconview.h
+@@ -444,6 +444,7 @@
+ virtual void contentsDropEvent( QDropEvent *e );
+ #endif
+
++ void bufferedPaintEvent( QPaintEvent* );
+ virtual void resizeEvent( QResizeEvent* e );
+ virtual void keyPressEvent( QKeyEvent *e );
+ virtual void focusInEvent( QFocusEvent *e );
diff --git a/packages/qte/qte-2.3.10/qpe.patch b/packages/qte/qte-2.3.10/qpe.patch
index e69de29bb2..af2e31664a 100644
--- a/packages/qte/qte-2.3.10/qpe.patch
+++ b/packages/qte/qte-2.3.10/qpe.patch
@@ -0,0 +1,105 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- /dev/null
++++ qt-2.3.9-snapshot-20041211/src/tools/qconfig-qpe.h
+@@ -0,0 +1,97 @@
++/**********************************************************************
++** Copyright (C) 2000 Trolltech AS. All rights reserved.
++**
++** This file is part of Qtopia Environment.
++**
++** This file may be distributed and/or modified under the terms of the
++** GNU General Public License version 2 as published by the Free Software
++** Foundation and appearing in the file LICENSE.GPL included in the
++** packaging of this file.
++**
++** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
++** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
++**
++** See http://www.trolltech.com/gpl/ for GPL licensing information.
++**
++** Contact info@trolltech.com if any conditions of this licensing are
++** not clear to you.
++**
++**********************************************************************/
++#ifndef QT_H
++#endif // QT_H
++
++// Empty leaves all features enabled. See doc/html/features.html for choices.
++
++// Note that disabling some features will produce a libqt that is not
++// compatible with other libqt builds. Such modifications are only
++// supported on Qt/Embedded where reducing the library size is important
++// and where the application-suite is often a fixed set.
++
++#ifndef QT_DLL
++#define QT_DLL // Internal
++#endif
++
++#define QT_NO_QWS_CURSOR
++#define QT_NO_QWS_MOUSE_AUTO
++#ifndef QT_NO_CODECS
++#define QT_NO_CODECS
++#endif
++#define QT_NO_UNICODETABLES
++//#define QT_NO_IMAGEIO_BMP
++#define QT_NO_IMAGEIO_PPM
++//#define QT_NO_ASYNC_IO
++//#define QT_NO_ASYNC_IMAGE_IO
++#define QT_NO_FREETYPE
++#define QT_NO_BDF
++//#define QT_NO_FONTDATABASE
++#define QT_NO_DRAGANDDROP
++//#define QT_NO_CLIPBOARD
++#define QT_NO_PROPERTIES
++#define QT_NO_NETWORKPROTOCOL
++
++#define QT_NO_IMAGE_TEXT
++
++//#define QT_NO_TOOLTIP
++#define QT_NO_COLORNAMES
++#define QT_NO_TRANSFORMATIONS
++#define QT_NO_TRANSLATION_BUILDER
++#define QT_NO_COMPLEXTEXT
++#define QT_NO_PRINTER
++#define QT_NO_PICTURE
++//#define QT_NO_ICONVIEW
++#define QT_NO_DIAL
++#define QT_NO_SIZEGRIP
++#define QT_NO_WORKSPACE
++//#define QT_NO_TABLE
++//#define QT_NO_ACTION
++//#define QT_NO_SETTINGS
++#define QT_NO_STYLE_POCKETPC
++#ifndef QT_NO_STYLE_AQUA
++# define QT_NO_STYLE_AQUA
++#endif
++#define QT_NO_STYLE_MOTIF
++#define QT_NO_STYLE_PLATINUM
++#define QT_NO_FILEDIALOG
++#define QT_NO_FONTDIALOG
++#define QT_NO_PRINTDIALOG
++#define QT_NO_COLORDIALOG
++#define QT_NO_INPUTDIALOG
++//#define QT_NO_MESSAGEBOX
++#define QT_NO_PROGRESSDIALOG
++//#define QT_NO_TABDIALOG
++#define QT_NO_WIZARD
++#define QT_NO_EFFECTS
++//#define QT_NO_COMPONENT
++#define QT_NO_DOM
++#define QT_NO_SEMIMODAL
++//#define QT_NO_PROGRESSBAR
++#define QT_NO_SPLITTER
++
++//#define QT_NO_QWS_SAVEFONTS
++//#define QT_NO_QWS_PROPERTIES
++
++#define QT_NO_QWS_BEOS_WM_STYLE
++#define QT_NO_QWS_KDE2_WM_STYLE
++#define QT_NO_QWS_KDE_WM_STYLE
++#define QT_NO_QWS_WINDOWS_WM_STYLE
++
diff --git a/packages/qte/qte-2.3.10/qt-visibility.patch b/packages/qte/qte-2.3.10/qt-visibility.patch
index e69de29bb2..ccdebb0c40 100644
--- a/packages/qte/qte-2.3.10/qt-visibility.patch
+++ b/packages/qte/qte-2.3.10/qt-visibility.patch
@@ -0,0 +1,459 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20050114/configure~qt-visibility
++++ qt-2.3.9-snapshot-20050114/configure
+@@ -409,6 +409,9 @@
+ -tslib)
+ TSLIB=yes
+ ;;
++ -visibility-hidden)
++ VISIBILITY=YES
++ ;;
+ -no-g++-exceptions)
+ GPLUSPLUS_EXCEPTIONS=no
+ ;;
+@@ -1296,6 +1299,9 @@
+ -tslib ............. Enable TSlib (touchscreen library) mouse handler.
+ See http://arm.linux.org.uk
+
++ -visibility-hidden . Use -fvisibility=hidden as default. This requires GCC 4.0
++ or a special patched GCC to support the visibility attribute
++
+ -no-g++-exceptions . Disable exceptions on platforms using the GNU C++
+ compiler by using the -fno-exceptions flag.
+
+@@ -1364,6 +1370,10 @@
+ QT_CXX="${QT_CXX} -DQT_QWS_TSLIB"
+ QT_LIBS="${QT_LIBS} -lts"
+ fi
++if [ "x$VISIBILITY=" = "xyes" ]
++then
++ QT_CXX="${QT_CXX} -DGCC_SUPPORTS_VISIBILITY -fvisibility=hidden"
++fi
+ if [ "x$THREAD" = "xyes" ]
+ then
+ cat >src-mt.mk <<EOF
+--- qt-2.3.9-snapshot-20050114/src/tools/qglobal.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/tools/qglobal.h
+@@ -503,6 +503,12 @@
+ #undef QT_DLL
+ #endif
+
++#ifdef GCC_SUPPORTS_VISIBILITY
++#ifndef Q_EXPORT
++ #define Q_EXPORT __attribute__((visibility("default")))
++#endif
++#endif
++
+ #ifndef Q_EXPORT
+ #define Q_EXPORT
+ #endif
+--- qt-2.3.9-snapshot-20050114/src/widgets/qscrollview.cpp~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/widgets/qscrollview.cpp
+@@ -696,7 +696,7 @@
+ The surrounding environment (or application, if there is no
+ environment, may set this. Requires Qt >= 2.3.8.
+ */
+-bool qt_left_hand_scrollbars = FALSE;
++bool Q_EXPORT qt_left_hand_scrollbars = FALSE;
+
+ /*!
+ Updates scrollbars - all possibilities considered. You should never
+--- qt-2.3.9-snapshot-20050114/src/Makefile.in~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/Makefile.in
+@@ -641,7 +641,7 @@
+ network/qsocket.h \
+ network/qsocketdevice.h
+ echo '#include "kernel/qt.h"' >allmoc.cpp
+- $(CXX) -E -DQT_MOC_CPP $(CXXFLAGS) $(INCPATH) >allmoc.h allmoc.cpp
++ $(CXX) -E -DQT_MOC_CPP -DQ_EXPORT="" $(CXXFLAGS) $(INCPATH) >allmoc.h allmoc.cpp
+ $(MOC) -o allmoc.cpp allmoc.h
+ perl -pi -e 's{"allmoc.h"}{"kernel/qt.h"}' allmoc.cpp
+ rm allmoc.h
+--- qt-2.3.9-snapshot-20050114/src/kernel/qcopchannel_qws.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qcopchannel_qws.h
+@@ -42,7 +42,7 @@
+ class QCopChannelPrivate;
+ class QWSClient;
+
+-class QCopChannel : public QObject
++class Q_EXPORT QCopChannel : public QObject
+ {
+ Q_OBJECT
+ public:
+--- qt-2.3.9-snapshot-20050114/src/kernel/qfontmanager_qws.cpp~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qfontmanager_qws.cpp
+@@ -68,7 +68,7 @@
+ return r;
+ }
+
+-QFontManager * qt_fontmanager=0;
++QFontManager Q_EXPORT *qt_fontmanager=0;
+
+ /*!
+ \class QFontManager qfontmanager_qws.h
+--- qt-2.3.9-snapshot-20050114/src/kernel/qgfx_qws.cpp~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qgfx_qws.cpp
+@@ -38,10 +38,10 @@
+ #include <stdlib.h>
+
+ #ifndef QT_NO_QWS_CURSOR
+-bool qt_sw_cursor=false;
+-QScreenCursor * qt_screencursor=0;
++bool Q_EXPORT qt_sw_cursor=false;
++QScreenCursor Q_EXPORT * qt_screencursor=0;
+ #endif
+-QScreen * qt_screen=0;
++QScreen Q_EXPORT * qt_screen=0;
+
+ extern bool qws_screen_is_interlaced; //### hack, from qapplication_qws.cpp
+
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.cpp~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.cpp
+@@ -89,7 +89,7 @@
+
+ extern void qt_setMaxWindowRect(const QRect& r);
+
+-QWSServer *qwsServer=0;
++QWSServer Q_EXPORT *qwsServer=0;
+
+ #define MOUSE 0
+ #define KEY 1
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwsdecoration_qws.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwsdecoration_qws.h
+@@ -41,7 +41,7 @@
+ /*
+ Implements decoration styles
+ */
+-class QWSDecoration
++class Q_EXPORT QWSDecoration
+ {
+ public:
+ QWSDecoration() {}
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.h
+@@ -67,7 +67,7 @@
+
+ struct QWSWindowData;
+
+-class QWSScreenSaver
++class Q_EXPORT QWSScreenSaver
+ {
+ public:
+ virtual ~QWSScreenSaver();
+@@ -75,7 +75,7 @@
+ virtual bool save(int level)=0;
+ };
+
+-class QWSWindow
++class Q_EXPORT QWSWindow
+ {
+ friend class QWSServer;
+ public:
+@@ -169,9 +169,9 @@
+ struct QWSCommandStruct;
+
+ #ifndef QT_NO_QWS_MULTIPROCESS
+-class QWSServer : public QWSServerSocket
++class Q_EXPORT QWSServer : public QWSServerSocket
+ #else
+-class QWSServer : public QObject
++class Q_EXPORT QWSServer : public QObject
+ #endif
+ {
+ friend class QCopChannel;
+@@ -501,7 +501,7 @@
+
+
+ #ifndef QT_NO_QWS_IM
+-class QWSInputMethod : public QObject
++class Q_EXPORT QWSInputMethod : public QObject
+ {
+ public:
+ QWSInputMethod();
+@@ -525,7 +525,7 @@
+ #endif
+
+ #ifndef QT_NO_QWS_FSIM
+-class QWSGestureMethod : public QObject
++class Q_EXPORT QWSGestureMethod : public QObject
+ {
+ public:
+ QWSGestureMethod();
+@@ -573,7 +573,7 @@
+
+ typedef QMap<int, QWSCursor*> QWSCursorMap;
+
+-class QWSClient : public QObject
++class Q_EXPORT QWSClient : public QObject
+ {
+ Q_OBJECT
+ public:
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwsdefaultdecoration_qws.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwsdefaultdecoration_qws.h
+@@ -44,7 +44,7 @@
+
+
+
+-class QWSDefaultDecoration : public QWSDecoration
++class Q_EXPORT QWSDefaultDecoration : public QWSDecoration
+ {
+ public:
+ QWSDefaultDecoration();
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwscommand_qws.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwscommand_qws.h
+@@ -47,8 +47,8 @@
+ *
+ *********************************************************************/
+ #ifndef QT_NO_QWS_MULTIPROCESS
+-void qws_write_command( QWSSocket *socket, int type, char *simpleData, int simpleLen, char *rawData, int rawLen );
+-bool qws_read_command( QWSSocket *socket, char *&simpleData, int &simpleLen, char *&rawData, int &rawLen, int &bytesRead );
++void Q_EXPORT qws_write_command( QWSSocket *socket, int type, char *simpleData, int simpleLen, char *rawData, int rawLen );
++bool Q_EXPORT qws_read_command( QWSSocket *socket, char *&simpleData, int &simpleLen, char *&rawData, int &rawLen, int &bytesRead );
+ #endif
+ /*********************************************************************
+ *
+@@ -57,7 +57,7 @@
+ *********************************************************************/
+
+
+-struct QWSProtocolItem
++struct Q_EXPORT QWSProtocolItem
+ {
+ // ctor - dtor
+ QWSProtocolItem( int t, int len, char *ptr ) : type( t ),
+--- qt-2.3.9-snapshot-20050114/src/kernel/qfont_qws.cpp~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qfont_qws.cpp
+@@ -152,7 +152,7 @@
+ static QFontCache *fontCache = 0; // cache of loaded fonts
+ static QFontDict *fontDict = 0; // dict of all loaded fonts
+
+-void qws_clearLoadedFonts()
++void Q_EXPORT qws_clearLoadedFonts()
+ {
+ QFontDictIt it( *fontDict );
+ while ( it.current() ) {
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwscursor_qws.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwscursor_qws.h
+@@ -37,7 +37,7 @@
+ #include <qimage.h>
+ #endif // QT_H
+
+-class QWSCursor : public Qt
++class Q_EXPORT QWSCursor : public Qt
+ {
+ public:
+ QWSCursor() {}
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwsevent_qws.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwsevent_qws.h
+@@ -40,7 +40,7 @@
+
+ struct QWSMouseEvent;
+
+-struct QWSEvent : QWSProtocolItem {
++struct Q_EXPORT QWSEvent : QWSProtocolItem {
+
+ QWSEvent( int t, int len, char *ptr ) : QWSProtocolItem(t,len,ptr) {}
+
+@@ -71,7 +71,7 @@
+
+ //All events must start with windowID
+
+-struct QWSConnectedEvent : QWSEvent {
++struct Q_EXPORT QWSConnectedEvent : QWSEvent {
+ QWSConnectedEvent()
+ : QWSEvent( QWSEvent::Connected, sizeof( simpleData ),
+ (char*)&simpleData ) {}
+@@ -90,7 +90,7 @@
+ char *display;
+ };
+
+-struct QWSMaxWindowRectEvent : QWSEvent {
++struct Q_EXPORT QWSMaxWindowRectEvent : QWSEvent {
+ QWSMaxWindowRectEvent()
+ : QWSEvent( MaxWindowRect, sizeof( simpleData ), (char*)&simpleData ) { }
+ struct SimpleData {
+@@ -99,7 +99,7 @@
+ } simpleData;
+ };
+
+-struct QWSMouseEvent : QWSEvent {
++struct Q_EXPORT QWSMouseEvent : QWSEvent {
+ QWSMouseEvent()
+ : QWSEvent( QWSEvent::Mouse, sizeof( simpleData ),
+ (char*)&simpleData ) {}
+@@ -110,7 +110,7 @@
+ } simpleData;
+ };
+
+-struct QWSFocusEvent : QWSEvent {
++struct Q_EXPORT QWSFocusEvent : QWSEvent {
+ QWSFocusEvent()
+ : QWSEvent( QWSEvent::Focus, sizeof( simpleData ), (char*)&simpleData )
+ { memset((char*)&simpleData,0,sizeof(simpleData)); }
+@@ -120,7 +120,7 @@
+ } simpleData;
+ };
+
+-struct QWSKeyEvent: QWSEvent {
++struct Q_EXPORT QWSKeyEvent: QWSEvent {
+ QWSKeyEvent()
+ : QWSEvent( QWSEvent::Key, sizeof( simpleData ),
+ (char*)&simpleData )
+@@ -136,7 +136,7 @@
+ };
+
+
+-struct QWSCreationEvent : QWSEvent {
++struct Q_EXPORT QWSCreationEvent : QWSEvent {
+ QWSCreationEvent()
+ : QWSEvent( QWSEvent::Creation, sizeof( simpleData ),
+ (char*)&simpleData ) {}
+@@ -146,7 +146,7 @@
+ };
+
+ #ifndef QT_NO_QWS_PROPERTIES
+-struct QWSPropertyNotifyEvent : QWSEvent {
++struct Q_EXPORT QWSPropertyNotifyEvent : QWSEvent {
+ QWSPropertyNotifyEvent()
+ : QWSEvent( QWSEvent::PropertyNotify, sizeof( simpleData ),
+ (char*)&simpleData ) {}
+@@ -162,7 +162,7 @@
+ };
+ #endif
+
+-struct QWSSelectionClearEvent : QWSEvent {
++struct Q_EXPORT QWSSelectionClearEvent : QWSEvent {
+ QWSSelectionClearEvent()
+ : QWSEvent( QWSEvent::SelectionClear, sizeof( simpleData ),
+ (char*)&simpleData ) {}
+@@ -171,7 +171,7 @@
+ } simpleData;
+ };
+
+-struct QWSSelectionRequestEvent : QWSEvent {
++struct Q_EXPORT QWSSelectionRequestEvent : QWSEvent {
+ QWSSelectionRequestEvent()
+ : QWSEvent( QWSEvent::SelectionRequest, sizeof( simpleData ),
+ (char*)&simpleData ) {}
+@@ -184,7 +184,7 @@
+ } simpleData;
+ };
+
+-struct QWSSelectionNotifyEvent : QWSEvent {
++struct Q_EXPORT QWSSelectionNotifyEvent : QWSEvent {
+ QWSSelectionNotifyEvent()
+ : QWSEvent( QWSEvent::SelectionNotify, sizeof( simpleData ),
+ (char*)&simpleData ) {}
+@@ -198,7 +198,7 @@
+
+ //complex events:
+
+-struct QWSRegionModifiedEvent : QWSEvent {
++struct Q_EXPORT QWSRegionModifiedEvent : QWSEvent {
+ QWSRegionModifiedEvent()
+ : QWSEvent( QWSEvent::RegionModified, sizeof( simpleData ),
+ (char*)&simpleData )
+@@ -218,7 +218,7 @@
+ QRect *rectangles;
+ };
+ #ifndef QT_NO_QWS_PROPERTIES
+-struct QWSPropertyReplyEvent : QWSEvent {
++struct Q_EXPORT QWSPropertyReplyEvent : QWSEvent {
+ QWSPropertyReplyEvent()
+ : QWSEvent( QWSEvent::PropertyReply, sizeof( simpleData ),
+ (char*)&simpleData ) {}
+@@ -238,7 +238,7 @@
+ #endif //QT_NO_QWS_PROPERTIES
+
+ #ifndef QT_NO_COP
+-struct QWSQCopMessageEvent : QWSEvent {
++struct Q_EXPORT QWSQCopMessageEvent : QWSEvent {
+ QWSQCopMessageEvent()
+ : QWSEvent( QWSEvent::QCopMessage, sizeof( simpleData ),
+ (char*)&simpleData )
+@@ -268,7 +268,7 @@
+
+ #endif
+
+-struct QWSWindowOperationEvent : QWSEvent {
++struct Q_EXPORT QWSWindowOperationEvent : QWSEvent {
+ QWSWindowOperationEvent()
+ : QWSEvent( WindowOperation, sizeof( simpleData ), (char*)&simpleData ) { }
+
+@@ -280,7 +280,7 @@
+ };
+
+ #ifndef QT_NO_QWS_IM
+-struct QWSIMEvent : QWSEvent {
++struct Q_EXPORT QWSIMEvent : QWSEvent {
+ QWSIMEvent()
+ : QWSEvent( IMEvent, sizeof( simpleData ), (char*)&simpleData ) { }
+
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwsmanager_qws.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwsmanager_qws.h
+@@ -48,7 +48,7 @@
+ class QWSButton;
+ class QWSManager;
+
+-class QWSManager : public QObject
++class Q_EXPORT QWSManager : public QObject
+ {
+ Q_OBJECT
+
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwsmouse_qws.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwsmouse_qws.h
+@@ -38,7 +38,7 @@
+ #include <qpointarray.h>
+ #endif // QT_H
+
+-class QWSPointerCalibrationData
++class Q_EXPORT QWSPointerCalibrationData
+ {
+ public:
+ enum Location { TopLeft = 0, BottomLeft = 1, BottomRight = 2, TopRight = 3,
+@@ -47,7 +47,7 @@
+ QPoint screenPoints[5];
+ };
+
+-class QWSMouseHandler : public QObject {
++class Q_EXPORT QWSMouseHandler : public QObject {
+ Q_OBJECT
+ public:
+ QWSMouseHandler();
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwsproperty_qws.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwsproperty_qws.h
+@@ -47,7 +47,7 @@
+
+ class QWSPropertyManagerData;
+
+-class QWSPropertyManager
++class Q_EXPORT QWSPropertyManager
+ {
+ public:
+ enum Mode {
+--- qt-2.3.9-snapshot-20050114/src/kernel/qlayoutengine.cpp~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qlayoutengine.cpp
+@@ -70,7 +70,7 @@
+ pos and space give the interval (relative to parentWidget topLeft.)
+ */
+
+-void qGeomCalc( QArray<QLayoutStruct> &chain, int start, int count, int pos,
++void Q_EXPORT qGeomCalc( QArray<QLayoutStruct> &chain, int start, int count, int pos,
+ int space, int spacer )
+ {
+ typedef int fixed;
+--- qt-2.3.9-snapshot-20050114/src/kernel/qfontmanager_qws.h~qt-visibility
++++ qt-2.3.9-snapshot-20050114/src/kernel/qfontmanager_qws.h
+@@ -84,7 +84,7 @@
+ // e.g. Truetype Times, 10 point. There's only one of these though;
+ // we want to share generated glyphs
+
+-class QRenderedFont {
++class Q_EXPORT QRenderedFont {
+
+ public:
+
diff --git a/packages/qte/qte-2.3.10/qtabbar.patch b/packages/qte/qte-2.3.10/qtabbar.patch
index e69de29bb2..6940ec9b25 100644
--- a/packages/qte/qte-2.3.10/qtabbar.patch
+++ b/packages/qte/qte-2.3.10/qtabbar.patch
@@ -0,0 +1,39 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/src/widgets/qtabbar.cpp~qtabbar
++++ qt-2.3.10/src/widgets/qtabbar.cpp
+@@ -260,7 +260,6 @@
+ lstatic->insert( index, newTab );
+
+ layoutTabs();
+- updateArrowButtons();
+ makeVisible( tab( currentTab() ) );
+
+ #ifndef QT_NO_ACCEL
+@@ -282,7 +281,6 @@
+ l->remove( t );
+ lstatic->remove( t );
+ layoutTabs();
+- updateArrowButtons();
+ makeVisible( tab( currentTab() ) );
+ update();
+ }
+@@ -887,6 +885,7 @@
+ }
+ for ( t = lstatic->first(); t; t = lstatic->next() )
+ t->r.setHeight( r.height() );
++ updateArrowButtons();
+ }
+
+ /*!
+@@ -977,7 +976,6 @@
+ d->leftB->setGeometry( width() - 2*arrowWidth, 0, arrowWidth, height() );
+ #endif
+ layoutTabs();
+- updateArrowButtons();
+ makeVisible( tab( currentTab() ));
+ }
+
diff --git a/packages/qte/qte-2.3.10/qte-fix-iconsize.patch b/packages/qte/qte-2.3.10/qte-fix-iconsize.patch
index e69de29bb2..cc14315bd0 100644
--- a/packages/qte/qte-2.3.10/qte-fix-iconsize.patch
+++ b/packages/qte/qte-2.3.10/qte-fix-iconsize.patch
@@ -0,0 +1,99 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/src/widgets/qpopupmenu.cpp~qte-iconsize
++++ qt-2.3.10/src/widgets/qpopupmenu.cpp
+@@ -820,7 +820,7 @@
+ mi->custom()->setFont( font() );
+ if ( mi->iconSet() != 0)
+ maxPMWidth = QMAX( maxPMWidth,
+- mi->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 4 );
++ mi->iconSet()->pixmap().width() + 4 );
+ }
+
+ int dh = QApplication::desktop()->height();
+--- qt-2.3.10/src/widgets/qtabbar.cpp~qte-iconsize
++++ qt-2.3.10/src/widgets/qtabbar.cpp
+@@ -414,8 +414,8 @@
+ int iw = 0;
+ int ih = 0;
+ if ( t->iconset != 0 ) {
+- iw = t->iconset->pixmap( QIconSet::Small, QIconSet::Normal ).width();
+- ih = t->iconset->pixmap( QIconSet::Small, QIconSet::Normal ).height();
++ iw = t->iconset->pixmap().width();
++ ih = t->iconset->pixmap().height();
+ if (!t->label.isEmpty())
+ iw +=2;
+ }
+@@ -442,7 +442,11 @@
+ ? QIconSet::Normal : QIconSet::Disabled;
+ if ( mode == QIconSet::Normal && has_focus )
+ mode = QIconSet::Active;
+- QPixmap pixmap = t->iconset->pixmap( QIconSet::Small, mode );
++ QPixmap pixmap;
++ if ( mode == QIconSet::Disabled )
++ pixmap = t->iconset->pixmap( QIconSet::Automatic, QIconSet::Disabled );
++ else
++ pixmap = t->iconset->pixmap();
+ int pixw = pixmap.width();
+ int pixh = pixmap.height();
+ r.setLeft( r.left() + pixw + 2 );
+@@ -871,8 +875,8 @@
+ int iw = 0;
+ int ih = 0;
+ if ( t->iconset != 0 ) {
+- iw = t->iconset->pixmap( QIconSet::Small, QIconSet::Normal ).width();
+- ih = t->iconset->pixmap( QIconSet::Small, QIconSet::Normal ).height();
++ iw = t->iconset->pixmap().width();
++ ih = t->iconset->pixmap().height();
+ if (!t->label.isNull())
+ iw +=2;
+ }
+@@ -915,8 +919,8 @@
+ int iw = 0;
+ int ih = 0;
+ if ( t->iconset != 0 ) {
+- iw = t->iconset->pixmap( QIconSet::Small, QIconSet::Normal ).width();
+- ih = t->iconset->pixmap( QIconSet::Small, QIconSet::Normal ).height();
++ iw = t->iconset->pixmap().width();
++ ih = t->iconset->pixmap().height();
+ if (!t->label.isEmpty())
+ iw +=2;
+ }
+@@ -947,8 +951,8 @@
+ int iw = 0;
+ int ih = 0;
+ if ( t->iconset != 0 ) {
+- iw = t->iconset->pixmap( QIconSet::Small, QIconSet::Normal ).width();
+- ih = t->iconset->pixmap( QIconSet::Small, QIconSet::Normal ).height();
++ iw = t->iconset->pixmap().width();
++ ih = t->iconset->pixmap().height();
+ if (!t->label.isEmpty())
+ iw +=2;
+ }
+--- qt-2.3.10/src/widgets/qwindowsstyle.cpp~qte-iconsize
++++ qt-2.3.10/src/widgets/qwindowsstyle.cpp
+@@ -1182,7 +1182,7 @@
+ h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame;
+
+ if ( !mi->isSeparator() && mi->iconSet() != 0 ) {
+- h = QMAX( h, mi->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height() + 2*motifItemFrame );
++ h = QMAX( h, mi->iconSet()->pixmap().height() + 2*motifItemFrame );
+ }
+ if ( mi->custom() )
+ h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame );
+@@ -1246,7 +1246,11 @@
+ QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal;
+ if (act && !dis )
+ mode = QIconSet::Active;
+- QPixmap pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode );
++ QPixmap pixmap;
++ if ( mode == QIconSet::Disabled )
++ pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, QIconSet::Disabled );
++ else
++ pixmap = mi->iconSet()->pixmap();
+ int pixw = pixmap.width();
+ int pixh = pixmap.height();
+ if ( act && !dis ) {
diff --git a/packages/qte/qte-2.3.10/sharp_char.h b/packages/qte/qte-2.3.10/sharp_char.h
index e69de29bb2..a70f5f690e 100644
--- a/packages/qte/qte-2.3.10/sharp_char.h
+++ b/packages/qte/qte-2.3.10/sharp_char.h
@@ -0,0 +1,309 @@
+/*
+ * linux/include/asm/sharp_char.h
+ *
+ * sharp drivers definitions (SHARP)
+ *
+ * Copyright (C) 2001 SHARP
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 General Public License for more details.
+ *
+ * Change Log
+ * 12-Dec-2002 Sharp Corporation for Poodle and Corgi
+ */
+
+#ifndef __ASM_SHARP_CHAR_H_INCLUDED
+#define __ASM_SHARP_CHAR_H_INCLUDED
+
+/*
+ * If SHARPCHAR_USE_MISCDEV defined , misc driver architecture used instead of sharp_char
+ */
+
+#define SHARPCHAR_USE_MISCDEV
+
+/*
+ * devices defines...
+ */
+
+#ifndef SHARP_DEV_MAJOR
+#define SHARP_DEV_MAJOR 11
+#endif
+
+#ifndef SHARP_DEV_MINOR_START
+#define SHARP_DEV_MINOR_START 210
+#endif
+
+#define SHARP_DEV_MINOR_MAX 4 /* defines last minor number of SHARP device */
+
+#define SHARP_LED_MINOR (SHARP_DEV_MINOR_START+0)
+#define SHARP_BUZZER_MINOR (SHARP_DEV_MINOR_START+1)
+#define SHARP_GSM_MINOR (SHARP_DEV_MINOR_START+2)
+#define SHARP_AUDIOCTL_MINOR (SHARP_DEV_MINOR_START+3)
+#define SHARP_KBDCTL_MINOR (SHARP_DEV_MINOR_START+4)
+
+/*
+ * ioctl defines...
+ */
+
+#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
+
+/* --- for SHARP_LED device --- */
+#define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
+#define SHARP_LED_GETSTATUS (SHARP_LED_IOCTL_START)
+#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
+#define SHARP_LED_ISUPPORTED (SHARP_LED_IOCTL_START+2)
+
+typedef struct sharp_led_status {
+ int which; /* select which LED status is wanted. */
+ int status; /* set new led status if you call SHARP_LED_SETSTATUS */
+} sharp_led_status;
+
+#define SHARP_LED_WHICH_MAX 15 /* last number of LED */
+
+/* parameters for 'which' member */
+#define SHARP_LED_PDA 0 /* PDA status */
+#define SHARP_LED_DALARM 1 /* daily alarm */
+#define SHARP_LED_SALARM 2 /* schedule alarm */
+#define SHARP_LED_BATTERY 3 /* main battery status */
+#define SHARP_LED_ACSTATUS 4 /* AC line status */
+#define SHARP_LED_CHARGER 5 /* charger status */
+#define SHARP_LED_PHONE_RSSI 6 /* phone status (RSSI...) */
+#define SHARP_LED_PHONE_DIAL 7 /* phone status (dialing...) */
+#define SHARP_LED_PHONE_IN 8 /* phone status (incoming..) */
+#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
+#define SHARP_LED_MAIL_SEND 10 /* mail status (sending...) */
+#define SHARP_LED_MAIL_QUEUE 11 /* mail to send is in queue */
+#define SHARP_LED_COLLIE_0 12 /* 1st pri. battery LED control */
+#define SHARP_LED_COLLIE_1 13 /* 1st pri. mail LED control */
+#define SHARP_LED_COMM 14 /* communication status */
+#define SHARP_LED_BROWSER 15 /* WWW browser status */
+
+/* parameters for 'status' member */
+#define LED_PDA_RUNNING 0 /* for SHARP_LED_RUN */
+#define LED_PDA_SUSPENDED 1 /* for SHARP_LED_RUN */
+#define LED_PDA_OFF 2 /* for SHARP_LED_RUN */
+#define LED_PDA_ERROR 3 /* for SHARP_LED_RUN */
+
+#define LED_DALARM_OFF 0 /* for SHARP_LED_DALARM */
+#define LED_DALARM_ON 1 /* for SHARP_LED_DALARM */
+
+#define LED_SALARM_OFF 0 /* for SHARP_LED_SALARM */
+#define LED_SALARM_ON 1 /* for SHARP_LED_SALARM */
+
+#define LED_BATTERY_GOOD 0 /* for SHARP_LED_BATTERY */
+#define LED_BATTERY_LOW 1 /* for SHARP_LED_BATTERY */
+#define LED_BATTERY_VERY_LOW 2 /* for SHARP_LED_BATTERY */
+#define LED_BATTERY_CRITICAL 3 /* for SHARP_LED_BATTERY */
+
+#define LED_CHARGER_OFF 0 /* for SHARP_LED_CHARGER */
+#define LED_CHARGER_CHARGING 1 /* for SHARP_LED_CHARGER */
+#define LED_CHARGER_ERROR 2 /* for SHARP_LED_CHARGER */
+#define LED_CHARGER_FLASH 3
+
+#define LED_AC_NOT_CONNECTED 0 /* for SHARP_LED_ACSTATUS */
+#define LED_AC_CONNECTED 1 /* for SHARP_LED_ACSTATUS */
+
+#define LED_RSSI_OUT 0 /* for SHARP_LED_PHONE_RSSI */
+#define LED_RSSI_IN 1 /* for SHARP_LED_PHONE_RSSI */
+
+#define LED_DIAL_OFF 0 /* for SHARP_LED_PHONE_DIAL */
+#define LED_DIAL_DIALING 1 /* for SHARP_LED_PHONE_DIAL */
+#define LED_DIAL_HOLDING 2 /* for SHARP_LED_PHONE_DIAL */
+
+#define LED_PHONE_WAITING 0 /* for SHARP_LED_PHONE_IN */
+#define LED_PHONE_INCOMING 1 /* for SHARP_LED_PHONE_IN */
+
+#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
+#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
+#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
+
+#define LED_SENDMAIL_OFF 0 /* for SHARP_LED_MAIL_SEND */
+#define LED_SENDMAIL_SENDING 1 /* for SHARP_LED_MAIL_SEND */
+#define LED_SENDMAIL_ERROR 2 /* for SHARP_LED_MAIL_SEND */
+
+#define LED_MAILQUEUE_NOUNREAD 0 /* for SHARP_LED_MAIL_QUEUE */
+#define LED_MAILQUEUE_NEWMAIL 1 /* for SHARP_LED_MAIL_QUEUE */
+#define LED_MAILQUEUE_UNREAD 2 /* for SHARP_LED_MAIL_QUEUE */
+
+#define LED_COLLIE_0_DEFAULT 0 /* for SHARP_LED_COLLIE_0 */
+#define LED_COLLIE_0_OFF 1 /* for SHARP_LED_COLLIE_0 */
+#define LED_COLLIE_0_ON 2 /* for SHARP_LED_COLLIE_0 */
+#define LED_COLLIE_0_FASTBLINK 3 /* for SHARP_LED_COLLIE_0 */
+#define LED_COLLIE_0_SLOWBLINK 4 /* for SHARP_LED_COLLIE_0 */
+
+#define LED_COLLIE_1_DEFAULT 0 /* for SHARP_LED_COLLIE_1 */
+#define LED_COLLIE_1_OFF 1 /* for SHARP_LED_COLLIE_1 */
+#define LED_COLLIE_1_ON 2 /* for SHARP_LED_COLLIE_1 */
+#define LED_COLLIE_1_FLASHON 3 /* for SHARP_LED_COLLIE_1 */
+#define LED_COLLIE_1_FLASHOFF 4 /* for SHARP_LED_COLLIE_1 */
+#define LED_COLLIE_1_VFSTBLINK 5 /* for SHARP_LED_COLLIE_1 */
+#define LED_COLLIE_1_FASTBLINK 6 /* for SHARP_LED_COLLIE_1 */
+#define LED_COLLIE_1_NORMBLINK 7 /* for SHARP_LED_COLLIE_1 */
+#define LED_COLLIE_1_SLOWBLINK 8 /* for SHARP_LED_COLLIE_1 */
+#define LED_COLLIE_1_SOFTBLINK 9 /* for SHARP_LED_COLLIE_1 */
+#define LED_COLLIE_1_SOFTFLASH 10 /* for SHARP_LED_COLLIE_1 */
+
+#define LED_COMM_OFFLINE 0 /* for SHARP_LED_COMM */
+#define LED_COMM_ONLINE 1 /* for SHARP_LED_COMM */
+#define LED_COMM_ERROR 2 /* for SHARP_LED_COMM */
+
+#define LED_BROWSER_OFFLINE 0 /* for SHARP_LED_BROWSER */
+#define LED_BROWSER_ONLINE 1 /* for SHARP_LED_BROWSER */
+#define LED_BROWSER_ERROR 2 /* for SHARP_LED_BROWSER */
+
+
+/* --- for SHARP_BUZZER device --- */
+#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
+#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
+#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
+#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
+#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
+#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
+#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
+#define SHARP_BUZZER_SET_BUFFER (SHARP_BUZZER_IOCTL_START+6)
+
+typedef struct sharp_buzzer_status { /* this struct is used for setvolume/getvolume */
+ int which; /* select which LED status is wanted. */
+ int volume; /* set new buzzer volume if you call SHARP_BUZZER_SETVOLUME */
+ int mute; /* set 1 to MUTE if you call SHARP_BUZZER_SETMUTE */
+} sharp_buzzer_status;
+
+#define SHARP_BUZ_WHICH_MAX 14 /* last number of buzzer */
+
+#define SHARP_BUZ_ALL_SOUNDS -1 /* for setting volumes of ALL sounds at a time */
+
+#define SHARP_BUZ_WRITESOUND 0 /* for sound datas through 'write' calls */
+#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
+#define SHARP_BUZ_KEYSOUND 2 /* key sound */
+#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
+#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
+#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
+#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
+#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
+#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
+#define SHARP_PDA_APPSTART 9 /* application start */
+#define SHARP_PDA_APPQUIT 10 /* application ends */
+#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
+#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
+#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
+#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
+
+#define SHARP_BUZ_VOLUME_OFF 0
+#define SHARP_BUZ_VOLUME_LOW 33
+#define SHARP_BUZ_VOLUME_MEDIUM 67
+#define SHARP_BUZ_VOLUME_HIGH 100 /* currentry , this is the maximum ... */
+#define SHARP_BUZ_VOLUME_MAX (SHARP_BUZ_VOLUME_HIGH)
+
+/* --- for SHARP_GSM device --- */
+#define SHARP_GSM_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
+#define SHARP_GSM_GETEXTSTATUS (SHARP_GSM_IOCTL_START+16)
+#define SHARP_GSM_INFO_TELL_MODE (SHARP_GSM_IOCTL_START+17)
+#define SHARP_IRIS_GETSYNCSTATUS (SHARP_GSM_IOCTL_START+18)
+#define SHARP_IRIS_RECHECKDEVICE (SHARP_GSM_IOCTL_START+19)
+
+
+#define GSM_PHONE_NO_POWER 0 /* for SHARP_GSM_INFO_TELL_MODE */
+#define GSM_PHONE_NO_CONNECTION 1 /* for SHARP_GSM_INFO_TELL_MODE */
+#define GSM_PHONE_IN_ANALOG_MODE 2 /* for SHARP_GSM_INFO_TELL_MODE */
+#define GSM_PHONE_IN_DATA_MODE 3 /* for SHARP_GSM_INFO_TELL_MODE */
+
+#define IRIS_AUDIO_EXT_IS_NONE 0
+#define IRIS_AUDIO_EXT_IS_HEADPHONEMIC 1
+#define IRIS_AUDIO_EXT_IS_EXTSPEAKER 2
+
+typedef struct sharp_gsmext_status {
+ int carkit; /* be set as 1 , if car-kit is connected */
+ int headphone_mic; /* be set as 1 , if head-phone-microphone is inserted */
+ int external_sp; /* be set as 1 , if external-speaker is inserted */
+} sharp_gsmext_status;
+
+typedef struct sharp_irisext_status { /* for SHARP_IRIS_GETSYNCSTATUS */
+ int usb;
+ int uart;
+ int carkit;
+} sharp_irisext_status;
+
+/* --- for SHARP_AUDIOCTL device --- */
+#define SHARP_AUDIOCTL_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
+#define SHARP_AUDIOCTL_ARCH_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START+0x10)
+#define SHARP_IRIS_AUFIL_GETVAL (SHARP_AUDIOCTL_ARCH_IOCTL_START+0)
+#define SHARP_IRIS_AUFIL_SETVAL (SHARP_AUDIOCTL_ARCH_IOCTL_START+1)
+#define SHARP_IRIS_AMP_EXT_ON (SHARP_AUDIOCTL_ARCH_IOCTL_START+2)
+#define SHARP_IRIS_AMP_EXT_OFF (SHARP_AUDIOCTL_ARCH_IOCTL_START+3)
+
+
+#define SHARP_IRIS_AUFIL_FILTERON 0x01 /* Iris AudioCtl Specific. Enable Audio Filter */
+
+/* --- for SHARP_AUDIOCTL device --- */
+#define SHARP_KBDCTL_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
+#define SHARP_KBDCTL_GETMODIFSTAT (SHARP_KBDCTL_IOCTL_START+0)
+#define SHARP_KBDCTL_TOGGLEMODIFSTAT (SHARP_KBDCTL_IOCTL_START+1)
+#define SHARP_KBDCTL_SETHOLDTH (SHARP_KBDCTL_IOCTL_START+2)
+#define SHARP_KBDCTL_SETHOLDTH_GR (SHARP_KBDCTL_IOCTL_START+3)
+#define SHARP_KBDCTL_HOLDINFO_SETHD (SHARP_KBDCTL_IOCTL_START+4)
+#define SHARP_KBDCTL_HOLDINFO_SETSL (SHARP_KBDCTL_IOCTL_START+5)
+#define SHARP_KBDCTL_HOLDINFO_DELHD (SHARP_KBDCTL_IOCTL_START+6)
+#define SHARP_KBDCTL_HOLDINFO_DELSL (SHARP_KBDCTL_IOCTL_START+7)
+#define SHARP_KBDCTL_HOLDINFO_RESTHD (SHARP_KBDCTL_IOCTL_START+8)
+#define SHARP_KBDCTL_HOLDINFO_RESTSL (SHARP_KBDCTL_IOCTL_START+9)
+#define SHARP_KBDCTL_HOLDINFO_RESTFULL (SHARP_KBDCTL_IOCTL_START+10)
+#define IRIS_KBDCTL_ENABLEKEYBOARD (SHARP_KBDCTL_IOCTL_START+16)
+#define IRIS_KBDCTL_DISABLEKEYBOARD (SHARP_KBDCTL_IOCTL_START+17)
+#define SHARP_KBDCTL_SENDKEY (SHARP_KBDCTL_IOCTL_START+18)
+
+typedef struct sharp_kbdctl_modifstat {
+ int which;
+ int stat;
+} sharp_kbdctl_modifstat;
+
+typedef struct sharp_kbdctl_holdstat {
+ int group;
+ int timeout;
+} sharp_kbdctl_holdstat;
+
+typedef struct sharp_kbdctl_holdcustom {
+ int normal_hardcode;
+ int normal_slcode;
+ int hold_slcode;
+} sharp_kbdctl_holdcustom;
+
+#define SHARP_EXTMODIF_2ND 0x01
+#define SHARP_EXTMODIF_CAPS 0x02
+#define SHARP_EXTMODIF_NUMLOCK 0x03
+
+#define HOLDKEY_GROUP_NORMAL 0
+#define HOLDKEY_GROUP_POWER 1
+
+
+/* --- for AUDIO & REMOCON device --- */
+#define HPJACK_STATE_UNDETECT (-1)
+#define HPJACK_STATE_NONE (0)
+#define HPJACK_STATE_HEADPHONE (1)
+#define HPJACK_STATE_REMOCON (2)
+
+
+#endif /* __ASM_SHARP_CHAR_H_INCLUDED */
+
+
+//#define EXTERNAL_IO_BASE01 0xF8000000
+//#define EXTEND_GPIO_RED_LED (1<<4)
+//#define EXTEND_GPIO_GREEN_LED (1<<5)
+//unsigned short * pwEGPIO1 ;
+//unsigned short gwExtendGpio1;
+// pwEGPIO1 = (unsigned short *) EXTERNAL_IO_BASE01;
+
+
+
+
+
+
+
+
+
diff --git a/packages/qte/qte-2.3.10/switches.h b/packages/qte/qte-2.3.10/switches.h
index e69de29bb2..37516b4c75 100644
--- a/packages/qte/qte-2.3.10/switches.h
+++ b/packages/qte/qte-2.3.10/switches.h
@@ -0,0 +1,74 @@
+/*
+ * linux/include/linux/switches.h
+ *
+ * Copyright (C) 2000 John Dorsey
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 23 October 2000 - created.
+ */
+
+#if !defined(_LINUX_SWITCHES_H)
+#define _LINUX_SWITCHES_H
+
+#define SWITCHES_MASK_SIZE (128)
+
+typedef unsigned long switches_bitfield;
+
+#define SWITCHES_BITS (sizeof(switches_bitfield) * 8)
+#define SWITCHES_NUM_FIELDS (SWITCHES_MASK_SIZE / SWITCHES_BITS)
+#define SWITCHES_FIELD_SELECT(i) ((i) / SWITCHES_BITS)
+#define SWITCHES_FIELD_MASK(i) ((switches_bitfield)(1 << (i) % \
+ SWITCHES_BITS))
+
+typedef struct switches_mask_t {
+ unsigned int count;
+ switches_bitfield events[SWITCHES_NUM_FIELDS];
+ switches_bitfield states[SWITCHES_NUM_FIELDS];
+} switches_mask_t;
+
+#define SWITCHES_ZERO(m) \
+do { \
+ unsigned int sz_i; \
+ (m)->count = 0; \
+ for(sz_i = 0; sz_i < SWITCHES_NUM_FIELDS; ++sz_i) \
+ (m)->events[sz_i] = (m)->states[sz_i] = 0; \
+} while (0)
+
+/* `s' is the state of the switch, either 0 or non-zero: */
+#define SWITCHES_SET(m, i, s) \
+do { \
+ ((m)->events[SWITCHES_FIELD_SELECT((i))] |= \
+ SWITCHES_FIELD_MASK((i))); \
+ if(s) \
+ ((m)->states[SWITCHES_FIELD_SELECT((i))] |= \
+ SWITCHES_FIELD_MASK((i))); \
+ else \
+ ((m)->states[SWITCHES_FIELD_SELECT((i))] &= \
+ ~SWITCHES_FIELD_MASK((i))); \
+ ++((m)->count); \
+} while (0)
+
+/* Should only use to clear an event set by SWITCHES_SET(): */
+#define SWITCHES_CLEAR(m, i) \
+do { \
+ ((m)->events[SWITCHES_FIELD_SELECT((i))] &= \
+ ~SWITCHES_FIELD_MASK((i))); \
+ ((m)->states[SWITCHES_FIELD_SELECT((i))] &= \
+ ~SWITCHES_FIELD_MASK((i))); \
+ --((m)->count); \
+}
+
+#define SWITCHES_COUNT(m) ((m)->count)
+
+/* Returns 0 or non-zero: */
+#define SWITCHES_EVENT(m, i) \
+((m)->events[SWITCHES_FIELD_SELECT((i))] & SWITCHES_FIELD_MASK((i)))
+
+/* Returns 0 or non-zero: */
+#define SWITCHES_STATE(m, i) \
+((m)->states[SWITCHES_FIELD_SELECT((i))] & SWITCHES_FIELD_MASK((i)))
+
+#endif /* !defined(_LINUX_SWITCHES_H) */
diff --git a/packages/qte/qte-2.3.10/vt-switch.patch b/packages/qte/qte-2.3.10/vt-switch.patch
index e69de29bb2..4007a5d9f6 100644
--- a/packages/qte/qte-2.3.10/vt-switch.patch
+++ b/packages/qte/qte-2.3.10/vt-switch.patch
@@ -0,0 +1,178 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20041221/src/kernel/qapplication_qws.cpp~vt-switch.patch
++++ qt-2.3.9-snapshot-20041221/src/kernel/qapplication_qws.cpp
+@@ -124,6 +124,12 @@
+ static int qt_thread_pipe[2];
+ #endif
+
++#if defined(_OS_LINUX_)
++#include <sys/ioctl.h>
++#include <linux/vt.h>
++#include <linux/kd.h>
++#endif
++
+ const int qwsSharedRamSize = 32 * 1024; //Small amount to fit on small devices.
+
+ // These are in qapplication.cpp in qt/main
+@@ -164,6 +170,8 @@
+ bool qws_accel = TRUE; // ### never set
+ const char *qws_display_spec = ":0";
+ int qws_display_id = 0;
++int qws_terminal_id = 0;
++int qws_terminal_old = 0;
+ int qws_client_id = 0;
+ QWidget *qt_pressGrab = 0;
+ QWidget *qt_mouseGrb = 0;
+@@ -1700,6 +1708,15 @@
+ type = QApplication::GuiServer;
+ } else if ( arg == "-interlaced" ) {
+ qws_screen_is_interlaced = TRUE;
++ } else if ( arg == "-terminal" ) {
++ if ( ++i < argc )
++ {
++ if ( ( qws_terminal_id = atoi( argv[i] ) ) < 1 )
++ {
++ qWarning( "Ignoring Invalid Terminal Specification." );
++ qws_terminal_id = 0;
++ }
++ }
+ } else if ( arg == "-display" ) {
+ if ( ++i < argc )
+ qws_display_spec = argv[i];
+@@ -1724,6 +1741,53 @@
+ if ( type == QApplication::GuiServer ) {
+ qt_appType = type;
+ qws_single_process = TRUE;
++
++ /* Allocate a dedicated virtual terminal -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
++ * Added a new command line option which only is relevant if the application is created as a GuiServer.
++ * The option is -terminal <num>, where <num> specifies the virtual terminal to be occupied by the server.
++ * As default in Linux, 0 means the current virtual terminal.
++ */
++ #if defined(_OS_LINUX_)
++ if ( qws_terminal_id )
++ {
++ qDebug( "qt_init() - terminal specification is '%d'.", qws_terminal_id );
++ struct vt_stat console_stat;
++ int console_fd = ::open( QString().sprintf( "/dev/tty%d", qws_terminal_id ).latin1(), O_RDWR );
++ if ( console_fd == -1)
++ {
++ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
++ exit( -1 );
++ }
++ if ( ioctl( console_fd, VT_GETSTATE, &console_stat ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(VT_GETSTATE): %s", strerror( errno ) );
++ exit( -1 );
++ }
++ qws_terminal_old = console_stat.v_active;
++ qDebug( "qt_init() - active vt is #%d, switching to #%d as requested...", qws_terminal_old, qws_terminal_id );
++
++ if ( ioctl( console_fd, VT_ACTIVATE, qws_terminal_id ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(VT_ACTIVATE): %s", strerror( errno ) );
++ exit( -1 );
++ }
++ if ( ioctl( console_fd, VT_WAITACTIVE, qws_terminal_id ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(VT_WAITACTIVE): %s", strerror( errno ) );
++ exit( -1 );
++ }
++ if ( ioctl( console_fd, KDSETMODE, KD_GRAPHICS ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(KDSETMODE:KD_GRAPHICS): %s", strerror( errno ) );
++ exit( -1 );
++ }
++ ::close( console_fd );
++ }
++ else
++ {
++ qDebug( "QWSApplication::qt_init() - current terminal specified." );
++ }
++ #endif
+ QWSServer::startup(flags);
+ setenv("QWS_DISPLAY", qws_display_spec, 0);
+ }
+@@ -1774,7 +1838,36 @@
+ QFontManager::cleanup();
+
+ if ( qws_single_process ) {
+- QWSServer::closedown();
++ qDebug( "qt_cleanup() - shutting down QWSServer..." );
++#ifndef QT_NO_QWS_KEYBOARD
++ if ( qwsServer )
++ qwsServer->closeKeyboard();
++#endif
++ QWSServer::closedown();
++#if defined(_OS_LINUX_)
++ if ( qws_terminal_old > 0 )
++ {
++ qDebug( "qt_cleanup() - switching back to virtual terminal #%d", qws_terminal_old );
++
++ int console_fd = ::open( "/dev/tty0", O_RDWR );
++ if ( console_fd == -1)
++ {
++ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
++ }
++ else
++ {
++ if ( ioctl( console_fd, KDSETMODE, KD_TEXT ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(KDSETMODE:KD_TEXT): %s", strerror( errno ) );
++ }
++ if ( ioctl( console_fd, VT_ACTIVATE, qws_terminal_old ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(VT_ACTIVATE): %s", strerror( errno ) );
++ }
++ ::close( console_fd );
++ }
++ }
++#endif
+ }
+ if ( qt_is_gui_used ) {
+ delete qt_fbdpy;
+--- qt-2.3.9-snapshot-20041221/src/kernel/qkeyboard_qws.cpp~vt-switch.patch
++++ qt-2.3.9-snapshot-20041221/src/kernel/qkeyboard_qws.cpp
+@@ -1247,6 +1247,24 @@
+ {
+ if (kbdFD >= 0)
+ {
++
++#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
++ struct vt_mode vtMode;
++ ioctl(kbdFD, VT_GETMODE, &vtMode);
++
++ /* Mickey says: "Better give up control of VT switching.
++ * Hey, I really hate that OS-will-reacquire-resources on process-death
++ * kind of thinking!
++ */
++ vtMode.mode = VT_AUTO;
++ vtMode.relsig = 0;
++ vtMode.acqsig = 0;
++ ioctl(kbdFD, VT_SETMODE, &vtMode);
++
++ signal(VTSWITCHSIG, 0);
++ qDebug( "~QWSTtyKeyboardHandler() - released VT." );
++#endif
++
+ #if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
+ ioctl(kbdFD, KDSKBMODE, K_XLATE);
+ #endif
+--- qt-2.3.9-snapshot-20041221/src/kernel/qgfxlinuxfb_qws.cpp~vt-switch.patch
++++ qt-2.3.9-snapshot-20041221/src/kernel/qgfxlinuxfb_qws.cpp
+@@ -251,9 +251,9 @@
+
+ bool QLinuxFbScreen::initDevice()
+ {
+- // No blankin' screen, no blinkin' cursor!, no cursor!
++ /* Setting up the VT parameters is done in qapplication_qws.cpp
+ const char termctl[]="\033[9;0]\033[?33l\033[?25l";
+- writeTerm(termctl,sizeof(termctl));
++ writeTerm(termctl,sizeof(termctl)); */
+
+ // Grab current mode so we can reset it
+ fb_var_screeninfo vinfo;