summaryrefslogtreecommitdiff
path: root/qt/qt-2.3.10.patch
authormickeyl <mickeyl>2005-02-19 16:07:58 (UTC)
committer mickeyl <mickeyl>2005-02-19 16:07:58 (UTC)
commitb7bf9c7acdc010eb30bc246372efb0d1b394166a (patch) (unidiff)
tree8dde116603cd8ddf439a881fc4a1d8f413af617b /qt/qt-2.3.10.patch
parent298d0d244ca724405ca0651775ed61a22ce7a5ae (diff)
downloadopie-b7bf9c7acdc010eb30bc246372efb0d1b394166a.zip
opie-b7bf9c7acdc010eb30bc246372efb0d1b394166a.tar.gz
opie-b7bf9c7acdc010eb30bc246372efb0d1b394166a.tar.bz2
hello qte2.3.10 patches
bye bye old patches
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 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.9-snapshot-20041211/src/kernel/qapplication_qws.cpp~daemonize
7+++ qt-2.3.9-snapshot-20041211/src/kernel/qapplication_qws.cpp
8@@ -104,6 +104,7 @@
9 #endif
10
11 #include <sys/time.h>
12+#include <syslog.h>
13
14 #if defined(_OS_AIX_) && defined(_CC_GNU_)
15 #include <sys/select.h>
16@@ -163,6 +164,7 @@
17 //these used to be environment variables, they are initialized from
18 //environment variables in
19
20+bool qws_daemon = TRUE;
21 bool qws_savefonts = FALSE;
22 bool qws_screen_is_interlaced=FALSE; //### should be detected
23 bool qws_shared_memory = FALSE;
24@@ -1686,6 +1688,10 @@
25 mwGeometry = argv[i];
26 } else if ( arg == "-shared" ) {
27 qws_shared_memory = TRUE;
28 +} else if ( arg == "-daemon" ) {
29 + qws_daemon = TRUE;
30 +} else if ( arg == "-nodaemon" ) {
31 + qws_daemon = FALSE;
32 } else if ( arg == "-noshared" ) {
33 qws_shared_memory = FALSE;
34 } else if ( arg == "-savefonts" ) {
35@@ -1742,6 +1748,78 @@
36 qt_appType = type;
37 qws_single_process = TRUE;
38
39+ /* Daemonize the server process -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
40+ * Added a new command line option which only is relevant if the application is created as a GuiServer.
41+ * The option is -daemon respectively -nodaemon. If in daemon mode (which is the default now), the
42+ * server will detach from the controlling terminal and continue as a daemon. This is done via the standard
43+ * UNIX double fork magic.
44+ */
45+ if ( qws_daemon )
46+ {
47+ qWarning( "qt_init() - starting in daemon mode..." );
48+
49+ int pid1 = fork();
50+ if ( pid1 == -1 )
51+ {
52+ qWarning( "qt_init() - can't perform initial fork: %s", strerror( errno ) );
53+ exit( -1 );
54+ }
55+ if ( pid1 ) _exit( 0 ); // ok, first fork performed
56+
57+ chdir( "/" );
58+ setsid();
59+ umask(0);
60+ close(0);
61+ close(1);
62+ close(2);
63+
64+ int fdnull = ::open( "/dev/null", O_RDWR );
65+ if ( fdnull == -1 )
66+ {
67+ syslog( 3, "qt_init() - can't open /dev/null to redirect std{in|out|err}: %s", strerror( errno ) );
68+ exit( -1 );
69+ }
70+ dup2( fdnull, 0 ); // stdin
71+ dup2( fdnull, 1 ); // stdout
72+ dup2( fdnull, 2 ); // stderr
73+
74+ int pid2 = fork();
75+ if ( pid2 == -1 )
76+ {
77+ syslog( 3, "qt_init() - can't perform initial fork: %s", strerror( errno ) );
78+ exit( -1 );
79+ }
80+ if ( pid2 )
81+ {
82+ syslog( 4, "qt_init() [%d] - successfully entered daemon mode", pid2 );
83+ _exit( 0 ); // ok, second fork performed
84+ }
85+ }
86+
87+ /*
88+ * , ,
89+ * /( )`
90+ * \ \___ / | B E W A R E !
91+ * /- _ `-/ ' We are a DAEMON now!
92+ * (/\/ \ \ /\
93+ * / / | ` \
94+ * O O ) / |
95+ * `-^--'`< '
96+ * (_.) _ ) /
97+ * `.___/` /
98+ * `-----' /
99+ * <----. __ / __ \
100+ * <----|====O)))==) \) /====
101+ * <----' `--' `.__,' \
102+ * | |
103+ * \ /
104+ * ______( (_ / \______
105+ * (FL) ,' ,-----' | \
106+ * `--{__________) \/
107+ *
108+ */
109+
110+
111 /* Allocate a dedicated virtual terminal -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
112 * Added a new command line option which only is relevant if the application is created as a GuiServer.
113 * 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 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.9-snapshot-20050114/configure~devfs
7+++ qt-2.3.9-snapshot-20050114/configure
8@@ -412,6 +412,9 @@
9 -visibility-hidden)
10 VISIBILITY=YES
11 ;;
12+ -devfs)
13+ DEVFS=yes
14 +;;
15 -no-g++-exceptions)
16 GPLUSPLUS_EXCEPTIONS=no
17 ;;
18@@ -1302,6 +1305,8 @@
19 -visibility-hidden . Use -fvisibility=hidden as default. This requires GCC 4.0
20 or a special patched GCC to support the visibility attribute
21
22+ -devfs ............. Use devfs /dev paths.
23+
24 -no-g++-exceptions . Disable exceptions on platforms using the GNU C++
25 compiler by using the -fno-exceptions flag.
26
27@@ -1374,6 +1379,10 @@
28 then
29 QT_CXX="${QT_CXX} -DGCC_SUPPORTS_VISIBILITY -fvisibility=hidden"
30 fi
31+if [ "x$DEVFS" = "xyes" ]
32+then
33+ QT_CXX="${QT_CXX} -DQT_QWS_DEVFS"
34+fi
35 if [ "x$THREAD" = "xyes" ]
36 then
37 cat >src-mt.mk <<EOF
38--- qt-2.3.9-snapshot-20050114/src/kernel/qgfxlinuxfb_qws.cpp~devfs
39+++ qt-2.3.9-snapshot-20050114/src/kernel/qgfxlinuxfb_qws.cpp
40@@ -101,11 +101,19 @@
41 bool QLinuxFbScreen::connect( const QString &displaySpec )
42 {
43 // Check for explicitly specified device
44+#ifdef QT_QWS_DEVFS
45+ QRegExp r( "/dev/fb/[0-9]+" );
46+#else
47 QRegExp r( "/dev/fb[0-9]+" );
48+#endif
49 int len;
50 int m = r.match( displaySpec, 0, &len );
51
52+#ifdef QT_QWS_DEVFS
53+ QString dev = (m>=0) ? displaySpec.mid( m, len ) : QString("/dev/fb/0");
54+#else
55 QString dev = (m>=0) ? displaySpec.mid( m, len ) : QString("/dev/fb0");
56+#endif
57
58 fd=open( dev.latin1(), O_RDWR );
59 if (fd<0) {
60@@ -121,14 +129,22 @@
61
62 /* Get fixed screen information */
63 if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo)) {
64+#ifdef QT_QWS_DEVFS
65 +perror("reading /dev/fb/0");
66+#else
67 perror("reading /dev/fb0");
68+#endif
69 qWarning("Error reading fixed information");
70 return FALSE;
71 }
72
73 /* Get variable screen information */
74 if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo)) {
75+#ifdef QT_QWS_DEVFS
76 +perror("reading /dev/fb/0");
77+#else
78 perror("reading /dev/fb0");
79+#endif
80 qWarning("Error reading variable information");
81 return FALSE;
82 }
83@@ -165,7 +181,11 @@
84 data += dataoffset;
85
86 if ((int)data == -1) {
87 -perror("mapping /dev/fb0");
88+#ifdef QT_QWS_DEVFS
89 +perror("reading /dev/fb/0");
90+#else
91 +perror("reading /dev/fb0");
92+#endif
93 qWarning("Error: failed to map framebuffer device to memory.");
94 return FALSE;
95 }
96@@ -229,7 +249,11 @@
97
98 static void writeTerm(const char* termctl, int sizeof_termctl)
99 {
100+#ifdef QT_QWS_DEVFS
101+ const char* tt[]={"/dev/vc/1","/dev/console","/dev/tty",0};
102+#else
103 const char* tt[]={"/dev/console","/dev/tty","/dev/tty0",0};
104+#endif
105 const char** dev=tt;
106 while (*dev) {
107 int tty=::open(*dev,O_WRONLY);
108@@ -792,7 +816,11 @@
109 fb_var_screeninfo vinfo;
110
111 if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo)) {
112+#ifdef QT_QWS_DEVFS
113 +perror("reading /dev/fb/0");
114+#else
115 perror("reading /dev/fb0");
116+#endif
117 qFatal("Error reading fixed information");
118 }
119
120--- qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp~devfs
121+++ qt-2.3.9-snapshot-20050114/src/kernel/qkeyboard_qws.cpp
122@@ -1192,7 +1192,11 @@
123
124 QWSTtyKeyboardHandler::QWSTtyKeyboardHandler(const QString& device)
125 {
126+#ifdef QT_QWS_DEVFS
127+ kbdFD=open(device.isEmpty() ? "/dev/vc/1" : device.latin1(), O_RDWR | O_NDELAY, 0);
128+#else
129 kbdFD=open(device.isEmpty() ? "/dev/tty0" : device.latin1(), O_RDWR | O_NDELAY, 0);
130+#endif
131
132 if ( kbdFD >= 0 ) {
133 QSocketNotifier *notifier;
134--- qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.cpp~devfs
135+++ qt-2.3.9-snapshot-20050114/src/kernel/qwindowsystem_qws.cpp
136@@ -836,7 +836,11 @@
137 void openDevice()
138 {
139 if ( !sn ) {
140+#ifdef QT_QWS_DEVFS
141 + int fd = ::open("/dev/sound/dsp",O_RDWR);
142+#else
143 int fd = ::open("/dev/dsp",O_RDWR);
144+#endif
145 if ( fd < 0 ) {
146 // For debugging purposes - defined QT_NO_SOUND if you
147 // don't have sound hardware!
148--- qt-2.3.9-snapshot-20050114/src/kernel/qsoundqss_qws.cpp~devfs
149+++ qt-2.3.9-snapshot-20050114/src/kernel/qsoundqss_qws.cpp
150@@ -1088,7 +1088,12 @@
151 // Don't block open right away.
152 //
153 bool openOkay = false;
154 - if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) {
155+#ifdef QT_QWS_DEVFS
156+ if ((fd = ::open("/dev/sound/dsp", O_WRONLY|O_NONBLOCK)) != -1)
157+#else
158+ if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1)
159+#endif
160+ {
161 int flags = fcntl(fd, F_GETFL);
162 flags &= ~O_NONBLOCK;
163 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 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.9-snapshot-20041211/src/tools/qstring.cpp~encoding
7+++ qt-2.3.9-snapshot-20041211/src/tools/qstring.cpp
8@@ -14469,7 +14469,11 @@
9 return qt_winQString2MB( *this );
10 #endif
11 #ifdef _WS_QWS_
12- return utf8(); // ##### if there is ANY 8 bit format supported?
13+ QTextCodec* codec = QTextCodec::codecForLocale();
14+ return codec
15 + ? codec->fromUnicode(*this)
16 + : utf8();
17+ //return latin1(); // ##### if there is ANY 8 bit format supported?
18 #endif
19 #endif
20 }
21@@ -14515,7 +14519,12 @@
22 return qt_winMB2QString( local8Bit );
23 #endif
24 #ifdef _WS_QWS_
25- return fromUtf8(local8Bit,len);
26+ QTextCodec* codec = QTextCodec::codecForLocale();
27+ if( len < 0) len = qstrlen(local8Bit);
28+ return codec
29 + ? codec->toUnicode(local8Bit, len)
30 + : QString::fromUtf8(local8Bit,len);
31+// return fromLatin1(local8Bit,len);
32 #endif
33 #endif // QT_NO_TEXTCODEC
34 }
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 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.9-snapshot-20041211/src/kernel/qgfxraster_qws.cpp~fix-qgfxraster
7+++ qt-2.3.9-snapshot-20041211/src/kernel/qgfxraster_qws.cpp
8@@ -4037,13 +4037,14 @@
9 for( loopc2=0;loopc2<frontadd;loopc2++ )
10 *(alphaptr++)=get_value_32(16,(unsigned char **)&temppos);
11
12 -PackType temp2;
13 -unsigned char * cp;
14 +volatile PackType temp2;
15 +volatile unsigned short int * cp;
16 for( loopc2=0;loopc2<count;loopc2++ ) {
17 - temp2=*((PackType *)temppos);
18 - cp=(unsigned char *)&temp2;
19 - *(alphaptr++)=get_value_32(16,&cp);
20 - *(alphaptr++)=get_value_32(16,&cp);
21+ temp2=*reinterpret_cast<PackType *>(temppos);
22+ cp=reinterpret_cast<volatile unsigned short int *>(&temp2);
23+ *(alphaptr++)=qt_conv16ToRgb(*cp);
24+ cp++;
25+ *(alphaptr++)=qt_conv16ToRgb(*cp);
26 temppos += 2;
27 }
28
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 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.9-snapshot-20041211/src/tools/qcstring.h~gcc3
7+++ qt-2.3.9-snapshot-20041211/src/tools/qcstring.h
8@@ -119,7 +119,7 @@
9 // We want to keep source compatibility for 2.x
10 // ### TODO for 4.0: completely remove these and the cstr* functions
11
12-#if !defined(QT_GENUINE_STR)
13+#if 0
14
15 #undefstrlen
16 #define strlen qstrlen
17--- qt-2.3.9-snapshot-20041211/src/kernel/qwsdecoration_qws.h~gcc3
18+++ qt-2.3.9-snapshot-20041211/src/kernel/qwsdecoration_qws.h
19@@ -50,7 +50,7 @@
20 enum Region { None=0, All=1, Title=2, Top=3, Bottom=4, Left=5, Right=6,
21 TopLeft=7, TopRight=8, BottomLeft=9, BottomRight=10,
22 Close=11, Minimize=12, Maximize=13, Normalize=14,
23 - Menu=15, LastRegion=Menu };
24 + Menu=15, LastRegion=Menu, UserDefined = 100 };
25
26 virtual QRegion region(const QWidget *, const QRect &rect, Region r=All) = 0;
27 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 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.10-snapshot-20050131/src/widgets/qcommonstyle.cpp~opie
7+++ qt-2.3.10-snapshot-20050131/src/widgets/qcommonstyle.cpp
8@@ -572,7 +572,7 @@
9 bool enabled, bool active )
10 {
11 #ifndef QT_NO_MENUBAR
12-#ifndef QT_NO_STYLE_SGI
13+#if 1 // #ifndef QT_NO_STYLE_SGI
14 if (draw_menu_bar_impl != 0) {
15 QDrawMenuBarItemImpl impl = draw_menu_bar_impl;
16 (this->*impl)(p, x, y, w, h, mi, g, enabled, active);
17--- qt-2.3.10-snapshot-20050131/src/widgets/qlistview.cpp~opie
18+++ qt-2.3.10-snapshot-20050131/src/widgets/qlistview.cpp
19@@ -5051,9 +5051,9 @@
20 l = l->childItem ? l->childItem : l->siblingItem;
21
22 if ( l && l->height() )
23 -s.setHeight( s.height() + 10 * l->height() );
24- else
25 -s.setHeight( s.height() + 140 );
26 +s.setHeight( s.height() + 4 /*10*/ * l->height() );
27+ else // ^v much too big for handhelds
28 +s.setHeight( s.height() + 30 /*140*/ );
29
30 if ( s.width() > s.height() * 3 )
31 s.setHeight( s.width() / 3 );
32--- qt-2.3.10-snapshot-20050131/src/kernel/qwindowsystem_qws.cpp~opie
33+++ qt-2.3.10-snapshot-20050131/src/kernel/qwindowsystem_qws.cpp
34@@ -918,6 +918,18 @@
35 {
36 }
37
38+static void catchSegvSignal( int )
39+{
40+#ifndef QT_NO_QWS_KEYBOARD
41+ if ( qwsServer )
42 +qwsServer->closeKeyboard();
43+#endif
44+ QWSServer::closedown();
45+ fprintf(stderr, "Segmentation fault.\n");
46+ exit(1);
47+}
48+
49+
50 /*!
51 \class QWSServer qwindowsystem_qws.h
52 \brief Server-specific functionality in Qt/Embedded
53@@ -1043,6 +1055,7 @@
54 }
55
56 signal(SIGPIPE, ignoreSignal); //we get it when we read
57+ signal(SIGSEGV, catchSegvSignal); //recover the keyboard on crash
58 #endif
59 focusw = 0;
60 mouseGrabber = 0;
61--- qt-2.3.10-snapshot-20050131/src/widgets/qtoolbutton.cpp~opie
62+++ qt-2.3.10-snapshot-20050131/src/widgets/qtoolbutton.cpp
63@@ -332,12 +332,12 @@
64 QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Large, QIconSet::Normal);
65 w = pm.width();
66 h = pm.height();
67 -if ( w < 32 )
68 - w = 32;
69 -if ( h < 32 )
70 - h = 32;
71 +if ( w < 24 )
72 + w = 24;
73 +if ( h < 24 )
74 + h = 24;
75 } else {
76 -w = h = 16;
77 +w = h = 14;
78 QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Small, QIconSet::Normal);
79 w = pm.width();
80 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 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.10-snapshot-20050131/src/iconview/qiconview.cpp~qiconview-speed
7+++ qt-2.3.10-snapshot-20050131/src/iconview/qiconview.cpp
8@@ -225,6 +225,7 @@
9 QIconView::SelectionMode selectionMode;
10 QIconViewItem *currentItem, *tmpCurrentItem, *highlightedItem, *startDragItem, *pressedItem, *selectAnchor;
11 QRect *rubber;
12+ QPixmap *backBuffer;
13 QTimer *scrollTimer, *adjustTimer, *updateTimer, *inputTimer,
14 *fullRedrawTimer;
15 int rastX, rastY, spacing;
16@@ -2268,6 +2269,7 @@
17 d->currentItem = 0;
18 d->highlightedItem = 0;
19 d->rubber = 0;
20+ d->backBuffer = 0;
21 d->scrollTimer = 0;
22 d->startDragItem = 0;
23 d->tmpCurrentItem = 0;
24@@ -2416,6 +2418,8 @@
25 delete item;
26 item = tmp;
27 }
28+ delete d->backBuffer;
29+ d->backBuffer = 0;
30 delete d->fm;
31 d->fm = 0;
32 #ifndef QT_NO_TOOLTIP
33@@ -2882,6 +2886,48 @@
34 }
35
36 /*!
37+ This function grabs all paintevents that otherwise would have been
38+ processed by the QScrollView::viewportPaintEvent(). Here we use a
39+ doublebuffer to reduce 'on-paint' flickering on QIconView
40+ (and of course its childs).
41+
42+ \sa QScrollView::viewportPaintEvent(), QIconView::drawContents()
43+*/
44+
45+void QIconView::bufferedPaintEvent( QPaintEvent* pe )
46+{
47+ QWidget* vp = viewport();
48+ QRect r = pe->rect() & vp->rect();
49+ int ex = r.x() + contentsX();
50+ int ey = r.y() + contentsY();
51+ int ew = r.width();
52+ int eh = r.height();
53+
54+ if ( !d->backBuffer )
55 +d->backBuffer = new QPixmap(vp->size());
56+ if ( d->backBuffer->size() != vp->size() ) {
57 +//Resize function (with hysteesis). Uses a good compromise between memory
58 +//consumption and speed (number) of resizes.
59+ float newWidth = (float)vp->width();
60 +float newHeight = (float)vp->height();
61 +if ( newWidth > d->backBuffer->width() || newHeight > d->backBuffer->height() )
62 +{
63 + newWidth *= 1.1892;
64 + newHeight *= 1.1892;
65 + d->backBuffer->resize( (int)newWidth, (int)newHeight );
66 +} else if ( 1.5*newWidth < d->backBuffer->width() || 1.5*newHeight < d->backBuffer->height() )
67 + d->backBuffer->resize( (int)newWidth, (int)newHeight );
68+ }
69+
70+ QPainter p;
71+ p.begin(d->backBuffer, vp);
72+ drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh);
73+ p.end();
74+ bitBlt(vp, r.x(), r.y(), d->backBuffer, r.x(), r.y(), ew, eh);
75+}
76+
77+/*!
78+
79 \reimp
80 */
81
82@@ -4939,7 +4985,7 @@
83 if ( !d->rubber )
84 drawDragShapes( d->oldDragPos );
85 }
86 - viewportPaintEvent( (QPaintEvent*)e );
87+ bufferedPaintEvent ((QPaintEvent*)e );
88 if ( d->dragging ) {
89 if ( !d->rubber )
90 drawDragShapes( d->oldDragPos );
91@@ -5377,11 +5423,19 @@
92 return;
93
94 if ( item->d->container1 && d->firstContainer ) {
95 -item->d->container1->items.removeRef( item );
96+ //Special-case checking of the last item, since this may be
97+ //called a few times for the same item.
98+ if (item->d->container1->items.last() == item)
99+ item->d->container1->items.removeLast();
100+ else
101+ item->d->container1->items.removeRef( item );
102 }
103 item->d->container1 = 0;
104 if ( item->d->container2 && d->firstContainer ) {
105 -item->d->container2->items.removeRef( item );
106+ if (item->d->container2->items.last() == item)
107+ item->d->container2->items.removeLast();
108+ else
109+ item->d->container2->items.removeRef( item );
110 }
111 item->d->container2 = 0;
112
113--- qt-2.3.10-snapshot-20050131/src/iconview/qiconview.h~qiconview-speed
114+++ qt-2.3.10-snapshot-20050131/src/iconview/qiconview.h
115@@ -444,6 +444,7 @@
116 virtual void contentsDropEvent( QDropEvent *e );
117 #endif
118
119+ void bufferedPaintEvent( QPaintEvent* );
120 virtual void resizeEvent( QResizeEvent* e );
121 virtual void keyPressEvent( QKeyEvent *e );
122 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 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.10-snapshot-20050131/src/kernel/qkeyboard_qws.cpp~simpad
7+++ qt-2.3.10-snapshot-20050131/src/kernel/qkeyboard_qws.cpp
8@@ -37,6 +37,7 @@
9 #include <qapplication.h>
10 #include <qsocketnotifier.h>
11 #include <qnamespace.h>
12+#include <qdatetime.h>
13 #include <qtimer.h>
14
15 #include <stdlib.h>
16@@ -80,6 +81,60 @@
17 #include <sys/vt.h>
18 #endif
19
20+/*
21+ * SIMpad switches handler
22+ * (C) 2003-2005 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
23+ */
24+
25+
26+
27+#include <linux/switches.h>
28+#define SIMPAD_SWITCHES_DEVICE "/dev/misc/switches"
29+
30+// switches from left top to right down over the SIMpad surface
31+
32+#define SIMPAD_SWITCH_POWER 0x02
33+#define SIMPAD_SWITCH_UPPER 0x10
34+#define SIMPAD_SWITCH_UP 0x20
35+#define SIMPAD_SWITCH_DOWN 0x40
36+#define SIMPAD_SWITCH_LEFT 0x80
37+#define SIMPAD_SWITCH_RIGHT 0x100
38+#define SIMPAD_SWITCH_LOWER 0x8
39+
40+class QWSsimpadButtonsHandler : public QWSKeyboardHandler
41+{
42+ Q_OBJECT
43+
44+ public:
45+ QWSsimpadButtonsHandler();
46+ virtual ~QWSsimpadButtonsHandler();
47+
48+ bool isOpen() { return fd > 0; }
49+
50+ private slots:
51+ void readSwitchesData();
52+ void autoRepeat();
53+
54+ private:
55+ switches_mask_t switches;
56+
57+ int fd;
58+ int repeatdelay;
59+ int repeatperiod;
60+
61+ int lastCode; // last native code
62+ int lastPress; // last press/release state
63+
64+ int k; // last emitted Qt key code
65+ int shiftKeyPressed; // true if one of the SHIFT keys has been pressed and not yet released
66+ bool shiftUsed; // true if SHIFT has been used
67+
68+ QTime eventTimer; // tracks time between raw events
69+ QTimer* repeater;
70+ QSocketNotifier *notifier;
71+};
72+
73+
74 #ifdef QT_QWS_SL5XXX
75 #include <asm/sharp_char.h>
76 #endif
77@@ -165,9 +220,9 @@
78 current = 0;
79 }
80
81- void setAutoRepeat(int d, int p) { if ( d > 0 ) repeatdelay=d;
82+ void setAutoRepeat(int d, int p) { if ( d > 0 ) repeatdelay=d;
83 if ( p > 0 ) repeatperiod=p;}
84- void getAutoRepeat(int *d ,int *p ) { if (d) *d=repeatdelay;
85+ void getAutoRepeat(int *d ,int *p ) { if (d) *d=repeatdelay;
86 if (p) *p=repeatperiod; }
87
88 void stop()
89@@ -551,9 +606,9 @@
90
91 void doKey(uchar scancode);
92
93-
94+
95 void restoreLeds();
96-
97+
98 private:
99 bool shift;
100 bool alt;
101@@ -809,7 +864,7 @@
102
103 #if !defined(QT_QWS_SL5XXX)
104 if (code == 224
105-#if defined(QT_QWS_IPAQ)
106+#if defined(QT_QWS_IPAQ)
107 && !ipaq_return_pressed
108 #endif
109 ) {
110@@ -1775,9 +1830,11 @@
111 } else {
112 type = spec;
113 }
114-
115 if ( type == "Buttons" ) {
116-#if defined(QT_QWS_YOPY)
117+#if defined(QT_QWS_SIMPAD)
118 +qDebug( "QWSKeyboardHandler: using SIMpad switches handler..." );
119 +handler = new QWSsimpadButtonsHandler();
120+#elif defined(QT_QWS_YOPY)
121 handler = new QWSyopyButtonsHandler();
122 #elif defined(QT_QWS_CASSIOPEIA)
123 handler = new QWSVr41xxButtonsHandler();
124@@ -1812,6 +1869,218 @@
125 return keyM;
126 }
127
128-#endif // QT_NO_QWS_KEYBOARD
129
130+/*
131+ * SIMpad switches handler
132+ * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
133+ */
134+
135+
136+QWSsimpadButtonsHandler::QWSsimpadButtonsHandler()
137+ :QWSKeyboardHandler(), fd( -1 ),
138+ repeatdelay( 700 ), repeatperiod( 80 ),
139+ lastCode( 0 ), lastPress( 0 ),
140+ k( -1 ), shiftKeyPressed( 0 ), shiftUsed( false )
141+{
142+ qDebug( "SimpadButtonsHandler() - V4.1" );
143+ fd = ::open( SIMPAD_SWITCHES_DEVICE, O_RDWR | O_NDELAY, 0 );
144+ if ( fd < 0 )
145+ {
146+ qWarning( "SimpadButtonsHandler(): can't open %s", SIMPAD_SWITCHES_DEVICE );
147+ return;
148+ }
149+
150+ notifier = new QSocketNotifier( fd, QSocketNotifier::Read, this );
151+ connect( notifier, SIGNAL( activated(int) ),this, SLOT( readSwitchesData() ) );
152+
153+ repeater = new QTimer(this);
154+ connect(repeater, SIGNAL(timeout()), this, SLOT(autoRepeat()));
155+
156+}
157
158+
159+QWSsimpadButtonsHandler::~QWSsimpadButtonsHandler()
160+{
161+ qDebug( "~SimpadButtonsHandler()" );
162+ if ( fd > 0 )
163+ {
164+ ::close( fd );
165+ fd = -1;
166+ }
167+}
168+
169+
170+void QWSsimpadButtonsHandler::readSwitchesData()
171+{
172+ qDebug( "SimpadButtonsHandler() - detected switches action" );
173+
174+ if ( ::read( fd, &switches, sizeof switches ) < 0 )
175+ {
176+ qWarning( "SimpadButtonsHandler() - switches read error!" );
177+ return;
178+ }
179+
180+ qDebug( "SimpadButtonsHandler() - Shift: %0x [used: %0x] + Event = %0x | %0x",
181+ shiftKeyPressed, shiftUsed, switches.events[0], switches.states[0] );
182+
183+ bool press = switches.states[0]; // == switches.event[0];
184+ int code = switches.events[0];
185+
186+ //=========================================================================
187+
188+ /**
189+ * Work around a bug in the kernel keyboard driver emitting
190+ * bogus events when pressing multiple switches at once
191+ **/
192+
193+ if ( lastCode == 0 )
194+ {
195+ // first press ever
196+ eventTimer.start();
197+ lastPress = press;
198+ lastCode = code;
199+ }
200+ else
201+ {
202+ int interval = eventTimer.restart();
203+ qDebug( "event interval = %d", interval );
204+ if ( code == lastCode && interval < 10 )
205+ {
206+ qDebug( "event interval too small - ignoring bogus event" );
207+ qDebug( "did I say i hate buggy kernel drivers? :-D" );
208+ return;
209+ }
210+
211+ lastPress = press;
212+ lastCode = code;
213+ }
214+
215+ /**
216+ * Actually it may also be a hardware problem, but I really don't like
217+ * to review kernel code for further inquiry. So just being lazy and
218+ * do the workaround in user space :-D
219+ **/
220+
221+ //=====================================================================
222+
223+ if ( shiftKeyPressed )
224+ {
225+ // a shift key obviously is being held
226+ qDebug( "while shift key is being held..." );
227+
228+ if ( code != shiftKeyPressed )
229+ {
230+ // another key is being touched - that means shift mode for us!
231+ qDebug( " another key is being touched -> shift use now = true" );
232+
233+ shiftUsed = true;
234+
235+ if ( shiftKeyPressed == SIMPAD_SWITCH_LOWER ) // SHIFT 1
236+ {
237+ qDebug( " shift mode 1" );
238+ switch(code)
239+ {
240+ case SIMPAD_SWITCH_UP: k = Qt::Key_F9; break; // Shift1-Up = Calendar
241+ case SIMPAD_SWITCH_DOWN: k = Qt::Key_F10; break; // Shift1-Down = Contacts
242+ case SIMPAD_SWITCH_LEFT: k = Qt::Key_F13; break; // Shift1-Left = Mail
243+ case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F11; break; // Shift1-Up = Menu
244+ case SIMPAD_SWITCH_UPPER: k = Qt::Key_F12; break; // Shift1-Upper = Home
245+ default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 1 !" ); break;
246+ }
247+ }
248+ else if ( shiftKeyPressed == SIMPAD_SWITCH_UPPER ) // SHIFT 2
249+ {
250+ qDebug( " shift mode 2" );
251+ switch(code)
252+ {
253+ case SIMPAD_SWITCH_UP: k = Qt::Key_F5; break; // Shift2-Up = F5
254+ case SIMPAD_SWITCH_DOWN: k = Qt::Key_F6; break; // Shift2-Down = F6
255+ case SIMPAD_SWITCH_LEFT: k = Qt::Key_F7; break; // Shift2-Left = F7
256+ case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F8; break; // Shift2-Up = F8
257+ case SIMPAD_SWITCH_LOWER: k = Qt::Key_F9; break; // Shift2-Lower = F9
258+ default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 2!" ); break;
259+ }
260+ }
261+ }
262+ else
263+ {
264+ qDebug( " shift key has been released. checking if being used..." );
265+ shiftKeyPressed = 0;
266+
267+ if ( !shiftUsed )
268+ {
269+ qDebug( " ... has _not_ being used -> really emit the key" );
270+ k = ( code == SIMPAD_SWITCH_UPPER ? Qt::Key_Escape : Qt::Key_Return );
271+ qDebug( "Emitting key = %d (pressed)", k );
272+ processKeyEvent( 0, k, 0, true, true );
273+ qDebug( "Emitting key = %d (released)", k );
274+ processKeyEvent( 0, k, 0, false, true );
275+ return;
276+ }
277+ else
278+ {
279+ qDebug( " ... has being used -> doing nothing" );
280+ return;
281+ }
282+ }
283+ }
284+ else
285+ {
286+ qDebug( "standard mode - no shift yet..." );
287+
288+ switch(code)
289+ {
290+ case SIMPAD_SWITCH_UP: k = Qt::Key_Up; break;
291+ case SIMPAD_SWITCH_DOWN: k = Qt::Key_Down; break;
292+ case SIMPAD_SWITCH_LEFT: k = Qt::Key_Left; break;
293+ case SIMPAD_SWITCH_RIGHT: k = Qt::Key_Right; break;
294+ case SIMPAD_SWITCH_POWER: k = Qt::Key_F34; break; // Power Button
295+
296+ case SIMPAD_SWITCH_UPPER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return;
297+ case SIMPAD_SWITCH_LOWER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return;
298+
299+ default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event!" ); break;
300+ }
301+ }
302+
303+ if ( k == -1 )
304+ {
305+ qDebug( "no key to emit - returning." );
306+ return;
307+ }
308+
309+ bool repeatable = ( k == Qt::Key_Up || k == Qt::Key_Down ||
310+ k == Qt::Key_Right || k == Qt::Key_Left );
311+
312+ qDebug( "key to emit = %d [%s] [repeat=%s]", k,
313+ press ? "press" : "release",
314+ repeatable ? "true":"false" );
315+
316+ if ( qt_screen->isTransformed() && k >= Qt::Key_Left && k <= Qt::Key_Down )
317+ {
318+ qDebug( "SimpadButtonsHandler() - We are transformed! Correcting..." );
319+ int oldK = k;
320+ k = xform_dirkey( k );
321+ qDebug( "SimpadButtonsHandler() - Old Key: %d - New Key %d", oldK, k );
322+ }
323+
324+ if ( repeatable && press )
325+ repeater->start( repeatdelay, true );
326+ else
327+ repeater->stop();
328+
329+ qwsServer->processKeyEvent( 0, k, 0, press, false );
330+}
331+
332+
333+void QWSsimpadButtonsHandler::autoRepeat()
334+{
335+ qDebug( "Emitting key = %d (released)", k );
336+ processKeyEvent( 0, k, 0, false, true );
337+ qDebug( "Emitting key = %d (pressed)", k );
338+ processKeyEvent( 0, k, 0, true, true );
339+ repeater->start(repeatperiod);
340+}
341+
342+
343+#endif // QT_NO_QWS_KEYBOARD
344--- qt-2.3.10-snapshot-20050131/src/kernel/qsoundqss_qws.cpp~simpad
345+++ qt-2.3.10-snapshot-20050131/src/kernel/qsoundqss_qws.cpp
346@@ -53,8 +53,8 @@
347
348 extern int errno;
349
350-#define QT_QWS_SOUND_16BIT 1 // or 0, or undefined for always 0
351-#define QT_QWS_SOUND_STEREO 1 // or 0, or undefined for always 0
352+#define QT_QWS_SOUND_16BIT 0 // or 0, or undefined for always 0
353+#define QT_QWS_SOUND_STEREO 0 // or 0, or undefined for always 0
354
355 // Zaurus SL5000D doesn't seem to return any error if setting to 44000 and it fails,
356 // however 44100 works, 44100 is more common that 44000.
357--- qt-2.3.10-snapshot-20050131/src/kernel/qwsmouse_qws.cpp~simpad
358+++ qt-2.3.10-snapshot-20050131/src/kernel/qwsmouse_qws.cpp
359@@ -47,6 +47,7 @@
360 #include <stdlib.h>
361 #include <stdio.h>
362 #include <sys/ioctl.h>
363+#include <sys/time.h>
364 #include <sys/types.h>
365 #include <sys/stat.h>
366 #include <fcntl.h>
367@@ -73,6 +74,7 @@
368 unsigned short x;
369 unsigned short y;
370 unsigned short pad;
371+ struct timeval stamp;
372 } TS_EVENT;
373 #elif defined(QT_QWS_SL5XXX)
374 #define QT_QWS_SL5XXX_RAW
375@@ -1310,6 +1312,11 @@
376 return;
377 }
378 # endif
379+#elif defined(QT_QWS_SIMPAD )
380+ if ((mouseFD = open( "/dev/touchscreen/ucb1x00", O_RDONLY | O_NONBLOCK )) < 0) {
381+ qWarning( "Cannot open /dev/touchscreen/ucb1x00 (%s)", strerror(errno));
382+ return;
383+ }
384 #endif
385
386 QSocketNotifier *mouseNotifier;
387@@ -1323,7 +1330,7 @@
388
389 QTPanelHandlerPrivate::~QTPanelHandlerPrivate()
390 {
391-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
392+#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
393 if (mouseFD >= 0)
394 close(mouseFD);
395 #endif
396@@ -1331,7 +1338,7 @@
397
398 void QTPanelHandlerPrivate::readMouseData()
399 {
400-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
401+#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
402 if(!qt_screen)
403 return;
404
405@@ -2014,7 +2021,7 @@
406 handler = new QTSLibHandlerPrivate();
407 #elif defined(QT_QWS_YOPY)
408 handler = new QYopyTPanelHandlerPrivate(mouseProtocol,mouseDev);
409-#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
410+#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
411 handler = new QTPanelHandlerPrivate(mouseProtocol,mouseDev);
412 #elif defined(QT_QWS_CASSIOPEIA)
413 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 @@
1Index: qt-2.3.10/src/kernel/qwsmouse_qws.cpp
2===================================================================
3 --- qt-2.3.10.orig/src/kernel/qwsmouse_qws.cpp2005-02-16 00:53:53.090339898 +0100
4 +++ qt-2.3.10/src/kernel/qwsmouse_qws.cpp2005-02-16 00:54:43.059069292 +0100
5@@ -1878,30 +1878,33 @@
6 */
7 void QTSLibHandlerPrivate::interpolateSample() {
8 #ifdef QT_QWS_TSLIB
9- static struct ts_sample samples[25];
10- int index = -1;
11+#define TSLIB_MAX_SAMPLES 25
12+ static struct ts_sample samples[TSLIB_MAX_SAMPLES];
13+ int index = 0;
14+ int read_samples = 0;
15 int ret;
16
17 do {
18- /* fill only the last sample again */
19- if ( index >= 25 )
20- index = 24;
21-
22+ /* do not access negative arrays */
23+ if ( index < 0 )
24+ index = 0;
25 +
26 /* we're opened non-blocking */
27- if((ret= ts_read_raw(m_ts, &samples[index], 1 ) ) != 1 ) {
28+ if((ret= ts_read_raw(m_ts, &samples[index], 1 ) ) != 1 )
29 /* no event yet, so try again */
30- if (ret==-1 ) {
31- index--;
32+ if (ret==-1 )
33 continue;
34- }
35- }
36- }while (samples[index++].pressure != 0);
37 +
38 +read_samples++;
39 +index = (index+1)%TSLIB_MAX_SAMPLES;
40+ }while (samples[index == 0 ? (TSLIB_MAX_SAMPLES-1) : index-1].pressure != 0);
41
42 /*
43- * index is maximal 25 and we at least one sample
44+ * If we've wrapped around each sample is used otherwise
45+ * we will use the index
46 */
47- if( index >= 25 )
48- index = 24;
49+ index = read_samples >= TSLIB_MAX_SAMPLES ?
50+ (TSLIB_MAX_SAMPLES-1 ) : index;
51 int x, y;
52
53 /*
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 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.9-snapshot-20041221/src/kernel/qapplication_qws.cpp~vt-switch.patch
7+++ qt-2.3.9-snapshot-20041221/src/kernel/qapplication_qws.cpp
8@@ -124,6 +124,12 @@
9 static int qt_thread_pipe[2];
10 #endif
11
12+#if defined(_OS_LINUX_)
13+#include <sys/ioctl.h>
14+#include <linux/vt.h>
15+#include <linux/kd.h>
16+#endif
17+
18 const int qwsSharedRamSize = 32 * 1024;//Small amount to fit on small devices.
19
20 // These are in qapplication.cpp in qt/main
21@@ -164,6 +170,8 @@
22 bool qws_accel = TRUE; // ### never set
23 const char *qws_display_spec = ":0";
24 int qws_display_id = 0;
25+int qws_terminal_id = 0;
26+int qws_terminal_old = 0;
27 int qws_client_id = 0;
28 QWidget *qt_pressGrab = 0;
29 QWidget *qt_mouseGrb = 0;
30@@ -1700,6 +1708,15 @@
31 type = QApplication::GuiServer;
32 } else if ( arg == "-interlaced" ) {
33 qws_screen_is_interlaced = TRUE;
34+ } else if ( arg == "-terminal" ) {
35+ if ( ++i < argc )
36+ {
37+ if ( ( qws_terminal_id = atoi( argv[i] ) ) < 1 )
38+ {
39+ qWarning( "Ignoring Invalid Terminal Specification." );
40+ qws_terminal_id = 0;
41+ }
42+ }
43 } else if ( arg == "-display" ) {
44 if ( ++i < argc )
45 qws_display_spec = argv[i];
46@@ -1724,6 +1741,53 @@
47 if ( type == QApplication::GuiServer ) {
48 qt_appType = type;
49 qws_single_process = TRUE;
50+
51+ /* Allocate a dedicated virtual terminal -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
52+ * Added a new command line option which only is relevant if the application is created as a GuiServer.
53+ * The option is -terminal <num>, where <num> specifies the virtual terminal to be occupied by the server.
54+ * As default in Linux, 0 means the current virtual terminal.
55+ */
56+ #if defined(_OS_LINUX_)
57+ if ( qws_terminal_id )
58+ {
59+ qDebug( "qt_init() - terminal specification is '%d'.", qws_terminal_id );
60+ struct vt_stat console_stat;
61+ int console_fd = ::open( QString().sprintf( "/dev/tty%d", qws_terminal_id ).latin1(), O_RDWR );
62+ if ( console_fd == -1)
63+ {
64+ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
65+ exit( -1 );
66+ }
67+ if ( ioctl( console_fd, VT_GETSTATE, &console_stat ) == -1 )
68+ {
69+ qWarning( "qt_init() - can't ioctl(VT_GETSTATE): %s", strerror( errno ) );
70+ exit( -1 );
71+ }
72+ qws_terminal_old = console_stat.v_active;
73+ qDebug( "qt_init() - active vt is #%d, switching to #%d as requested...", qws_terminal_old, qws_terminal_id );
74+
75+ if ( ioctl( console_fd, VT_ACTIVATE, qws_terminal_id ) == -1 )
76+ {
77+ qWarning( "qt_init() - can't ioctl(VT_ACTIVATE): %s", strerror( errno ) );
78+ exit( -1 );
79+ }
80+ if ( ioctl( console_fd, VT_WAITACTIVE, qws_terminal_id ) == -1 )
81+ {
82+ qWarning( "qt_init() - can't ioctl(VT_WAITACTIVE): %s", strerror( errno ) );
83+ exit( -1 );
84+ }
85+ if ( ioctl( console_fd, KDSETMODE, KD_GRAPHICS ) == -1 )
86+ {
87+ qWarning( "qt_init() - can't ioctl(KDSETMODE:KD_GRAPHICS): %s", strerror( errno ) );
88+ exit( -1 );
89+ }
90+ ::close( console_fd );
91+ }
92+ else
93+ {
94+ qDebug( "QWSApplication::qt_init() - current terminal specified." );
95+ }
96+ #endif
97 QWSServer::startup(flags);
98 setenv("QWS_DISPLAY", qws_display_spec, 0);
99 }
100@@ -1774,7 +1838,36 @@
101 QFontManager::cleanup();
102
103 if ( qws_single_process ) {
104 -QWSServer::closedown();
105+ qDebug( "qt_cleanup() - shutting down QWSServer..." );
106+#ifndef QT_NO_QWS_KEYBOARD
107+ if ( qwsServer )
108+ qwsServer->closeKeyboard();
109+#endif
110+ QWSServer::closedown();
111+#if defined(_OS_LINUX_)
112+ if ( qws_terminal_old > 0 )
113+ {
114+ qDebug( "qt_cleanup() - switching back to virtual terminal #%d", qws_terminal_old );
115+
116+ int console_fd = ::open( "/dev/tty0", O_RDWR );
117+ if ( console_fd == -1)
118+ {
119+ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
120+ }
121+ else
122+ {
123+ if ( ioctl( console_fd, KDSETMODE, KD_TEXT ) == -1 )
124+ {
125+ qWarning( "qt_init() - can't ioctl(KDSETMODE:KD_TEXT): %s", strerror( errno ) );
126+ }
127+ if ( ioctl( console_fd, VT_ACTIVATE, qws_terminal_old ) == -1 )
128+ {
129+ qWarning( "qt_init() - can't ioctl(VT_ACTIVATE): %s", strerror( errno ) );
130+ }
131+ ::close( console_fd );
132+ }
133+ }
134+#endif
135 }
136 if ( qt_is_gui_used ) {
137 delete qt_fbdpy;
138--- qt-2.3.9-snapshot-20041221/src/kernel/qkeyboard_qws.cpp~vt-switch.patch
139+++ qt-2.3.9-snapshot-20041221/src/kernel/qkeyboard_qws.cpp
140@@ -1247,6 +1247,24 @@
141 {
142 if (kbdFD >= 0)
143 {
144+
145+#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
146+ struct vt_mode vtMode;
147+ ioctl(kbdFD, VT_GETMODE, &vtMode);
148+
149+ /* Mickey says: "Better give up control of VT switching.
150+ * Hey, I really hate that OS-will-reacquire-resources on process-death
151+ * kind of thinking!
152+ */
153+ vtMode.mode = VT_AUTO;
154+ vtMode.relsig = 0;
155+ vtMode.acqsig = 0;
156+ ioctl(kbdFD, VT_SETMODE, &vtMode);
157+
158+ signal(VTSWITCHSIG, 0);
159+ qDebug( "~QWSTtyKeyboardHandler() - released VT." );
160+#endif
161+
162 #if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
163 ioctl(kbdFD, KDSKBMODE, K_XLATE);
164 #endif
165--- qt-2.3.9-snapshot-20041221/src/kernel/qgfxlinuxfb_qws.cpp~vt-switch.patch
166+++ qt-2.3.9-snapshot-20041221/src/kernel/qgfxlinuxfb_qws.cpp
167@@ -251,9 +251,9 @@
168
169 bool QLinuxFbScreen::initDevice()
170 {
171- // No blankin' screen, no blinkin' cursor!, no cursor!
172+ /* Setting up the VT parameters is done in qapplication_qws.cpp
173 const char termctl[]="\033[9;0]\033[?33l\033[?25l";
174- writeTerm(termctl,sizeof(termctl));
175+ writeTerm(termctl,sizeof(termctl)); */
176
177 // Grab current mode so we can reset it
178 fb_var_screeninfo vinfo;