summaryrefslogtreecommitdiff
path: root/qt/qt-2.3.10.patch
Side-by-side diff
Diffstat (limited to 'qt/qt-2.3.10.patch') (more/less context) (ignore whitespace changes)
-rw-r--r--qt/qt-2.3.10.patch/daemonize.patch113
-rw-r--r--qt/qt-2.3.10.patch/devfs.patch163
-rw-r--r--qt/qt-2.3.10.patch/encoding.patch34
-rw-r--r--qt/qt-2.3.10.patch/fix-qgfxraster.patch28
-rw-r--r--qt/qt-2.3.10.patch/gcc3.patch27
-rw-r--r--qt/qt-2.3.10.patch/handhelds.patch80
-rw-r--r--qt/qt-2.3.10.patch/qiconview-speed.patch122
-rw-r--r--qt/qt-2.3.10.patch/simpad.patch413
-rw-r--r--qt/qt-2.3.10.patch/tslib.patch53
-rw-r--r--qt/qt-2.3.10.patch/vt-switch.patch178
10 files changed, 1211 insertions, 0 deletions
diff --git a/qt/qt-2.3.10.patch/daemonize.patch b/qt/qt-2.3.10.patch/daemonize.patch
new file mode 100644
index 0000000..487a18c
--- a/dev/null
+++ b/qt/qt-2.3.10.patch/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/qt/qt-2.3.10.patch/devfs.patch b/qt/qt-2.3.10.patch/devfs.patch
new file mode 100644
index 0000000..27ea423
--- a/dev/null
+++ b/qt/qt-2.3.10.patch/devfs.patch
@@ -0,0 +1,163 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20050114/configure~devfs
++++ qt-2.3.9-snapshot-20050114/configure
+@@ -412,6 +412,9 @@
+ -visibility-hidden)
+ VISIBILITY=YES
+ ;;
++ -devfs)
++ DEVFS=yes
++ ;;
+ -no-g++-exceptions)
+ GPLUSPLUS_EXCEPTIONS=no
+ ;;
+@@ -1302,6 +1305,8 @@
+ -visibility-hidden . Use -fvisibility=hidden as default. This requires GCC 4.0
+ or a special patched GCC to support the visibility attribute
+
++ -devfs ............. Use devfs /dev paths.
++
+ -no-g++-exceptions . Disable exceptions on platforms using the GNU C++
+ compiler by using the -fno-exceptions flag.
+
+@@ -1374,6 +1379,10 @@
+ then
+ QT_CXX="${QT_CXX} -DGCC_SUPPORTS_VISIBILITY -fvisibility=hidden"
+ fi
++if [ "x$DEVFS" = "xyes" ]
++then
++ QT_CXX="${QT_CXX} -DQT_QWS_DEVFS"
++fi
+ if [ "x$THREAD" = "xyes" ]
+ then
+ cat >src-mt.mk <<EOF
+--- qt-2.3.9-snapshot-20050114/src/kernel/qgfxlinuxfb_qws.cpp~devfs
++++ qt-2.3.9-snapshot-20050114/src/kernel/qgfxlinuxfb_qws.cpp
+@@ -101,11 +101,19 @@
+ bool QLinuxFbScreen::connect( const QString &displaySpec )
+ {
+ // Check for explicitly specified device
++#ifdef QT_QWS_DEVFS
++ QRegExp r( "/dev/fb/[0-9]+" );
++#else
+ QRegExp r( "/dev/fb[0-9]+" );
++#endif
+ int len;
+ int m = r.match( displaySpec, 0, &len );
+
++#ifdef QT_QWS_DEVFS
++ QString dev = (m>=0) ? displaySpec.mid( m, len ) : QString("/dev/fb/0");
++#else
+ QString dev = (m>=0) ? displaySpec.mid( m, len ) : QString("/dev/fb0");
++#endif
+
+ fd=open( dev.latin1(), O_RDWR );
+ if (fd<0) {
+@@ -121,14 +129,22 @@
+
+ /* Get fixed screen information */
+ if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo)) {
++#ifdef QT_QWS_DEVFS
++ perror("reading /dev/fb/0");
++#else
+ perror("reading /dev/fb0");
++#endif
+ qWarning("Error reading fixed information");
+ return FALSE;
+ }
+
+ /* Get variable screen information */
+ if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo)) {
++#ifdef QT_QWS_DEVFS
++ perror("reading /dev/fb/0");
++#else
+ perror("reading /dev/fb0");
++#endif
+ qWarning("Error reading variable information");
+ return FALSE;
+ }
+@@ -165,7 +181,11 @@
+ data += dataoffset;
+
+ if ((int)data == -1) {
+- perror("mapping /dev/fb0");
++#ifdef QT_QWS_DEVFS
++ perror("reading /dev/fb/0");
++#else
++ perror("reading /dev/fb0");
++#endif
+ qWarning("Error: failed to map framebuffer device to memory.");
+ return FALSE;
+ }
+@@ -229,7 +249,11 @@
+
+ static void writeTerm(const char* termctl, int sizeof_termctl)
+ {
++#ifdef QT_QWS_DEVFS
++ const char* tt[]={"/dev/vc/1","/dev/console","/dev/tty",0};
++#else
+ const char* tt[]={"/dev/console","/dev/tty","/dev/tty0",0};
++#endif
+ const char** dev=tt;
+ while (*dev) {
+ int tty=::open(*dev,O_WRONLY);
+@@ -792,7 +816,11 @@
+ fb_var_screeninfo vinfo;
+
+ if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo)) {
++#ifdef QT_QWS_DEVFS
++ perror("reading /dev/fb/0");
++#else
+ perror("reading /dev/fb0");
++#endif
+ qFatal("Error reading fixed information");
+ }
+
+--- qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp~devfs
++++ qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp
+@@ -1192,7 +1192,11 @@
+
+ QWSTtyKeyboardHandler::QWSTtyKeyboardHandler(const QString& device)
+ {
++#ifdef QT_QWS_DEVFS
++ kbdFD=open(device.isEmpty() ? "/dev/vc/1" : device.latin1(), O_RDWR | O_NDELAY, 0);
++#else
+ kbdFD=open(device.isEmpty() ? "/dev/tty0" : device.latin1(), O_RDWR | O_NDELAY, 0);
++#endif
+
+ if ( kbdFD >= 0 ) {
+ QSocketNotifier *notifier;
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.cpp~devfs
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.cpp
+@@ -836,7 +836,11 @@
+ void openDevice()
+ {
+ if ( !sn ) {
++#ifdef QT_QWS_DEVFS
++ int fd = ::open("/dev/sound/dsp",O_RDWR);
++#else
+ int fd = ::open("/dev/dsp",O_RDWR);
++#endif
+ if ( fd < 0 ) {
+ // For debugging purposes - defined QT_NO_SOUND if you
+ // don't have sound hardware!
+--- qt-2.3.9-snapshot-20050114/src/kernel/qsoundqss_qws.cpp~devfs
++++ qt-2.3.9-snapshot-20050114/src/kernel/qsoundqss_qws.cpp
+@@ -1088,7 +1088,12 @@
+ // Don't block open right away.
+ //
+ bool openOkay = false;
+- if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) {
++#ifdef QT_QWS_DEVFS
++ if ((fd = ::open("/dev/sound/dsp", O_WRONLY|O_NONBLOCK)) != -1)
++#else
++ if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1)
++#endif
++ {
+ int flags = fcntl(fd, F_GETFL);
+ flags &= ~O_NONBLOCK;
+ openOkay = (fcntl(fd, F_SETFL, flags) == 0);
diff --git a/qt/qt-2.3.10.patch/encoding.patch b/qt/qt-2.3.10.patch/encoding.patch
new file mode 100644
index 0000000..13a4828
--- a/dev/null
+++ b/qt/qt-2.3.10.patch/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/qt/qt-2.3.10.patch/fix-qgfxraster.patch b/qt/qt-2.3.10.patch/fix-qgfxraster.patch
new file mode 100644
index 0000000..7bc1e2a
--- a/dev/null
+++ b/qt/qt-2.3.10.patch/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/qt/qt-2.3.10.patch/gcc3.patch b/qt/qt-2.3.10.patch/gcc3.patch
new file mode 100644
index 0000000..fc1656a
--- a/dev/null
+++ b/qt/qt-2.3.10.patch/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/qt/qt-2.3.10.patch/handhelds.patch b/qt/qt-2.3.10.patch/handhelds.patch
new file mode 100644
index 0000000..3335796
--- a/dev/null
+++ b/qt/qt-2.3.10.patch/handhelds.patch
@@ -0,0 +1,80 @@
+
+#
+# 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;
+--- qt-2.3.10-snapshot-20050131/src/widgets/qtoolbutton.cpp~opie
++++ qt-2.3.10-snapshot-20050131/src/widgets/qtoolbutton.cpp
+@@ -332,12 +332,12 @@
+ QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Large, QIconSet::Normal);
+ w = pm.width();
+ h = pm.height();
+- if ( w < 32 )
+- w = 32;
+- if ( h < 32 )
+- h = 32;
++ if ( w < 24 )
++ w = 24;
++ if ( h < 24 )
++ h = 24;
+ } else {
+- w = h = 16;
++ w = h = 14;
+ QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Small, QIconSet::Normal);
+ w = pm.width();
+ h = pm.height();
diff --git a/qt/qt-2.3.10.patch/qiconview-speed.patch b/qt/qt-2.3.10.patch/qiconview-speed.patch
new file mode 100644
index 0000000..bac9b97
--- a/dev/null
+++ b/qt/qt-2.3.10.patch/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/qt/qt-2.3.10.patch/simpad.patch b/qt/qt-2.3.10.patch/simpad.patch
new file mode 100644
index 0000000..1777a94
--- a/dev/null
+++ b/qt/qt-2.3.10.patch/simpad.patch
@@ -0,0 +1,413 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10-snapshot-20050131/src/kernel/qkeyboard_qws.cpp~simpad
++++ qt-2.3.10-snapshot-20050131/src/kernel/qkeyboard_qws.cpp
+@@ -37,6 +37,7 @@
+ #include <qapplication.h>
+ #include <qsocketnotifier.h>
+ #include <qnamespace.h>
++#include <qdatetime.h>
+ #include <qtimer.h>
+
+ #include <stdlib.h>
+@@ -80,6 +81,60 @@
+ #include <sys/vt.h>
+ #endif
+
++/*
++ * SIMpad switches handler
++ * (C) 2003-2005 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
++ */
++
++
++
++#include <linux/switches.h>
++#define SIMPAD_SWITCHES_DEVICE "/dev/misc/switches"
++
++// switches from left top to right down over the SIMpad surface
++
++#define SIMPAD_SWITCH_POWER 0x02
++#define SIMPAD_SWITCH_UPPER 0x10
++#define SIMPAD_SWITCH_UP 0x20
++#define SIMPAD_SWITCH_DOWN 0x40
++#define SIMPAD_SWITCH_LEFT 0x80
++#define SIMPAD_SWITCH_RIGHT 0x100
++#define SIMPAD_SWITCH_LOWER 0x8
++
++class QWSsimpadButtonsHandler : public QWSKeyboardHandler
++{
++ Q_OBJECT
++
++ public:
++ QWSsimpadButtonsHandler();
++ virtual ~QWSsimpadButtonsHandler();
++
++ bool isOpen() { return fd > 0; }
++
++ private slots:
++ void readSwitchesData();
++ void autoRepeat();
++
++ private:
++ switches_mask_t switches;
++
++ int fd;
++ int repeatdelay;
++ int repeatperiod;
++
++ int lastCode; // last native code
++ int lastPress; // last press/release state
++
++ int k; // last emitted Qt key code
++ int shiftKeyPressed; // true if one of the SHIFT keys has been pressed and not yet released
++ bool shiftUsed; // true if SHIFT has been used
++
++ QTime eventTimer; // tracks time between raw events
++ QTimer* repeater;
++ QSocketNotifier *notifier;
++};
++
++
+ #ifdef QT_QWS_SL5XXX
+ #include <asm/sharp_char.h>
+ #endif
+@@ -165,9 +220,9 @@
+ current = 0;
+ }
+
+- void setAutoRepeat(int d, int p) { if ( d > 0 ) repeatdelay=d;
++ void setAutoRepeat(int d, int p) { if ( d > 0 ) repeatdelay=d;
+ if ( p > 0 ) repeatperiod=p;}
+- void getAutoRepeat(int *d ,int *p ) { if (d) *d=repeatdelay;
++ void getAutoRepeat(int *d ,int *p ) { if (d) *d=repeatdelay;
+ if (p) *p=repeatperiod; }
+
+ void stop()
+@@ -551,9 +606,9 @@
+
+ void doKey(uchar scancode);
+
+-
++
+ void restoreLeds();
+-
++
+ private:
+ bool shift;
+ bool alt;
+@@ -809,7 +864,7 @@
+
+ #if !defined(QT_QWS_SL5XXX)
+ if (code == 224
+-#if defined(QT_QWS_IPAQ)
++#if defined(QT_QWS_IPAQ)
+ && !ipaq_return_pressed
+ #endif
+ ) {
+@@ -1775,9 +1830,11 @@
+ } else {
+ type = spec;
+ }
+-
+ if ( type == "Buttons" ) {
+-#if defined(QT_QWS_YOPY)
++#if defined(QT_QWS_SIMPAD)
++ qDebug( "QWSKeyboardHandler: using SIMpad switches handler..." );
++ handler = new QWSsimpadButtonsHandler();
++#elif defined(QT_QWS_YOPY)
+ handler = new QWSyopyButtonsHandler();
+ #elif defined(QT_QWS_CASSIOPEIA)
+ handler = new QWSVr41xxButtonsHandler();
+@@ -1812,6 +1869,218 @@
+ return keyM;
+ }
+
+-#endif // QT_NO_QWS_KEYBOARD
+
++/*
++ * SIMpad switches handler
++ * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
++ */
++
++
++QWSsimpadButtonsHandler::QWSsimpadButtonsHandler()
++ :QWSKeyboardHandler(), fd( -1 ),
++ repeatdelay( 700 ), repeatperiod( 80 ),
++ lastCode( 0 ), lastPress( 0 ),
++ k( -1 ), shiftKeyPressed( 0 ), shiftUsed( false )
++{
++ qDebug( "SimpadButtonsHandler() - V4.1" );
++ fd = ::open( SIMPAD_SWITCHES_DEVICE, O_RDWR | O_NDELAY, 0 );
++ if ( fd < 0 )
++ {
++ qWarning( "SimpadButtonsHandler(): can't open %s", SIMPAD_SWITCHES_DEVICE );
++ return;
++ }
++
++ notifier = new QSocketNotifier( fd, QSocketNotifier::Read, this );
++ connect( notifier, SIGNAL( activated(int) ),this, SLOT( readSwitchesData() ) );
++
++ repeater = new QTimer(this);
++ connect(repeater, SIGNAL(timeout()), this, SLOT(autoRepeat()));
++
++}
+
++
++QWSsimpadButtonsHandler::~QWSsimpadButtonsHandler()
++{
++ qDebug( "~SimpadButtonsHandler()" );
++ if ( fd > 0 )
++ {
++ ::close( fd );
++ fd = -1;
++ }
++}
++
++
++void QWSsimpadButtonsHandler::readSwitchesData()
++{
++ qDebug( "SimpadButtonsHandler() - detected switches action" );
++
++ if ( ::read( fd, &switches, sizeof switches ) < 0 )
++ {
++ qWarning( "SimpadButtonsHandler() - switches read error!" );
++ return;
++ }
++
++ qDebug( "SimpadButtonsHandler() - Shift: %0x [used: %0x] + Event = %0x | %0x",
++ shiftKeyPressed, shiftUsed, switches.events[0], switches.states[0] );
++
++ bool press = switches.states[0]; // == switches.event[0];
++ int code = switches.events[0];
++
++ //=========================================================================
++
++ /**
++ * Work around a bug in the kernel keyboard driver emitting
++ * bogus events when pressing multiple switches at once
++ **/
++
++ if ( lastCode == 0 )
++ {
++ // first press ever
++ eventTimer.start();
++ lastPress = press;
++ lastCode = code;
++ }
++ else
++ {
++ int interval = eventTimer.restart();
++ qDebug( "event interval = %d", interval );
++ if ( code == lastCode && interval < 10 )
++ {
++ qDebug( "event interval too small - ignoring bogus event" );
++ qDebug( "did I say i hate buggy kernel drivers? :-D" );
++ return;
++ }
++
++ lastPress = press;
++ lastCode = code;
++ }
++
++ /**
++ * Actually it may also be a hardware problem, but I really don't like
++ * to review kernel code for further inquiry. So just being lazy and
++ * do the workaround in user space :-D
++ **/
++
++ //=====================================================================
++
++ if ( shiftKeyPressed )
++ {
++ // a shift key obviously is being held
++ qDebug( "while shift key is being held..." );
++
++ if ( code != shiftKeyPressed )
++ {
++ // another key is being touched - that means shift mode for us!
++ qDebug( " another key is being touched -> shift use now = true" );
++
++ shiftUsed = true;
++
++ if ( shiftKeyPressed == SIMPAD_SWITCH_LOWER ) // SHIFT 1
++ {
++ qDebug( " shift mode 1" );
++ switch(code)
++ {
++ case SIMPAD_SWITCH_UP: k = Qt::Key_F9; break; // Shift1-Up = Calendar
++ case SIMPAD_SWITCH_DOWN: k = Qt::Key_F10; break; // Shift1-Down = Contacts
++ case SIMPAD_SWITCH_LEFT: k = Qt::Key_F13; break; // Shift1-Left = Mail
++ case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F11; break; // Shift1-Up = Menu
++ case SIMPAD_SWITCH_UPPER: k = Qt::Key_F12; break; // Shift1-Upper = Home
++ default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 1 !" ); break;
++ }
++ }
++ else if ( shiftKeyPressed == SIMPAD_SWITCH_UPPER ) // SHIFT 2
++ {
++ qDebug( " shift mode 2" );
++ switch(code)
++ {
++ case SIMPAD_SWITCH_UP: k = Qt::Key_F5; break; // Shift2-Up = F5
++ case SIMPAD_SWITCH_DOWN: k = Qt::Key_F6; break; // Shift2-Down = F6
++ case SIMPAD_SWITCH_LEFT: k = Qt::Key_F7; break; // Shift2-Left = F7
++ case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F8; break; // Shift2-Up = F8
++ case SIMPAD_SWITCH_LOWER: k = Qt::Key_F9; break; // Shift2-Lower = F9
++ default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 2!" ); break;
++ }
++ }
++ }
++ else
++ {
++ qDebug( " shift key has been released. checking if being used..." );
++ shiftKeyPressed = 0;
++
++ if ( !shiftUsed )
++ {
++ qDebug( " ... has _not_ being used -> really emit the key" );
++ k = ( code == SIMPAD_SWITCH_UPPER ? Qt::Key_Escape : Qt::Key_Return );
++ qDebug( "Emitting key = %d (pressed)", k );
++ processKeyEvent( 0, k, 0, true, true );
++ qDebug( "Emitting key = %d (released)", k );
++ processKeyEvent( 0, k, 0, false, true );
++ return;
++ }
++ else
++ {
++ qDebug( " ... has being used -> doing nothing" );
++ return;
++ }
++ }
++ }
++ else
++ {
++ qDebug( "standard mode - no shift yet..." );
++
++ switch(code)
++ {
++ case SIMPAD_SWITCH_UP: k = Qt::Key_Up; break;
++ case SIMPAD_SWITCH_DOWN: k = Qt::Key_Down; break;
++ case SIMPAD_SWITCH_LEFT: k = Qt::Key_Left; break;
++ case SIMPAD_SWITCH_RIGHT: k = Qt::Key_Right; break;
++ case SIMPAD_SWITCH_POWER: k = Qt::Key_F34; break; // Power Button
++
++ case SIMPAD_SWITCH_UPPER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return;
++ case SIMPAD_SWITCH_LOWER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return;
++
++ default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event!" ); break;
++ }
++ }
++
++ if ( k == -1 )
++ {
++ qDebug( "no key to emit - returning." );
++ return;
++ }
++
++ bool repeatable = ( k == Qt::Key_Up || k == Qt::Key_Down ||
++ k == Qt::Key_Right || k == Qt::Key_Left );
++
++ qDebug( "key to emit = %d [%s] [repeat=%s]", k,
++ press ? "press" : "release",
++ repeatable ? "true":"false" );
++
++ if ( qt_screen->isTransformed() && k >= Qt::Key_Left && k <= Qt::Key_Down )
++ {
++ qDebug( "SimpadButtonsHandler() - We are transformed! Correcting..." );
++ int oldK = k;
++ k = xform_dirkey( k );
++ qDebug( "SimpadButtonsHandler() - Old Key: %d - New Key %d", oldK, k );
++ }
++
++ if ( repeatable && press )
++ repeater->start( repeatdelay, true );
++ else
++ repeater->stop();
++
++ qwsServer->processKeyEvent( 0, k, 0, press, false );
++}
++
++
++void QWSsimpadButtonsHandler::autoRepeat()
++{
++ qDebug( "Emitting key = %d (released)", k );
++ processKeyEvent( 0, k, 0, false, true );
++ qDebug( "Emitting key = %d (pressed)", k );
++ processKeyEvent( 0, k, 0, true, true );
++ repeater->start(repeatperiod);
++}
++
++
++#endif // QT_NO_QWS_KEYBOARD
+--- qt-2.3.10-snapshot-20050131/src/kernel/qsoundqss_qws.cpp~simpad
++++ qt-2.3.10-snapshot-20050131/src/kernel/qsoundqss_qws.cpp
+@@ -53,8 +53,8 @@
+
+ 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
++#define QT_QWS_SOUND_16BIT 0 // or 0, or undefined for always 0
++#define QT_QWS_SOUND_STEREO 0 // or 0, or undefined for always 0
+
+ // Zaurus SL5000D doesn't seem to return any error if setting to 44000 and it fails,
+ // however 44100 works, 44100 is more common that 44000.
+--- qt-2.3.10-snapshot-20050131/src/kernel/qwsmouse_qws.cpp~simpad
++++ qt-2.3.10-snapshot-20050131/src/kernel/qwsmouse_qws.cpp
+@@ -47,6 +47,7 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <sys/ioctl.h>
++#include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+@@ -73,6 +74,7 @@
+ unsigned short x;
+ unsigned short y;
+ unsigned short pad;
++ struct timeval stamp;
+ } TS_EVENT;
+ #elif defined(QT_QWS_SL5XXX)
+ #define QT_QWS_SL5XXX_RAW
+@@ -1310,6 +1312,11 @@
+ return;
+ }
+ # endif
++#elif defined(QT_QWS_SIMPAD )
++ if ((mouseFD = open( "/dev/touchscreen/ucb1x00", O_RDONLY | O_NONBLOCK )) < 0) {
++ qWarning( "Cannot open /dev/touchscreen/ucb1x00 (%s)", strerror(errno));
++ return;
++ }
+ #endif
+
+ QSocketNotifier *mouseNotifier;
+@@ -1323,7 +1330,7 @@
+
+ QTPanelHandlerPrivate::~QTPanelHandlerPrivate()
+ {
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
++#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
+ if (mouseFD >= 0)
+ close(mouseFD);
+ #endif
+@@ -1331,7 +1338,7 @@
+
+ void QTPanelHandlerPrivate::readMouseData()
+ {
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
++#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
+ if(!qt_screen)
+ return;
+
+@@ -2014,7 +2021,7 @@
+ handler = new QTSLibHandlerPrivate();
+ #elif defined(QT_QWS_YOPY)
+ handler = new QYopyTPanelHandlerPrivate(mouseProtocol,mouseDev);
+-#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
++#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
+ handler = new QTPanelHandlerPrivate(mouseProtocol,mouseDev);
+ #elif defined(QT_QWS_CASSIOPEIA)
+ handler = new QVrTPanelHandlerPrivate( mouseProtocol, mouseDev );
diff --git a/qt/qt-2.3.10.patch/tslib.patch b/qt/qt-2.3.10.patch/tslib.patch
new file mode 100644
index 0000000..47837d7
--- a/dev/null
+++ b/qt/qt-2.3.10.patch/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/qt/qt-2.3.10.patch/vt-switch.patch b/qt/qt-2.3.10.patch/vt-switch.patch
new file mode 100644
index 0000000..4007a5d
--- a/dev/null
+++ b/qt/qt-2.3.10.patch/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;