aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-qt
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2011-07-24 17:57:24 +0100
committerPaul Eggleton <paul.eggleton@linux.intel.com>2011-07-30 02:35:12 +0100
commite9b45ff67d32fdc27950a51135b6dabada8334e7 (patch)
treede99cd760c8292ee1dd334e23e1e5cc43e90dfbd /recipes-qt
downloadmeta-opie-e9b45ff67d32fdc27950a51135b6dabada8334e7.tar.gz
meta-opie-e9b45ff67d32fdc27950a51135b6dabada8334e7.tar.bz2
meta-opie-e9b45ff67d32fdc27950a51135b6dabada8334e7.zip
initial commit of meta-opie
Populate the repository with files from OpenEmbedded at revision 45edf621296daf150c72b876d720861235e5762e - no changes, only rearranged the directory structure to match the new oe-core style and added COPYING.MIT and README. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'recipes-qt')
-rw-r--r--recipes-qt/qmake/files/linux-oe-qmake.conf82
-rw-r--r--recipes-qt/qmake/qmake-native_1.07a.bb48
-rw-r--r--recipes-qt/qte/qte-2.3.10/bidimetrics.patch2389
-rw-r--r--recipes-qt/qte/qte-2.3.10/c7x0-w100-accel.patch3404
-rw-r--r--recipes-qt/qte/qte-2.3.10/c7x0-w100-gcc4.patch31
-rw-r--r--recipes-qt/qte/qte-2.3.10/daemonize.patch113
-rw-r--r--recipes-qt/qte/qte-2.3.10/disable-dup-rotation.patch13
-rw-r--r--recipes-qt/qte/qte-2.3.10/encoding.patch34
-rw-r--r--recipes-qt/qte/qte-2.3.10/fix-errno-exception-spec.patch16
-rw-r--r--recipes-qt/qte/qte-2.3.10/fix-linuxfb-offscreenoverflow.patch22
-rw-r--r--recipes-qt/qte/qte-2.3.10/fix-linuxfb-setmode.patch32
-rw-r--r--recipes-qt/qte/qte-2.3.10/fix-native-build.patch11
-rw-r--r--recipes-qt/qte/qte-2.3.10/fix-qgfxraster.patch28
-rw-r--r--recipes-qt/qte/qte-2.3.10/fix-qscreen-sync.patch17
-rw-r--r--recipes-qt/qte/qte-2.3.10/fix-qte-asm-include.patch19
-rw-r--r--recipes-qt/qte/qte-2.3.10/gcc3.patch27
-rw-r--r--recipes-qt/qte/qte-2.3.10/gcc4.patch16
-rw-r--r--recipes-qt/qte/qte-2.3.10/handhelds.patch60
-rw-r--r--recipes-qt/qte/qte-2.3.10/improve-calibration-r0.patch159
-rw-r--r--recipes-qt/qte/qte-2.3.10/increase-qxml-robustness.patch17
-rw-r--r--recipes-qt/qte/qte-2.3.10/ipaq_sound_fix.patch60
-rw-r--r--recipes-qt/qte/qte-2.3.10/kernel-keymap-corgi.patch23
-rw-r--r--recipes-qt/qte/qte-2.3.10/kernel-keymap.patch1293
-rw-r--r--recipes-qt/qte/qte-2.3.10/key.patch74
-rw-r--r--recipes-qt/qte/qte-2.3.10/keyboardless-buttonmap.patch19
-rw-r--r--recipes-qt/qte/qte-2.3.10/no-moc.patch37
-rw-r--r--recipes-qt/qte/qte-2.3.10/qiconview-speed.patch122
-rw-r--r--recipes-qt/qte/qte-2.3.10/qpe.patch105
-rw-r--r--recipes-qt/qte/qte-2.3.10/qt-visibility.patch459
-rw-r--r--recipes-qt/qte/qte-2.3.10/qtabbar.patch39
-rw-r--r--recipes-qt/qte/qte-2.3.10/qte-fix-iconsize.patch99
-rw-r--r--recipes-qt/qte/qte-2.3.10/remove-unused-kbdhandler.patch420
-rw-r--r--recipes-qt/qte/qte-2.3.10/sharp_char.h309
-rw-r--r--recipes-qt/qte/qte-2.3.10/spitz-adhoc-keypad-rotate.patch21
-rw-r--r--recipes-qt/qte/qte-2.3.10/support_18bpp.patch275
-rw-r--r--recipes-qt/qte/qte-2.3.10/suspend-resume-hooks.patch78
-rw-r--r--recipes-qt/qte/qte-2.3.10/switches.h74
-rw-r--r--recipes-qt/qte/qte-2.3.10/tslib.patch53
-rw-r--r--recipes-qt/qte/qte-2.3.10/vt-switch.patch178
-rw-r--r--recipes-qt/qte/qte-common_2.3.10.inc149
-rw-r--r--recipes-qt/qte/qte-functions.inc11
-rw-r--r--recipes-qt/qte/qte-mt_2.3.10.bb9
-rw-r--r--recipes-qt/qte/qte_2.3.10.bb6
-rw-r--r--recipes-qt/uicmoc/uicmoc-native-2.3.10/64bit-cleanup.patch226
-rw-r--r--recipes-qt/uicmoc/uicmoc-native-2.3.10/fix-makefile.patch16
-rw-r--r--recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc3_4.patch27
-rw-r--r--recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc4.patch12
-rw-r--r--recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc4_1.patch16
-rw-r--r--recipes-qt/uicmoc/uicmoc-native-2.3.10/kernel-asm-page.patch20
-rw-r--r--recipes-qt/uicmoc/uicmoc-native_2.3.10.bb56
50 files changed, 10824 insertions, 0 deletions
diff --git a/recipes-qt/qmake/files/linux-oe-qmake.conf b/recipes-qt/qmake/files/linux-oe-qmake.conf
new file mode 100644
index 0000000..205b693
--- /dev/null
+++ b/recipes-qt/qmake/files/linux-oe-qmake.conf
@@ -0,0 +1,82 @@
+#
+# qmake configuration for linux-oe-g++ / OpenEmbedded Build System / http://openembedded.org
+#
+
+MAKEFILE_GENERATOR = UNIX
+TEMPLATE = app
+CONFIG += qt warn_on release
+
+QMAKE_CC = $(OE_QMAKE_CC)
+QMAKE_LEX = flex
+QMAKE_LEXFLAGS =
+QMAKE_YACC = yacc
+QMAKE_YACCFLAGS = -d
+QMAKE_CFLAGS = -pipe $(OE_QMAKE_CFLAGS) $(CFLAGS_EXTRA)
+QMAKE_CFLAGS_WARN_ON = -Wall -W
+QMAKE_CFLAGS_WARN_OFF =
+QMAKE_CFLAGS_RELEASE = $(if $(CFLAGS_RELEASE),$(CFLAGS_RELEASE), -O2)
+QMAKE_CFLAGS_DEBUG = -g
+QMAKE_CFLAGS_SHLIB = -fPIC
+QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
+QMAKE_CFLAGS_THREAD = -D_REENTRANT
+
+QMAKE_CXX = $(OE_QMAKE_CXX)
+QMAKE_CXXFLAGS = $$QMAKE_CFLAGS $(OE_QMAKE_CXXFLAGS) $(CXXFLAGS_EXTRA)
+QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
+QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
+QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
+QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
+QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB
+QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
+QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
+
+QMAKE_INCDIR =
+QMAKE_LIBDIR =
+QMAKE_INCDIR_X11 =
+QMAKE_LIBDIR_X11 =
+QMAKE_INCDIR_QT = $(OE_QMAKE_INCDIR_QT)
+QMAKE_LIBDIR_QT = $(OE_QMAKE_LIBDIR_QT)
+QMAKE_INCDIR_OPENGL =
+QMAKE_LIBDIR_OPENGL =
+
+QMAKE_LINK = $(OE_QMAKE_LINK)
+QMAKE_LINK_SHLIB = $(OE_QMAKE_LINK)
+QMAKE_LFLAGS = $(OE_QMAKE_LDFLAGS) $(LFLAGS_EXTRA)
+QMAKE_LFLAGS_RELEASE =
+QMAKE_LFLAGS_DEBUG =
+QMAKE_LFLAGS_SHLIB = -shared
+QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
+QMAKE_LFLAGS_SONAME = -Wl,-soname,
+QMAKE_LFLAGS_THREAD =
+QMAKE_RPATH = -Wl,-rpath-link,
+
+QMAKE_LIBS = $(LIBS_EXTRA)
+QMAKE_LIBS_DYNLOAD = -ldl
+QMAKE_LIBS_X11 = $(OE_QMAKE_LIBS_X11)
+QMAKE_LIBS_X11SM =
+QMAKE_LIBS_QT = -l$(OE_QMAKE_LIBS_QT)
+QMAKE_LIBS_QT_THREAD = -l$(OE_QMAKE_LIBS_QT)-mt
+QMAKE_LIBS_OPENGL = $(OE_QMAKE_LIBS_OPENGL)
+QMAKE_LIBS_OPENGL_QT = $(OE_QMAKE_LIBS_OPENGL_QT)
+QMAKE_LIBS_THREAD = -lpthread
+
+QMAKE_MOC = $(OE_QMAKE_MOC)
+QMAKE_UIC = $(OE_QMAKE_UIC)
+
+QMAKE_AR = $(OE_QMAKE_AR) cqs
+QMAKE_RANLIB =
+
+QMAKE_TAR = tar -cf
+QMAKE_GZIP = gzip -9f
+
+QMAKE_COPY = cp -f
+QMAKE_COPY_FILE = $(COPY)
+QMAKE_COPY_DIR = $(COPY) -r
+QMAKE_MOVE = mv -f
+QMAKE_DEL_FILE = rm -f
+QMAKE_DEL_DIR = rmdir
+QMAKE_STRIP = $(OE_QMAKE_STRIP)
+QMAKE_STRIPFLAGS_LIB += --strip-unneeded
+QMAKE_CHK_DIR_EXISTS = test -d
+QMAKE_MKDIR = mkdir -p
+
diff --git a/recipes-qt/qmake/qmake-native_1.07a.bb b/recipes-qt/qmake/qmake-native_1.07a.bb
new file mode 100644
index 0000000..ac87b45
--- /dev/null
+++ b/recipes-qt/qmake/qmake-native_1.07a.bb
@@ -0,0 +1,48 @@
+DESCRIPTION = "TrollTech Makefile Generator"
+PRIORITY = "optional"
+HOMEPAGE = "http://www.trolltech.com"
+SECTION = "devel"
+LICENSE = "GPL QPL"
+PR = "r6"
+
+QTEVER = "qt-embedded-free-3.3.5"
+
+SRC_URI = "ftp://ftp.trolltech.com/pub/qt/source/${QTEVER}.tar.bz2 \
+ file://linux-oe-qmake.conf"
+S = "${WORKDIR}/${QTEVER}"
+
+inherit autotools native
+
+export QTDIR = "${S}"
+EXTRA_OEMAKE = "-e"
+
+do_configure() {
+ # Install the OE build templates
+ for template in linux-oe-g++ linux-uclibc-oe-g++ linux-gnueabi-oe-g++ linux-uclibceabi-oe-g++
+ do
+ install -d ${S}/mkspecs/$template
+ install -m 0644 ${WORKDIR}/linux-oe-qmake.conf ${S}/mkspecs/$template/qmake.conf
+ ln -sf ../linux-g++/qplatformdefs.h ${S}/mkspecs/$template/qplatformdefs.h
+ done
+ QMAKESPEC=
+ PLATFORM=${HOST_OS}-oe-g++
+ export PLATFORM
+ oenote ./configure ${EXTRA_OECONF}
+ echo yes | ./configure ${EXTRA_OECONF} || die "Configuring qt failed"
+}
+
+do_compile() {
+ :
+}
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 bin/qmake ${D}${bindir}
+ install -d ${D}${datadir}/qmake
+ cp -fPR mkspecs/* ${D}${datadir}/qmake
+}
+
+SRC_URI[md5sum] = "022d7a3c572b554f3c47b12cae71a8a4"
+SRC_URI[sha256sum] = "a97656796c0ef8e87dd83e6138bc406e31830d08f9b213e039d8be39ea65c8e4"
+
+NATIVE_INSTALL_WORKS = "1"
diff --git a/recipes-qt/qte/qte-2.3.10/bidimetrics.patch b/recipes-qt/qte/qte-2.3.10/bidimetrics.patch
new file mode 100644
index 0000000..50990f5
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/c7x0-w100-accel.patch b/recipes-qt/qte/qte-2.3.10/c7x0-w100-accel.patch
new file mode 100644
index 0000000..59a6710
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/c7x0-w100-accel.patch
@@ -0,0 +1,3404 @@
+ATI IMAGEON (W100) Accelerated support
+Manuel Teira <manuel.teira@telefonica.net>
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/configure~w100
++++ qt-2.3.10/configure
+@@ -325,6 +325,9 @@
+ -accel-matrox)
+ QWS_ACCEL_MATROX=y
+ ;;
++ -accel-w100)
++ QWS_ACCEL_W100=y
++ ;;
+ -qvfb)
+ QWS_QVFB=y
+ ;;
+@@ -726,6 +729,10 @@
+ then
+ QT_CXX="$QT_CXX -DQT_NO_QWS_MATROX"
+ fi
++if [ -z "$QWS_ACCEL_W100" -a -n "$EMB" ]
++then
++ QT_CXX="$QT_CXX -DQT_NO_QWS_W100"
++fi
+ if [ -z "$QWS_VNC" -a -n "$EMB" ]
+ then
+ QT_CXX="$QT_CXX -DQT_NO_QWS_VNC"
+@@ -1338,6 +1345,7 @@
+ -accel-voodoo3 ..... Enable Voodoo3 acceleration.
+ -accel-mach64 ...... Enable Mach64 acceleration.
+ -accel-matrox ...... Enable Matrox MGA acceleration.
++ -accel-w100 ........ Enable ATI Imageon w100 acceleration (experimental).
+ -qvfb .............. Enable X11-based Qt Virtual Frame Buffer.
+ -vnc ............... Enable VNC server (requires network module).
+
+@@ -1462,6 +1470,7 @@
+ [ "x$JPEG" = "xyes" ] && QT_LIBS="${QT_LIBS} -ljpeg"
+ [ "x$MNG" = "xyes" ] && QT_LIBS="${QT_LIBS} -lmng -ljpeg" # assume JNG support
+ [ "x$NAS_SOUND" = "xyes" ] && QT_LIBS="${QT_LIBS} -laudio -lXt" # Xt junk in audio library
++[ "x$QWS_ACCEL_W100" = "xy" ] && QT_LIBS="${QT_LIBS} -laticore" # Aticore W100 support
+ QT_LIBS="$L_FLAGS $R_FLAGS $QT_LIBS $l_FLAGS"
+
+
+--- qt-2.3.10/src/kernel/qgfxraster_qws.cpp~w100
++++ qt-2.3.10/src/kernel/qgfxraster_qws.cpp
+@@ -2673,7 +2673,6 @@
+ }
+ #endif
+ // Bresenham algorithm from Graphics Gems
+-
+ int ax=QABS(dx)*2;
+ int ay=QABS(dy)*2;
+ int sy=dy>0 ? 1 : -1;
+@@ -5945,6 +5944,10 @@
+ # include "qgfxmatrox_qws.cpp"
+ #endif
+
++#if !defined(QT_NO_QWS_W100)
++# include "qgfxw100_qws.cpp"
++#endif
++
+ #if !defined(QT_NO_QWS_VFB)
+ # include "qgfxvfb_qws.cpp"
+ #endif
+@@ -5999,6 +6002,9 @@
+ #if !defined(QT_NO_QWS_MATROX)
+ { "Matrox", qt_get_screen_matrox, 1 },
+ #endif
++#if !defined(QT_NO_QWS_W100)
++ { "W100", qt_get_screen_w100, 1 },
++#endif
+ #if !defined(QT_NO_QWS_TRANSFORMED)
+ { "Transformed", qt_get_screen_transformed, 0 },
+ #endif
+@@ -6039,6 +6045,8 @@
+ qt_screen = driverTable[i].qt_get_screen( display_id );
+ if ( qt_screen ) {
+ if ( qt_screen->connect( spec ) ) {
++ printf( "[%d]:Connected to screen '%s'\n",
++ getpid(), driverTable[i].name );
+ return qt_screen;
+ } else {
+ delete qt_screen;
+--- /dev/null
++++ qt-2.3.10/src/3rdparty/kernel/aticore/aticore.h
+@@ -0,0 +1,574 @@
++/*
++ * AtiCore 2D acceleration API
++ *
++ */
++
++#include <inttypes.h>
++#include <sys/types.h>
++
++#ifndef __W100API_H__
++#define __W100API_H__
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#define SolidRop_GXclear 0x00 /* 0 */
++#define SolidRop_GXand 0xa0 /* src AND dst */
++#define SolidRop_GXandReverse 0x50 /* src AND NOT dst */
++#define SolidRop_GXcopy 0xf0 /* src */
++#define SolidRop_GXandInverted 0x0a /* NOT src AND dst */
++#define SolidRop_GXnoop 0xaa /* dst */
++#define SolidRop_GXxor 0x5a /* src XOR dst */
++#define SolidRop_GXor 0xfa /* src OR dst */
++#define SolidRop_GXnor 0x05 /* NOT src AND NOT dst */
++#define SolidRop_GXequiv 0xa5 /* NOT src XOR dst */
++#define SolidRop_GXinvert 0x55 /* NOT dst */
++#define SolidRop_GXorReverse 0xf5 /* src OR NOT dst */
++#define SolidRop_GXcopyInverted 0x0f /* NOT src */
++#define SolidRop_GXorInverted 0xaf /* NOT src OR dst */
++#define SolidRop_GXnand 0x5f /* NOT src OR NOT dst */
++#define SolidRop_GXset 0xff /* 1 */
++
++#define BltRop_GXclear 0x00 /* 0 */
++#define BltRop_GXand 0x88 /* src AND dst */
++#define BltRop_GXandReverse 0x44 /* src AND NOT dst */
++#define BltRop_GXcopy 0xcc /* src */
++#define BltRop_GXandInverted 0x22 /* NOT src AND dst */
++#define BltRop_GXnoop 0xaa /* dst */
++#define BltRop_GXxor 0x66 /* src XOR dst */
++#define BltRop_GXor 0xee /* src OR dst */
++#define BltRop_GXnor 0x11 /* NOT src AND NOT dst */
++#define BltRop_GXequiv 0x99 /* NOT src XOR dst */
++#define BltRop_GXinvert 0x55 /* NOT dst */
++#define BltRop_GXorReverse 0xdd /* src OR NOT dst */
++#define BltRop_GXcopyInverted 0x33 /* NOT src */
++#define BltRop_GXorInverted 0xbb /* NOT src OR dst */
++#define BltRop_GXnand 0x77 /* NOT src OR NOT dst */
++#define BltRop_GXset 0xff /* 1 */
++
++#define DSTTYPE_8BPP 2 //8bpp
++#define DSTTYPE_16BPP_1555 3 //16 bpp aRGB 1555
++#define DSTTYPE_16BPP_444 5 //16 bpp aRGB 4444
++
++#define SRCTYPE_1BPP_OPA 0 //mono (expanded to frgd, bkgd)
++#define SRCTYPE_1BPP_TRA 1 //mono (expanded to frgd, leave_alone)
++#define SRCTYPE_EQU_DST 3 //color (same as DST)
++#define SRCTYPE_SOLID_COLOR_BLT 4 //solid color for Blt (use frgd)
++#define SRCTYPE_4BPP 5 //4 bpp
++#define SRCTYPE_12BPP_PACKED 6 //12 bpp packed
++
++#define ROP3_SRCCOPY 0xcc
++#define ROP3_PATCOPY 0xf0
++
++#define OVLTYPE_YUV420 7
++#define OVLTYPE_RGB565 8
++
++#define DP_BRUSH_8x8MONOOPA 0 //8x8 mono pattern (expanded to frgd, bkgd )
++#define DP_BRUSH_8x8MONOTRA 1 //8x8 mono pattern (expanded to frgd, leave alone )
++#define DP_PEN_32x1MONOOPA 6 //32x1 mono pattern (expanded to frgd, bkgd)
++#define DP_PEN_32x1MONOTRA 7 //32x1 mono pattern (expanded to frgd, leave alone)
++#define DP_BRUSH_8x8COLOR 10 //8x8 color pattern
++#define DP_BRUSH_SOLIDCOLOR 13 //solid color pattern (frgd)
++#define DB_BRUSH_NONE 15 //No brush used
++
++ typedef struct {
++ int16_t XCoord;
++ int16_t YCoord;
++ } ATI_POINT;
++
++ typedef struct {
++ int16_t XCoord;
++ int16_t YCoord;
++ int16_t Width;
++ int16_t Height;
++ } ATI_RECT;
++
++ typedef struct {
++ int16_t X_Top_Left; // x coordinate of top left corner
++ int16_t Y_Top_Left; // y coordinate of top left corner
++ int16_t X_Bottom_Right; // x coordinate of bottom right corner
++ int16_t Y_Bottom_Right; // y coordinate of bottom right corner
++ } ATI_CLIPRECT;
++
++ typedef struct {
++ uint32_t Count;
++ uint8_t ScaleXFactor;
++ uint8_t ScaleYFactor;
++ uint8_t BlendOn;
++ uint8_t dummy1;
++ } ATI_STRETCH;
++
++ typedef struct {
++ uint32_t *lpSrcBitmap; /* サーフェスのオフセット */
++ uint16_t XCoord; /* +4 確定:サーフェス内のx座標 */
++ uint16_t YCoord; /* +6 確定:サーフェス内のy座標 */
++ uint16_t SrcPitch; /* +8 確定: */
++ uint16_t SrcHeight; /* +10 確定: */
++ uint16_t OverlayWidth; /* オーバレイの幅(Srcと違う値にしても、動的に拡大縮小されたりはしない、意味あんの?) */
++ uint16_t OverlayHeight;
++ uint32_t lpOverlayKey; /* +16 確定:謎(カラーキー?) */
++ uint8_t OverlayFormat; /* +20 確定 */
++ uint8_t dummy1;
++ uint16_t dummy2;
++ } ATI_OVERLAYPROP; /* 24bytes? */
++
++ typedef struct {
++ int HInvert;
++ int VInvert;
++ } ATI_EXTVIDEOPROP;
++
++ typedef struct {
++ ATI_EXTVIDEOPROP ExtVideoProp;
++ } ATI_UNKNOWN1;
++
++ typedef struct {
++ unsigned long clr_cmp_fcn_src :3;
++ unsigned long :5;
++ unsigned long clr_cmp_fcn_dst :3;
++ unsigned long :13;
++ unsigned long clr_cmp_src :2;
++ unsigned long :6;
++ } clr_cmp_cntl_t;
++
++ typedef struct {
++ uint16_t x;
++ uint16_t y;
++ uint16_t w;
++ uint16_t h;
++ clr_cmp_cntl_t cmp_cntl;
++ unsigned long tcolour;
++ } transbitblt_t;
++
++ typedef struct {
++ uint32_t dummy1;
++ uint32_t dummy2;
++ uint8_t HExpansion; /* +8 確定 */
++ uint8_t VExpansion; /* +9 確定 */
++ uint8_t dummy3;
++ uint8_t dummy4;
++ uint8_t RConversion; /* +12 確定 */
++ uint8_t dummy5;
++ uint8_t dummy6;
++ uint8_t dummy7;
++ ATI_UNKNOWN1 x;
++ } ATI_EXTENDEDOVERLAYPROP; /* 16byte? */
++
++ /**
++ * AtiCore initialization.
++ * Sets up the shared memory area
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_ProcessAttach( void );
++
++ /**
++ * AtiCore finish.
++ *
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_ProcessDetach( void );
++
++
++ /**
++ * Allocates a surface on the internal RAM.
++ * Perhaps there's a way to indicate to allocate on the
++ * internal RAM?
++ * @arg handle Reference to the returned surface handle
++ * @arg offset Returned offset of this surface on the video memory
++ * @arg size Size (bytes) to be reserved (16 multiple)
++ * @arg direction
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_AllocateSurface( uint16_t *handle, uint32_t *offset,
++ uint32_t size, uint32_t direction );
++
++ /**
++ * Deallocates a given surface.
++ * @arg handle Handle to the allocated surface
++ * (As returned by AllocateSurface)
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_DestroySurface( uint16_t handle );
++
++ /**
++ * Sets the kind of Raster Operation.
++ * @param rop Raster operation to be performed
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetRopOperation( uint32_t rop );
++
++ /**
++ * Sets the destination type for raster operation.
++ * @param dsttype
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetDstType( uint32_t dsttype );
++
++ /**
++ * Sets the source type for raster operation.
++ * @param srctype
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetSrcType( uint32_t srctype );
++
++ /**
++ * Sets Source clipping rectangle.
++ * @param cliprect Rectangle to perform clipping.
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetSrcClippingRect( ATI_CLIPRECT *cliprect );
++
++ /**
++ * Sets Destination clipping rectangle.
++ * @param cliprect Rectangle to perform clipping.
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetDstClippingRect(ATI_CLIPRECT *cliprect);
++
++ /**
++ * Sets pitch and offset for source in a raster operation.
++ * @param pitch Pitch (line width) of source
++ * @param offset Offset of source
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetSrcPitchOffset( int pitch, int offset );
++
++ /**
++ * Sets pitch and offset destination source in a raster operation.
++ * @param pitch Pitch (line width) of destination
++ * @param offset Offset of destination (memory offset)
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetDstPitchOffset( int pitch, int offset );
++
++ /**
++ * Performs a BitBlt with source rotation.
++ * @param flags Rotation degree
++ * @param dstRect Rectangle for destination Bitblitting
++ * @param srcRect Rectangle for origin bitblitting
++ * @test Tested with specified flags parameter
++ */
++ int AtiCore_BitBltFilpRotate( int flags,
++ ATI_RECT *dstRect,
++ ATI_RECT *srcRect);
++
++ /**
++ * Performs a BitBlt with source stretching.
++ * @param option Unknown
++ * @param point Unknown
++ * @param srcRect Source blitting surface
++ * @test Untested
++ */
++ int AtiCore_StretchBlt( ATI_STRETCH *option,
++ ATI_POINT *point,
++ ATI_RECT *srcRect);
++
++ /**
++ * Waits for the FIFO to be idle at least msecs.
++ * @param msecs Maximum time to wait for FIFO to idle
++ * @return 1:success, 0:fail
++ * @test Untested
++ */
++ int AtiCore_WaitComplete( int msec );
++
++ /**
++ * Allocates a new overlay handle.
++ * @param handle overlay
++ * @return 1:success, 0:fail
++ * @test Yes
++ */
++ int AtiCore_AllocOverlay( uint16_t *handle );
++
++ /**
++ * Deallocates a overlay handle.
++ * @param handle overlay
++ * @return 1:success, 0:fail
++ * @test Yes
++ */
++ int AtiCore_ReleaseOverlay( uint16_t handle );
++
++ /**
++ * Sets up an overlay given a handle an a set of properties.
++ * @param handle Allocated handle to setup the overlay.
++ * @param props Overlay properties struct
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetupOverlay( uint16_t handle, ATI_OVERLAYPROP *props );
++
++ /**
++ * Sets up extended overlay features.
++ * @param handle Allocated handle to an overlay
++ * @param props Extended overlay properties
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetupOverlayExtended( uint16_t handle,
++ ATI_EXTENDEDOVERLAYPROP *props );
++
++ /**
++ * Enable/Disable an overlayed surface.
++ * @param handle Overlay to be enabled/disabled
++ * @param enable 1: Enable, 0: Disable
++ * @return 1:success, 0:fail
++ * @test Tested
++ */
++ int AtiCore_SetOverlayOnOff( uint16_t handle, int enable );
++
++ /**
++ * Sets up the overlay position for a given handle.
++ * @param handle Overlay Handle
++ * @param x X Coordinate (Seems to be a bug with x < 4 )
++ * @param y Y Coordinate
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetOverlayPos( uint16_t handle,
++ uint16_t x,
++ uint16_t y );
++
++ /**
++ * Translates between physical/virtual addresses.
++ * @param offset VRAM offset to be translated
++ * @param viraddr Virtual address for VRAM
++ * @return 1:success,0:fail
++ */
++ int AtiCore_SetupMemoryTransfer( uint32_t offset,
++ uint32_t *viraddr );
++
++ /**
++ * Related with the previous one. It seems to be necesary to be called
++ * but I'm not sure of its function.
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_TerminateMemoryTransfer( void );
++
++ /**
++ * Returns the frontbuffer pitch and offset.
++ * @param pitch Return value for the frontbuffer pitch (width)
++ * @param offset Return value for the frontbuffer offset
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_GetFrontBufferPitchOffset( uint32_t *pitch,
++ uint32_t *offset );
++
++ /**
++ * Changes display brighness ?
++ * @param brightness -64...63
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetDisplayBrightness( int brightness );
++
++ /**
++ * Returns the amount of available internal/external memory.
++ * @param internal Pointer to return internal memory size
++ * @param external Pointer to return external memory size
++ * @return 1:success, 0:fail
++ */
++ int GetAvailableVideoMem( uint32_t *internal,
++ uint32_t *external );
++
++/**
++ *
++ *
++ *
++
++ {
++ (uint32_t) 0
++ (uint32_t) 0
++ (uint16_t) 480
++ (uint16_t) 640
++ (uint16_t) 480
++ (uint16_t) 640
++ (uint32_t) 5
++ */
++
++ typedef struct {
++ uint32_t dummy1;
++ ATI_RECT Size;
++ uint16_t Width;
++ uint16_t Height;
++ uint32_t Flag;
++ } ATI_GRAPHICWINDOW;
++
++ int AtiCore_SetupGraphicWindow(void* );
++
++ /**
++ * It seems to be necessary after AtiCore_ProcessAttach
++ * @param mode: 0xaaab for portrait, 0xaaaa for landscape
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_ProcessAttachSpecialMode( int mode );
++
++ /**
++ * Detach from the special mode. Whatever it means.
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_ProcessDetachSpecialMode( void );
++
++ /**
++ * Sets up the position of the Graphic viewport ?
++ * @param x X coordinate
++ * @param y Y coordinate
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetGraphicWindowPos( int x, int y );
++
++ /**
++ * Get the graphic viewport position.
++ * @param x Pointer to xcoord placeholder
++ * @param y Pointer to ycoord placeholder
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_GetGraphicWindowPos( int *x, int *y );
++
++ /**
++ * Sets up the frontbuffer position.
++ * @param offset VRAM offset to be used.
++ * @param x X Coordinate?
++ * @param y Y Coordinate?
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetFrontBuffer( int offset, int x, int y );
++
++ /**
++ * Enable/Disable the frontbuffer?
++ * @param enable 1 enables/ 0 disables
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetGraphicWindowOnOff( int enable );
++
++ /*
++ * Sets the foreground color.
++ * @param colour Color in 565 format (perhaps depends on the source format)
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetFrgColour( int colour );
++
++ /*
++ * Sets the background colour.
++ * @param colour Colour in 565 format (perhaps depends on the source format)
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_SetBkgColour( int colour );
++
++ /**
++ * Changes the painting brush
++ * @param btype Type of brush to use
++ * 4: Uses the pattern
++ * 6: SolidLine
++ * @param pattern Pointer to a 32 bit pattern
++ * @return 1:success, 0:fail
++ * @test Some values for btype produces a kind of antialiasing line
++ */
++ int AtiCore_BrushType( int btype, unsigned int *pattern );
++
++ /**
++ * Performs a rectangle paint.
++ * @param nrects Number of rectangles to be painted
++ * @param rects Array of rectangles to be painted
++ * @return 1:success, 0:fail
++ * @test Tested with nrects==1
++ */
++ int AtiCore_PaintRect( int nrects ,
++ ATI_RECT rects[] );
++
++ /**
++ * Draws a set of lines.
++ * @param npoints Number of points in the polyline set
++ * @param points Pointer to an array of ATI_POINT
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_Polyline( int npoints, ATI_POINT points[] );
++
++ int AtiCore_GetPitchOffsetProperty( void *, void *);
++
++ int AtiCore_CursorOnOff( int, int );
++
++ /**
++ * Performs a BitBlt ROP operation.
++ * @param unk Unknown (Always set to 1)
++ * @param dstrect Bounding destination rect
++ * @param srcrect Bounding source rect
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_BitBlt( int unk,
++ ATI_RECT *dstrect,
++ ATI_RECT *srcrect );
++
++ /**
++ * Performs a Transparent BitBlt ROP operation.
++ * @param dstrect Transparent DstRect bitblt argument
++ * @param srcrect Transparent SrcRect bitblt argument
++ * @return 1:success, 0:fail
++ * @test Doesn't work. It sets to zero CLR_CMP_CNTL and CLR_CMP_MSK
++ */
++ int AtiCore_TransBitBlt( transbitblt_t *dstrect,
++ transbitblt_t *srcrect );
++
++ int AtiCore_WakeUpCall( void );
++
++ /**
++ * Draws a set of pixels
++ * @param npoints Number of points to draw
++ * @param points Pointer to an array of ATI_POINT
++ * @return 1:success, 0:fail
++ */
++ int AtiCore_DrawPixel( int npoints, ATI_POINT *points );
++
++ int AtiCore_SetSysClk( unsigned short in0 );
++ int AtiCore_SetFastSysClk( unsigned short in0 );
++ int AtiCore_SetSlowSysClk( unsigned short in0 );
++
++ int AtiCore_GetCursorPos( unsigned long in0,
++ unsigned short *x,
++ unsigned short *y );
++
++
++
++/* ================================================================ */
++/* from libqte.so.2.3.2 */
++/*
++AtiCore_AlphaBlend
++
++AtiCore_Flush
++AtiCore_GammaCorrection
++AtiCore_GetCRC
++AtiCore_GetCursorPos
++AtiCore_GetDeviceInfo
++AtiCore_GetGPIO_Data
++AtiCore_GetGraphicExtended
++AtiCore_GetGraphicWindowPos
++AtiCore_GetLargestVideoMemBlock
++AtiCore_GetLastError
++AtiCore_GetMultiCRC
++AtiCore_GetOverlayPos
++AtiCore_Host
++AtiCore_LoadCursorBitMap
++AtiCore_PolyScanline
++AtiCore_ProcessAttachMinimal(void)?
++AtiCore_ProcessDetachMinimal(void)?
++AtiCore_ProcessDetachSpecialMode
++AtiCore_ReadCfgReg
++AtiCore_ReadMem(int, int)?
++AtiCore_ReadReg(int, int)?
++AtiCore_ScanlineShading
++AtiCore_SetApertures
++AtiCore_SetBytePixelOrder
++AtiCore_SetCursorPos
++AtiCore_SetDisplayParameters
++AtiCore_SetDriverBehaviour
++AtiCore_SetGPIO_Data
++AtiCore_SetOverlayPosUsingGraphicWindowXY
++AtiCore_SetPartialCursor
++AtiCore_SetupGraphicExtended
++AtiCore_SetupPM4
++AtiCore_SmallText
++AtiCore_SubmitPM4Packet
++AtiCore_WriteCfgReg
++AtiCore_WriteMem
++AtiCore_WriteReg
++ */
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
+--- /dev/null
++++ qt-2.3.10/src/kernel/qgfxw100_qws.cpp
+@@ -0,0 +1,2709 @@
++ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil -*- */
++/***************************************************************************
++
++** Imageon driver for qte using libAticore
++** Manuel Teira( 2005 )
++** BUGS
++* - Enable again internal memory surfaces.
++****************************************************************************/
++#include <unistd.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <errno.h>
++#include <string.h>
++#include <dirent.h>
++#include <fcntl.h>
++#include <sys/types.h>
++#include <sys/mman.h>
++#include <sys/time.h>
++#include <time.h>
++
++#include <sys/ipc.h>
++#include <sys/shm.h>
++
++#include <qapplication.h>
++
++#ifndef __sparc__
++#include <sys/io.h>
++#endif
++
++#include "qgfxraster_qws.h"
++#include "qgfxlinuxfb_qws.h"
++#include <aticore/aticore.h>
++
++#include <stdarg.h>
++
++class W100Driver {
++public:
++
++ typedef enum Loglevel {
++ ERROR = 0,
++ WARNING,
++ INFO
++ };
++
++ typedef enum Opcodes {
++ DRAWLINE = 0,
++ DRAWPOINT,
++ DRAWPOINTS,
++ FILLRECT,
++ SCROLL,
++ BITBLT,
++ POLYLINE,
++ EOO
++ };
++
++ typedef enum Retcodes {
++ codOK,
++ codError
++ };
++
++
++ typedef struct Opcode {
++ QString str;
++ int index;
++ bool accelerated;
++ int hits;
++ int misses;
++ };
++
++ static Opcode lOpcodes[];
++
++ static QString level2str( int level )
++ {
++ switch( level ) {
++ case ERROR:
++ return QString( "ERROR" );
++ break;
++ case WARNING:
++ return QString( "WARNING" );
++ break;
++ case INFO:
++ return QString( "INFO" );
++ break;
++ default:
++ return QString( "UNKNOWN" );
++ break;
++ }
++ }
++
++ W100Driver():
++ m_loglevel( 0 ),
++ m_logenabled( 0 ),
++ m_logcount( 0 ),
++ m_attached( false )
++ {
++ m_pid = getpid();
++ m_loglevel = 0;
++ char *var;
++ if ( var = getenv( "W100_DEBUG" ) ) {
++ if ( strtol( var, 0, 0 ) == 1 ) {
++ m_logenabled = 1;
++ }
++ }
++
++ if ( m_logenabled ) {
++ if ( var = getenv( "W100_DEBUGLEVEL" ) ) {
++ if ( ( m_loglevel = strtol( var, 0, 0 ) ) < 0 ) {
++ m_loglevel = 0;
++ }
++ }
++
++ QString path( "/mnt/card/w100/w100debug.log" );
++ if ( var = getenv( "W100_DEBUGPATH" ) ) {
++ path = QString( var ) + "/w100debug.log";
++ }
++ m_logfile = fopen( path.latin1(), "a" );
++ if ( m_logfile == NULL ) m_logenabled = 0;
++ }
++
++ Opcode *opcodePtr = lOpcodes;
++ while ( opcodePtr->index != EOO ) {
++ QString varName = "W100_ACCEL_" + opcodePtr->str;
++ char *varPtr;
++ if ( ( varPtr = getenv( varName.latin1() ) ) ) {
++ if ( ( strtol( varPtr, NULL, 0 ) == 0 ) ||
++ ( strcmp( varPtr, "false" ) == 0 ) ) {
++ opcodePtr->accelerated = false;
++ }
++ }
++ opcodePtr++;
++ }
++ }
++
++ ~W100Driver()
++ {
++ //Dump statistics about any opcode
++ Opcode *opcodePtr = lOpcodes;
++ while ( opcodePtr->index != EOO ) {
++ log( WARNING, "Opcode %s. Accelerated=%s. Hits=%d. Misses=%d",
++ opcodePtr->str.latin1(),
++ opcodePtr->accelerated ? "true" : "false",
++ opcodePtr->hits,
++ opcodePtr->misses );
++ opcodePtr++;
++ }
++ if ( m_logenabled && m_logfile ) {
++ fclose( m_logfile );
++ }
++ }
++
++ bool accelerated( int opcode )
++ {
++ if ( !m_attached ) {
++ log( WARNING, "Asking for accelerated '%s' when not attached",
++ lOpcodes[opcode].str.latin1() );
++ return false;
++ }
++ if ( opcode < EOO ) {
++ if ( lOpcodes[opcode].accelerated ) {
++ return true;
++ } else {
++ log( WARNING, "Not accelerated '%s'",
++ lOpcodes[opcode].str.latin1() );
++ return false;
++ }
++ }
++ return false;
++ }
++
++ void addHit( int opcode )
++ {
++ lOpcodes[opcode].hits++;
++ }
++
++ void addMiss( int opcode )
++ {
++ lOpcodes[opcode].misses++;
++ }
++
++ void log( int level, const char *fmt, ... )
++ {
++ if ( m_logenabled && ( level <= m_loglevel ) ) {
++ timeval tv;
++ char buffer[1024];
++ va_list ap;
++ va_start( ap, fmt );
++ vsnprintf( buffer, 1023, fmt, ap );
++ va_end( ap );
++ gettimeofday( &tv, NULL );
++ fprintf( m_logfile, "(%010u.%06u)%d:%d:%s:%s\n",
++ tv.tv_sec, tv.tv_usec,
++ m_logcount++,
++ m_pid,
++ level2str( level ).latin1(),
++ buffer );
++ fflush( m_logfile );
++ }
++ }
++
++ bool attached( void ) const
++ {
++ return m_attached;
++ }
++
++ int processAttach( void )
++ {
++ if ( !m_attached ) {
++ if ( AtiCore_ProcessAttach() ) {
++ log( WARNING, "Process attached succesfully" );
++ m_attached = true;
++ return codOK;
++ } else {
++ log( WARNING, "Error attaching process" );
++ }
++ } else {
++ log( WARNING, "Process already attached" );
++ }
++ return codError;
++ }
++
++ int processDetach( void )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_ProcessDetach() ) {
++ log( WARNING, "Process detached succesfully" );
++ m_attached = false;
++ return codOK;
++ } else {
++ log( WARNING, "Error detaching process" );
++ }
++ } else {
++ log( WARNING, "Trying to detach while not attached" );
++ }
++ return codError;
++ }
++
++ int allocateSurface( uint16_t *handle, uint32_t *offset,
++ uint32_t size, uint32_t direction )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_AllocateSurface( handle, offset,
++ size, direction ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in allocateSurface" );
++ }
++ } else {
++ log( WARNING, "Trying to allocateSurface while not attached" );
++ }
++ return codError;
++ }
++
++ int destroySurface( uint16_t handle )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_DestroySurface( handle ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in destroySurface" );
++ }
++ } else {
++ log( WARNING, "Trying to destroySurface while not attached" );
++ }
++ return codError;
++ }
++
++ int drawPixel( int npoints, ATI_POINT *points )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_DrawPixel( npoints, points ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in drawPixel" );
++ }
++ } else {
++ log( WARNING, "Trying to drawPixel while not attached" );
++ }
++ return codError;
++ }
++
++ int setRopOperation( uint32_t rop )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetRopOperation( rop ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setRopOperation" );
++ }
++ } else {
++ log( WARNING, "Trying to setRopOperation while not attached" );
++ }
++ return codError;
++ }
++
++ int setDstType( uint32_t dtype )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetDstType( dtype ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setDstType" );
++ }
++ } else {
++ log( WARNING, "Trying to setDstType while not attached" );
++ }
++ return codError;
++ }
++
++ int setSrcType( uint32_t stype )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetSrcType( stype ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setSrcType" );
++ }
++ } else {
++ log( WARNING, "Trying to setSrcType while not attached" );
++ }
++ return codError;
++ }
++
++ int setSrcClippingRect( ATI_CLIPRECT *cliprect )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetSrcClippingRect( cliprect ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setSrcClippingRect" );
++ }
++ } else {
++ log( WARNING, "Trying to setSrcClippingRect while not attached" );
++ }
++ return codError;
++ }
++
++ int setDstClippingRect( ATI_CLIPRECT *cliprect )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetDstClippingRect( cliprect ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setDstClippingRect" );
++ }
++ } else {
++ log( WARNING, "Trying to setDstClippingRect while not attached" );
++ }
++ return codError;
++ }
++
++ int setSrcPitchOffset( int pitch, int offset )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetSrcPitchOffset( pitch, offset ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setSrcPitchOffset" );
++ }
++ } else {
++ log( WARNING, "Trying to setSrcPitchOffset while not attached" );
++ }
++ return codError;
++ }
++
++ int setDstPitchOffset( int pitch, int offset )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetDstPitchOffset( pitch, offset ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setDstPitchOffset" );
++ }
++ } else {
++ log( WARNING, "Trying to setDstPitchOffset while not attached" );
++ }
++ return codError;
++ }
++
++ int bitBltFlipRotate( int rot,
++ ATI_RECT *dstRect,
++ ATI_RECT *srcRect )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_BitBltFilpRotate( rot, dstRect, srcRect ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in bitBltFlipRotate" );
++ }
++ } else {
++ log( WARNING, "Trying to bitBltFlipRotate while not attached" );
++ }
++ return codError;
++ }
++
++ int stretchBlt( ATI_STRETCH *option,
++ ATI_POINT *point,
++ ATI_RECT *srcRect )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_StretchBlt( option, point, srcRect ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in stretchBlt" );
++ }
++ } else {
++ log( WARNING, "Trying to stretchBlt while not attached" );
++ }
++ return codError;
++ }
++
++ int waitComplete( int msec )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_WaitComplete( msec ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in waitComplete" );
++ }
++ } else {
++ log( WARNING, "Trying to waitComplete while not attached" );
++ }
++ return codError;
++ }
++
++ int allocOverlay( uint16_t *handle )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_AllocOverlay( handle ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in allocOverlay" );
++ }
++ } else {
++ log( WARNING, "Trying to allocOverlay while not attached" );
++ }
++ return codError;
++ }
++
++ int releaseOverlay( uint16_t handle )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_ReleaseOverlay( handle ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in releaseOverlay" );
++ }
++ } else {
++ log( WARNING, "Trying to releaseOverlay while not attached" );
++ }
++ return codError;
++ }
++
++ int setupOverlay( uint16_t handle, ATI_OVERLAYPROP *prop )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetupOverlay( handle, prop ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setupOverlay" );
++ }
++ } else {
++ log( WARNING, "Trying to setupOverlay while not attached" );
++ }
++ return codError;
++ }
++
++ int setupOverlayExtended( uint16_t handle,
++ ATI_EXTENDEDOVERLAYPROP *prop )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetupOverlayExtended( handle, prop ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setupOverlayExtended" );
++ }
++ } else {
++ log( WARNING, "Trying to setupOverlayExtended while not attached" );
++ }
++ return codError;
++ }
++
++ int setOverlayOnOff( uint16_t handle, int isShow )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetOverlayOnOff( handle, isShow ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setOverlayOnOff" );
++ }
++ } else {
++ log( WARNING, "Trying to setOverlayOnOff while not attached" );
++ }
++ return codError;
++ }
++
++ int setOverlayPos( uint16_t handle, uint16_t x, uint16_t y )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetOverlayPos( handle, x, y ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setOverlayPos" );
++ }
++ } else {
++ log( WARNING, "Trying to setOverlayPos while not attached" );
++ }
++ return codError;
++ }
++
++ int setupMemoryTransfer( uint32_t offset, uint32_t *regdata )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetupMemoryTransfer( offset, regdata ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setupMemoryTransfer" );
++ }
++ } else {
++ log( WARNING, "Trying to setupMemoryTransfer while not attached" );
++ }
++ return codError;
++ }
++
++ int terminateMemoryTransfer( void )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_TerminateMemoryTransfer() ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in terminateMemoryTransfer" );
++ }
++ } else {
++ log( WARNING, "Trying to terminateMemoryTransfer while not attached" );
++ }
++ return codError;
++ }
++
++ int getFrontBufferPitchOffset( uint32_t *pitch, uint32_t *offset )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_GetFrontBufferPitchOffset( pitch, offset ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in getFrontBufferPitchOffset" );
++ }
++ } else {
++ log( WARNING, "Trying to getFrontBufferPitchOffset while not attached" );
++ }
++ return codError;
++ }
++
++ int setDisplayBrightness( int bri )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetDisplayBrightness( bri ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setDisplayBrightness" );
++ }
++ } else {
++ log( WARNING, "Trying to setDisplayBrighness while not attached" );
++ }
++ return codError;
++ }
++
++ int getAvailableVideoMem( uint32_t *internal, uint32_t *external )
++ {
++ if ( m_attached ) {
++ if ( GetAvailableVideoMem( internal, external ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in getAvailableVideoMem" );
++ }
++ } else {
++ log( WARNING, "Trying to getAvailableVideoMem while not attached" );
++ }
++ return codError;
++ }
++
++ int setupGraphicWindow( ATI_GRAPHICWINDOW *win )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetupGraphicWindow( ( void * ) win ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setupGraphicWindow" );
++ }
++ } else {
++ log( WARNING, "Trying to setupGraphicWindow while not attached" );
++ }
++ return codError;
++ }
++
++ int processAttachSpecialMode( int mode )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_ProcessAttachSpecialMode( mode ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in processAttachSpecialMode" );
++ }
++ } else {
++ log( WARNING, "Trying to processAttachSpecialMode while not attached" );
++ }
++ return codError;
++ }
++
++ int processDetachSpecialMode( void )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_ProcessDetachSpecialMode() ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in processDetachSpecialMode" );
++ }
++ } else {
++ log( WARNING, "Trying to processDetachSpecialMode while not attached" );
++ }
++ return codError;
++ }
++
++ int setGraphicWindowPos( int x, int y )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetGraphicWindowPos( x, y ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setGraphicWindowPos" );
++ }
++ } else {
++ log( WARNING, "Trying to setGraphicWindow while not attached" );
++ }
++ return codError;
++ }
++
++ int setFrontBuffer( int offset, int a, int b )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetFrontBuffer( offset, a, b ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setFrontBuffer" );
++ }
++ } else {
++ log( WARNING, "Trying to setFrontBuffer while not attached" );
++ }
++ return codError;
++ }
++
++ int setGraphicWindowOnOff( int val )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetGraphicWindowOnOff( val ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setGraphicWindowOnOff" );
++ }
++ } else {
++ log( WARNING, "Trying to setGraphicWindowOnOff while not attached" );
++ }
++ }
++
++ static unsigned long ccolor( unsigned int rgb )
++ {
++ unsigned char r = ( rgb & 0xff0000 ) >> 19;
++ unsigned char g = ( rgb & 0xff00 ) >> 10;
++ unsigned char b = ( rgb & 0xff ) >> 3;
++ return ( ( ( ( unsigned short )0x1f & r ) << 11 ) |
++ ( ( ( unsigned short )0x3f & g ) << 5 ) |
++ ( ( ( unsigned short )0x1f & b ) ) );
++ }
++
++ int setFrgColour( int val )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_SetFrgColour( ccolor( val ) ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in setFrgColour" );
++ }
++ } else {
++ log( WARNING, "Trying to setFrgColour while not attached" );
++ }
++ return codError;
++ }
++
++ int brushType( int type, unsigned int pattern )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_BrushType( type, &pattern ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in brushType" );
++ }
++ } else {
++ log( WARNING, "Trying to brushType while not attached" );
++ }
++ return codError;
++ }
++
++ int paintRect( int flags, ATI_RECT *rect )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_PaintRect( flags, rect ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in paintRect" );
++ }
++ } else {
++ log( WARNING, "Trying to paintRect while not attached" );
++ }
++ return codError;
++ }
++
++ int polyline( int npoints, ATI_POINT *points )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_Polyline( npoints, points ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in polyline" );
++ }
++ } else {
++ log( WARNING, "Trying to polyline while not attached" );
++ }
++ return codError;
++ }
++
++ int getPitchOffsetProperty( void *pitch, void *offset )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_GetPitchOffsetProperty( pitch, offset ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in getPitchOffsetProperty" );
++ }
++ } else {
++ log( WARNING, "Trying to getPitchOffsetProperty while not attached" );
++ }
++ return codError;
++ }
++
++ int cursorOnOff( int a, int b )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_CursorOnOff( a, b ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in cursorOnOff" );
++ }
++ } else {
++ log( WARNING, "Trying to cursorOnOff while not attached" );
++ }
++ return codError;
++ }
++
++ int bitBlt( int flags, ATI_RECT *dst, ATI_RECT *src )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_BitBlt( flags, dst, src ) ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in bitBlt" );
++ }
++ } else {
++ log( WARNING, "Trying to bitBlt while not attached" );
++ }
++ return codError;
++ }
++
++ int wakeUpCall( void )
++ {
++ if ( m_attached ) {
++ if ( AtiCore_WakeUpCall() ) {
++ return codOK;
++ } else {
++ log( ERROR, "Error in wakeUpCall" );
++ }
++ } else {
++ log( WARNING, "Trying to wakeupCall while not attached" );
++ }
++ return codError;
++ }
++
++private:
++ FILE *m_logfile;
++ int m_loglevel;
++ bool m_logenabled;
++ bool m_attached;
++ int m_pid;
++ int m_logcount;
++};
++
++W100Driver::Opcode W100Driver::lOpcodes[] = {
++ { "DRAWLINE", W100Driver::DRAWLINE, true, 0, 0 },
++ { "DRAWPOINT", W100Driver::DRAWPOINT, true, 0, 0 },
++ { "DRAWPOINTS", W100Driver::DRAWPOINTS, true, 0, 0 },
++ { "FILLRECT", W100Driver::FILLRECT, true, 0, 0 },
++ { "SCROLL", W100Driver::SCROLL, true, 0, 0 },
++ { "BITBLT", W100Driver::BITBLT, true, 0, 0 },
++ { "POLYLINE", W100Driver::POLYLINE, true, 0, 0 },
++ { "" , W100Driver::EOO, false, 0, 0 }
++};
++
++W100Driver driver;
++
++class QW100Screen;
++static QW100Screen *qt_w100_screen = 0;
++
++class QW100Screen : public QLinuxFbScreen {
++public:
++ class HWSurface {
++ public:
++ HWSurface( void ):
++ m_handle( 0 ),
++ m_offset( 0 ),
++ m_addr( 0 ),
++ m_size( 0 ),
++ m_internal( false ),
++ m_clientid( -1 ) {};
++ HWSurface( unsigned short handle,
++ uint32_t sOffset,
++ unsigned char *localAddr,
++ int amount,
++ bool internal,
++ int clientid ):
++ m_handle( handle ),
++ m_offset( sOffset ),
++ m_addr( localAddr ),
++ m_size( amount ),
++ m_internal( internal ),
++ m_clientid( clientid ) {};
++ HWSurface( uint32_t sOffset,
++ unsigned char *localAddr,
++ bool internal,
++ int amount ):
++ m_handle( 0 ),
++ m_offset( sOffset ),
++ m_addr( localAddr ),
++ m_size( amount ),
++ m_internal( internal ),
++ m_clientid( -1 ) {};
++ bool operator!=( HWSurface &other ) {
++ return( m_offset == other.getSOffset() );
++ };
++ HWSurface &operator=( const HWSurface &c ) {
++ m_handle = c.getHandle();
++ m_offset = c.getSOffset();
++ m_addr = c.getAddr();
++ m_size = c.getSize();
++ m_clientid= c.getCId();
++ m_internal = c.internal();
++ return( *this );
++ };
++ unsigned short getHandle( void ) const { return m_handle; };
++ uint32_t getSOffset( void ) const { return m_offset; };
++ unsigned char *getAddr( void ) const { return m_addr; };
++ unsigned int getSize( void ) const { return m_size; };
++ int getCId( void ) const { return m_clientid; };
++ bool internal( void ) const { return m_internal; };
++
++ private:
++ unsigned short m_handle;
++ uint32_t m_offset;
++ unsigned char *m_addr;
++ int m_size;
++ bool m_internal;
++ int m_clientid;
++ };
++
++ QW100Screen( int display_id );
++ virtual ~QW100Screen();
++ virtual bool connect( const QString &spec );
++ virtual void disconnect( void );
++ virtual bool initDevice();
++ virtual void shutdownDevice();
++ virtual void restore();
++ virtual bool useOffscreen() { return true; }
++ virtual QGfx * createGfx( unsigned char *, int, int, int, int);
++ virtual uchar *cache( int amount, int optim );
++ virtual void uncache( uchar *c );
++ virtual bool onCard( unsigned char *p ) const;
++ virtual bool onCard( unsigned char *p, ulong& offset ) const;
++ QMap< uchar*, HWSurface > *getPSurfaceMap( void ) const;
++ void clearCache( int clientId );
++
++ // Suspend/resume hooks
++ virtual void prepareToSuspend();
++ virtual void prepareToResume();
++ // Rotation stuff
++ enum Transformation { None, Rot90, Rot180, Rot270 };
++ void setTransformation( Transformation t );
++ Transformation transformation() const;
++ virtual bool isTransformed() const { return trans != None; };
++ virtual QSize mapToDevice( const QSize & ) const;
++ virtual QSize mapFromDevice( const QSize & ) const;
++ virtual QPoint mapToDevice( const QPoint &, const QSize & ) const;
++ virtual QPoint mapFromDevice( const QPoint &, const QSize & ) const;
++ virtual QRect mapToDevice( const QRect &, const QSize & ) const;
++ virtual QRect mapFromDevice( const QRect &, const QSize & ) const;
++ virtual QImage mapToDevice( const QImage & ) const;
++ virtual QImage mapFromDevice( const QImage & ) const;
++ virtual QRegion mapToDevice( const QRegion &, const QSize & ) const;
++ virtual QRegion mapFromDevice( const QRegion &, const QSize & ) const;
++ virtual int transformOrientation() const;
++
++protected:
++ bool w100init();
++ void w100shutdown();
++ Transformation trans;
++ static Transformation getTransSpec( const QString &dspec );
++ static void clearCache( QScreen *instance, int clientId );
++ QMap< uchar*, HWSurface > surfaceMap;
++ int vramoffset;
++ bool m_isServer;
++ virtual int pixmapLinestepAlignment() { return 128; }
++};
++
++template <const int depth, const int type>
++class QGfxW100 : public QGfxRaster<depth,type> {
++
++public:
++ QGfxW100( unsigned char *b, int w, int h );
++ virtual void drawLine( int, int, int, int);
++ virtual void fillRect( int, int, int, int);
++ virtual void blt( int, int, int, int, int, int );
++ virtual void sync();
++ virtual void setOffset( int x, int y );
++ virtual void setPen( const QPen & p );
++
++ virtual void drawPolyline( const QPointArray &, int, int );
++ virtual void drawPolygon( const QPointArray &, bool, int, int );
++ virtual void drawPoint( int, int );
++ virtual void drawPoints( const QPointArray &, int, int );
++ virtual void scroll( int, int, int, int, int, int );
++ virtual void tiledBlt( int rx, int ry, int w, int h );
++
++ inline int tx( int x, int y ) {
++ switch ( qt_w100_screen->transformation() ) {
++ case QW100Screen::Rot90:
++ return y - this->xoffs + this->yoffs;
++ case QW100Screen::Rot180:
++ return ( this->width - x - 1) - this->xoffs - this->xoffs;
++ case QW100Screen::Rot270:
++ return ( this->height - y - 1) - this->xoffs - this->yoffs;
++ default:
++ return x;
++ }
++ }
++ inline int ty( int x, int y ) {
++ switch ( qt_w100_screen->transformation() ) {
++ case QW100Screen::Rot90:
++ return (this->width - x - 1) - this->yoffs - this->xoffs;
++ case QW100Screen::Rot180:
++ return (this->height - y - 1) - this->yoffs - this->yoffs;
++ case QW100Screen::Rot270:
++ return x - this->yoffs + this->xoffs;
++ default:
++ return y;
++ }
++ }
++
++protected:
++ bool checkDest( bool setsrc = false );
++ bool checkSourceDest();
++ virtual void setSourceWidgetOffset( int x, int y );
++ void processSpans( int n, QPoint* point, int* width );
++ bool inDraw;
++
++ virtual void dDrawLine( int, int, int, int);
++ virtual void dFillRect( int, int, int, int);
++ virtual void dBlt( int, int, int, int, int, int );
++ void dDrawPolyline( const QPointArray &, int, int );
++ void dDrawPolygon( const QPointArray &, bool, int, int );
++ void dDrawPoint( int, int );
++ void dDrawPoints( const QPointArray &, int, int );
++ void dScroll( int, int, int, int, int, int );
++ void dTiledBlt( int rx, int ry, int w, int h );
++};
++
++template<const int depth,const int type>
++QGfxW100<depth,type>::QGfxW100( unsigned char * b, int w, int h )
++ : QGfxRaster<depth,type>(b, w, h),
++ inDraw( false )
++{
++}
++
++template<const int depth,const int type>
++inline void QGfxW100<depth,type>::setOffset( int x, int y )
++{
++ QGfxRaster<depth,type>::setOffset( x, y );
++}
++
++namespace {
++ QString penStyleStr( const QPen &pen )
++ {
++ QString res;
++ switch( pen.style() ) {
++ case Qt::NoPen:
++ res = "NoPen";
++ break;
++ case Qt::SolidLine:
++ res = "SolidLine";
++ break;
++ case Qt::DashLine:
++ res = "DashLine";
++ break;
++ case Qt::DotLine:
++ res = "DotLine";
++ break;
++ case Qt::DashDotLine:
++ res = "DashDotLine";
++ break;
++ case Qt::DashDotDotLine:
++ res = "DashDotDotLine";
++ break;
++ default:
++ res = "Unknown";
++ }
++ return res;
++ }
++}
++
++template<const int depth, const int type>
++inline void QGfxW100<depth,type>::setPen( const QPen &p )
++{
++ QGfxRaster<depth,type>::setPen( p );
++}
++
++template<const int depth,const int type>
++inline bool QGfxW100<depth,type>::checkSourceDest()
++{
++ if ( !checkDest() ) {
++ return FALSE;
++ }
++
++ int sourcepixelpitch;
++ ulong src_buffer_offset;
++ if ( this->srctype == this->SourcePen ) {
++ src_buffer_offset = -1;
++ return FALSE;
++ } else {
++ if ( !qt_screen->onCard( this->srcbits, src_buffer_offset ) ) {
++ return FALSE;
++ }
++ sourcepixelpitch = ( this->srclinestep * 8 ) / this->srcdepth;
++ driver.setSrcPitchOffset( sourcepixelpitch,
++ src_buffer_offset );
++ }
++ return TRUE;
++}
++
++template< const int depth, const int type>
++inline bool QGfxW100<depth, type>::checkDest( bool setsrc )
++{
++ //Main framebuffer should be registered as a hardware surface
++ ulong buffer_offset;
++ if ( !qt_screen->onCard( this->buffer, buffer_offset ) ) {
++ return FALSE;
++ }
++ int pixelstep = ( this->linestep() * 8 ) / depth;
++ driver.setDstPitchOffset( pixelstep, buffer_offset );
++ if ( setsrc ) {
++ driver.setSrcPitchOffset( pixelstep, buffer_offset );
++ }
++ return TRUE;
++}
++
++template<const int depth,const int type>
++void QGfxW100<depth,type>::drawLine( int x1, int y1, int x2, int y2 )
++{
++ if ( inDraw ) {
++ dDrawLine( x1, y1, x2, y2 );
++ } else {
++ inDraw = true;
++ dDrawLine( tx(x1,y1), ty(x1,y1),
++ tx(x2,y2), ty(x2,y2) );
++ inDraw = false;
++ }
++}
++
++template<const int depth,const int type>
++void QGfxW100<depth,type>::dDrawLine( int x1, int y1, int x2, int y2 )
++{
++ if ( ( this->ncliprect < 1) ||
++ ( this->cpen.style() == this->NoPen ) ) {
++ return;
++ }
++
++ if ( depth != 16 ||
++ !driver.accelerated( W100Driver::DRAWLINE ) ) {
++ driver.addMiss( W100Driver::DRAWLINE );
++ QGfxRaster<depth,type>::drawLine( x1, y1, x2, y2 );
++ return;
++ }
++
++ // Only handle 'normal' lines
++ if ( ( this->cpen.style() != this->SolidLine ) ||
++ ( this->myrop != this->CopyROP ) ||
++ ( this->cpen.width() > 1 ) ||
++ ( this->dashedLines ) ) {
++ driver.addMiss( W100Driver::DRAWLINE );
++ QGfxRaster<depth,type>::drawLine( x1, y1, x2, y2);
++ return;
++ }
++
++ // Stop anyone else trying to access optype/lastop/the graphics engine
++ // to avoid synchronization problems with other processes
++ QWSDisplay::grab( true );
++ if ( !checkDest() ) {
++ QWSDisplay::ungrab();
++ driver.addMiss( W100Driver::DRAWLINE );
++ QGfxRaster<depth,type>::drawLine( x1, y1, x2, y2 );
++ return;
++ }
++
++
++ // Note that the last operation used the 2d engine
++ ( *optype ) = 1;
++
++ // Add the offset of the gfx - used to make the origin the right
++ // place for windows
++ x1 += this->xoffs;
++ y1 += this->yoffs;
++ x2 += this->xoffs;
++ y2 += this->yoffs;
++
++ QRect boundRect( x1 < x2 ? x1: x2,
++ y1 < y2 ? y1 : y2,
++ QABS( x2 - x1 ) + 1,
++ QABS( y2 - y1 ) + 1 );
++
++ GFX_START( boundRect );
++
++ // The clip region is defined as a series of rectangles
++ // We repeatedly set up the hardware clip rectangle to one of
++ // these rectangles and re-draw the line - an alternative approach
++ // would be to clip to the rectangle in software
++
++ driver.setDstType( DSTTYPE_16BPP_1555 );
++ driver.setSrcType( SRCTYPE_EQU_DST );
++ driver.setRopOperation( ROP3_PATCOPY );
++ driver.brushType( 6, 0 );
++ driver.setFrgColour( this->cpen.color().rgb() );
++ driver.addHit( W100Driver::DRAWLINE );
++
++ //The imageon seems not to write on the edge of the clip
++ //for the polyline op.
++ //We are using a three points array repeating the last point
++ //to get the last single point painted.
++ ATI_POINT points[3];
++ points[0].XCoord = x1;
++ points[0].YCoord = y1;
++ points[1].XCoord = x2;
++ points[1].YCoord = y2;
++ points[2].XCoord = x2;
++ points[2].YCoord = y2;
++ for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
++ if ( boundRect.intersects( this->cliprect[loopc] ) ) {
++ ATI_CLIPRECT clip;
++ clip.X_Top_Left = this->cliprect[loopc].x();
++ clip.Y_Top_Left = this->cliprect[loopc].y();
++ clip.X_Bottom_Right = this->cliprect[loopc].right() + 1;
++ clip.Y_Bottom_Right = this->cliprect[loopc].bottom() + 1;
++ driver.setDstClippingRect( &clip );
++ driver.polyline( 3, points );
++ }
++ }
++
++ // Software mouse cursor stuff
++ GFX_END;
++
++ // Release display again - not doing so will cause Qt/Embedded applications
++ // to deadlock
++ QWSDisplay::ungrab();
++}
++
++template< const int depth, const int type >
++void QGfxW100< depth, type>::drawPolyline( const QPointArray &a,
++ int index,
++ int npoints )
++{
++ if ( inDraw ) {
++ dDrawPolyline( a, index, npoints );
++ } else {
++ inDraw = true;
++ QPointArray na( npoints );
++
++ for ( int i = 0; i < npoints; i++ ) {
++ int x, y;
++ a.point( i+index, &x, &y );
++ na.setPoint( i, tx(x,y), ty(x,y) );
++ }
++
++ dDrawPolyline( na, 0, npoints );
++ inDraw = false;
++ }
++}
++
++template< const int depth, const int type >
++void QGfxW100< depth, type>::dDrawPolyline( const QPointArray &a,
++ int index,
++ int npoints )
++{
++ if ( ( this->ncliprect < 1 ) ||
++ ( npoints < 1 ) ||
++ ( this->cpen.style() == this->NoPen ) ) {
++ return;
++ }
++
++ if ( depth != 16 ||
++ !driver.accelerated( W100Driver::POLYLINE ) ) {
++ driver.addMiss( W100Driver::POLYLINE );
++ QGfxRaster<depth,type>::drawPolyline( a, index, npoints );
++ return;
++ }
++
++ if ( this->cpen.style() != this->SolidLine ||
++ this->myrop != this->CopyROP ) {
++ driver.addMiss( W100Driver::POLYLINE );
++ QGfxRaster<depth,type>::drawPolyline( a, index, npoints );
++ return;
++ }
++
++ QWSDisplay::grab( TRUE );
++ if ( !checkDest() ) {
++ QWSDisplay::ungrab();
++ driver.addMiss( W100Driver::POLYLINE );
++ QGfxRaster<depth,type>::drawPolyline( a, index, npoints );
++ return;
++ }
++
++ ( *optype ) = 1;
++
++ driver.setDstType( DSTTYPE_16BPP_1555 );
++ driver.setSrcType( SRCTYPE_EQU_DST );
++ driver.setRopOperation( ROP3_PATCOPY );
++ driver.brushType( 6, 0 );
++ driver.setFrgColour( this->cpen.color().rgb() );
++
++ driver.addHit( W100Driver::POLYLINE );
++
++ ATI_POINT *points = new ATI_POINT[ npoints + 1 ];
++
++ for ( int i = 0; i < npoints; i++ ) {
++ points[i].XCoord = a[i+index].x() + this->xoffs;
++ points[i].YCoord = a[i+index].y() + this->yoffs;
++ }
++ //Hack to get the last point of the last line painted
++ points[ npoints ] = points[ npoints - 1 ];
++
++
++ GFX_START( clipbounds );
++ driver.setFrgColour( this->cpen.color().rgb() );
++ driver.setRopOperation( ROP3_PATCOPY );
++ for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
++ ATI_CLIPRECT clip;
++ clip.X_Top_Left = this->cliprect[loopc].x();
++ clip.Y_Top_Left = this->cliprect[loopc].y();
++ clip.X_Bottom_Right = this->cliprect[loopc].right() + 1;
++ clip.Y_Bottom_Right = this->cliprect[loopc].bottom() + 1;
++ driver.setDstClippingRect( &clip );
++ driver.polyline( npoints + 1, points );
++ }
++ GFX_END;
++
++ delete [] points;
++
++ QWSDisplay::ungrab();
++}
++
++
++template< const int depth, const int type >
++void QGfxW100< depth, type>::drawPolygon( const QPointArray &a,
++ bool w, int index,
++ int npoints )
++{
++ if ( inDraw || this->cpen.style()==this->NoPen || this->patternedbrush ) {
++ //slowpath
++ dDrawPolygon( a, w, index, npoints );
++ } else {
++ inDraw = TRUE;
++ QPointArray na( npoints );
++
++ for ( int i = 0; i < npoints; i++ ) {
++ int x,y;
++ a.point( i+index, &x, &y );
++ na.setPoint( i, tx(x,y), ty(x,y) );
++ }
++ dDrawPolygon( na, w, 0, npoints );
++ inDraw = FALSE;
++ }
++}
++
++template< const int depth, const int type >
++void QGfxW100< depth, type>::dDrawPolygon( const QPointArray &a, bool w, int index, int npoints )
++{
++ QGfxRaster<depth,type>::drawPolygon( a, w, index, npoints );
++}
++
++template< const int depth, const int type >
++void QGfxW100< depth, type>::drawPoint( int x, int y )
++{
++ dDrawPoint( tx( x, y ), ty( x, y ) );
++}
++
++template< const int depth, const int type >
++void QGfxW100< depth, type>::dDrawPoint( int x, int y )
++{
++
++ if ( this->ncliprect < 1 ) {
++ return;
++ }
++
++ if ( depth != 16 ||
++ !driver.accelerated( W100Driver::DRAWPOINT) ) {
++ driver.addMiss( W100Driver::DRAWPOINT );
++ QGfxRaster<depth,type>::drawPoint( x, y );
++ return;
++ }
++
++ if ( this->cpen.style() != this->SolidLine ||
++ this->myrop != this->CopyROP ) {
++ driver.addMiss( W100Driver::DRAWPOINT );
++ QGfxRaster<depth,type>::drawPoint( x, y );
++ return;
++ }
++
++ QWSDisplay::grab( TRUE );
++ if ( !checkDest() ) {
++ QWSDisplay::ungrab();
++ driver.addMiss( W100Driver::DRAWPOINT );
++ QGfxRaster<depth,type>::drawPoint( x, y );
++ return;
++ }
++
++ driver.addHit( W100Driver::DRAWPOINT );
++ ( *optype ) = 1;
++
++ ATI_POINT point;
++ point.XCoord = x + this->xoffs;
++ point.YCoord = y + this->yoffs;
++
++ GFX_START( clipbounds );
++ driver.setFrgColour( this->cpen.color().rgb() );
++ driver.setRopOperation( ROP3_PATCOPY );
++ for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
++ ATI_CLIPRECT clip;
++ clip.X_Top_Left = this->cliprect[loopc].x();
++ clip.Y_Top_Left = this->cliprect[loopc].y();
++ clip.X_Bottom_Right = this->cliprect[loopc].right() + 1;
++ clip.Y_Bottom_Right = this->cliprect[loopc].bottom() + 1;
++ driver.setDstClippingRect( &clip );
++ driver.drawPixel( 1, &point );
++ }
++ GFX_END;
++ QWSDisplay::ungrab();
++}
++
++template< const int depth, const int type >
++void QGfxW100< depth, type>::drawPoints( const QPointArray &a,
++ int index,
++ int npoints )
++{
++ QPointArray na( npoints );
++
++ for ( int i = 0; i < npoints; i++ ) {
++ int x, y;
++ a.point( i+index, &x, &y );
++ na.setPoint( i, tx( x, y ), ty( x, y ) );
++ }
++
++ dDrawPoints( na, 0, npoints );
++}
++
++template< const int depth, const int type >
++void QGfxW100< depth, type>::dDrawPoints( const QPointArray &a,
++ int index,
++ int npoints )
++{
++ if ( ( this->ncliprect < 1 ) || ( npoints < 1 ) ) {
++ return;
++ }
++
++ if ( depth != 16 ||
++ !driver.accelerated( W100Driver::DRAWPOINTS ) ) {
++ driver.addMiss( W100Driver::DRAWPOINTS );
++ QGfxRaster<depth,type>::drawPoints( a, index, npoints );
++ return;
++ }
++
++ if ( this->cpen.style() != this->SolidLine ||
++ this->myrop != this->CopyROP ) {
++ driver.addMiss( W100Driver::DRAWPOINTS );
++ QGfxRaster<depth,type>::drawPoints( a, index, npoints );
++ return;
++ }
++
++ QWSDisplay::grab( TRUE );
++ if ( !checkDest() ) {
++ QWSDisplay::ungrab();
++ driver.addMiss( W100Driver::DRAWPOINTS );
++ QGfxRaster<depth,type>::drawPoints( a, index, npoints );
++ return;
++ }
++
++ driver.addHit( W100Driver::DRAWPOINTS );
++ ( *optype ) = 1;
++
++ ATI_POINT *points = new ATI_POINT[ npoints ];
++ for ( int i = 0; i < npoints; i++ ) {
++ points[i].XCoord = a[i+index].x() + this->xoffs;
++ points[i].YCoord = a[i+index].y() + this->yoffs;
++ }
++
++ GFX_START( clipbounds );
++ driver.setFrgColour( this->cpen.color().rgb() );
++ driver.setRopOperation( ROP3_PATCOPY );
++ for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
++ ATI_CLIPRECT clip;
++ clip.X_Top_Left = this->cliprect[loopc].x();
++ clip.Y_Top_Left = this->cliprect[loopc].y();
++ clip.X_Bottom_Right = this->cliprect[loopc].right() + 1;
++ clip.Y_Bottom_Right = this->cliprect[loopc].bottom() + 1;
++ driver.setDstClippingRect( &clip );
++ driver.drawPixel( npoints, points );
++ }
++ GFX_END;
++
++ delete [] points;
++ QWSDisplay::ungrab();
++}
++
++template <const int depth, const int type>
++void QGfxW100<depth,type>::scroll( int x, int y, int w, int h, int sx, int sy )
++{
++ if ( w == 0 || h == 0 )
++ return;
++ QRect r;
++ QRect s;
++ if ( inDraw ) {
++ r = QRect( x, y, w, h );
++ s = QRect( sx, sy, w, h );
++ } else {
++ r.setCoords( tx(x,y), ty(x,y), tx(x+w-1,y+h-1), ty(x+w-1,y+h-1) );
++ s.setCoords( tx(sx,sy), ty(sx,sy), tx(sx+w-1,sy+h-1), ty(sx+w-1,sy+h-1) );
++ r = r.normalize();
++ s = s.normalize();
++ }
++ dScroll( r.x(), r.y(), r.width(), r.height(), s.x(), s.y() );
++}
++
++
++template< const int depth, const int type >
++void QGfxW100< depth, type>::dScroll( int rx, int ry,
++ int w, int h,
++ int sx, int sy )
++{
++ if ( depth != 16 ||
++ !driver.accelerated( W100Driver::SCROLL ) ) {
++ driver.addMiss( W100Driver::SCROLL );
++ QGfxRaster<depth,type>::scroll( rx, ry, w, h, sx, sy );
++ return;
++ }
++
++ if ( this->ncliprect < 1 ) return;
++
++ if ( ( w < 1 ) || ( h < 1 ) ) return;
++
++ int dy = sy - ry;
++ int dx = sx - rx;
++
++ if ( dx == 0 && dy == 0 ) return;
++
++
++ QWSDisplay::grab( TRUE );
++
++ if ( checkDest( true ) ) {
++
++ rx += this->xoffs;
++ sx += this->xoffs;
++ ry += this->yoffs;
++ sy += this->yoffs;
++
++ QRect boundRect( QMIN( rx , sx ),
++ QMIN( ry , sy ),
++ w + QABS( dx ) + 1,
++ h + QABS( dy ) + 1 );
++ GFX_START( boundRect );
++ ( *optype ) = 1;
++
++
++ //if ( driver.lastOp() != W100Driver::SCROLL ) {
++ driver.setRopOperation( ROP3_SRCCOPY );
++ driver.setDstType( DSTTYPE_16BPP_1555 );
++ driver.setSrcType( SRCTYPE_EQU_DST );
++ //}
++
++ driver.addHit( W100Driver::SCROLL );
++
++ ATI_RECT srcrect, dstrect;
++
++ srcrect.XCoord = sx;
++ srcrect.YCoord = sy;
++ srcrect.Width = w;
++ srcrect.Height = h;
++ dstrect.XCoord = rx;
++ dstrect.YCoord = ry;
++ dstrect.Width = w;
++ dstrect.Height = h;
++ for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
++ if ( boundRect.intersects( this->cliprect[loopc] ) ) {
++ ATI_CLIPRECT clip;
++ clip.X_Top_Left = this->cliprect[ loopc ].x();
++ clip.Y_Top_Left = this->cliprect[ loopc ].y();
++ clip.X_Bottom_Right = this->cliprect[ loopc ].right() + 1;
++ clip.Y_Bottom_Right = this->cliprect[ loopc ].bottom() + 1;
++ driver.setDstClippingRect( &clip );
++ driver.bitBlt( 1, &dstrect, &srcrect );
++ }
++ }
++ GFX_END;
++ QWSDisplay::ungrab();
++
++ } else {
++ QWSDisplay::ungrab();
++ // software fallback
++ driver.addMiss( W100Driver::SCROLL );
++ QGfxRaster<depth,type>::scroll( rx, ry, w, h, sx, sy );
++ }
++}
++
++template< const int depth, const int type >
++void QGfxW100< depth, type>::fillRect( int x, int y, int w, int h )
++{
++ if ( w == 0 || h == 0 )
++ return;
++ QRect r( x, y, w, h );
++ r.setCoords( tx( x, y ), ty( x, y ),
++ tx( x + w - 1, y + h - 1 ), ty( x + w - 1, y + h - 1 ) );
++ r = r.normalize();
++ inDraw = TRUE;
++ dFillRect( r.x(), r.y(), r.width(), r.height() );
++ inDraw = FALSE;
++}
++
++template< const int depth, const int type >
++void QGfxW100< depth, type>::dFillRect( int rx, int ry, int w, int h )
++{
++ if ( w <= 0 || h <= 0 || this->ncliprect < 1 ) return;
++
++ if ( depth != 16 ||
++ !driver.accelerated( W100Driver::FILLRECT ) ) {
++ driver.addMiss( W100Driver::FILLRECT );
++ QGfxRaster<depth,type>::fillRect( rx, ry, w, h );
++ return;
++ }
++
++ if ( ( this->cbrush.style() != this->NoBrush ) &&
++ ( this->cbrush.style() != this->SolidPattern ) ) {
++ driver.addMiss( W100Driver::FILLRECT );
++ QGfxRaster<depth,type>::fillRect( rx, ry, w, h );
++ return;
++ }
++
++ if ( !checkDest() || ( this->myrop != this->CopyROP ) ) {
++ driver.addMiss( W100Driver::FILLRECT );
++ QGfxRaster<depth,type>::fillRect( rx, ry, w, h );
++ return;
++ }
++
++ QWSDisplay::grab( TRUE );
++ rx += this->xoffs;
++ ry += this->yoffs;
++
++ QRect boundRect( rx, ry, w + 1, h + 1 );
++ GFX_START( boundRect );
++
++ ( *optype ) = 1;
++
++ driver.setDstType( DSTTYPE_16BPP_1555 );
++ driver.setSrcType( SRCTYPE_EQU_DST );
++ driver.setRopOperation( ROP3_PATCOPY );
++ driver.brushType( 6, 0 );
++ driver.setFrgColour( this->cbrush.color().rgb() );
++
++ driver.addHit( W100Driver::FILLRECT );
++
++ if ( this->cbrush.style() != this->NoBrush ) {
++ //Using all the cliprects
++ for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
++ if ( boundRect.intersects( this->cliprect[loopc] ) ) {
++ ATI_CLIPRECT clip;
++ ATI_RECT rect;
++
++ clip.X_Top_Left = this->cliprect[ loopc ].x();
++ clip.Y_Top_Left = this->cliprect[ loopc ].y();
++ clip.X_Bottom_Right = this->cliprect[ loopc ].right() + 1;
++ clip.Y_Bottom_Right = this->cliprect[ loopc ].bottom() + 1;
++
++ driver.setDstClippingRect( &clip );
++ rect.XCoord = rx;
++ rect.YCoord = ry;
++ rect.Width = w;
++ rect.Height = h;
++ driver.paintRect( 1, &rect );
++ }
++ }
++ }
++ GFX_END;
++
++ QWSDisplay::ungrab();
++}
++
++template <const int depth, const int type>
++void QGfxW100<depth,type>::blt( int x, int y, int w, int h, int sx, int sy )
++{
++ if ( w == 0 || h == 0 )
++ return;
++ QRect r;
++ int rsx;
++ int rsy;
++ if ( inDraw ) {
++ r = QRect( x, y, w, h );
++ rsx = sx;
++ rsy = sy;
++ } else {
++ r.setCoords( tx(x,y), ty(x,y), tx(x+w-1,y+h-1), ty(x+w-1,y+h-1) );
++ r = r.normalize();
++ switch ( qt_w100_screen->transformation() ) {
++ case QW100Screen::Rot90:
++ rsx = sy;
++ rsy = this->srcwidth - sx - w;
++ break;
++ case QW100Screen::Rot180:
++ rsx = this->srcwidth - sx - w;
++ rsy = this->srcheight - sy - h;
++ break;
++ case QW100Screen::Rot270:
++ rsx = this->srcheight - sy - h;
++ rsy = sx;
++ break;
++ default:
++ rsx = sx;
++ rsy = sy;
++ break;
++ }
++ }
++ dBlt( r.x(), r.y(), r.width(), r.height(), rsx, rsy );
++}
++
++template< const int depth, const int type >
++inline void QGfxW100< depth, type>::dBlt( int rx, int ry,
++ int w, int h,
++ int sx, int sy )
++{
++ if ( !w || !h || this->ncliprect < 1 ) {
++ return;
++ }
++
++ if ( depth != 16 ||
++ !driver.accelerated( W100Driver::BITBLT ) ) {
++ driver.addMiss( W100Driver::BITBLT );
++ QGfxRaster<depth,type>::blt( rx, ry, w, h, sx, sy );
++ return;
++ }
++
++ if ( this->alphatype == this->BigEndianMask ||
++ this->alphatype == this->LittleEndianMask ||
++ this->alphatype == this->SeparateAlpha ||
++ this->srctype == this->SourcePen ||
++ ( this->myrop != this->CopyROP ) ) {
++ driver.addMiss( W100Driver::BITBLT );
++ QGfxRaster<depth,type>::blt( rx, ry, w, h, sx, sy );
++ return;
++ }
++
++ if ( ( this->srcdepth != 16 ) || this->alphatype != this->IgnoreAlpha ) {
++ driver.addMiss( W100Driver::BITBLT );
++ QGfxRaster<depth,type>::blt( rx, ry, w, h, sx, sy );
++ return;
++ }
++
++ QWSDisplay::grab( TRUE );
++
++ if ( checkSourceDest() ) {
++ QRect boundRect( rx + this->xoffs, ry + this->yoffs,
++ w + 1, h + 1 );
++ GFX_START( boundRect );
++ ( *optype ) = 1;
++
++ driver.setRopOperation( ROP3_SRCCOPY );
++ driver.setDstType( DSTTYPE_16BPP_1555 );
++ driver.setSrcType( SRCTYPE_EQU_DST );
++
++ driver.addHit( W100Driver::BITBLT );
++
++ ATI_RECT rect1;
++ ATI_RECT rect2;
++
++ rx += this->xoffs;
++ ry += this->yoffs;
++
++ rect1.XCoord = this->srcwidgetoffs.x() + sx;
++ rect1.YCoord = this->srcwidgetoffs.y() + sy;
++ rect1.Width = w;
++ rect1.Height = h;
++ rect2.XCoord = rx;
++ rect2.YCoord = ry;
++ rect2.Width = w;
++ rect2.Height = h;
++ for(int loopc = 0; loopc < this->ncliprect; loopc++ ) {
++ if ( boundRect.intersects( this->cliprect[loopc] ) ) {
++ ATI_CLIPRECT clip;
++ clip.X_Top_Left = this->cliprect[ loopc ].x();
++ clip.Y_Top_Left = this->cliprect[ loopc ].y();
++ clip.X_Bottom_Right = this->cliprect[ loopc ].right() + 1;
++ clip.Y_Bottom_Right = this->cliprect[ loopc ].bottom() + 1;
++ driver.setDstClippingRect( &clip );
++ driver.bitBlt( 1, &rect2, &rect1 );
++ }
++ }
++ GFX_END;
++
++ QWSDisplay::ungrab();
++ return;
++ } else {
++ QWSDisplay::ungrab();
++ driver.addMiss( W100Driver::BITBLT );
++ QGfxRaster<depth,type>::blt( rx, ry,
++ w, h, sx, sy );
++ }
++}
++
++
++template <const int depth, const int type>
++void QGfxW100<depth,type>::tiledBlt( int rx,int ry,int w,int h )
++{
++ if ( w <= 0 || h <= 0 )
++ return;
++ QRect r;
++ if ( inDraw ) {
++ r = QRect(rx,ry,w,h);
++ } else {
++ r.setCoords( tx(rx,ry), ty(rx,ry), tx(rx+w-1,ry+h-1), ty(rx+w-1,ry+h-1) );
++ r = r.normalize();
++ }
++
++ inDraw = TRUE;
++
++ QPoint oldBrushOffs = this->brushoffs;
++ int brx, bry;
++ switch ( qt_w100_screen->transformation() ) {
++ case QW100Screen::Rot90:
++ brx = this->brushoffs.y();
++ bry = this->srcwidth - this->brushoffs.x() - w;
++ break;
++ case QW100Screen::Rot180:
++ brx = this->srcwidth - this->brushoffs.x() - w;
++ bry = this->srcheight - this->brushoffs.y() - h;
++ break;
++ case QW100Screen::Rot270:
++ brx = this->srcheight - this->brushoffs.y() - h;
++ bry = this->brushoffs.x();
++ break;
++ default:
++ brx = this->brushoffs.x();
++ bry = this->brushoffs.y();
++ break;
++ }
++ this->brushoffs = QPoint( brx, bry );
++
++ int oldsw = this->srcwidth;
++ int oldsh = this->srcheight;
++ QSize s = qt_screen->mapToDevice( QSize(this->srcwidth,this->srcheight) );
++ this->srcwidth = s.width();
++ this->srcheight = s.height();
++
++ dTiledBlt( r.x(), r.y(), r.width(), r.height() );
++
++ this->srcwidth = oldsw;
++ this->srcheight = oldsh;
++ this->brushoffs = oldBrushOffs;
++ inDraw = FALSE;
++}
++
++
++template <const int depth, const int type>
++void QGfxW100<depth,type>::dTiledBlt( int rx,int ry, int w,int h )
++{
++ if ( this->srcwidth == 0 || this->srcheight == 0 )
++ return;
++ QGfxRaster<depth,type>::tiledBlt( rx, ry, w, h );
++}
++
++template<const int depth,const int type>
++void QGfxW100<depth,type>::sync()
++{
++ driver.waitComplete( -1 );
++}
++
++template <const int depth, const int type>
++void QGfxW100<depth,type>::setSourceWidgetOffset(int x, int y)
++{
++ if ( this->srcbits == this->buffer ) {
++ switch ( qt_w100_screen->transformation() ) {
++ case QW100Screen::Rot90:
++ this->srcwidgetoffs = QPoint( y, this->width - x - this->srcwidth );
++ break;
++ case QW100Screen::Rot180:
++ this->srcwidgetoffs = QPoint( this->width - x - this->srcwidth, this->height - y - this->srcheight );
++ break;
++ case QW100Screen::Rot270:
++ this->srcwidgetoffs = QPoint( this->height - y - this->srcheight, x );
++ break;
++ default:
++ this->srcwidgetoffs = QPoint( x, y );
++ break;
++ }
++ } else {
++ this->srcwidgetoffs = QPoint( x, y );
++ }
++}
++
++template <const int depth, const int type>
++void QGfxW100<depth,type>::processSpans( int n, QPoint* point, int* width )
++{
++ if ( inDraw ||
++ this->patternedbrush &&
++ this->srcwidth != 0 &&
++ this->srcheight != 0 ) {
++ //in the patternedbrush case, we let blt do the transformation
++ // so we leave inDraw false.
++ QGfxRaster<depth,type>::processSpans( n, point, width );
++ } else {
++ inDraw = true;
++ while (n--) {
++ if ( *width > 0 ) {
++ int x=tx(point->x(),point->y())+this->xoffs;
++ int y=ty(point->x(),point->y())+this->yoffs;
++
++ switch( qt_w100_screen->transformation() ) {
++ case QW100Screen::Rot90:
++ this->vline( x, y-(*width-1), y );
++ break;
++ case QW100Screen::Rot180:
++ this->hline( x - (*width-1), x, y );
++ break;
++ case QW100Screen::Rot270:
++ this->vline( x, y, y+*width-1 );
++ break;
++ default:
++ this->hline( x, x+*width-1, y );
++ break;
++ }
++ }
++ point++;
++ width++;
++ }
++ inDraw = false;
++ }
++}
++
++QW100Screen::QW100Screen( int display_id )
++ :QLinuxFbScreen( display_id ),
++ vramoffset( 0 ),
++ m_isServer( false )
++{
++ qt_w100_screen = this;
++ vramoffset = 0;
++ clearCacheFunc = &clearCache;
++ trans = None;
++}
++
++static const char *trans2str( QW100Screen::Transformation t )
++{
++ switch( t ) {
++ case QW100Screen::None:
++ return "None";
++ break;
++ case QW100Screen::Rot90:
++ return "Rot90";
++ break;
++ case QW100Screen::Rot180:
++ return "Rot180";
++ break;
++ case QW100Screen::Rot270:
++ return "Rot270";
++ break;
++ default:
++ return "Unknown";
++ break;
++ }
++}
++
++QW100Screen::Transformation QW100Screen::getTransSpec( const QString &dspec )
++{
++ Transformation mytrans = None;
++ if ( dspec.find( ":Rot270" ) >= 0 ) {
++ mytrans = Rot270;
++ } else if ( dspec.find( ":Rot180" ) >= 0 ) {
++ mytrans = Rot180;
++ } else if ( dspec.find( ":Rot90" ) >= 0 ) {
++ mytrans = Rot90;
++ }
++ return mytrans;
++}
++
++bool QW100Screen::connect( const QString &displaySpec )
++{
++ driver.log( W100Driver::WARNING, "QW100Screen::connect('%s')",
++ displaySpec.latin1() );
++ trans = getTransSpec( displaySpec );
++
++ if ( QLinuxFbScreen::connect( displaySpec ) ) {
++ vramoffset = ( w == 320 ) ? 0 : 0x0f000000;
++ if ( driver.processAttach() == W100Driver::codOK ) {
++ driver.processAttachSpecialMode( ( w == 480 ) ? 0xaaab : 0xaaaa );
++ surfaceMap.clear();
++ surfaceMap.insert( 0, HWSurface( vramoffset,
++ data , false,
++ w*h*d/8 ) );
++ canaccel = true;
++ QSize s = mapFromDevice( QSize( w, h ) );
++ w = s.width();
++ h = s.height();
++ return true;
++ }
++ }
++ return false;
++}
++
++void QW100Screen::disconnect( void )
++{
++ driver.log( W100Driver::WARNING, "QW100Screen::disconnect()" );
++ driver.processDetachSpecialMode();
++ driver.processDetach();
++ QLinuxFbScreen::disconnect();
++ printf( "[%d]QW100Screen disconnected with %d surfaces\n",
++ getpid(), surfaceMap.count() );
++ surfaceMap.clear();
++}
++
++void QW100Screen::prepareToSuspend( void )
++{
++
++ driver.log( W100Driver::WARNING,
++ "QW100Screen::prepareToSuspend. Server = %s",
++ m_isServer ? "true" : "false" );
++
++ QWSDisplay::grab( true );
++ driver.waitComplete( -1 );
++
++ if ( !driver.attached() ) {
++ driver.log( W100Driver::ERROR, "Driver was not attached. " );
++ } else {
++ driver.processDetachSpecialMode();
++ driver.processDetach();
++ }
++ QWSDisplay::ungrab();
++
++ driver.log( W100Driver::WARNING, "prepareToSuspend done" );
++
++}
++
++void QW100Screen::prepareToResume( void )
++{
++
++ driver.log( W100Driver::WARNING,
++ "QW100Screen::prepareToResume. Server = %s",
++ m_isServer ? "true": "false" );
++
++ driver.processAttach();
++ driver.processAttachSpecialMode( ( w == 480 ) ? 0xaaab : 0xaaaa );
++ if ( m_isServer ) {
++ QWSDisplay::grab( true );
++ w100init();
++ QWSDisplay::ungrab();
++ driver.log( W100Driver::WARNING, "W100 restarted" );
++ }
++ driver.log( W100Driver::WARNING, "prepareToResume done" );
++
++}
++
++QW100Screen::~QW100Screen()
++{
++}
++
++bool QW100Screen::w100init()
++{
++ driver.log( W100Driver::WARNING,
++ "QW100Screen::w100init(%dx%d)", dw, dh );
++ ATI_GRAPHICWINDOW win;
++ ATI_CLIPRECT clip;
++ uint16_t overlay;
++
++ win.dummy1 = 0;
++ win.Size.XCoord = 0;
++ win.Size.YCoord = 0;
++ win.Size.Width = dw;
++ win.Size.Height = dh;
++ win.Width = dw > dh ? dh : dw;
++ win.Height = dw > dh ? dw : dh;
++ win.Flag = DSTTYPE_16BPP_444;
++
++ driver.waitComplete( -1 );
++ driver.setGraphicWindowOnOff( 0 );
++
++ driver.setupGraphicWindow( &win );
++ driver.setGraphicWindowPos( 0, 0 );
++
++ driver.setFrontBuffer( vramoffset, 0, 0 );
++ driver.setDstPitchOffset( dw, vramoffset );
++ driver.setDstType( DSTTYPE_16BPP_444 );
++ driver.setSrcPitchOffset( dw, vramoffset );
++ driver.setSrcType( SRCTYPE_SOLID_COLOR_BLT );
++ clip.X_Top_Left = 0;
++ clip.Y_Top_Left = 0;
++ clip.X_Bottom_Right = dw;
++ clip.Y_Bottom_Right = dh;
++ driver.setDstClippingRect( &clip );
++
++ clip.X_Top_Left = 0xE000;
++ clip.Y_Top_Left = 0xE000;
++ clip.X_Bottom_Right = 0x1FFF;
++ clip.Y_Bottom_Right = 0x1FFF;
++
++ driver.setSrcClippingRect( &clip );
++
++ driver.setRopOperation( ROP3_SRCCOPY );
++ driver.setGraphicWindowOnOff( 1 );
++ driver.allocOverlay( &overlay );
++ driver.setOverlayOnOff( overlay, 0 );
++ driver.releaseOverlay( overlay );
++ driver.setDstPitchOffset( dw, vramoffset );
++ driver.setDstClippingRect( NULL );
++ for ( int i = 0; i < dw * dh ; i++ ) {
++ *( data + i ) = 0;
++ }
++ driver.waitComplete( -1 );
++ return true;
++}
++
++void QW100Screen::w100shutdown()
++{
++}
++
++bool QW100Screen::initDevice()
++{
++ QWSDisplay::grab( true );
++ driver.log( W100Driver::WARNING, "initDevice( dw=%d, dh=%d )",
++ dw, dh );
++ m_isServer = true;
++
++ if ( !w100init() ) {
++ QWSDisplay::ungrab();
++ return false;
++ }
++
++ if ( QLinuxFbScreen::initDevice() ) {
++ //HACK
++ //Some sprite corruption seems to be avoided
++ //reserving some upper memory on the offscreen framebuffer memory
++ QLinuxFbScreen::cache( 65535 * 2, 0 );
++ QWSDisplay::ungrab();
++ return true;
++ }
++ QWSDisplay::ungrab();
++ return false;
++}
++
++void QW100Screen::shutdownDevice()
++{
++ driver.log( W100Driver::WARNING, "Shutting down device" );
++ QLinuxFbScreen::shutdownDevice();
++}
++
++void QW100Screen::restore()
++{
++ driver.log( W100Driver::WARNING, "Restoring W100..." );
++ QLinuxFbScreen::restore();
++ driver.log( W100Driver::WARNING, "Restoring done" );
++}
++
++
++QGfx *QW100Screen::createGfx( unsigned char *b,
++ int w, int h, int d, int linestep )
++{
++ //We need ALL the gfx created to be QGfxW100 to allow software
++ //drawing syncing after hardware operations
++ QGfx * ret=0;
++ if ( false ) {
++#ifndef QT_NO_QWS_DEPTH_1
++ } else if ( d == 1 ) {
++ ret = new QGfxW100<1,0>( b, w, h );
++#endif
++#ifndef QT_NO_QWS_DEPTH_4
++ } else if ( d == 4 ) {
++ ret = new QGfxW100<4,0>( b, w, h );
++#endif
++#ifndef QT_NO_QWS_DEPTH_8
++ } else if ( d == 8 ) {
++ ret = new QGfxW100<8,0>( b, w, h );
++#endif
++#ifndef QT_NO_QWS_DEPTH_16
++ } else if ( d == 16 ) {
++ ret = new QGfxW100<16,0>( b, w, h );
++#endif
++#ifndef QT_NO_QWS_DEPTH_24
++ } else if ( d == 24 ) {
++ ret = new QGfxW100<24,0>( b, w, h );
++#endif
++#ifndef QT_NO_QWS_DEPTH_32
++ } else if ( d == 32 ) {
++ ret = new QGfxW100<32,0>( b, w, h );
++#endif
++ } else {
++ qFatal( "Unsupported depth %d\n", d );
++ ret = 0;
++ }
++
++ ret->setLineStep( linestep );
++ return ret;
++}
++
++
++uchar *QW100Screen::cache( int amount, int optim )
++{
++ unsigned short hSurface = 0;
++ uint32_t surfaceOffset = 0;
++ uchar* localAddr = 0;
++ bool internal = false;
++
++ /* The size must have 0xF bit zeroed (16 multiple)*/
++ /* Perhaps this is not needed anymore, after setting
++ * QW100Screen::pixmapLinestepAlignment to 128
++ */
++ amount = ( amount & 0x0F ) ? ( amount | 0x10 ) & ~0x0F : amount;
++
++ /* Experimenting memory corruption with the
++ * internal AtiCore memory allocation routines
++ * disabled for now
++ */
++#if 1
++ if ( !( localAddr = QLinuxFbScreen::cache( amount, optim ) ) ) {
++ return( 0 );
++ }
++ surfaceOffset = vramoffset + ( uint32_t ) localAddr - ( uint32_t )data;
++
++#else
++ int retcode = 0;
++ qt_fbdpy->grab( true );
++ retcode = driver.allocateSurface( &hSurface,
++ &surfaceOffset,
++ amount, 1 );
++ qt_fbdpy->ungrab();
++ if ( retcode ) {
++ internal = true;
++ driver.setupMemoryTransfer( surfaceOffset,
++ (uint32_t*) &localAddr );
++ driver.terminateMemoryTransfer();
++ } else {
++ // Try to use the offscreen framebuffer memory
++ // to allocate the surface. Use the qgfxlinuxfb routines
++ if ( !( localAddr = QLinuxFbScreen::cache( amount, optim ) ) ) {
++ return( 0 );
++ }
++ //Distance between physical vram start and surface should be
++ //the same than distance between logical addresses
++ surfaceOffset = vramoffset + ( uint32_t ) localAddr - ( uint32_t ) data;
++ }
++#endif
++
++ HWSurface surface( hSurface, surfaceOffset,
++ localAddr, amount,
++ internal,
++ qws_client_id );
++ surfaceMap.insert( surface.getAddr(), surface );
++ return( ( uchar* ) localAddr );
++}
++
++void QW100Screen::uncache( uchar *c )
++{
++ QMap< uchar*, HWSurface >::Iterator itr;
++ if ( ( itr = surfaceMap.find( c ) ) != surfaceMap.end() ) {
++ driver.waitComplete( -1 );
++ if ( itr.data().internal() ) {
++ qt_fbdpy->grab( true );
++ driver.destroySurface( itr.data().getHandle() );
++ qt_fbdpy->ungrab();
++ } else {
++ QLinuxFbScreen::uncache( c );
++ }
++ surfaceMap.remove( itr );
++ }
++}
++
++bool QW100Screen::onCard( uchar *p ) const
++{
++ QMap< uchar*, HWSurface >::ConstIterator itr = surfaceMap.begin();
++ for ( ; itr != surfaceMap.end(); itr++ ) {
++ uchar *begin;
++ if ( ( begin = itr.data().getAddr() ) <= p ) {
++ if ( ( itr.data().getSize() + begin ) >= p ) {
++ return TRUE;
++ }
++ }
++ }
++ return FALSE;
++}
++
++bool QW100Screen::onCard( unsigned char *p, ulong& offset ) const
++{
++ QMap< uchar*, HWSurface >::ConstIterator itr;
++ for ( itr = surfaceMap.begin(); itr != surfaceMap.end(); itr++ ) {
++ uchar *begin;
++ if ( ( begin = itr.data().getAddr() ) <= p ) {
++ if ( ( itr.data().getSize() + begin ) >= p ) {
++ offset = itr.data().getSOffset() + ( p - begin );
++ return TRUE;
++ }
++ }
++ }
++ return FALSE;
++}
++
++QMap< uchar*, QW100Screen::HWSurface >
++*QW100Screen::getPSurfaceMap( void ) const
++{
++ return ( QMap<uchar*,HWSurface> *) &surfaceMap;
++}
++
++void QW100Screen::clearCache( int clientId )
++{
++ printf( "[%d] CLEARING CACHE FOR %d\n", getpid(), clientId );
++ driver.log( W100Driver::WARNING, "Cleaning cache for '%d'", clientId );
++ QMap< uchar*, HWSurface >::Iterator itr = surfaceMap.begin();
++ while ( itr != surfaceMap.end() ) {
++ if ( itr.data().getCId() == clientId ) {
++ if ( itr.data().internal() ) {
++ qt_fbdpy->grab();
++ driver.destroySurface( itr.data().getHandle() );
++ qt_fbdpy->ungrab();
++ }
++ surfaceMap.remove( itr );
++ }
++ itr++;
++ }
++ QLinuxFbScreen::clearCache( this, clientId );
++}
++
++void QW100Screen::clearCache( QScreen *instance, int clientId )
++{
++ QW100Screen *screen = reinterpret_cast<QW100Screen *> ( instance );
++ screen->clearCache( clientId );
++}
++
++void QW100Screen::setTransformation( Transformation t )
++{
++ qt_fbdpy->grab( true );
++ trans = t;
++
++ QSize s = mapFromDevice( QSize( dw,dh ) );
++ w = s.width();
++ h = s.height();
++ qt_fbdpy->ungrab();
++}
++
++QW100Screen::Transformation QW100Screen::transformation( void ) const
++{
++ return trans;
++}
++
++QSize QW100Screen::mapToDevice( const QSize &s ) const
++{
++ if ( trans == Rot90 || trans == Rot270 ) {
++ return QSize( s.height(), s.width() );
++ }
++
++ return s;
++}
++
++QSize QW100Screen::mapFromDevice( const QSize &s ) const
++{
++ if ( trans == Rot90 || trans == Rot270 ) {
++ return QSize( s.height(), s.width() );
++ }
++
++ return s;
++}
++
++QPoint QW100Screen::mapToDevice( const QPoint &p, const QSize &s ) const
++{
++ QPoint rp( p );
++
++ switch ( trans ) {
++ case Rot90:
++ rp.setX( p.y() );
++ rp.setY( s.width() - p.x() - 1 );
++ break;
++ case Rot180:
++ rp.setX( s.width() - p.x() - 1 );
++ rp.setY( s.height() - p.y() - 1 );
++ break;
++ case Rot270:
++ rp.setX( s.height() - p.y() - 1 );
++ rp.setY( p.x() );
++ break;
++ default:
++ break;
++ }
++
++ return rp;
++}
++
++QPoint QW100Screen::mapFromDevice( const QPoint &p, const QSize &s ) const
++{
++ QPoint rp( p );
++
++ switch ( trans ) {
++ case Rot90:
++ rp.setX( s.height() - p.y() - 1 );
++ rp.setY( p.x() );
++ break;
++ case Rot180:
++ rp.setX( s.width() - p.x() - 1 );
++ rp.setY( s.height() - p.y() - 1 );
++ break;
++ case Rot270:
++ rp.setX( p.y() );
++ rp.setY( s.width() - p.x() - 1 );
++ break;
++ default:
++ break;
++ }
++
++ return rp;
++}
++
++QRect QW100Screen::mapToDevice( const QRect &r, const QSize &s ) const
++{
++ QRect tr;
++ switch ( trans ) {
++ case Rot90:
++ tr.setCoords( r.y(), s.width() - r.x() - 1,
++ r.bottom(), s.width() - r.right() - 1 );
++ break;
++ case Rot180:
++ tr.setCoords( s.width() - r.x() - 1, s.height() - r.y() - 1,
++ s.width() - r.right() - 1, s.height() - r.bottom() - 1 );
++ break;
++ case Rot270:
++ tr.setCoords( s.height() - r.y() - 1, r.x(),
++ s.height() - r.bottom() - 1, r.right() );
++ break;
++ default:
++ tr = r;
++ break;
++ }
++
++ return tr.normalize();
++}
++
++QRect QW100Screen::mapFromDevice( const QRect &r, const QSize &s ) const
++{
++ QRect tr;
++ switch ( trans ) {
++ case Rot90:
++ tr.setCoords( s.height() - r.y() - 1, r.x(),
++ s.height() - r.bottom() - 1, r.right() );
++ break;
++ case Rot180:
++ tr.setCoords( s.width() - r.x() - 1, s.height() - r.y() - 1,
++ s.width() - r.right() - 1, s.height() - r.bottom() - 1 );
++ break;
++ case Rot270:
++ tr.setCoords( r.y(), s.width() - r.x() - 1,
++ r.bottom(), s.width() - r.right() - 1 );
++ break;
++ default:
++ tr = r;
++ break;
++ }
++
++ return tr.normalize();
++}
++
++template<class T>
++static inline void rotateLoopTemplate( uchar *src, int srcBytesPerLine,
++ uchar *dst, int dstBytesPerLine,
++ int width, int height,
++ QW100Screen::Transformation trans,
++ bool mapToDevice )
++{
++ int dstXAdd = 0;
++ int dstYAdd = 0;
++ int dstXOfs = 0;
++ int dstYOfs = 0;
++ int srcYAdd = srcBytesPerLine - width * sizeof(T);
++
++ if ( !mapToDevice ) {
++ if ( trans == QW100Screen::Rot90 )
++ trans = QW100Screen::Rot270;
++ else if ( trans == QW100Screen::Rot270 )
++ trans = QW100Screen::Rot90;
++ }
++
++ switch ( trans ) {
++ case QW100Screen::Rot90:
++ dstXOfs = 0;
++ dstYOfs = width - 1;
++ dstXAdd = -dstBytesPerLine;
++ dstYAdd = 1 * sizeof(T) + width * dstBytesPerLine;
++ break;
++ case QW100Screen::Rot270:
++ dstXOfs = height - 1;
++ dstYOfs = 0;
++ dstXAdd = dstBytesPerLine;
++ dstYAdd = -1 * sizeof(T) - width * dstBytesPerLine;
++ break;
++ default:
++ dstXOfs = width - 1;
++ dstYOfs = height - 1;
++ dstXAdd = -1 * sizeof(T);
++ dstYAdd = -dstBytesPerLine + width * sizeof(T);
++ break;
++ };
++
++ T *dstPtr = (T *)(dst + dstYOfs * dstBytesPerLine) + dstXOfs;
++ T *srcPtr = (T *)src;
++ for ( int y = 0; y < height; y++ ) {
++ for ( int x = 0; x < width; x++ ) {
++ *dstPtr = *srcPtr++;
++ dstPtr = (T *)((uchar*)dstPtr + dstXAdd); // add dstXAdd number of bytes
++ }
++ srcPtr = (T *)((uchar*)srcPtr + srcYAdd); // add srcYAdd number of bytes
++ dstPtr = (T *)((uchar*)dstPtr + dstYAdd); // add dstYAdd number of bytes
++ }
++}
++
++QImage QW100Screen::mapToDevice( const QImage &img ) const
++{
++ if ( img.isNull() || trans == None )
++ return img;
++
++ int iw = img.width();
++ int ih = img.height();
++ int w = iw;
++ int h = ih;
++ if ( trans == Rot90 || trans == Rot270 ) {
++ w = ih;
++ h = iw;
++ }
++
++ QImage rimg( w, h, img.depth(), img.numColors(), img.bitOrder() );
++
++ for ( int i = 0; i < img.numColors(); i++ ) {
++ rimg.colorTable()[i] = img.colorTable()[i];
++ }
++
++ // Optimized image rotation code for nice bit depths
++ int d = img.depth();
++ if ( d == 8 || d == 16 || d == 32 ) {
++ int srcBytesPerLine = img.bytesPerLine();
++ int dstBytesPerLine = rimg.bytesPerLine();
++ uchar *srcBits = img.bits();
++ uchar *dstBits = rimg.bits();
++ switch ( d ) {
++ case 8:
++ rotateLoopTemplate<uchar>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, TRUE );
++ break;
++ case 16:
++ rotateLoopTemplate<ushort>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, TRUE );
++ break;
++ case 32:
++ rotateLoopTemplate<uint>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, TRUE );
++ break;
++ }
++ rimg.setAlphaBuffer( img.hasAlphaBuffer() );
++ rimg.setOffset( img.offset() );
++ return rimg;
++ }
++
++ // Slower fall back code for image rotation for 1-bit and other depths
++#define ROTATE_LOOP( X, Y, VAL ) \
++ for ( int y = 0; y < ih; y++ ) { \
++ for ( int x = 0; x < iw; x++ ) { \
++ rimg.setPixel( X, Y, VAL ); \
++ } \
++ } \
++ break;
++
++ if ( img.depth() > 8 ) {
++ switch ( trans ) {
++ case Rot90:
++ ROTATE_LOOP( y, iw - x - 1, img.pixel(x, y) )
++ case Rot270:
++ ROTATE_LOOP( ih - y - 1, x, img.pixel(x, y) );
++ default:
++ ROTATE_LOOP( iw - x - 1, ih - y - 1, img.pixel(x, y) );
++ }
++ } else {
++ switch ( trans ) {
++ case Rot90:
++ ROTATE_LOOP( y, iw - x - 1, img.pixelIndex(x, y) );
++ case Rot270:
++ ROTATE_LOOP( ih - y - 1, x, img.pixelIndex(x, y) );
++ default:
++ ROTATE_LOOP( iw - x - 1, ih - y - 1, img.pixelIndex(x, y) );
++ }
++ }
++
++#undef ROTATE_LOOP
++
++ rimg.setAlphaBuffer( img.hasAlphaBuffer() );
++ rimg.setOffset( img.offset() );
++
++ return rimg;
++}
++
++QImage QW100Screen::mapFromDevice( const QImage &img ) const
++{
++ if ( img.isNull() || trans == None )
++ return img;
++
++ int iw = img.width();
++ int ih = img.height();
++ int w = iw;
++ int h = ih;
++ if ( trans == Rot90 || trans == Rot270 ) {
++ w = ih;
++ h = iw;
++ }
++
++ QImage rimg( w, h, img.depth(), img.numColors(), img.bitOrder() );
++
++ for ( int i = 0; i < img.numColors(); i++ ) {
++ rimg.colorTable()[i] = img.colorTable()[i];
++ }
++
++ // Optimized image rotation code for nice bit depths
++ int d = img.depth();
++ if ( d == 8 || d == 16 || d == 32 ) {
++ int srcBytesPerLine = img.bytesPerLine();
++ int dstBytesPerLine = rimg.bytesPerLine();
++ uchar *srcBits = img.bits();
++ uchar *dstBits = rimg.bits();
++ switch ( d ) {
++ case 8:
++ rotateLoopTemplate<uchar>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, FALSE );
++ break;
++ case 16:
++ rotateLoopTemplate<ushort>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, FALSE );
++ break;
++ case 32:
++ rotateLoopTemplate<uint>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, FALSE );
++ break;
++ }
++ rimg.setAlphaBuffer( img.hasAlphaBuffer() );
++ rimg.setOffset( img.offset() );
++ return rimg;
++ }
++
++ // Slower fall back code for image rotation for 1-bit and other depths
++#define ROTATE_LOOP( X, Y, VAL ) \
++ for ( int y = 0; y < ih; y++ ) { \
++ for ( int x = 0; x < iw; x++ ) { \
++ rimg.setPixel( X, Y, VAL ); \
++ } \
++ } \
++ break;
++
++ if ( img.depth() > 8 ) {
++ switch ( trans ) {
++ case Rot90:
++ ROTATE_LOOP( ih - y - 1, x, img.pixel(x, y) );
++ case Rot270:
++ ROTATE_LOOP( y, iw - x - 1, img.pixel(x, y) )
++ default:
++ ROTATE_LOOP( iw - x - 1, ih - y - 1, img.pixel(x, y) );
++ }
++ } else {
++ switch ( trans ) {
++ case Rot90:
++ ROTATE_LOOP( ih - y - 1, x, img.pixelIndex(x, y) );
++ case Rot270:
++ ROTATE_LOOP( y, iw - x - 1, img.pixelIndex(x, y) );
++ default:
++ ROTATE_LOOP( iw - x - 1, ih - y - 1, img.pixelIndex(x, y) );
++ }
++ }
++
++#undef ROTATE_LOOP
++
++ rimg.setAlphaBuffer( img.hasAlphaBuffer() );
++ rimg.setOffset( img.offset() );
++
++ return rimg;
++}
++
++QRegion QW100Screen::mapToDevice( const QRegion &rgn, const QSize &s ) const
++{
++ if ( trans == None )
++ return rgn;
++
++ QRegion trgn;
++ QArray<QRect> a = rgn.rects();
++ QRect tr;
++ const QRect *r = a.data();
++
++ int w = s.width();
++ int h = s.height();
++ int size = a.size();
++
++ switch ( trans ) {
++ case Rot270:
++ for ( int i = 0; i < size; i++, r++ ) {
++ tr.setCoords( h - r->y() - 1, r->x(),
++ h - r->bottom() - 1, r->right() );
++ trgn |= tr.normalize();
++ }
++ break;
++ case Rot90:
++ for ( int i = 0; i < size; i++, r++ ) {
++ tr.setCoords( r->y(), w - r->x() - 1,
++ r->bottom(), w - r->right() - 1 );
++ trgn |= tr.normalize();
++ }
++ break;
++ case Rot180:
++ for ( int i = 0; i < size; i++, r++ ) {
++ tr.setCoords( w - r->x() - 1, h - r->y() - 1,
++ w - r->right() - 1, h - r->bottom() - 1 );
++ trgn |= tr.normalize();
++ }
++ break;
++ default:
++ break;
++ }
++ return trgn;
++}
++
++QRegion QW100Screen::mapFromDevice( const QRegion &rgn, const QSize &s ) const
++{
++ if ( trans == None )
++ return rgn;
++
++ QRegion trgn;
++ QArray<QRect> a = rgn.rects();
++ const QRect *r = a.data();
++ QRect tr;
++
++ int w = s.width();
++ int h = s.height();
++ int size = a.size();
++
++ switch ( trans ) {
++ case Rot270:
++ for ( int i = 0; i < size; i++, r++ ) {
++ tr.setCoords( r->y(), w - r->x() - 1,
++ r->bottom(), w - r->right() - 1 );
++ trgn |= tr.normalize();
++ }
++ break;
++ case Rot90:
++ for ( int i = 0; i < size; i++, r++ ) {
++ tr.setCoords( h - r->y() - 1, r->x(),
++ h - r->bottom() - 1, r->right() );
++ trgn |= tr.normalize();
++ }
++ break;
++ case Rot180:
++ for ( int i = 0; i < size; i++, r++ ) {
++ tr.setCoords( w - r->x() - 1, h - r->y() - 1,
++ w - r->right() - 1, h - r->bottom() - 1 );
++ trgn |= tr.normalize();
++ }
++ break;
++ default:
++ break;
++ }
++
++ return trgn;
++}
++
++/*!
++ 0 = none
++ 1..3 = rotates 90..270
++ 4..7 = mirrored 0..3
++*/
++int QW100Screen::transformOrientation() const
++{
++ return (int)trans;
++}
++
++
++void qws_w100Transformation( int t )
++{
++ if ( qt_w100_screen ) {
++ qt_w100_screen->setTransformation( static_cast<QW100Screen::Transformation>( t ) );
++ }
++}
++
++extern bool qws_accel;
++
++extern "C" QScreen * qt_get_screen_w100( int display_id )
++{
++ return( new QW100Screen( display_id ) );
++}
+--- qt-2.3.10/src/kernel/qapplication_qws.cpp~w100
++++ qt-2.3.10/src/kernel/qapplication_qws.cpp
+@@ -1450,16 +1450,25 @@
+ extern void qws_clearLoadedFonts();
+ #endif
+
++#ifndef QT_NO_QWS_W100
++extern void qws_w100Transformation( int t );
++#endif
++
+ void QWSDisplay::setTransformation( int t )
+ {
+-#ifndef QT_NO_QWS_TRANSFORMED
++#if !defined(QT_NO_QWS_TRANSFORMED) || !defined(QT_NO_QWS_W100)
+ QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect,
+ QSize(qt_screen->width(), qt_screen->height()) );
+
+ QPixmapCache::clear();
+ qws_clearLoadedFonts();
+ qws_mapPixmaps( TRUE );
++#ifndef QT_NO_QWS_TRANSFORMED
+ qws_setScreenTransformation( t );
++#endif
++#ifndef QT_NO_QWS_W100
++ qws_w100Transformation( t );
++#endif
+ qws_mapPixmaps( FALSE );
+
+ if ( qt_fbdpy->d->directServerConnection() ) {
diff --git a/recipes-qt/qte/qte-2.3.10/c7x0-w100-gcc4.patch b/recipes-qt/qte/qte-2.3.10/c7x0-w100-gcc4.patch
new file mode 100644
index 0000000..101f959
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/c7x0-w100-gcc4.patch
@@ -0,0 +1,31 @@
+diff --git a/src/kernel/qgfxw100_qws.cpp b/src/kernel/qgfxw100_qws.cpp
+index cbc42d6..b5dfe31 100644
+--- a/src/kernel/qgfxw100_qws.cpp
++++ b/src/kernel/qgfxw100_qws.cpp
+@@ -1250,7 +1250,7 @@ void QGfxW100< depth, type>::dDrawPolyline( const QPointArray &a,
+ points[ npoints ] = points[ npoints - 1 ];
+
+
+- GFX_START( clipbounds );
++ GFX_START( this->clipbounds );
+ driver.setFrgColour( this->cpen.color().rgb() );
+ driver.setRopOperation( ROP3_PATCOPY );
+ for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
+@@ -1341,7 +1341,7 @@ void QGfxW100< depth, type>::dDrawPoint( int x, int y )
+ point.XCoord = x + this->xoffs;
+ point.YCoord = y + this->yoffs;
+
+- GFX_START( clipbounds );
++ GFX_START( this->clipbounds );
+ driver.setFrgColour( this->cpen.color().rgb() );
+ driver.setRopOperation( ROP3_PATCOPY );
+ for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
+@@ -1413,7 +1413,7 @@ void QGfxW100< depth, type>::dDrawPoints( const QPointArray &a,
+ points[i].YCoord = a[i+index].y() + this->yoffs;
+ }
+
+- GFX_START( clipbounds );
++ GFX_START( this->clipbounds );
+ driver.setFrgColour( this->cpen.color().rgb() );
+ driver.setRopOperation( ROP3_PATCOPY );
+ for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
diff --git a/recipes-qt/qte/qte-2.3.10/daemonize.patch b/recipes-qt/qte/qte-2.3.10/daemonize.patch
new file mode 100644
index 0000000..487a18c
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/disable-dup-rotation.patch b/recipes-qt/qte/qte-2.3.10/disable-dup-rotation.patch
new file mode 100644
index 0000000..6874ba5
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/disable-dup-rotation.patch
@@ -0,0 +1,13 @@
+--- qte/src/kernel/kernelkeyboard.cpp 2008-05-26 16:25:23.000000000 +0100
++++ qte/src/kernel/kernelkeyboard.cpp 2008-05-26 16:27:52.000000000 +0100
+@@ -627,8 +627,10 @@
+ case Qt::Key_Down:
+ unicode = 0xffff;
+ mod_key = false;
++#if 0
+ if (qt_screen->isTransformed())
+ qtKeyCode = static_cast<Qt::Key>( xform_dirkey(static_cast<int>( qtKeyCode ) ) );
++#endif
+ break;
+ /*
+ * handle lock, we don't handle scroll lock!
diff --git a/recipes-qt/qte/qte-2.3.10/encoding.patch b/recipes-qt/qte/qte-2.3.10/encoding.patch
new file mode 100644
index 0000000..13a4828
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/fix-errno-exception-spec.patch b/recipes-qt/qte/qte-2.3.10/fix-errno-exception-spec.patch
new file mode 100644
index 0000000..19a5c13
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/fix-errno-exception-spec.patch
@@ -0,0 +1,16 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/src/kernel/qsoundqss_qws.cpp~fix-errno-exception-spec.patch
++++ qt-2.3.10/src/kernel/qsoundqss_qws.cpp
+@@ -51,8 +51,6 @@
+ #include <sys/ioctl.h>
+ #include <sys/soundcard.h>
+
+-extern int errno;
+-
+ #define QT_QWS_SOUND_16BIT 1 // or 0, or undefined for always 0
+ #define QT_QWS_SOUND_STEREO 1 // or 0, or undefined for always 0
+
diff --git a/recipes-qt/qte/qte-2.3.10/fix-linuxfb-offscreenoverflow.patch b/recipes-qt/qte/qte-2.3.10/fix-linuxfb-offscreenoverflow.patch
new file mode 100644
index 0000000..a604630
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/fix-linuxfb-offscreenoverflow.patch
@@ -0,0 +1,22 @@
+Fix an overflow when the amount of requested cache memory
+is greater than the *lowest value
+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-offscreenoverflow
++++ qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp
+@@ -610,6 +610,11 @@
+
+ // No free blocks in already-taken memory; get some more
+ // if we can
++ if ( amount >= (*lowest ) ) {
++ //Avoid this overflow
++ qt_fbdpy->ungrab();
++ return 0;
++ }
+ unsigned int newlowest = (*lowest)-amount;
+ if (newlowest % align) {
+ newlowest -= align;
diff --git a/recipes-qt/qte/qte-2.3.10/fix-linuxfb-setmode.patch b/recipes-qt/qte/qte-2.3.10/fix-linuxfb-setmode.patch
new file mode 100644
index 0000000..212463c
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/fix-native-build.patch b/recipes-qt/qte/qte-2.3.10/fix-native-build.patch
new file mode 100644
index 0000000..7670d44
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/fix-native-build.patch
@@ -0,0 +1,11 @@
+--- qt-2.3.10/src/kernel/qwindowsystem_qws.h.orig 2005-09-19 17:50:39.000000000 +0200
++++ qt-2.3.10/src/kernel/qwindowsystem_qws.h 2005-09-19 17:50:45.000000000 +0200
+@@ -53,6 +53,8 @@
+ class QWSRegionManager;
+ class QGfx;
+ class QWSServerData;
++class QWSInputMethod;
++class QWSGestureMethod;
+
+ class QWSInternalWindowInfo
+ {
diff --git a/recipes-qt/qte/qte-2.3.10/fix-qgfxraster.patch b/recipes-qt/qte/qte-2.3.10/fix-qgfxraster.patch
new file mode 100644
index 0000000..7bc1e2a
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/fix-qscreen-sync.patch b/recipes-qt/qte/qte-2.3.10/fix-qscreen-sync.patch
new file mode 100644
index 0000000..47929ee
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/fix-qscreen-sync.patch
@@ -0,0 +1,17 @@
+Add a sync member to QScreen class
+Manuel Teira <manuel.teira@telefonica.net>
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/src/kernel/qgfx_qws.h~fix-qscreen-sync
++++ qt-2.3.10/src/kernel/qgfx_qws.h
+@@ -191,6 +191,7 @@
+ virtual int pixmapOffsetAlignment() { return 64; }
+ virtual int pixmapLinestepAlignment() { return 64; }
+
++ virtual void sync() {}
+ virtual bool onCard(unsigned char *) const;
+ virtual bool onCard(unsigned char *, ulong& out_offset) const;
+
diff --git a/recipes-qt/qte/qte-2.3.10/fix-qte-asm-include.patch b/recipes-qt/qte/qte-2.3.10/fix-qte-asm-include.patch
new file mode 100644
index 0000000..951bd82
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/fix-qte-asm-include.patch
@@ -0,0 +1,19 @@
+--- a/src/kernel/qpixmapcache.cpp 2005-01-23 14:00:46.000000000 +0000
++++ b/src/kernel/qpixmapcache.cpp 2009-11-05 22:49:44.000000000 +0000
+@@ -119,13 +119,13 @@
+ #include <time.h>
+ #include <stdio.h>
+ #include <signal.h>
++#include <unistd.h>
+
+ #ifdef THROW_AWAY_UNUSED_PAGES
+ # include <sys/mman.h> // madvise
+-# include <asm/page.h> // PAGE_SIZE,PAGE_MASK,PAGE_ALIGN
+-# ifndef PAGE_ALIGN
++# define PAGE_SIZE getpagesize()
++# define PAGE_MASK (~(PAGE_SIZE-1))
+ # define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
+-# endif // PAGE_ALIGN
+ #endif // THROW_AWAY_UNUSED_PAGES
+
+
diff --git a/recipes-qt/qte/qte-2.3.10/gcc3.patch b/recipes-qt/qte/qte-2.3.10/gcc3.patch
new file mode 100644
index 0000000..fc1656a
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/gcc4.patch b/recipes-qt/qte/qte-2.3.10/gcc4.patch
new file mode 100644
index 0000000..550effd
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/gcc4.patch
@@ -0,0 +1,16 @@
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+--- qt-2.3.10/src/tools/qvaluestack.h~gcc4 2005-01-23 15:00:47.000000000 +0100
++++ qt-2.3.10/src/tools/qvaluestack.h 2006-03-19 02:32:56.000000000 +0100
+@@ -54,7 +54,7 @@
+ {
+ T elem( this->last() );
+ if ( !this->isEmpty() )
+- remove( this->fromLast() );
++ this->remove( this->fromLast() );
+ return elem;
+ }
+ T& top() { return this->last(); }
diff --git a/recipes-qt/qte/qte-2.3.10/handhelds.patch b/recipes-qt/qte/qte-2.3.10/handhelds.patch
new file mode 100644
index 0000000..f67766a
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/handhelds.patch
@@ -0,0 +1,60 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10-snapshot-20050131/src/widgets/qcommonstyle.cpp~opie
++++ qt-2.3.10-snapshot-20050131/src/widgets/qcommonstyle.cpp
+@@ -572,7 +572,7 @@
+ bool enabled, bool active )
+ {
+ #ifndef QT_NO_MENUBAR
+-#ifndef QT_NO_STYLE_SGI
++#if 1 // #ifndef QT_NO_STYLE_SGI
+ if (draw_menu_bar_impl != 0) {
+ QDrawMenuBarItemImpl impl = draw_menu_bar_impl;
+ (this->*impl)(p, x, y, w, h, mi, g, enabled, active);
+--- qt-2.3.10-snapshot-20050131/src/widgets/qlistview.cpp~opie
++++ qt-2.3.10-snapshot-20050131/src/widgets/qlistview.cpp
+@@ -5051,9 +5051,9 @@
+ l = l->childItem ? l->childItem : l->siblingItem;
+
+ if ( l && l->height() )
+- s.setHeight( s.height() + 10 * l->height() );
+- else
+- s.setHeight( s.height() + 140 );
++ s.setHeight( s.height() + 4 /*10*/ * l->height() );
++ else // ^v much too big for handhelds
++ s.setHeight( s.height() + 30 /*140*/ );
+
+ if ( s.width() > s.height() * 3 )
+ s.setHeight( s.width() / 3 );
+--- qt-2.3.10-snapshot-20050131/src/kernel/qwindowsystem_qws.cpp~opie
++++ qt-2.3.10-snapshot-20050131/src/kernel/qwindowsystem_qws.cpp
+@@ -918,6 +918,18 @@
+ {
+ }
+
++static void catchSegvSignal( int )
++{
++#ifndef QT_NO_QWS_KEYBOARD
++ if ( qwsServer )
++ qwsServer->closeKeyboard();
++#endif
++ QWSServer::closedown();
++ fprintf(stderr, "Segmentation fault.\n");
++ exit(1);
++}
++
++
+ /*!
+ \class QWSServer qwindowsystem_qws.h
+ \brief Server-specific functionality in Qt/Embedded
+@@ -1043,6 +1055,7 @@
+ }
+
+ signal(SIGPIPE, ignoreSignal); //we get it when we read
++ signal(SIGSEGV, catchSegvSignal); //recover the keyboard on crash
+ #endif
+ focusw = 0;
+ mouseGrabber = 0;
diff --git a/recipes-qt/qte/qte-2.3.10/improve-calibration-r0.patch b/recipes-qt/qte/qte-2.3.10/improve-calibration-r0.patch
new file mode 100644
index 0000000..6052510
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/improve-calibration-r0.patch
@@ -0,0 +1,159 @@
+Index: qt-2.3.10/src/kernel/qwsmouse_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qwsmouse_qws.cpp 2005-08-31 13:44:12.000000000 +0000
++++ qt-2.3.10/src/kernel/qwsmouse_qws.cpp 2005-09-01 19:38:27.000000000 +0000
+@@ -14,10 +14,6 @@
+ ** 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.
+ **
+@@ -30,6 +26,12 @@
+ **
+ **********************************************************************/
+
++/*
++ * The 5 point algorithim in QTSLibHandlerPrivate::calibrate() is
++ * GPL only code and Copyright (C) 2001 Russel King.
++ *
++ * Taken from ts_calibrate.c from tslib
++ */
+ #include "qwindowsystem_qws.h"
+ #include "qsocketnotifier.h"
+ #include "qwsevent_qws.h"
+@@ -1813,6 +1815,7 @@
+
+ void QTSLibHandlerPrivate::calibrate( QWSPointerCalibrationData * cd)
+ {
++#ifdef ORIG_CALIBRATE
+ QPoint dev_tl = cd->devPoints[ QWSPointerCalibrationData::TopLeft ];
+ QPoint dev_br = cd->devPoints[ QWSPointerCalibrationData::BottomRight ];
+ QPoint screen_tl = cd->screenPoints[ QWSPointerCalibrationData::TopLeft ];
+@@ -1843,6 +1846,122 @@
+ {
+ qDebug( "Could not save calibration: %s", calFile.latin1() );
+ }
++
++#else
++ int j;
++ float n, x, y, x2, y2, xy, z, zx, zy;
++ float det, cal_a, cal_b, cal_c, cal_d, cal_e, cal_f, cal_i;
++ float scaling = 65536.0;
++ int cal_x[5], cal_xfb[5], cal_y[5], cal_yfb[5], cal_o[7];
++
++ cal_x[0]=cd->devPoints[ QWSPointerCalibrationData::TopLeft ].x();
++ cal_y[0]=cd->devPoints[ QWSPointerCalibrationData::TopLeft ].y();
++ cal_x[1]=cd->devPoints[ QWSPointerCalibrationData::TopRight ].x();
++ cal_y[1]=cd->devPoints[ QWSPointerCalibrationData::TopRight ].y();
++ cal_x[2]=cd->devPoints[ QWSPointerCalibrationData::BottomLeft ].x();
++ cal_y[2]=cd->devPoints[ QWSPointerCalibrationData::BottomLeft ].y();
++ cal_x[3]=cd->devPoints[ QWSPointerCalibrationData::BottomRight ].x();
++ cal_y[3]=cd->devPoints[ QWSPointerCalibrationData::BottomRight ].y();
++ cal_x[4]=cd->devPoints[ QWSPointerCalibrationData::Center ].x();
++ cal_y[4]=cd->devPoints[ QWSPointerCalibrationData::Center ].y();
++
++ cal_xfb[0]=cd->screenPoints[ QWSPointerCalibrationData::TopLeft ].x();
++ cal_yfb[0]=cd->screenPoints[ QWSPointerCalibrationData::TopLeft ].y();
++ cal_xfb[1]=cd->screenPoints[ QWSPointerCalibrationData::TopRight ].x();
++ cal_yfb[1]=cd->screenPoints[ QWSPointerCalibrationData::TopRight ].y();
++ cal_xfb[2]=cd->screenPoints[ QWSPointerCalibrationData::BottomLeft ].x();
++ cal_yfb[2]=cd->screenPoints[ QWSPointerCalibrationData::BottomLeft ].y();
++ cal_xfb[3]=cd->screenPoints[ QWSPointerCalibrationData::BottomRight ].x();
++ cal_yfb[3]=cd->screenPoints[ QWSPointerCalibrationData::BottomRight ].y();
++ cal_xfb[4]=cd->screenPoints[ QWSPointerCalibrationData::Center ].x();
++ cal_yfb[4]=cd->screenPoints[ QWSPointerCalibrationData::Center ].y();
++
++ //qDebug("Top left : X = %4d Y = %4d", cal_x[0], cal_y[0]);
++ //qDebug("Top right: X = %4d Y = %4d", cal_x[1], cal_y[1]);
++ //qDebug("Bot left : X = %4d Y = %4d", cal_x[2], cal_y[2]);
++ //qDebug("Bot right: X = %4d Y = %4d", cal_x[3], cal_y[3]);
++ //qDebug("Middle: X = %4d Y = %4d", cal_x[4], cal_y[4]);
++
++ // Get sums for matrix
++ n = x = y = x2 = y2 = xy = 0;
++ for(j=0;j<5;j++) {
++ n += 1.0;
++ x += (float)cal_x[j];
++ y += (float)cal_y[j];
++ x2 += (float)(cal_x[j]*cal_x[j]);
++ y2 += (float)(cal_y[j]*cal_y[j]);
++ xy += (float)(cal_x[j]*cal_y[j]);
++ }
++
++ // Get determinant of matrix -- check if determinant is too small
++ det = n*(x2*y2 - xy*xy) + x*(xy*y - x*y2) + y*(x*xy - y*x2);
++ if(det < 0.1 && det > -0.1) {
++ qDebug("determinant is too small -- %f",det);
++ return;// false;
++ }
++
++ // Get elements of inverse matrix
++ cal_a = (x2*y2 - xy*xy)/det;
++ cal_b = (xy*y - x*y2)/det;
++ cal_c = (x*xy - y*x2)/det;
++ cal_e = (n*y2 - y*y)/det;
++ cal_f = (x*y - n*xy)/det;
++ cal_i = (n*x2 - x*x)/det;
++
++ // Get sums for x calibration
++ z = zx = zy = 0;
++ for(j=0;j<5;j++) {
++ z += (float)cal_xfb[j];
++ zx += (float)(cal_xfb[j]*cal_x[j]);
++ zy += (float)(cal_xfb[j]*cal_y[j]);
++ }
++
++ // Now multiply out to get the calibration for framebuffer x coord
++ cal_o[0] = (int)((cal_a*z + cal_b*zx + cal_c*zy)*(scaling));
++ cal_o[1] = (int)((cal_b*z + cal_e*zx + cal_f*zy)*(scaling));
++ cal_o[2] = (int)((cal_c*z + cal_f*zx + cal_i*zy)*(scaling));
++
++ qDebug("%f %f %f",(cal_a*z + cal_b*zx + cal_c*zy), (cal_b*z + cal_e*zx + cal_f*zy), (cal_c*z + cal_f*zx + cal_i*zy));
++
++ // Get sums for y calibration
++ z = zx = zy = 0;
++ for (j=0;j<5;j++) {
++ z += (float)cal_yfb[j];
++ zx += (float)(cal_yfb[j]*cal_x[j]);
++ zy += (float)(cal_yfb[j]*cal_y[j]);
++ }
++
++ // Now multiply out to get the calibration for framebuffer y coord
++ cal_o[3] = (int)((cal_a*z + cal_b*zx + cal_c*zy)*(scaling));
++ cal_o[4] = (int)((cal_b*z + cal_e*zx + cal_f*zy)*(scaling));
++ cal_o[5] = (int)((cal_c*z + cal_f*zx + cal_i*zy)*(scaling));
++
++ qDebug("%f %f %f",(cal_a*z + cal_b*zx + cal_c*zy), (cal_b*z + cal_e*zx + cal_f*zy), (cal_c*z + cal_f*zx + cal_i*zy));
++
++
++ // If we got here, we're OK, so assign scaling to a[6] and return
++ cal_o[6] = (int) scaling;
++
++ qDebug("Calibration constants: %d %d %d %d %d %d %d",
++ cal_o[0], cal_o[1], cal_o[2],
++ cal_o[3], cal_o[4], cal_o[5],
++ cal_o[6]);
++
++ QString calFile = "/etc/pointercal";
++#ifndef QT_NO_TEXTSTREAM
++ QFile file( calFile );
++ if ( file.open( IO_WriteOnly ) ) {
++ QTextStream t( &file );
++ t << cal_o[1] << " " << cal_o[2] << " " << cal_o[0] << " ";
++ t << cal_o[4] << " " << cal_o[5] << " " << cal_o[3] << " " << cal_o[6];
++ file.flush(); closeTs();
++ openTs();
++ } else
++#endif
++ {
++ qDebug( "Could not save calibration: %s", calFile.latin1() );
++ }
++#endif
+ }
+
+ void QTSLibHandlerPrivate::readMouseData()
diff --git a/recipes-qt/qte/qte-2.3.10/increase-qxml-robustness.patch b/recipes-qt/qte/qte-2.3.10/increase-qxml-robustness.patch
new file mode 100644
index 0000000..3a29b4a
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/ipaq_sound_fix.patch b/recipes-qt/qte/qte-2.3.10/ipaq_sound_fix.patch
new file mode 100644
index 0000000..af72362
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/ipaq_sound_fix.patch
@@ -0,0 +1,60 @@
+Attention HACK ahead:
+ The OpenSoundSystem is just scary this is a special hack
+ for supporting iPAQ(s) at least h3870.
+
+ Features:
+ -It does not crash when playing a 'null' file
+ -Change sound fragment size to 12
+ -Force stereo on!!! (hardcoded at least uda1341 needs it)
+
+
+
+Index: qt-2.3.10/src/kernel/qsoundqss_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qsoundqss_qws.cpp 2005-03-20 17:11:29.000000000 +0100
++++ qt-2.3.10/src/kernel/qsoundqss_qws.cpp 2005-03-20 23:53:46.403129133 +0100
+@@ -73,7 +73,7 @@
+ };
+
+ #if defined(QT_QWS_IPAQ)
+-static const int sound_fragment_size = 12;
++static const int sound_fragment_size = 14;
+ #else
+ static const int sound_fragment_size = 12;
+ #endif
+@@ -451,8 +451,14 @@
+
+ int devSamples()
+ {
+- int possible = (((max1+max2-out) / ((chunkdata.wBitsPerSample>>3)*chunkdata.channels))
+- *sound_speed)/chunkdata.samplesPerSec;
++ if ( !(chunkdata.wBitsPerSample>>3) ||
++ !chunkdata.channels ||
++ !sound_speed ||
++ !chunkdata.samplesPerSec )
++ return 0;
++
++ int possible = (((max1+max2-out) / ((chunkdata.wBitsPerSample>>3 )*chunkdata.channels))
++ *sound_speed)/chunkdata.samplesPerSec;
+
+ return possible;
+ }
+@@ -1116,12 +1127,14 @@
+ if ( AFMT_U8 != v )
+ qDebug("Want format %d got %d", AFMT_U8, v);
+ #endif
+- v=sound_stereo; if ( ioctl(fd, SNDCTL_DSP_STEREO, &v) )
++ v=1; if ( ioctl(fd, SNDCTL_DSP_STEREO, &v) )
+ qWarning("Could not set stereo %d",v);
+ if ( sound_stereo != v )
+- qDebug("Want stereo %d got %d", sound_stereo, v);
+-#ifdef QT_QWS_SOUND_STEREO
+- sound_stereo=v;
++ qDebug("Want stereo %d got %d", sound_stereo, v);
++#if defined(QT_QWS_IPAQ)
++ sound_stereo=1;
++#elif QT_QWS_SOUND_STEREO
++ sound_stereo=v;
+ #endif
+ v=sound_speed; if ( ioctl(fd, SNDCTL_DSP_SPEED, &sound_speed) )
+ qWarning("Could not set speed %d",v);
diff --git a/recipes-qt/qte/qte-2.3.10/kernel-keymap-corgi.patch b/recipes-qt/qte/qte-2.3.10/kernel-keymap-corgi.patch
new file mode 100644
index 0000000..0fabd78
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/kernel-keymap.patch b/recipes-qt/qte/qte-2.3.10/kernel-keymap.patch
new file mode 100644
index 0000000..0111c83
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/kernel-keymap.patch
@@ -0,0 +1,1293 @@
+--- /dev/null 2004-07-13 00:58:01.000000000 +0000
++++ qte/src/kernel/kernelkeyboard.cpp 2007-04-07 01:00:36.000000000 +0000
+@@ -0,0 +1,769 @@
++/*
++
++ Copyright (C) 2003 Chris Larson
++ 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 Chris Larson 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.
++
++*/
++
++/*
++ Copyright (C) 2005 ROAD GmbH
++
++ 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.
++
++ You should have received a copy of the GNU General Public
++ License along with this program; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330,
++ Boston, MA 02111-1307 USA
++
++
++ Changes Done:
++ -ShiftL and ShiftR modifier handling
++ -Keypad handling improved
++ -Handle unmapped keys by lookin them up in the first column
++ -Handle AutoRepeat
++ -Handle Keys >127
++ -Handle Increment and Decrement the Console
++ -Handle the Home Key
++ -Fix handling of Function Keys
++ -Fix handling of the unicode value (to fix QPopupMenu,QAction)
++
++ */
++
++/*
++ Paul Sokolovsky, 2007-04:
++
++ 1. Added support for nicely named and extensible key bindings.
++ E.g., in loadkeys do:
++ keycode 155 = F100
++ string F100 = "power"
++ where 155 is keycode a power button happens to have on your machine, F100 is
++ arbitrary function key (please use F100-F120), and "power" is OPIE binding.
++ Currently defined bindings are "power", "backlight", "record"
++ 2. K_DO ("Do") keycode is mapped to OPIE power button by default. Kernel uses
++ K_DO for KEY_POWER input subsystem keycode. So, if your device does the right
++ thing, it will work out of the box.
++ 3. Implemented NumLock handling for numeric keypad.
++ */
++
++/*
++ This is an alternative implementation of the QWSTtyKeyboardHandler
++ of Trolltech's QtE.
++
++ Instead of using a hardcoded incomplete map, this implementation
++ imports the Keymap from a Linux Kernel.
++
++ */
++
++
++//
++// 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 ) {
++ QSocketNotifier *notifier;
++ notifier = new QSocketNotifier( kbdFD, QSocketNotifier::Read, this );
++ connect( notifier, SIGNAL(activated(int)),this,
++ SLOT(readKeyboardData()) );
++
++ // save for restore.
++ tcgetattr( kbdFD, &origTermData );
++
++ struct termios termdata;
++ tcgetattr( kbdFD, &termdata );
++
++#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
++ ioctl(kbdFD, KDSKBMODE, K_MEDIUMRAW);
++#endif
++
++ 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);
++
++ readUnicodeMap();
++ readKeyboardMap();
++
++ signal(VTSWITCHSIG, vtSwitchHandler);
++
++#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
++ 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;
++#endif
++ }
++}
++
++QWSTtyKeyboardHandler::~QWSTtyKeyboardHandler()
++{
++ restoreLeds();
++ 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
++ tcsetattr(kbdFD, TCSANOW, &origTermData);
++ ::close(kbdFD);
++ kbdFD = -1;
++ }
++}
++void QWSTtyKeyboardHandler::readUnicodeMap()
++{
++ if (kbdFD < 0)
++ return;
++ if (ioctl(kbdFD,GIO_UNISCRNMAP,acm) != 0)
++ return;
++}
++
++static Qt::Key getSpecialKey(int fKey)
++{
++ struct kbsentry kbs;
++ kbs.kb_func = fKey;
++
++ if (ioctl(kbdFD, KDGKBSENT, &kbs) != 0)
++ return Qt::Key_unknown;
++ const char *str = (const char *)kbs.kb_string;
++
++ if (!strcmp("record", str))
++ return Qt::Key_F24;
++ else if (!strcmp("power", str))
++ return Qt::Key_F34;
++ else if (!strcmp("backlight", str))
++ return Qt::Key_F35;
++
++ return Qt::Key_unknown;
++}
++
++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) ||
++ ((kbe.kb_value == K_HOLE) || (kbe.kb_value == K_NOSUCHMAP)) ) {
++ kernel_map[map][key] = KeyMap( KeyMap::Key_NotMapped, 0 );
++ 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:
++ case KT_META:
++ 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 >= 30 && kval <= 44)
++ kernel_map[map][key] = KeyMap( static_cast<Qt::Key>( Qt::Key_F21 + (kval - 30) ), kval );
++ else {
++ Qt::Key specialKey = getSpecialKey(kval);
++ if (specialKey != Qt::Key_unknown) {
++ kernel_map[map][key] = KeyMap( specialKey, 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:
++ kernel_map[map][key] = KeyMap( Qt::Key_Home, kval );
++ break;
++ case K_DO:
++ kernel_map[map][key] = KeyMap( Qt::Key_F34, kval );
++ break;
++ 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_DECRCONSOLE:
++ kernel_map[map][key] = KeyMap( KeyMap::Key_DecConsole, kval );
++ break;
++ case K_INCRCONSOLE:
++ kernel_map[map][key] = KeyMap( KeyMap::Key_IncConsole, 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_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, kbe.kb_value );
++ break;
++ case K_P1:
++ kernel_map[map][key] = KeyMap( Qt::Key_1, kbe.kb_value );
++ break;
++ case K_P2:
++ kernel_map[map][key] = KeyMap( Qt::Key_2, kbe.kb_value );
++ break;
++ case K_P3:
++ kernel_map[map][key] = KeyMap( Qt::Key_3, kbe.kb_value );
++ break;
++ case K_P4:
++ kernel_map[map][key] = KeyMap( Qt::Key_4, kbe.kb_value );
++ break;
++ case K_P5:
++ kernel_map[map][key] = KeyMap( Qt::Key_5, kbe.kb_value );
++ break;
++ case K_P6:
++ kernel_map[map][key] = KeyMap( Qt::Key_6, kbe.kb_value );
++ break;
++ case K_P7:
++ kernel_map[map][key] = KeyMap( Qt::Key_7, kbe.kb_value );
++ break;
++ case K_P8:
++ kernel_map[map][key] = KeyMap( Qt::Key_8, kbe.kb_value );
++ break;
++ case K_P9:
++ kernel_map[map][key] = KeyMap( Qt::Key_9, kbe.kb_value );
++ break;
++ case K_PPLUS:
++ kernel_map[map][key] = KeyMap( Qt::Key_Plus, '+' );
++ break;
++ case K_PMINUS:
++ kernel_map[map][key] = KeyMap( Qt::Key_Minus, '-' );
++ break;
++ case K_PSTAR:
++ kernel_map[map][key] = KeyMap( Qt::Key_multiply, '*' );
++ break;
++ case K_PSLASH:
++ kernel_map[map][key] = KeyMap( Qt::Key_division, '/' );
++ 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, '.' ) ;
++ break;
++ case K_PPLUSMINUS:
++ kernel_map[map][key] = KeyMap( Qt::Key_plusminus, kval );
++ break;
++ case K_PDOT:
++ kernel_map[map][key] = KeyMap( Qt::Key_Comma, '.' ) ;
++ 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;
++
++ /*
++ * Console keys
++ */
++ case KT_CONS:
++ if ( kval < 10 )
++ kernel_map[map][key] = KeyMap(static_cast<KeyMap::ExtraKey>( KeyMap::Key_Console1+kval ), kval );
++ else
++ 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:
++ kernel_map[map][key] = KeyMap( KeyMap::Key_ShiftL, kval );
++ break;
++ case K_SHIFTR:
++ kernel_map[map][key] = KeyMap( KeyMap::Key_ShiftR, kval );
++ break;
++ 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 || key == KeyMap::Key_DecConsole )
++ term = QMAX(vtQws -1, 1 );
++ else if ( key == Qt::Key_Right || key == KeyMap::Key_IncConsole )
++ 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;
++ }
++}
++
++static Qt::Key numpad2cursor[NR_PAD] = {
++ Qt::Key_Insert,
++ Qt::Key_End,
++ Qt::Key_Down,
++ Qt::Key_Next,
++ Qt::Key_Left,
++ Qt::Key_5,
++ Qt::Key_Right,
++ Qt::Key_Home,
++ Qt::Key_Up,
++ Qt::Key_Prior,
++};
++
++void QWSTtyKeyboardHandler::handleKey(unsigned int code, bool release)
++{
++ int old_modifier = modifier;
++ bool mod_key = true;
++
++ KeyMap key_map = kernel_map[current_map][code];
++ if( key_map.key == KeyMap::Key_NotMapped ) {
++ qWarning("Unmapped Key Pressed fixing up map:%d modif:%d code:%d", current_map, modifier, code);
++ key_map = kernel_map[0][code];
++ }
++
++ unsigned short unicode = 0xffff;
++ if (key_map.code < 0x100)
++ unicode = acm[key_map.code & 0xff] & 0xff;
++ 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:
++ unicode = 0xffff;
++ modif = (1<<KG_ALT);
++ map = modif;
++ break;
++ case Qt::Key_Control:
++ unicode = 0xffff;
++ modif = (1<<KG_CTRL);
++ map = modif;
++ break;
++ case Qt::Key_Shift:
++ unicode = 0xffff;
++ modif = (1<<KG_SHIFT);
++ map = modif;
++ break;
++ case KeyMap::Key_AltGr:
++ map = (1<<KG_ALTGR );
++ break;
++ case KeyMap::Key_ShiftL:
++ unicode = 0xfff;
++ map = (1<<KG_SHIFTL);
++ break;
++ case KeyMap::Key_ShiftR:
++ unicode = 0xfff;
++ map = (1<<KG_SHIFTR);
++ break;
++ case Qt::Key_Left:
++ case Qt::Key_Right:
++ case Qt::Key_Up:
++ case Qt::Key_Down:
++ unicode = 0xffff;
++ 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:
++ unicode = 0xffff;
++ 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 NumLock
++ if (KTYP(key_map.code) == KT_PAD) {
++ if (!numlock) {
++ qtKeyCode = numpad2cursor[KVAL(key_map.code)];
++ } else {
++ unicode = KVAL(key_map.code) + '0';
++ }
++ }
++
++ /*
++ * do not repeat modifier keys
++ */
++ if ( modifier == old_modifier && mod_key )
++ return;
++
++ processKeyEvent(unicode, qtKeyCode, map_to_modif(), !release, 0);
++}
++
++
++/*
++ * We will read the keys off the kernel. We have two cases here
++ * 1. ) keycode < 128, bit8 is the down/up bit and the rest is
++ * is the value of the key. we can simply process it
++ * 2. ) keycode > 128, the first byte is either empty or 0x80.
++ * We need to save the status ( press/release ) the following
++ * two bytes.
++ * The difficulty is we might have not read all keys into the
++ * buffer. This makes the reading of highkeys a bit harder and
++ * I've decided against rereading, or adding a special case for
++ * the 'all' buffers in loop instead we have a simple state machine.
++ */
++void QWSTtyKeyboardHandler::readKeyboardData()
++{
++ unsigned char buf[81];
++ unsigned char code;
++ bool release = false;
++ bool release_bit;
++
++ bool highKey = false;
++ unsigned int highKeyCode = 0;
++ unsigned int highNeedMoreKey = 0;
++
++ int n = ::read(kbdFD, buf, 80 );
++ for ( int loop = 0; loop < n; loop++ ) {
++ code = buf[loop] & 0x7f;
++ release_bit = buf[loop] & 0x80;
++
++ if ( highKey ) {
++ if ( highNeedMoreKey == 2 ) {
++ highNeedMoreKey--;
++ highKeyCode = code << 7;
++ }else if ( highNeedMoreKey == 1 ) {
++ highNeedMoreKey = 0;
++ highKeyCode |= code;
++ highKey = false;
++ if ( highKeyCode > 127 && highKeyCode < NR_KEYS )
++ handleKey( highKeyCode, release );
++ }
++ }else if (code == 0) {
++ highKey = true;
++ highNeedMoreKey = 2;
++ release = release_bit;
++ }else {
++ release = release_bit;
++ handleKey(code, release);
++ }
++ }
++}
++
++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 );
++}
++
++void QWSTtyKeyboardHandler::processKeyEvent(int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ) {
++ static int last_unicode = -1;
++ static int last_keycode = -1;
++
++ autoRepeat = false;
++ if( last_unicode == unicode && last_keycode == keycode && isPress )
++ autoRepeat = true;
++
++ QWSPC101KeyboardHandler::processKeyEvent(unicode, keycode, modifiers, isPress, autoRepeat);
++
++ if ( isPress ) {
++ last_unicode = unicode;
++ last_keycode = keycode;
++ } else {
++ last_unicode = last_keycode = -1;
++ }
++}
+Index: src/kernel/qkeyboard_qws.cpp
+===================================================================
+--- qte/src/kernel/qkeyboard_qws.cpp.orig 2006-04-01 23:36:22.499297680 +0200
++++ qte/src/kernel/qkeyboard_qws.cpp 2006-04-01 23:38:19.913448016 +0200
+@@ -45,15 +45,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 +138,6 @@
+ };
+
+
+-#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 +161,6 @@
+ int xf = qt_screen->transformOrientation() + dir_keyrot;
+ return (key-Qt::Key_Left+xf)%4+Qt::Key_Left;
+ }
+-#endif
+
+ #define VTSWITCHSIG SIGUSR2
+
+@@ -643,18 +634,81 @@
+ ioctl(0, KDSETLED, leds);
+ }
+
++/*
++ * This class was extended by:
++ *
++ * Copyright 2002 Chris Larson
++ * Copyright 2004, 2005 Holger Hans Peter Freyther
++ */
+ class QWSTtyKeyboardHandler : public QWSPC101KeyboardHandler
+ {
+ Q_OBJECT
+ public:
+ QWSTtyKeyboardHandler(const QString&);
+ virtual ~QWSTtyKeyboardHandler();
++ void readKeyboardMap();
++ void readUnicodeMap();
++ void handleKey(unsigned int key, bool release);
+
+ 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,
++ Key_ShiftL = 0x130000,
++ Key_ShiftR = 0x130001,
++ Key_IncConsole= 0x130002,
++ Key_DecConsole= 0x130003,
++ Key_NotMapped = 0x130004,
++ };
++
++ 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;
++
++protected:
++ void processKeyEvent(int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
+ };
+
+
+@@ -814,6 +868,7 @@
+ fn = FALSE;
+
+ numLock = FALSE;
++#if 0
+ sharp_kbdctl_modifstat st;
+ int dev = ::open("/dev/sharp_kbdctl", O_RDWR);
+ if( dev >= 0 ) {
+@@ -825,6 +880,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;
+@@ -1250,98 +1306,10 @@
+ //
+ // Tty keyboard
+ //
+-
+-QWSTtyKeyboardHandler::QWSTtyKeyboardHandler(const QString& device)
+-{
+- kbdFD=open(device.isEmpty() ? "/dev/tty0" : device.latin1(), O_RDWR | O_NDELAY, 0);
+-
+- if ( kbdFD >= 0 ) {
+- QSocketNotifier *notifier;
+- notifier = new QSocketNotifier( kbdFD, QSocketNotifier::Read, this );
+- connect( notifier, SIGNAL(activated(int)),this,
+- SLOT(readKeyboardData()) );
+-
+- // save for restore.
+- tcgetattr( kbdFD, &origTermData );
+-
+- struct termios termdata;
+- 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
+-#endif
+-
+- 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);
+-
+- signal(VTSWITCHSIG, vtSwitchHandler);
+-
+-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
+- 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;
+-#endif
+- }
+-}
+-
+-QWSTtyKeyboardHandler::~QWSTtyKeyboardHandler()
+-{
+- 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
+- tcsetattr(kbdFD, TCSANOW, &origTermData);
+- ::close(kbdFD);
+- kbdFD = -1;
+- }
+-}
+-
+-void QWSTtyKeyboardHandler::readKeyboardData()
+-{
+- unsigned char buf[81];
+- int n = ::read(kbdFD, buf, 80 );
+- for ( int loop = 0; loop < n; loop++ )
+- doKey(buf[loop]);
+-}
++/*
++ * Include the alternative implementation
++ */
++#include "kernelkeyboard.cpp"
+
+ typedef struct {
+ unsigned short key;
+Index: src/kernel/keyboard_linux_to_qt.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ qte/src/kernel/keyboard_linux_to_qt.h 2006-04-01 23:37:03.928999408 +0200
+@@ -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_At,
++Qt::Key_A,
++Qt::Key_B,
++Qt::Key_C,
++Qt::Key_D,
++Qt::Key_E,
++Qt::Key_F,
++Qt::Key_G,
++Qt::Key_Backspace,
++Qt::Key_Tab,
++Qt::Key_J, // Linefeed
++Qt::Key_K,
++Qt::Key_L,
++Qt::Key_Enter,
++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_Escape,
++Qt::Key_Backslash,
++Qt::Key_BracketRight,
++Qt::Key_AsciiCircum,
++Qt::Key_Underscore,
++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/recipes-qt/qte/qte-2.3.10/key.patch b/recipes-qt/qte/qte-2.3.10/key.patch
new file mode 100644
index 0000000..d3cf4f7
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/key.patch
@@ -0,0 +1,74 @@
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+Index: qt-2.3.10/src/kernel/qkeyboard_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qkeyboard_qws.cpp 2005-03-31 17:51:14.978609000 -0500
++++ qt-2.3.10/src/kernel/qkeyboard_qws.cpp 2005-03-31 17:54:28.140243968 -0500
+@@ -848,6 +848,9 @@
+ bool release = false;
+ int keypad = 0;
+
++#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // need autorepeat implemented here?
++ bool repeatable = TRUE;
++
+ #ifndef QT_QWS_USE_KEYCODES
+ #if defined(QT_QWS_IPAQ)
+ // map ipaq 'action' key (0x60, 0xe0)
+@@ -984,9 +987,6 @@
+ if ( currentKey )
+ keyCode = currentKey->key_code;
+
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // need autorepeat implemented here?
+- bool repeatable = TRUE;
+-
+ #if defined(QT_QWS_IPAQ)
+ switch (code) {
+ #if defined(QT_QWS_SL5XXX)
+@@ -1061,25 +1061,23 @@
+ repeatable = FALSE;
+ #endif
+
++#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
+ if ( qt_screen->isTransformed()
+ && keyCode >= Qt::Key_Left && keyCode <= Qt::Key_Down )
+ {
+ keyCode = xform_dirkey(keyCode);
+ }
+-
+-#ifdef QT_QWS_AUTOREPEAT_MANUALLY
+- if ( repeatable && !release )
+- rep->start(prevuni,prevkey,modifiers);
+- else
+- rep->stop();
+ #endif
++
+ #endif
+ /*
+ Translate shift+Key_Tab to Key_Backtab
+ */
+ if (( keyCode == Key_Tab ) && shift )
+ keyCode = Key_Backtab;
++#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
+ }
++#endif
+
+ #ifndef QT_QWS_USE_KEYCODES
+ /*
+@@ -1234,6 +1232,14 @@
+ } else {
+ prevkey = prevuni = 0;
+ }
++
++#ifdef QT_QWS_AUTOREPEAT_MANUALLY
++ if ( repeatable && !release )
++ rep->start(prevuni,prevkey,modifiers);
++ else
++ rep->stop();
++#endif
++
+ }
+ #ifndef QT_QWS_USE_KEYCODES
+ extended = 0;
diff --git a/recipes-qt/qte/qte-2.3.10/keyboardless-buttonmap.patch b/recipes-qt/qte/qte-2.3.10/keyboardless-buttonmap.patch
new file mode 100644
index 0000000..9bea5b6
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/keyboardless-buttonmap.patch
@@ -0,0 +1,19 @@
+--- qt-2.3.10/src/kernel/qkeyboard_qws.cpp.org 2006-09-16 20:54:32.000000000 +0000
++++ qt-2.3.10/src/kernel/qkeyboard_qws.cpp 2006-10-06 13:25:29.000000000 +0000
+@@ -1018,6 +1018,16 @@
+ repeatable = FALSE;
+ break;
+ #endif
++
++ case 0x74: // kernel KEY_POWER
++ keyCode = Key_F34;
++ repeatable = FALSE;
++ break;
++ case 89: // kernel KEY_RO
++ keyCode = Key_F24;
++ repeatable = FALSE;
++ break;
++
+ case 0x78:
+ # if defined(QT_QWS_IPAQ)
+ keyCode = Key_F24; // record
diff --git a/recipes-qt/qte/qte-2.3.10/no-moc.patch b/recipes-qt/qte/qte-2.3.10/no-moc.patch
new file mode 100644
index 0000000..128f8a6
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/qiconview-speed.patch b/recipes-qt/qte/qte-2.3.10/qiconview-speed.patch
new file mode 100644
index 0000000..bac9b97
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/qpe.patch b/recipes-qt/qte/qte-2.3.10/qpe.patch
new file mode 100644
index 0000000..554c42c
--- /dev/null
+++ b/recipes-qt/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
++
++#undef 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/recipes-qt/qte/qte-2.3.10/qt-visibility.patch b/recipes-qt/qte/qte-2.3.10/qt-visibility.patch
new file mode 100644
index 0000000..ccdebb0
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/qtabbar.patch b/recipes-qt/qte/qte-2.3.10/qtabbar.patch
new file mode 100644
index 0000000..6940ec9
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/qte-fix-iconsize.patch b/recipes-qt/qte/qte-2.3.10/qte-fix-iconsize.patch
new file mode 100644
index 0000000..cc14315
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/remove-unused-kbdhandler.patch b/recipes-qt/qte/qte-2.3.10/remove-unused-kbdhandler.patch
new file mode 100644
index 0000000..2bebb02
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/remove-unused-kbdhandler.patch
@@ -0,0 +1,420 @@
+--- qt-2.3.10.orig/src/kernel/qkeyboard_qws.cpp.org 2007-07-19 11:00:39.000000000 +0300
++++ qt-2.3.10/src/kernel/qkeyboard_qws.cpp 2007-07-19 12:14:48.000000000 +0300
+@@ -853,417 +853,6 @@
+
+ void QWSPC101KeyboardHandler::doKey(uchar code)
+ {
+- const QWSServer::KeyMap *currentKey = 0;
+- int keyCode = Qt::Key_unknown;
+- bool release = false;
+- int keypad = 0;
+-
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // need autorepeat implemented here?
+- bool repeatable = TRUE;
+-
+-#ifndef QT_QWS_USE_KEYCODES
+-#if defined(QT_QWS_IPAQ)
+- // map ipaq 'action' key (0x60, 0xe0)
+- if ((code & 0x7f) == 0x60) {
+-#if defined(QT_KEYPAD_MODE)
+- // to keycode for select (keypad mode)
+- code = (code & 0x80) | 116;
+-#else
+- // to keycode for space. (no keypad mode0
+- code = (code & 0x80) | 57;
+-#endif
+- }
+-#endif
+-
+-#if !defined(QT_QWS_SL5XXX)
+- if (code == 224
+-#if defined(QT_QWS_IPAQ)
+- && !ipaq_return_pressed
+-#endif
+- ) {
+- // extended
+- extended = 1;
+- return;
+- }
+- else if (code == 225) {
+- // extended 2
+- extended = 2;
+- return;
+- }
+-#endif
+-#endif
+-
+-
+- /*------------------------------------------------------------------
+- First find the Qt KeyCode
+- ------------------------------------------------------------------*/
+-
+- if (code & 0x80) {
+- release = true;
+- code &= 0x7f;
+- }
+-
+-#ifndef QT_QWS_USE_KEYCODES
+- if (extended == 1) {
+- currentKey = overrideMap ? overrideMap->find( code+0xe000 ) : 0;
+- if ( currentKey )
+- keyCode = currentKey->key_code;
+- else
+- switch (code) {
+- case 72:
+- keyCode = Qt::Key_Up;
+- break;
+- case 75:
+- keyCode = Qt::Key_Left;
+- break;
+- case 77:
+- keyCode = Qt::Key_Right;
+- break;
+- case 80:
+- keyCode = Qt::Key_Down;
+- break;
+- case 82:
+- keyCode = Qt::Key_Insert;
+- break;
+- case 71:
+- keyCode = Qt::Key_Home;
+- break;
+- case 73:
+- keyCode = Qt::Key_Prior;
+- break;
+- case 83:
+- keyCode = Qt::Key_Delete;
+- break;
+- case 79:
+- keyCode = Qt::Key_End;
+- break;
+- case 81:
+- keyCode = Qt::Key_Next;
+- break;
+- case 28:
+- keyCode = Qt::Key_Enter;
+- break;
+- case 53:
+- keyCode = Qt::Key_Slash;
+- break;
+- case 0x1d:
+- keyCode = Qt::Key_Control;
+- break;
+- case 0x2a:
+- keyCode = Qt::Key_SysReq;
+- break;
+- case 0x38:
+- keyCode = Qt::Key_Alt;
+- break;
+- case 0x5b:
+- keyCode = Qt::Key_Super_L;
+- break;
+- case 0x5c:
+- keyCode = Qt::Key_Super_R;
+- break;
+- case 0x5d:
+- keyCode = Qt::Key_Menu;
+- break;
+- }
+- } else if ( extended == 2 ) {
+- switch (code) {
+- case 0x1d:
+- return;
+- case 0x45:
+- keyCode = Qt::Key_Pause;
+- break;
+- }
+- } else
+-#endif
+- {
+-#if defined(QT_QWS_SL5XXX)
+- if ( fn && !meta && (code >= 0x42 && code <= 0x52) ) {
+- ushort unicode=0xffff;
+- int scan=0;
+- if ( code == 0x42 ) { unicode='X'-'@'; scan=Key_X; } // Cut
+- else if ( code == 0x43 ) { unicode='C'-'@'; scan=Key_C; } // Copy
+- else if ( code == 0x44 ) { unicode='V'-'@'; scan=Key_V; } // Paste
+- else if ( code == 0x52 ) { unicode='Z'-'@'; scan=Key_Z; } // Undo
+- if ( scan ) {
+- processKeyEvent( unicode, scan, ControlButton, !release, FALSE );
+- return;
+- }
+- }
+-#endif
+- currentKey = overrideMap ? overrideMap->find( code ) : 0;
+- if ( !currentKey && code < keyMSize ) {
+- currentKey = &QWSServer::keyMap()[code];
+- }
+- if ( currentKey )
+- keyCode = currentKey->key_code;
+-
+-#if defined(QT_QWS_IPAQ)
+- switch (code) {
+-#if defined(QT_QWS_SL5XXX)
+-#if defined(QT_KEYPAD_MODE)
+- case 0x7a:
+- keyCode = Key_Call;
+- repeatable = FALSE;
+- break;
+- case 0x7b:
+- keyCode = Key_Context1;
+- repeatable = FALSE;
+- break;
+- case 0x7c:
+- keyCode = Key_Back;
+- repeatable = FALSE;
+- break;
+- case 0x7d:
+- keyCode = Key_Hangup;
+- repeatable = FALSE;
+- break;
+-#else
+- case 0x7a: case 0x7b: case 0x7c: case 0x7d:
+- keyCode = code - 0x7a + Key_F9;
+- repeatable = FALSE;
+- break;
+-#endif
+- case 0x79:
+- keyCode = Key_F34;
+- repeatable = FALSE;
+- break;
+-#endif
+-
+- case 0x74: // kernel KEY_POWER
+- keyCode = Key_F34;
+- repeatable = FALSE;
+- break;
+- case 89: // kernel KEY_RO
+- keyCode = Key_F24;
+- repeatable = FALSE;
+- break;
+-
+- case 0x78:
+-# if defined(QT_QWS_IPAQ)
+- keyCode = Key_F24; // record
+-# else
+- keyCode = Key_Escape;
+-# endif
+- repeatable = FALSE;
+- break;
+- case 0x60:
+- keyCode = Key_Return;
+-# ifdef QT_QWS_IPAQ
+- ipaq_return_pressed = !release;
+-# endif
+- break;
+- case 0x67:
+- keyCode = Key_Right;
+- break;
+- case 0x69:
+- keyCode = Key_Up;
+- break;
+- case 0x6a:
+- keyCode = Key_Down;
+- break;
+- case 0x6c:
+- keyCode = Key_Left;
+- break;
+- }
+-#endif
+-
+- /*------------------------------------------------------------------
+- Then do special processing of magic keys
+- ------------------------------------------------------------------*/
+-
+-
+-#if defined(QT_QWS_SL5XXX)
+- if ( release && ( keyCode == Key_F34 || keyCode == Key_F35 ) )
+- return; // no release for power and light keys
+- if ( keyCode >= Key_F1 && keyCode <= Key_F35
+- || keyCode == Key_Escape || keyCode == Key_Home
+- || keyCode == Key_Shift || keyCode == Key_Meta )
+- repeatable = FALSE;
+-#endif
+-
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
+- if ( qt_screen->isTransformed()
+- && keyCode >= Qt::Key_Left && keyCode <= Qt::Key_Down )
+- {
+- keyCode = xform_dirkey(keyCode);
+- }
+-#endif
+-
+-#endif
+- /*
+- Translate shift+Key_Tab to Key_Backtab
+- */
+- if (( keyCode == Key_Tab ) && shift )
+- keyCode = Key_Backtab;
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
+- }
+-#endif
+-
+-#ifndef QT_QWS_USE_KEYCODES
+- /*
+- Keypad consists of extended keys 53 and 28,
+- and non-extended keys 55 and 71 through 83.
+- */
+- if (( extended == 1 ) ? (code == 53 || code == 28) :
+- (code == 55 || ( code >= 71 && code <= 83 )) )
+- keypad = Qt::Keypad;
+-#else
+- if ( code == 55 || code >= 71 && code <= 83 || code == 96
+- || code == 98 || code == 118 )
+- keypad = Qt::Keypad;
+-#endif
+-
+- // Virtual console switching
+- int term = 0;
+- 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 && !release) {
+- ctrl = false;
+- alt = false;
+-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
+- ioctl(kbdFD, VT_ACTIVATE, term);
+-#endif
+- return;
+- }
+-
+-#if defined(QT_QWS_SL5XXX)
+- // Ctrl-Alt-Delete exits qws
+- if (ctrl && alt && keyCode == Qt::Key_Delete) {
+- qApp->quit();
+- }
+-#else
+- // Ctrl-Alt-Backspace exits qws
+- if (ctrl && alt && keyCode == Qt::Key_Backspace) {
+- qApp->quit();
+- }
+-#endif
+-
+-#if defined(QT_QWS_SL5XXX)
+- if (keyCode == Qt::Key_F22) { /* Fn key */
+- fn = !release;
+- } else if ( keyCode == Key_NumLock ) {
+- if ( release )
+- numLock = !numLock;
+- } else
+-#endif
+-
+- if (keyCode == Qt::Key_Alt) {
+- alt = !release;
+- } else if (keyCode == Qt::Key_Control) {
+- ctrl = !release;
+- } else if (keyCode == Qt::Key_Shift) {
+- shift = !release;
+-#if defined(QT_QWS_SL5XXX)
+- } else if (keyCode == Qt::Key_Meta) {
+- meta = !release;
+-#endif
+- } else if ( keyCode == Qt::Key_CapsLock && release ) {
+- caps = !caps;
+-#if defined(_OS_LINUX_) && !defined(QT_QWS_SL5XXX)
+- char leds;
+- ioctl(0, KDGETLED, &leds);
+- leds = leds & ~LED_CAP;
+- if ( caps ) leds |= LED_CAP;
+- ioctl(0, KDSETLED, leds);
+-#endif
+- }
+-
+- /*------------------------------------------------------------------
+- Then find the Unicode value and send the event
+- ------------------------------------------------------------------*/
+- //If we map the keyboard to a non-latin1 layout, we may have
+- //valid keys with unknown key codes.
+- if ( currentKey || keyCode != Qt::Key_unknown ) {
+- bool bAlt = alt;
+- bool bCtrl = ctrl;
+- bool bShift = shift;
+- int unicode = 0xffff;
+- if ( currentKey ) {
+-#if !defined(QT_QWS_SL5XXX)
+- bool bCaps = shift ||
+- (caps ? QChar(QWSServer::keyMap()[code].unicode).isLetter() : FALSE);
+-#else
+- bool bCaps = caps ^ shift;
+- if (fn) {
+- if ( shift ) {
+- bCaps = bShift = FALSE;
+- bCtrl = TRUE;
+- }
+- if ( meta ) {
+- bCaps = bShift = TRUE;
+- bAlt = TRUE;
+- }
+- } else if ( meta ) {
+- bCaps = bShift = TRUE;
+- }
+- if ( code > 40 && caps ) {
+- // fn-keys should only react to shift, not caps
+- bCaps = bShift = shift;
+- }
+- if ( numLock ) {
+- if ( keyCode != Key_Space && keyCode != Key_Tab )
+- bCaps = bShift = FALSE;
+- }
+- if ( keyCode == Key_Delete && (bAlt || bCtrl) ) {
+- keyCode = Key_BraceLeft;
+- unicode = '[';
+- bCaps = bShift = bAlt = bCtrl = FALSE;
+- } else if (keyCode == Qt::Key_F31 && bCtrl) {
+- keyCode = Key_QuoteLeft;
+- unicode = '`';
+- } else
+-#endif
+-
+- if (bCtrl)
+- unicode = currentKey->ctrl_unicode;
+- else if (bCaps)
+- unicode = currentKey->shift_unicode;
+- else
+- unicode = currentKey->unicode;
+-#ifndef QT_QWS_USE_KEYCODES
+- } else if ( extended == 1 ) {
+- if ( keyCode == Qt::Key_Slash )
+- unicode = '/';
+- else if ( keyCode == Qt::Key_Enter )
+- unicode = 0xd;
+-#endif
+- }
+-
+- modifiers = 0;
+- if ( bAlt ) modifiers |= AltButton;
+- if ( bCtrl ) modifiers |= ControlButton;
+- if ( bShift ) modifiers |= ShiftButton;
+- if ( keypad ) modifiers |= Keypad;
+-
+- // looks wrong -- WWA
+- bool repeat = FALSE;
+- if (prevuni == unicode && prevkey == keyCode && !release)
+- repeat = TRUE;
+-
+- processKeyEvent( unicode, keyCode, modifiers, !release, repeat );
+-
+- if (!release) {
+- prevuni = unicode;
+- prevkey = keyCode;
+- } else {
+- prevkey = prevuni = 0;
+- }
+-
+-#ifdef QT_QWS_AUTOREPEAT_MANUALLY
+- if ( repeatable && !release )
+- rep->start(prevuni,prevkey,modifiers);
+- else
+- rep->stop();
+-#endif
+-
+- }
+-#ifndef QT_QWS_USE_KEYCODES
+- extended = 0;
+-#endif
+ }
+
+
diff --git a/recipes-qt/qte/qte-2.3.10/sharp_char.h b/recipes-qt/qte/qte-2.3.10/sharp_char.h
new file mode 100644
index 0000000..a70f5f6
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/spitz-adhoc-keypad-rotate.patch b/recipes-qt/qte/qte-2.3.10/spitz-adhoc-keypad-rotate.patch
new file mode 100644
index 0000000..a32207d
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/spitz-adhoc-keypad-rotate.patch
@@ -0,0 +1,21 @@
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+Index: qt-2.3.10/src/kernel/kernelkeyboard.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/kernelkeyboard.cpp 2006-04-05 23:04:30.000000000 +0200
++++ qt-2.3.10/src/kernel/kernelkeyboard.cpp 2006-04-05 23:09:40.514650408 +0200
+@@ -568,7 +568,11 @@
+ case Qt::Key_Down:
+ unicode = 0xffff;
+ 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/recipes-qt/qte/qte-2.3.10/support_18bpp.patch b/recipes-qt/qte/qte-2.3.10/support_18bpp.patch
new file mode 100644
index 0000000..138c4ce
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/support_18bpp.patch
@@ -0,0 +1,275 @@
+diff -urN qt-2.3.10/configure qt-2.3.10_mod/configure
+--- qt-2.3.10/configure 2005-01-23 08:00:36.000000000 -0600
++++ qt-2.3.10_mod/configure 2006-10-21 23:13:29.000000000 -0500
+@@ -805,7 +805,8 @@
+ echo " 4. 4bpp grayscale - also enables 8bpp"
+ echo " 8. 8bpp"
+ echo " 16. 16bpp"
+- echo " 24. 24bpp - also enables 32bpp"
++ echo " 18. 18bpp - packed into 24bpp, cannot be enabled with 24bpp"
++ echo " 24. 24bpp - also enables 32bpp, cannot be enabled with 18bpp"
+ echo " 32. 32bpp"
+ echo
+ echo "Each depth adds around 100Kb on 80386."
+@@ -830,7 +831,7 @@
+
+ if [ -n "$DEPTHS" ]
+ then
+- DV=;D4=;D8=;D16=;D24=;D32=
++ DV=;D4=;D8=;D16=;D18=;D24=;D32=
+ for D in `echo "$DEPTHS" | sed -e 's/,/ /g'`
+ do
+ case "$D" in
+@@ -838,10 +839,20 @@
+ ;; 4) D4=y; D8=y
+ ;; 8) D8=y
+ ;; 16) D16=y
++ ;; 18) D18=y
+ ;; 24) D24=y; D32=y
+ ;; 32) D32=y
+ esac
+ done
++
++ if [ ! -z "$D18" -a ! -z "$D24" ]
++ then
++ echo
++ echo "WARNING: You have configured with depth 18 and 24."
++ echo " These depths are not compatible. Depth 24"
++ echo " will be disabled."
++ fi
++
+ if [ -z "$DV" ]
+ then
+ QT_CXX="$QT_CXX -DQT_NO_QWS_VGA_16"
+@@ -858,9 +869,19 @@
+ then
+ QT_CXX="$QT_CXX -DQT_NO_QWS_DEPTH_16"
+ fi
++ if [ -z "$D18" ]
++ then
++ QT_CXX="$QT_CXX -DQT_NO_QWS_DEPTH_18"
++ fi
+ if [ -z "$D24" ]
+ then
+ QT_CXX="$QT_CXX -DQT_NO_QWS_DEPTH_24"
++ else
++ # Disable depth 24 if depth 18 enabled
++ if [ ! -z "$D18" ]
++ then
++ QT_CXX="$QT_CXX -DQT_NO_QWS_DEPTH_24"
++ fi
+ fi
+ if [ -z "$D32" ]
+ then
+@@ -1326,7 +1347,7 @@
+ default ($QCONFIG).
+
+ -depths list ....... Comma-separated list of supported bit-per-pixel
+- depths, from: v, 4, 8, 16, 24, and 32. 'v' is VGA16.
++ depths, from: v, 4, 8, 16, 18, 24, and 32. 'v' is VGA16.
+
+ -accel-snap ........ Enable SciTech SNAP Graphics acceleration.
+ -accel-voodoo3 ..... Enable Voodoo3 acceleration.
+diff -urN qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp qt-2.3.10_mod/src/kernel/qgfxlinuxfb_qws.cpp
+--- qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp 2011-04-09 18:48:17.000000000 +0100
++++ qt-2.3.10_mod/src/kernel/qgfxlinuxfb_qws.cpp 2011-04-09 18:54:45.000000000 +0100
+@@ -134,6 +134,10 @@
+ }
+
+ d=vinfo.bits_per_pixel;
++ // 18-bpp-support
++ if ((d == 18) || (d == 19))
++ d = 24;
++ // End of 18-bpp-support
+ lstep=finfo.line_length;
+ int xoff = vinfo.xoffset;
+ int yoff = vinfo.yoffset;
+@@ -427,6 +431,15 @@
+ gbits=6;
+ bbits=5;
+ break;
++ // 18-bpp-support
++ case 18: case 19:
++ rbits=6;
++ gbits=6;
++ bbits=6;
++ vinfo.bits_per_pixel=24;
++ startupd=24;
++ break;
++ // End of 18-bpp-support
+ case 24: case 32:
+ rbits=gbits=bbits=8;
+ break;
+@@ -819,6 +832,10 @@
+ w=vinfo.xres;
+ h=vinfo.yres;
+ d=vinfo.bits_per_pixel;
++ // 18-bpp-support
++ if ((d == 18) || (d == 19))
++ d = 24;
++ // End of 18-bpp-support
+ lstep=finfo.line_length;
+ size=h*lstep;
+ }
+diff -urN qt-2.3.10/src/kernel/qgfxraster_qws.cpp qt-2.3.10_mod/src/kernel/qgfxraster_qws.cpp
+--- qt-2.3.10/src/kernel/qgfxraster_qws.cpp 2005-01-23 08:00:47.000000000 -0600
++++ qt-2.3.10_mod/src/kernel/qgfxraster_qws.cpp 2006-10-22 08:38:38.000000000 -0500
+@@ -161,25 +161,51 @@
+ #endif
+
+ #define MASK4BPP(x) (0xf0 >> (x))
+-
++// 18-bpp-support
+ inline void gfxSetRgb24( unsigned char *d, unsigned int p )
+ {
+- *d = p & 0x0000ff;
++#ifdef QT_NO_QWS_DEPTH_18
++ *d = p & 0x000ff;
+ *(d+1) = (p & 0x00ff00 ) >> 8;
+ *(d+2) = (p & 0xff0000 ) >> 16;
++#else
++ uint b = (p & 0x0000ff) >> 0;
++ uint g = (p & 0x00ff00) >> 8;
++ uint r = (p & 0xff0000) >> 16;
++ uint data = (b>>2) | ((g>>2) << 6) | ((r>>2) << 12);
++ *d = data & 0xff;
++ *(d+1) = (data >> 8) & 0xff;
++ *(d+2) = (data >> 16) & 0xff;
++#endif
+ }
+
+ inline void gfxSetRgb24( unsigned char *d, int r, int g, int b )
+ {
++#ifdef QT_NO_QWS_DEPTH_18
+ *d = b;
+ *(d+1) = g;
+ *(d+2) = r;
++#else
++ uint data = (b>>2) | ((g>>2) << 6) | ((r>>2) << 12);
++ *d = data & 0xff;
++ *(d+1) = (data >> 8) & 0xff;
++ *(d+2) = (data >> 16) & 0xff;
++#endif
+ }
+
+ inline unsigned int gfxGetRgb24( unsigned char *d )
+ {
++#ifdef QT_NO_QWS_DEPTH_18
+ return *d | (*(d+1)<<8) | (*(d+2)<<16);
++#else
++ uint data = *d | (*(d+1)<<8) | (*(d+2)<<16);
++ uint r = ((data >> 10) & 0xfc);
++ uint g = ((data >> 4) & 0xfc);
++ uint b = ((data << 2) & 0xfc);
++ return b | (g << 8) | (r << 16);
++#endif
+ }
++// End of 18-bpp-support
+
+ static bool simple_8bpp_alloc=FALSE;
+
+@@ -1767,11 +1793,12 @@
+ } else {
+ (*srcdata)+=4;
+ }
+-#if !defined( QT_NO_QWS_DEPTH_24 )
++// 18-bpp hack (mlk)
++//#if !defined( QT_NO_QWS_DEPTH_24 )
+ } else if(sdepth==24) {
+ ret = gfxGetRgb24( *srcdata );
+ (*srcdata) += 3;
+-#endif
++//#endif
+ #if !defined( QT_NO_IMAGE_16_BIT ) || !defined( QT_NO_QWS_DEPTH_16 )
+ } else if(sdepth==16) {
+ unsigned short int hold=*((unsigned short int *)(*srcdata));
+@@ -3963,9 +3990,22 @@
+ unsigned char *alphaptr = (unsigned char *)alphabuf;
+ unsigned char *avp = alphas;
+ int loopc;
+-
++// 18-bpp-support
++#ifdef QT_NO_QWS_DEPTH_18
+ memcpy( alphabuf, myptr+x1*3, w*3 );
+-
++#else
++ { uchar *srcptr24 = myptr+x1*3;
++ uchar *dstptr24 = (uchar*)alphabuf;
++ for ( int i = 0; i < w; i++ ) {
++ uint pix = gfxGetRgb24(srcptr24);
++ dstptr24[2] = (pix >> 16) & 0xff;
++ dstptr24[1] = (pix >> 8) & 0xff;
++ dstptr24[0] = (pix >> 0) & 0xff;
++ srcptr24 += 3;
++ dstptr24 += 3;
++ } }
++#endif
++// End of 18-bpp-support
+ // Now blend with source data
+ unsigned char * srcptr=srcdata;
+ unsigned int srcval;
+@@ -5808,10 +5848,10 @@
+ } else if(d==8) {
+ ret = new QGfxRaster<8,0>(bytes,w,h);
+ #endif
+-#ifndef QT_NO_QWS_DEPTH_24
++//#ifndef QT_NO_QWS_DEPTH_24
+ } else if(d==24) {
+ ret = new QGfxRaster<24,0>(bytes,w,h);
+-#endif
++//#endif
+ #ifndef QT_NO_QWS_DEPTH_32
+ } else if(d==32) {
+ ret = new QGfxRaster<32,0>(bytes,w,h);
+diff -urN qt-2.3.10/src/kernel/qgfxtransformed_qws.cpp qt-2.3.10_mod/src/kernel/qgfxtransformed_qws.cpp
+--- qt-2.3.10/src/kernel/qgfxtransformed_qws.cpp 2005-01-23 08:00:46.000000000 -0600
++++ qt-2.3.10_mod/src/kernel/qgfxtransformed_qws.cpp 2006-10-22 00:57:27.000000000 -0500
+@@ -1020,10 +1020,10 @@
+ } else if (d==8) {
+ ret = new QGfxTransformedRaster<8,0>(bytes,w,h);
+ #endif
+-#ifndef QT_NO_QWS_DEPTH_24
++//#ifndef QT_NO_QWS_DEPTH_24
+ } else if (d==24) {
+ ret = new QGfxTransformedRaster<24,0>(bytes,w,h);
+-#endif
++//#endif
+ #ifndef QT_NO_QWS_DEPTH_32
+ } else if (d==32) {
+ ret = new QGfxTransformedRaster<32,0>(bytes,w,h);
+diff -urN qt-2.3.10/src/kernel/qgfxvfb_qws.cpp qt-2.3.10_mod/src/kernel/qgfxvfb_qws.cpp
+--- qt-2.3.10/src/kernel/qgfxvfb_qws.cpp 2005-01-23 08:00:47.000000000 -0600
++++ qt-2.3.10_mod/src/kernel/qgfxvfb_qws.cpp 2006-10-22 00:19:30.000000000 -0500
+@@ -288,10 +288,14 @@
+ d = hdr->depth;
+ lstep = hdr->linestep;
+
+-#ifdef DEBUG
++//#ifdef DEBUG
+ qDebug( "Connected to VFB server: %d x %d x %d", w, h, d );
+-#endif
++//#endif
+
++// 18-bpp-support
++ if ( (d == 18) || (d == 19) )
++ d = 24;
++// End of 18-bpp-support
+ size = lstep * h;
+ mapsize = size;
+ screencols = hdr->numcols;
+@@ -434,6 +438,15 @@
+ else
+ ret = new QGfxRaster<32,0>(bytes,w,h);
+ #endif
++// 18-bpp-support
++//#ifndef QT_NO_QWS_DEPTH_24
++ } else if (d==24) {
++ if ( bytes == qt_screen->base() )
++ ret = new QGfxVFb<24,0>(bytes,w,h);
++ else
++ ret = new QGfxRaster<24,0>(bytes,w,h);
++//#endif
++// 18-bpp-support
+ } else {
+ qFatal("Can't drive depth %d",d);
+ }
diff --git a/recipes-qt/qte/qte-2.3.10/suspend-resume-hooks.patch b/recipes-qt/qte/qte-2.3.10/suspend-resume-hooks.patch
new file mode 100644
index 0000000..c6e9f16
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/suspend-resume-hooks.patch
@@ -0,0 +1,78 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10.foo/src/kernel/qgfx_qws.h~suspend-resume-hooks
++++ qt-2.3.10.foo/src/kernel/qgfx_qws.h
+@@ -192,6 +192,8 @@
+ virtual int pixmapLinestepAlignment() { return 64; }
+
+ virtual void sync() {}
++ virtual void prepareToSuspend() {}
++ virtual void prepareToResume() {}
+ virtual bool onCard(unsigned char *) const;
+ virtual bool onCard(unsigned char *, ulong& out_offset) const;
+
+--- qt-2.3.10.foo/src/kernel/qapplication_qws.cpp~suspend-resume-hooks
++++ qt-2.3.10.foo/src/kernel/qapplication_qws.cpp
+@@ -480,6 +480,7 @@
+ int region_offset_window;
+ #ifndef QT_NO_COP
+ QWSQCopMessageEvent *qcop_response;
++ bool manageAPMMessage( QWSQCopMessageEvent *e );
+ #endif
+ QWSEvent* current_event;
+ QValueList<int> unused_identifiers;
+@@ -840,7 +841,7 @@
+ QWSQCopMessageEvent *pe = (QWSQCopMessageEvent*)e;
+ if ( pe->simpleData.is_response ) {
+ qcop_response = pe;
+- } else {
++ } else if ( !manageAPMMessage( pe ) ) {
+ queue.append(e);
+ }
+ #endif
+@@ -851,6 +852,42 @@
+ }
+ }
+
++#ifndef QT_NO_COP
++bool QWSDisplayData::manageAPMMessage( QWSQCopMessageEvent *e )
++{
++ if ( e->channel.data() != QCString( "QPE/System" ) ) {
++ return FALSE;
++ }
++ if ( e->message.data() == QCString( "aboutToSuspend()" ) ) {
++ if ( qt_screen ) qt_screen->prepareToSuspend();
++ delete e;
++ return TRUE;
++ }
++ if ( e->message.data() == QCString( "returnFromSuspend()" ) ) {
++ if ( qt_screen ) qt_screen->prepareToResume();
++ delete e;
++ QWidgetList *list = QApplication::topLevelWidgets();
++ if ( list ) {
++ QWidgetListIt it( *list );
++ QWidget * w;
++ while ( (w=it.current()) != 0 ) {
++ ++it;
++ if ( !w->testWFlags(Qt::WType_Desktop) ) {
++ QETWidget *etw = (QETWidget*)w;
++ if ( etw->isVisible() ) {
++ etw->repaintHierarchy( etw->geometry(), TRUE );
++ etw->repaintDecoration( qApp->desktop()->rect(), TRUE );
++ }
++ }
++ }
++ delete list;
++ }
++ return TRUE;
++ }
++ return FALSE;
++}
++#endif
++
+ void QWSDisplayData::offsetPendingExpose( int window, const QPoint &offset )
+ {
+ if ( offset.isNull() )
diff --git a/recipes-qt/qte/qte-2.3.10/switches.h b/recipes-qt/qte/qte-2.3.10/switches.h
new file mode 100644
index 0000000..37516b4
--- /dev/null
+++ b/recipes-qt/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/recipes-qt/qte/qte-2.3.10/tslib.patch b/recipes-qt/qte/qte-2.3.10/tslib.patch
new file mode 100644
index 0000000..47837d7
--- /dev/null
+++ b/recipes-qt/qte/qte-2.3.10/tslib.patch
@@ -0,0 +1,53 @@
+Index: qt-2.3.10/src/kernel/qwsmouse_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qwsmouse_qws.cpp 2005-02-16 00:53:53.090339898 +0100
++++ qt-2.3.10/src/kernel/qwsmouse_qws.cpp 2005-02-16 00:54:43.059069292 +0100
+@@ -1878,30 +1878,33 @@
+ */
+ void QTSLibHandlerPrivate::interpolateSample() {
+ #ifdef QT_QWS_TSLIB
+- static struct ts_sample samples[25];
+- int index = -1;
++#define TSLIB_MAX_SAMPLES 25
++ static struct ts_sample samples[TSLIB_MAX_SAMPLES];
++ int index = 0;
++ int read_samples = 0;
+ int ret;
+
+ do {
+- /* fill only the last sample again */
+- if ( index >= 25 )
+- index = 24;
+-
++ /* 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 ) {
++ if((ret= ts_read_raw(m_ts, &samples[index], 1 ) ) != 1 )
+ /* no event yet, so try again */
+- if (ret==-1 ) {
+- index--;
++ if (ret==-1 )
+ continue;
+- }
+- }
+- }while (samples[index++].pressure != 0);
++
++ read_samples++;
++ index = (index+1)%TSLIB_MAX_SAMPLES;
++ }while (samples[index == 0 ? (TSLIB_MAX_SAMPLES-1) : index-1].pressure != 0);
+
+ /*
+- * index is maximal 25 and we at least one sample
++ * If we've wrapped around each sample is used otherwise
++ * we will use the index
+ */
+- if( index >= 25 )
+- index = 24;
++ index = read_samples >= TSLIB_MAX_SAMPLES ?
++ (TSLIB_MAX_SAMPLES-1 ) : index;
+ int x, y;
+
+ /*
diff --git a/recipes-qt/qte/qte-2.3.10/vt-switch.patch b/recipes-qt/qte/qte-2.3.10/vt-switch.patch
new file mode 100644
index 0000000..4007a5d
--- /dev/null
+++ b/recipes-qt/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;
diff --git a/recipes-qt/qte/qte-common_2.3.10.inc b/recipes-qt/qte/qte-common_2.3.10.inc
new file mode 100644
index 0000000..75419ac
--- /dev/null
+++ b/recipes-qt/qte/qte-common_2.3.10.inc
@@ -0,0 +1,149 @@
+DESCRIPTION = "Qt/Embedded Version ${PV}"
+SECTION = "libs"
+PRIORITY = "optional"
+HOMEPAGE = "http://www.trolltech.com"
+LICENSE = "GPL"
+DEPENDS = "zlib libpng jpeg tslib uicmoc-native"
+#DEPENDS_append_c7x0 = " sharp-aticore-oss"
+PROVIDES = "virtual/libqte2"
+
+FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/qte-${PV}"
+
+# Workaround GCC 4.1 issues with -fvisibility-inlines-hidden (see #1521)
+# by disabling it for qpe only. TODO: pinpoint actual issue causing GCC
+# misbehavior.
+#
+# Laibsch: Remove -fno-visibility-inlines-hidden instead of negating it
+# Laibsch: Fixes bug 1631
+#CXXFLAGS += "-fno-visibility-inlines-hidden"
+CXXFLAGS := "${@oe_filter_out('-fvisibility-inlines-hidden', '${CXXFLAGS}', d)}"
+
+SRC_URI = "ftp://ftp.trolltech.com/pub/qt/source/qt-embedded-${PV}-free.tar.gz;md5sum=1f7ad30113afc500cab7f5b2f4dec0d7 \
+ file://qpe.patch \
+ file://vt-switch.patch \
+ file://daemonize.patch \
+ file://no-moc.patch \
+ file://gcc3.patch \
+ file://gcc4.patch \
+ file://encoding.patch \
+ file://fix-qgfxraster.patch \
+ file://qt-visibility.patch \
+ file://tslib.patch \
+ file://handhelds.patch \
+ file://qiconview-speed.patch \
+ file://qtabbar.patch \
+ file://increase-qxml-robustness.patch \
+ file://qte-fix-iconsize.patch \
+ file://fix-linuxfb-setmode.patch \
+ file://fix-linuxfb-offscreenoverflow.patch \
+ file://fix-qscreen-sync.patch \
+ file://improve-calibration-r0.patch \
+ file://key.patch \
+ file://bidimetrics.patch \
+ file://fix-native-build.patch \
+ file://fix-errno-exception-spec.patch \
+ file://keyboardless-buttonmap.patch \
+ file://kernel-keymap.patch \
+ file://kernel-keymap-corgi.patch \
+ file://remove-unused-kbdhandler.patch \
+ file://disable-dup-rotation.patch \
+ file://fix-qte-asm-include.patch \
+ file://support_18bpp.patch \
+ file://sharp_char.h \
+ file://switches.h "
+
+#
+# add device specific patches here
+#
+
+W100_ACCEL_PATCHES = "file://c7x0-w100-accel.patch \
+ file://c7x0-w100-gcc4.patch \
+ file://suspend-resume-hooks.patch"
+
+#SRC_URI_append_c7x0 = "${W100_ACCEL_PATCHES} "
+#SRC_URI_append_spitz = "file://spitz-adhoc-keypad-rotate.patch "
+#SRC_URI_append_akita = "file://spitz-adhoc-keypad-rotate.patch "
+
+# "ipaqs" used to have this, but later were proven to at least work
+# without it. Review again and see if has interesting bits to be applied
+# universally.
+#SRC_URI_append = "file://ipaq_sound_fix.patch "
+
+
+S = "${WORKDIR}/qt-${PV}"
+export QTDIR = "${S}"
+
+require qte-functions.inc
+QTE_ARCH := "${@qte_arch(d)}"
+
+#
+# add device configuration here
+#
+EXTRA_OECONF_CONFIG = "-qconfig qpe"
+#EXTRA_OECONF_CONFIG_c7x0 = "-qconfig qpe -accel-w100"
+EXTRA_OECONF_CONFIG_native = "-qconfig qpe -qvfb"
+
+EXTRA_OECONF = "-system-jpeg -system-libpng -system-zlib -no-qvfb -no-xft -no-vnc -gif \
+ -xplatform ${TARGET_OS}-${QTE_ARCH}-g++ ${EXTRA_OECONF_CONFIG} -depths 8,16,18,32"
+EXTRA_OEMAKE = "-e"
+
+#
+# add device flags here
+#
+EXTRA_DEFINES = "-DQT_QWS_TSLIB -DQT_QWS_CUSTOM -DQT_QWS_IPAQ"
+#EXTRA_DEFINES_spitz = "-DQT_QWS_TSLIB -DQT_QWS_CUSTOM -DQT_QWS_IPAQ -DQT_QWS_SLCXK"
+#EXTRA_DEFINES_akita = "-DQT_QWS_TSLIB -DQT_QWS_CUSTOM -DQT_QWS_IPAQ -DQT_QWS_SLCXK"
+
+#
+# don't touch anything below here
+#
+export SYSCONF_CC = "${CC}"
+export SYSCONF_CXX = "${CXX}"
+export SYSCONF_LINK = "${CCLD}"
+export SYSCONF_SHLIB = "${CCLD}"
+export SYSCONF_CFLAGS = "${CFLAGS}"
+export SYSCONF_LINK_SHLIB = "${CCLD}"
+export SYSCONF_CXXFLAGS = "${CXXFLAGS} -pipe -DQWS -fno-exceptions -frtti -DNO_DEBUG ${EXTRA_DEFINES} -DUSE_BIDI"
+# enable if gcc supports visibility
+#export SYSCONF_CXXFLAGS = "${CXXFLAGS} -pipe -DQWS -fno-exceptions -frtti -fvisibility=hidden -DGCC_SUPPORTS_VISIBILITY -DNO_DEBUG ${EXTRA_DEFINES} -DUSE_BIDI"
+export SYSCONF_LFLAGS = "${LDFLAGS} -lts"
+export SYSCONF_MOC = "${STAGING_BINDIR_NATIVE}/moc"
+export SYSCONF_UIC = "${STAGING_BINDIR_NATIVE}/uic"
+
+# generate uclibc, eabi and powerpc configurations
+do_configure() {
+ for f in ${S}/configs/linux-*-g++-shared; do
+ sed -e 's,-linux-,-linux-uclibc-,g' < $f \
+ > `dirname $f`/`basename $f | sed -e 's,linux-,linux-uclibc-,'`
+ sed -e 's,-linux-,-linux-gnueabi-,g' < $f \
+ > `dirname $f`/`basename $f | sed -e 's,linux-,linux-gnueabi-,'`
+ sed -e 's,-linux-,-linux-uclibceabi-,g' < $f \
+ > `dirname $f`/`basename $f | sed -e 's,linux-,linux-uclibceabi-,'`
+ done
+ sed -e 's/arm/powerpc/' ${S}/configs/linux-arm-g++-shared > ${S}/configs/linux-powerpc-g++-shared
+ echo yes | ./configure ${EXTRA_OECONF} || die "Configuring qte failed. EXTRA_OECONF was ${EXTRA_OECONF}"
+}
+
+do_compile() {
+ unset CC LD CCLD CXX RANLIB AR STRIP CFLAGS LDFLAGS CXXFLAGS CPPFLAGS
+ install -d include/asm/
+ install -m 0644 ${WORKDIR}/sharp_char.h include/asm/
+ install -d include/linux/
+ install -m 0644 ${WORKDIR}/switches.h include/linux/
+
+ # Create symlinks first and then compile the library
+ oe_runmake symlinks
+ oe_runmake src-mt sub-src
+}
+
+do_install() {
+ oe_libinstall -so -C lib lib${PN} ${D}${libdir}
+
+ install -d ${D}/${includedir}/qte
+ rm -f include/qxt.h
+ install -m 0644 include/*.h ${D}/${includedir}/qte/
+}
+
+FILES_${PN} = "${libdir}/lib${PN}.so.*"
+FILES_${PN}-dev = "${includedir}/* ${libdir}/lib${PN}.so"
+FILES_${PN}-dbg += "${libdir}/.debug/"
diff --git a/recipes-qt/qte/qte-functions.inc b/recipes-qt/qte/qte-functions.inc
new file mode 100644
index 0000000..f0ffb0e
--- /dev/null
+++ b/recipes-qt/qte/qte-functions.inc
@@ -0,0 +1,11 @@
+def qte_arch(d):
+ import bb, re
+ arch = bb.data.getVar('TARGET_ARCH', d, 1)
+ if re.match("^i.86$", arch):
+ arch = "x86"
+ elif arch == "x86_64":
+ arch = "x86"
+ elif arch == "mipsel":
+ arch = "mips"
+ return arch
+
diff --git a/recipes-qt/qte/qte-mt_2.3.10.bb b/recipes-qt/qte/qte-mt_2.3.10.bb
new file mode 100644
index 0000000..84467f5
--- /dev/null
+++ b/recipes-qt/qte/qte-mt_2.3.10.bb
@@ -0,0 +1,9 @@
+require qte-common_${PV}.inc
+PR = "r31"
+
+EXTRA_OECONF += "-thread"
+
+DEFAULT_PREFERENCE = "1"
+
+SRC_URI[md5sum] = "1f7ad30113afc500cab7f5b2f4dec0d7"
+SRC_URI[sha256sum] = "883363eb0c94de3d1e36f3ab9e09a8f127418d497213cc1a0ed1a1588ecd66b8"
diff --git a/recipes-qt/qte/qte_2.3.10.bb b/recipes-qt/qte/qte_2.3.10.bb
new file mode 100644
index 0000000..7a4376d
--- /dev/null
+++ b/recipes-qt/qte/qte_2.3.10.bb
@@ -0,0 +1,6 @@
+require qte-common_${PV}.inc
+PR = "r56"
+
+
+SRC_URI[md5sum] = "1f7ad30113afc500cab7f5b2f4dec0d7"
+SRC_URI[sha256sum] = "883363eb0c94de3d1e36f3ab9e09a8f127418d497213cc1a0ed1a1588ecd66b8"
diff --git a/recipes-qt/uicmoc/uicmoc-native-2.3.10/64bit-cleanup.patch b/recipes-qt/uicmoc/uicmoc-native-2.3.10/64bit-cleanup.patch
new file mode 100644
index 0000000..3cca3e0
--- /dev/null
+++ b/recipes-qt/uicmoc/uicmoc-native-2.3.10/64bit-cleanup.patch
@@ -0,0 +1,226 @@
+--- qt-2.3.10/src/kernel/qsharedmemory.cpp~64bit 2005-12-14 12:31:39.000000000 +0000
++++ qt-2.3.10/src/kernel/qsharedmemory.cpp 2005-12-14 13:24:41.000000000 +0000
+@@ -36,6 +36,7 @@
+
+ #include <sys/ipc.h>
+ #include <sys/types.h>
++#include <stdint.h>
+
+ #if defined(QT_POSIX_QSHM)
+ #include <fcntl.h>
+@@ -122,8 +123,8 @@
+ if (shmId == -1)
+ shmId = shmget (key, shmSize, 0);
+
+- shmBase = shmat (shmId, 0, 0);
+- if ((int) shmBase == -1 || shmBase == 0)
++ intptr_t shmBase = (intptr_t) shmat (shmId, 0, 0);
++ if (shmBase == -1 || shmBase == 0)
+ return FALSE;
+ else
+ return TRUE;
+--- qt-2.3.10/src/kernel/qapplication_qws.cpp~64bit 2005-12-14 12:15:42.000000000 +0000
++++ qt-2.3.10/src/kernel/qapplication_qws.cpp 2005-12-14 12:19:39.000000000 +0000
+@@ -87,6 +87,7 @@
+ #include <sys/shm.h>
+ #include <sys/sem.h>
+ #include <sys/socket.h>
++#include <stdint.h>
+ #endif
+
+ #include <stdlib.h>
+@@ -2041,7 +2042,7 @@
+ w = widgetAt(*qt_last_x, *qt_last_y, FALSE);
+ if ( !w )
+ w = desktop();
+- QPaintDevice::qwsDisplay()->selectCursor(w, (int)app_cursor->handle());
++ QPaintDevice::qwsDisplay()->selectCursor(w, (intptr_t)app_cursor->handle());
+ }
+
+ void QApplication::restoreOverrideCursor()
+@@ -2060,11 +2061,11 @@
+ cursorStack = 0;
+ qws_overrideCursor = FALSE;
+ if ( w->testWState(WState_OwnCursor) )
+- QPaintDevice::qwsDisplay()->selectCursor(w, (int)w->cursor().handle());
++ QPaintDevice::qwsDisplay()->selectCursor(w, (intptr_t)w->cursor().handle());
+ else
+ QPaintDevice::qwsDisplay()->selectCursor(w, ArrowCursor);
+ } else {
+- QPaintDevice::qwsDisplay()->selectCursor(w, (int)app_cursor->handle());
++ QPaintDevice::qwsDisplay()->selectCursor(w, (intptr_t)app_cursor->handle());
+ }
+ }
+ #endif// QT_NO_CURSOR
+@@ -2635,7 +2636,7 @@
+ }
+ if ( !qws_overrideCursor ) { // is override cursor active?
+ if (curs)
+- QPaintDevice::qwsDisplay()->selectCursor(widget, (int)curs->handle());
++ QPaintDevice::qwsDisplay()->selectCursor(widget, (intptr_t)curs->handle());
+ else
+ QPaintDevice::qwsDisplay()->selectCursor(widget, ArrowCursor);
+ }
+--- qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp~64bit 2005-01-23 14:00:46.000000000 +0000
++++ qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp 2005-12-14 12:04:56.000000000 +0000
+@@ -42,6 +42,7 @@
+ #include <sys/mman.h>
+ #include <fcntl.h>
+ #include <errno.h>
++#include <stdint.h>
+
+ #include "qgfxlinuxfb_qws.h"
+ #include "qwindowsystem_qws.h"
+@@ -164,7 +165,7 @@
+ MAP_SHARED, fd, 0);
+ data += dataoffset;
+
+- if ((int)data == -1) {
++ if ((intptr_t)data == -1) {
+ perror("mapping /dev/fb0");
+ qWarning("Error: failed to map framebuffer device to memory.");
+ return FALSE;
+@@ -703,7 +704,7 @@
+ psize += 8; // for alignment
+ psize &= ~0x7; // align
+
+- unsigned int pos=(unsigned int)data;
++ uintptr_t pos=(uintptr_t)data;
+ pos += psize;
+ entryp = ((int *)pos);
+ lowest = ((unsigned int *)pos)+1;
+--- qt-2.3.10/src/kernel/qmemorymanager_qws.h~64bit 2005-01-23 14:00:46.000000000 +0000
++++ qt-2.3.10/src/kernel/qmemorymanager_qws.h 2005-12-14 12:00:32.000000000 +0000
+@@ -33,6 +33,9 @@
+ #ifndef QMEMORYMANAGER_H
+ #define QMEMORYMANAGER_H
+
++/* Needed for uintptr_t to allow 64bit clean pointer handling */
++#include <stdint.h>
++
+ #ifndef QT_H
+ #include <qfontmanager_qws.h>
+ #include <qstring.h>
+@@ -126,8 +129,8 @@
+ // constructs from a memory ptr to where the data after the item starts
+ QSMCacheItemPtr(void *data) {
+ char *ptr = (char*)data;
+- if ( (int)ptr != (((int)ptr+3)&~3) )
+- qDebug("err, passed a non-aligned data ptr %x", (int)ptr);
++ if (intptr_t(data)&3!=0)
++ qDebug("err, passed a non-aligned data ptr %p", ptr);
+ d = (QSMCacheItem*)(ptr - sizeof(QSMCacheItem));
+ }
+ // returns a pointer to the data after the item
+--- qt-2.3.10/src/kernel/qwsregionmanager_qws.cpp~64bit 2005-12-14 13:25:06.000000000 +0000
++++ qt-2.3.10/src/kernel/qwsregionmanager_qws.cpp 2005-12-14 13:25:51.000000000 +0000
+@@ -32,6 +32,7 @@
+ #include "qwsdisplay_qws.h"
+ #include "qwsregionmanager_qws.h"
+ #include <stdlib.h>
++#include <stdint.h>
+
+ #ifndef QT_NO_QWS_MULTIPROCESS
+ #include <sys/types.h>
+@@ -286,7 +287,7 @@
+ data = (unsigned char *)shmat( shmId, 0, SHM_RDONLY );
+ }
+
+- return ( shmId != -1 && (int)data != -1 );
++ return ( shmId != -1 && (intptr_t)data != -1 );
+ #else
+ int dataSize = sizeof(QWSRegionHeader) // header
+ + sizeof(QWSRegionIndex) * QT_MAX_REGIONS // + index
+--- qt-2.3.10/src/kernel/qpixmapcache.cpp~64bit 2005-12-14 13:26:43.000000000 +0000
++++ qt-2.3.10/src/kernel/qpixmapcache.cpp 2005-12-14 13:30:33.000000000 +0000
+@@ -38,6 +38,7 @@
+ #include "qpixmapcache.h"
+ #include "qcache.h"
+ #include "qobject.h"
++#include <stdint.h>
+
+
+ // REVISED: paul
+@@ -519,7 +520,7 @@
+ #endif // DEBUG_SHARED_MEMORY_CACHE
+ }
+
+- if ( shmId == -1 || (int)shm == -1 )
++ if ( shmId == -1 || (intptr_t)shm == -1 )
+ qFatal("Cannot attach to shared memory");
+
+ qt_sharedMemoryData = shm->data;
+@@ -536,8 +537,8 @@
+ shm->tail.setFree(false);
+ shm->tail.setNextFree(QSMemPtr());
+ #ifdef THROW_AWAY_UNUSED_PAGES
+- int freePageStart = PAGE_ALIGN((int)&shm->first + sizeof(QSMemNode));
+- int freePagesLength = PAGE_ALIGN((int)&shm->tail) - freePageStart;
++ intptr_t freePageStart = PAGE_ALIGN((intptr_t)&shm->first + sizeof(QSMemNode));
++ intptr_t freePagesLength = PAGE_ALIGN((intptr_t)&shm->tail) - freePageStart;
+ if ( freePagesLength ) {
+ # ifdef DEBUG_SHARED_MEMORY_CACHE
+ qDebug("Initially marking free pages as not needed");
+@@ -770,8 +771,8 @@
+ node = newFreeNode->next();
+
+ #ifdef THROW_AWAY_UNUSED_PAGES
+- int freePageStart = PAGE_ALIGN((int)newFreeNode+sizeof(QSMemNode));
+- int freePagesLength = PAGE_ALIGN((int)node) - freePageStart;
++ intptr_t freePageStart = PAGE_ALIGN((intptr_t)newFreeNode+sizeof(QSMemNode));
++ intptr_t freePagesLength = PAGE_ALIGN((intptr_t)node) - freePageStart;
+ if ( freePagesLength ) {
+ #ifdef DEBUG_SHARED_MEMORY_CACHE
+ qDebug("Marking pages not needed");
+--- qt-2.3.10/src/kernel/qwidget_qws.cpp~64bit 2005-12-14 12:20:46.000000000 +0000
++++ qt-2.3.10/src/kernel/qwidget_qws.cpp 2005-12-14 12:30:35.000000000 +0000
+@@ -50,6 +50,7 @@
+ #include "qwsmanager_qws.h"
+ #include "qwsregionmanager_qws.h"
+ #include "qinputcontext_p.h"
++#include <stdint.h>
+
+ void qt_insert_sip( QWidget*, int, int ); // defined in qapplication_x11.cpp
+ int qt_sip_count( QWidget* ); // --- "" ---
+@@ -633,7 +634,7 @@
+ qt_mouseGrb->releaseMouse();
+
+ qwsDisplay()->grabMouse(this,TRUE);
+- qwsDisplay()->selectCursor(this, (unsigned int)cursor.handle());
++ qwsDisplay()->selectCursor(this, (uintptr_t)cursor.handle());
+ qt_mouseGrb = this;
+ qt_pressGrab = 0;
+ }
+@@ -1840,11 +1841,11 @@
+ void QWidget::updateCursor( const QRegion &r ) const
+ {
+ if ( qt_last_x && (!QWidget::mouseGrabber() || QWidget::mouseGrabber() == this) &&
+- qt_last_cursor != (WId)cursor().handle() && !qws_overrideCursor ) {
++ qt_last_cursor != (uintptr_t)cursor().handle() && !qws_overrideCursor ) {
+ QSize s( qt_screen->width(), qt_screen->height() );
+ QPoint pos = qt_screen->mapToDevice(QPoint(*qt_last_x, *qt_last_y), s);
+ if ( r.contains(pos) )
+- qwsDisplay()->selectCursor((QWidget*)this, (unsigned int)cursor().handle());
++ qwsDisplay()->selectCursor((QWidget*)this, (uintptr_t)cursor().handle());
+ }
+ }
+ #endif
+--- qt-2.3.10/tools/qvfb/qvfbview.cpp~64bit 2005-12-14 13:32:47.000000000 +0000
++++ qt-2.3.10/tools/qvfb/qvfbview.cpp 2005-12-14 13:33:27.000000000 +0000
+@@ -40,6 +40,7 @@
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <math.h>
++#include <stdint.h>
+
+
+ QVFbView::QVFbView( int display_id, int _w, int _h, int d, Rotation r, QWidget *parent,
+@@ -136,7 +137,7 @@
+ data = (unsigned char *)shmat( shmId, 0, 0 );
+ }
+
+- if ( (int)data == -1 ){
++ if ( (intptr_t)data == -1 ){
+ ::close(mouseFd);
+ ::close(keyboardFd);
+ qFatal( "Cannot attach to shared memory %d",shmId );
diff --git a/recipes-qt/uicmoc/uicmoc-native-2.3.10/fix-makefile.patch b/recipes-qt/uicmoc/uicmoc-native-2.3.10/fix-makefile.patch
new file mode 100644
index 0000000..5943f0f
--- /dev/null
+++ b/recipes-qt/uicmoc/uicmoc-native-2.3.10/fix-makefile.patch
@@ -0,0 +1,16 @@
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+--- qt-2.3.7/Makefile~fix-makefile 2003-07-17 03:23:11.000000000 +0200
++++ qt-2.3.7/Makefile 2004-04-23 15:36:25.000000000 +0200
+@@ -29,7 +29,7 @@
+ cd tools; $(MAKE)
+
+ 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
++ @cd include; rm -f q*.h; for i in ../src/*/q*.h ../src/3rdparty/*/*.h ../extensions/*/src/q*.h; do ln -s $$i .; done; rm -f q*_p.h
+
+ sub-src: src-moc src-mt .buildopts FORCE
+ cd src; $(MAKE)
diff --git a/recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc3_4.patch b/recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc3_4.patch
new file mode 100644
index 0000000..fc1656a
--- /dev/null
+++ b/recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc3_4.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/recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc4.patch b/recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc4.patch
new file mode 100644
index 0000000..633fe86
--- /dev/null
+++ b/recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc4.patch
@@ -0,0 +1,12 @@
+--- qt-2.3.10/src/kernel/qwindowsystem_qws.h.orig 2005-07-13 20:23:30.061728456 +0100
++++ qt-2.3.10/src/kernel/qwindowsystem_qws.h 2005-07-13 20:37:57.183905848 +0100
+@@ -168,6 +168,9 @@
+ class QWSMouseHandler;
+ struct QWSCommandStruct;
+
++class QWSInputMethod;
++class QWSGestureMethod;
++
+ #ifndef QT_NO_QWS_MULTIPROCESS
+ class QWSServer : public QWSServerSocket
+ #else
diff --git a/recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc4_1.patch b/recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc4_1.patch
new file mode 100644
index 0000000..550effd
--- /dev/null
+++ b/recipes-qt/uicmoc/uicmoc-native-2.3.10/gcc4_1.patch
@@ -0,0 +1,16 @@
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+--- qt-2.3.10/src/tools/qvaluestack.h~gcc4 2005-01-23 15:00:47.000000000 +0100
++++ qt-2.3.10/src/tools/qvaluestack.h 2006-03-19 02:32:56.000000000 +0100
+@@ -54,7 +54,7 @@
+ {
+ T elem( this->last() );
+ if ( !this->isEmpty() )
+- remove( this->fromLast() );
++ this->remove( this->fromLast() );
+ return elem;
+ }
+ T& top() { return this->last(); }
diff --git a/recipes-qt/uicmoc/uicmoc-native-2.3.10/kernel-asm-page.patch b/recipes-qt/uicmoc/uicmoc-native-2.3.10/kernel-asm-page.patch
new file mode 100644
index 0000000..0d31874
--- /dev/null
+++ b/recipes-qt/uicmoc/uicmoc-native-2.3.10/kernel-asm-page.patch
@@ -0,0 +1,20 @@
+diff --git a/src/kernel/qpixmapcache.cpp b/src/kernel/qpixmapcache.cpp
+index c2e7d9b..8d39585 100644
+--- a/src/kernel/qpixmapcache.cpp
++++ b/src/kernel/qpixmapcache.cpp
+@@ -123,9 +123,12 @@ void cleanup_pixmap_cache();
+ #ifdef THROW_AWAY_UNUSED_PAGES
+ # include <sys/mman.h> // madvise
+-# include <asm/page.h> // PAGE_SIZE,PAGE_MASK,PAGE_ALIGN
++# include <unistd.h> // getpagesize()
++# if (!defined(PAGE_ALIGN)) && defined(PAGE_SIZE) && defined(PAGE_MASK)
++# define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
++# endif
+ # ifndef PAGE_ALIGN
+-# define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
+-# endif // PAGE_ALIGN
++# define PAGE_ALIGN(addr) (((addr)+getpagesize()-1)&~(getpagesize()-1))
++# endif
+ #endif // THROW_AWAY_UNUSED_PAGES
+
+
diff --git a/recipes-qt/uicmoc/uicmoc-native_2.3.10.bb b/recipes-qt/uicmoc/uicmoc-native_2.3.10.bb
new file mode 100644
index 0000000..12f10a0
--- /dev/null
+++ b/recipes-qt/uicmoc/uicmoc-native_2.3.10.bb
@@ -0,0 +1,56 @@
+DESCRIPTION = "User Interface Generator and Meta Object Compiler (moc) for Qt(E) 2.x"
+HOMEPAGE = "http://www.trolltech.com"
+SECTION = "devel"
+PRIORITY = "optional"
+LICENSE = "GPL QPL"
+PR = "r5"
+
+SRC_URI = "ftp://ftp.trolltech.com/pub/qt/source/qt-embedded-${PV}-free.tar.gz \
+ file://fix-makefile.patch \
+ file://gcc3_4.patch \
+ file://gcc4.patch \
+ file://gcc4_1.patch \
+ file://64bit-cleanup.patch \
+ file://kernel-asm-page.patch"
+S = "${WORKDIR}/qt-${PV}"
+
+inherit native qmake_base
+
+export QTDIR = "${S}"
+EXTRA_OEMAKE = 'SYSCONF_CXX="${CXX}" SYSCONF_LINK="${CXX}"'
+CXXFLAGS += " -DQWS"
+
+QT_CONFIG_FLAGS = "-depths 8,16 -no-qvfb -no-g++-exceptions -no-jpeg -no-mng \
+ -qt-zlib -qt-libpng -no-xft -no-xkb -no-vnc -no-sm \
+ -no-opengl -static -qconfig oe"
+
+do_configure() {
+ touch src/tools/qconfig-oe.h
+ echo "#define QT_NO_FREETYPE" >> src/tools/qconfig-oe.h
+ echo yes | ./configure ${QT_CONFIG_FLAGS} || die "Configuring qt failed"
+}
+
+do_compile() {
+ oe_runmake symlinks || die "Can't symlink include files"
+ oe_runmake -C src/moc || die "Building moc failed"
+
+ cp src/moc/moc bin/
+
+ oe_runmake -C src || die "Building libqt.a failed"
+ oe_runmake -C tools/designer/util || die "Building libqutil.a failed"
+ oe_runmake -C tools/designer/uic || die "Building uic failed"
+ oe_runmake -C tools/qvfb || die "Building qvfb failed"
+ oe_runmake -C tools/makeqpf || die "Building makeqpf failed"
+}
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 bin/moc ${D}${bindir}
+ install -m 0755 bin/uic ${D}${bindir}
+ install -m 0755 tools/makeqpf/makeqpf ${D}${bindir}
+}
+
+SRC_URI[md5sum] = "1f7ad30113afc500cab7f5b2f4dec0d7"
+SRC_URI[sha256sum] = "883363eb0c94de3d1e36f3ab9e09a8f127418d497213cc1a0ed1a1588ecd66b8"
+
+NATIVE_INSTALL_WORKS = "1"