summaryrefslogtreecommitdiff
path: root/qt/qt-2.3.9.patch
Unidiff
Diffstat (limited to 'qt/qt-2.3.9.patch') (more/less context) (show whitespace changes)
-rw-r--r--qt/qt-2.3.9.patch/qte239-all.patch510
-rw-r--r--qt/qt-2.3.9.patch/qte239-qwsmouse.patch301
2 files changed, 0 insertions, 811 deletions
diff --git a/qt/qt-2.3.9.patch/qte239-all.patch b/qt/qt-2.3.9.patch/qte239-all.patch
deleted file mode 100644
index 533652d..0000000
--- a/qt/qt-2.3.9.patch/qte239-all.patch
+++ b/dev/null
@@ -1,510 +0,0 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.9-snapshot-20041102/src/iconview/qiconview.cpp~qte239-all
7+++ qt-2.3.9-snapshot-20041102/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.9-snapshot-20041102/src/iconview/qiconview.h~qte239-all
114+++ qt-2.3.9-snapshot-20041102/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 );
123--- qt-2.3.9-snapshot-20041102/src/kernel/qapplication.cpp~qte239-all
124+++ qt-2.3.9-snapshot-20041102/src/kernel/qapplication.cpp
125@@ -35,6 +35,8 @@
126 **
127 **********************************************************************/
128
129 +#define QT_WEAK_SYMBOL__attribute__(( weak ))
130+
131 #include "qobjectlist.h"
132 #include "qobjectdict.h"
133 #include "qapplication.h"
134@@ -937,11 +939,16 @@
135 #ifndef QT_NO_STYLE
136 void QApplication::setStyle( QStyle *style )
137 {
138 +setStyle_NonWeak ( style );
139+}
140+
141+void QApplication::setStyle_NonWeak( QStyle *style )
142+{
143 QStyle* old = app_style;
144- app_style = style;
145
146 if ( startingUp() ) {
147 delete old;
148 +app_style = style;
149 return;
150 }
151
152@@ -962,6 +969,8 @@
153 old->unPolish( qApp );
154 }
155
156+ app_style = style;
157+
158 // take care of possible palette requirements of certain gui
159 // styles. Do it before polishing the application since the style
160 // might call QApplication::setStyle() itself
161@@ -1188,13 +1197,30 @@
162 \sa QWidget::setPalette(), palette(), QStyle::polish()
163 */
164
165-void QApplication::setPalette( const QPalette &palette, bool informWidgets,
166+void QApplication::setPalette ( const QPalette &palette, bool informWidgets,
167 + const char* className )
168+{
169 +setPalette_NonWeak ( palette, informWidgets, className );
170+}
171+
172+void QApplication::setPalette_NonWeak ( const QPalette &palette, bool informWidgets,
173 const char* className )
174 {
175 QPalette pal = palette;
176 #ifndef QT_NO_STYLE
177- if ( !startingUp() )
178+ if ( !startingUp() ) {
179 qApp->style().polish( pal );// NB: non-const reference
180 +if ( className ) {
181 + // if we just polished a class specific palette (this normally
182 + // only called by qt_fix_tooltips - see below), we better re-
183 + // polish the global palette. Some styles like liquid can get
184 + // confused, because they can not detect if the polished palette
185 + // is the global one or only a class specific one.
186 + // (liquid uses this palette to calculate blending pixmaps)
187 + QPalette p = qApp-> palette ( );
188 + qApp->style().polish ( p );
189 +}
190+ }
191 #endif
192 bool all = FALSE;
193 if ( !className ) {
194@@ -1279,6 +1305,12 @@
195 void QApplication::setFont( const QFont &font, bool informWidgets,
196 const char* className )
197 {
198 +setFont_NonWeak ( font, informWidgets, className );
199+}
200+
201+void QApplication::setFont_NonWeak( const QFont &font, bool informWidgets,
202 + const char* className )
203+{
204 bool all = FALSE;
205 if ( !className ) {
206 if ( !app_font ) {
207--- qt-2.3.9-snapshot-20041102/src/kernel/qapplication.h~qte239-all
208+++ qt-2.3.9-snapshot-20041102/src/kernel/qapplication.h
209@@ -61,6 +61,10 @@
210 class QSemaphore;
211 #endif
212
213+#if !defined( QT_WEAK_SYMBOL )
214+#define QT_WEAK_SYMBOL
215+#endif
216+
217 // REMOVE IN 3.0 (just here for moc source compatibility)
218 #define QNonBaseApplication QApplication
219
220@@ -85,7 +89,10 @@
221
222 #ifndef QT_NO_STYLE
223 static QStyle &style();
224 - static void setStyle( QStyle* );
225 + static void setStyle( QStyle* ) QT_WEAK_SYMBOL;
226+private:
227 +static void setStyle_NonWeak( QStyle* );
228+public:
229 #endif
230 #if 1/* OBSOLETE */
231 enum ColorMode { NormalColors, CustomColors };
232@@ -106,11 +113,19 @@
233 #ifndef QT_NO_PALETTE
234 static QPalette palette( const QWidget* = 0 );
235 static void setPalette( const QPalette &, bool informWidgets=FALSE,
236 + const char* className = 0 ) QT_WEAK_SYMBOL;
237+private:
238 + static void setPalette_NonWeak( const QPalette &, bool informWidgets=FALSE,
239 const char* className = 0 );
240+public:
241 #endif
242 static QFont font( const QWidget* = 0 );
243 static void setFont( const QFont &, bool informWidgets=FALSE,
244 + const char* className = 0 ) QT_WEAK_SYMBOL;
245+private:
246 + static void setFont_NonWeak( const QFont &, bool informWidgets=FALSE,
247 const char* className = 0 );
248 +public:
249 static QFontMetrics fontMetrics();
250
251 QWidget *mainWidget() const;
252@@ -207,7 +222,10 @@
253 void qwsSetCustomColors( QRgb *colortable, int start, int numColors );
254 #ifndef QT_NO_QWS_MANAGER
255 static QWSDecoration &qwsDecoration();
256- static void qwsSetDecoration( QWSDecoration *);
257+ static void qwsSetDecoration( QWSDecoration *) QT_WEAK_SYMBOL;
258+private:
259+ static void qwsSetDecoration_NonWeak( QWSDecoration *);
260+public:
261 #endif
262 #endif
263
264--- qt-2.3.9-snapshot-20041102/src/kernel/qapplication_qws.cpp~qte239-all
265+++ qt-2.3.9-snapshot-20041102/src/kernel/qapplication_qws.cpp
266@@ -2905,6 +2905,11 @@
267 */
268 void QApplication::qwsSetDecoration( QWSDecoration *d )
269 {
270 +qwsSetDecoration_NonWeak ( d );
271+}
272+
273+void QApplication::qwsSetDecoration_NonWeak( QWSDecoration *d )
274+{
275 if ( d ) {
276 delete qws_decoration;
277 qws_decoration = d;
278--- qt-2.3.9-snapshot-20041102/src/kernel/qfontdatabase.cpp~qte239-all
279+++ qt-2.3.9-snapshot-20041102/src/kernel/qfontdatabase.cpp
280@@ -35,6 +35,8 @@
281 **
282 **********************************************************************/
283
284+#define QT_WEAK_SYMBOL __attribute__(( weak ))
285+
286 #include "qfontdatabase.h"
287
288 #ifndef QT_NO_FONTDATABASE
289@@ -2424,6 +2426,13 @@
290 const QString &style,
291 const QString &charSet )
292 {
293 +return pointSizes_NonWeak ( family, style, charSet );
294+}
295+
296+QValueList<int> QFontDatabase::pointSizes_NonWeak ( const QString &family,
297+ const QString &style,
298+ const QString &charSet )
299+{
300 QString cs( charSet );
301 if ( charSet.isEmpty() ) {
302 QStringList lst = charSets( family );
303--- qt-2.3.9-snapshot-20041102/src/kernel/qfontdatabase.h~qte239-all
304+++ qt-2.3.9-snapshot-20041102/src/kernel/qfontdatabase.h
305@@ -59,6 +59,10 @@
306 class QDiskFont;
307 #endif
308
309+#if !defined( QT_WEAK_SYMBOL )
310+#define QT_WEAK_SYMBOL
311+#endif
312+
313 class QFontDatabasePrivate;
314
315 class Q_EXPORT QFontDatabase
316@@ -67,9 +71,16 @@
317 QFontDatabase();
318
319 QStringList families( bool onlyForLocale = TRUE ) const;
320+
321+
322 QValueList<int> pointSizes( const QString &family,
323 const QString &style = QString::null,
324 - const QString &charSet = QString::null );
325 + const QString &charSet = QString::null ) QT_WEAK_SYMBOL;
326+private:
327+ QValueList<int> pointSizes_NonWeak( const QString &family,
328 + const QString &style,
329 + const QString &charSet );
330+public:
331 QStringList styles( const QString &family,
332 const QString &charSet = QString::null ) const;
333 QStringList charSets( const QString &familyName,
334--- qt-2.3.9-snapshot-20041102/src/kernel/qgfxraster_qws.cpp~qte239-all
335+++ qt-2.3.9-snapshot-20041102/src/kernel/qgfxraster_qws.cpp
336@@ -4408,7 +4408,7 @@
337 setAlphaType(IgnoreAlpha);
338 if ( w <= 0 || h <= 0 || !ncliprect ) return;
339 GFX_START(QRect(rx+xoffs, ry+yoffs, w+1, h+1))
340-#ifdef QWS_EXPERIMENTAL_FASTPATH
341+#if 0 // def QWS_EXPERIMENTAL_FASTPATH !! this is crashing HancomWord on OZ !!
342 // ### fix for 8bpp
343 // This seems to be reliable now, at least for 16bpp
344
345--- qt-2.3.9-snapshot-20041102/src/kernel/qkeyboard_qws.cpp~qte239-all
346+++ qt-2.3.9-snapshot-20041102/src/kernel/qkeyboard_qws.cpp
347@@ -314,7 +314,7 @@
348 { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 63
349 { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 64
350 { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 65
351 - { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 66
352+ { Qt::Key_F14, 0xffff , 0xffff , 0xffff }, // 66
353 { Qt::Key_Meta, 0xffff , 0xffff , 0xffff }, // 67
354 { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 68
355 { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 69
356--- qt-2.3.9-snapshot-20041102/src/kernel/qwindowsystem_qws.cpp~qte239-all
357+++ qt-2.3.9-snapshot-20041102/src/kernel/qwindowsystem_qws.cpp
358@@ -913,6 +913,18 @@
359 {
360 }
361
362+static void catchSegvSignal( int )
363+{
364+#ifndef QT_NO_QWS_KEYBOARD
365+ if ( qwsServer )
366 +qwsServer->closeKeyboard();
367+#endif
368+ QWSServer::closedown();
369+ fprintf(stderr, "Segmentation fault.\n");
370+ exit(1);
371+}
372+
373+
374 /*!
375 \class QWSServer qwindowsystem_qws.h
376 \brief Server-specific functionality in Qt/Embedded
377@@ -1038,6 +1050,7 @@
378 }
379
380 signal(SIGPIPE, ignoreSignal); //we get it when we read
381+ signal(SIGSEGV, catchSegvSignal); //recover the keyboard on crash
382 #endif
383 focusw = 0;
384 mouseGrabber = 0;
385--- qt-2.3.9-snapshot-20041102/src/tools/qcstring.h~qte239-all
386+++ qt-2.3.9-snapshot-20041102/src/tools/qcstring.h
387@@ -119,7 +119,7 @@
388 // We want to keep source compatibility for 2.x
389 // ### TODO for 4.0: completely remove these and the cstr* functions
390
391-#if !defined(QT_GENUINE_STR)
392+#if 0
393
394 #undefstrlen
395 #define strlen qstrlen
396--- qt-2.3.9-snapshot-20041102/src/tools/qglobal.h~qte239-all
397+++ qt-2.3.9-snapshot-20041102/src/tools/qglobal.h
398@@ -207,8 +207,16 @@
399 #if __GNUC__ == 2 && __GNUC_MINOR__ == 96
400 #define Q_FP_CCAST_BROKEN
401 #endif
402+/* ARM gcc pads structs to 32 bits, even when they contain a single
403+ char, or short. We tell gcc to pack QChars to 16 bits, to avoid
404+ QString bloat. However, gcc 3.4 doesn't allow us to create references to
405+ members of a packed struct. (Pointers are OK, because then you
406+ supposedly know what you are doing.) */
407 #if (defined(__arm__) || defined(__ARMEL__)) && !defined(QT_MOC_CPP)
408 #define Q_PACKED __attribute__ ((packed))
409+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4
410+# define Q_NO_PACKED_REFERENCE
411+# endif
412 #endif
413 #elif defined(__xlC__)
414 #define _CC_XLC_
415--- qt-2.3.9-snapshot-20041102/src/tools/qstring.cpp~qte239-all
416+++ qt-2.3.9-snapshot-20041102/src/tools/qstring.cpp
417@@ -14469,7 +14469,11 @@
418 return qt_winQString2MB( *this );
419 #endif
420 #ifdef _WS_QWS_
421- return utf8(); // ##### if there is ANY 8 bit format supported?
422+ QTextCodec* codec = QTextCodec::codecForLocale();
423+ return codec
424 + ? codec->fromUnicode(*this)
425 + : utf8();
426+ //return latin1(); // ##### if there is ANY 8 bit format supported?
427 #endif
428 #endif
429 }
430@@ -14515,7 +14519,12 @@
431 return qt_winMB2QString( local8Bit );
432 #endif
433 #ifdef _WS_QWS_
434- return fromUtf8(local8Bit,len);
435+ QTextCodec* codec = QTextCodec::codecForLocale();
436+ if( len < 0) len = qstrlen(local8Bit);
437+ return codec
438 + ? codec->toUnicode(local8Bit, len)
439 + : QString::fromUtf8(local8Bit,len);
440+// return fromLatin1(local8Bit,len);
441 #endif
442 #endif // QT_NO_TEXTCODEC
443 }
444--- qt-2.3.9-snapshot-20041102/src/widgets/qcommonstyle.cpp~qte239-all
445+++ qt-2.3.9-snapshot-20041102/src/widgets/qcommonstyle.cpp
446@@ -572,7 +572,7 @@
447 bool enabled, bool active )
448 {
449 #ifndef QT_NO_MENUBAR
450-#ifndef QT_NO_STYLE_SGI
451+#if 1 // #ifndef QT_NO_STYLE_SGI
452 if (draw_menu_bar_impl != 0) {
453 QDrawMenuBarItemImpl impl = draw_menu_bar_impl;
454 (this->*impl)(p, x, y, w, h, mi, g, enabled, active);
455--- qt-2.3.9-snapshot-20041102/src/widgets/qlistview.cpp~qte239-all
456+++ qt-2.3.9-snapshot-20041102/src/widgets/qlistview.cpp
457@@ -5051,9 +5051,9 @@
458 l = l->childItem ? l->childItem : l->siblingItem;
459
460 if ( l && l->height() )
461 -s.setHeight( s.height() + 10 * l->height() );
462- else
463 -s.setHeight( s.height() + 140 );
464 +s.setHeight( s.height() + 4 /*10*/ * l->height() );
465+ else // ^v much too big for handhelds
466 +s.setHeight( s.height() + 30 /*140*/ );
467
468 if ( s.width() > s.height() * 3 )
469 s.setHeight( s.width() / 3 );
470--- qt-2.3.9-snapshot-20041102/src/widgets/qscrollview.cpp~qte239-all
471+++ qt-2.3.9-snapshot-20041102/src/widgets/qscrollview.cpp
472@@ -1285,6 +1285,9 @@
473 case QEvent::LayoutHint:
474 d->autoResizeHint(this);
475 break;
476 +case QEvent::WindowActivate:
477 +case QEvent::WindowDeactivate:
478 + return TRUE;
479 default:
480 break;
481 }
482--- qt-2.3.9-snapshot-20041102/src/widgets/qtoolbutton.cpp~qte239-all
483+++ qt-2.3.9-snapshot-20041102/src/widgets/qtoolbutton.cpp
484@@ -238,7 +238,7 @@
485 else
486 QToolTip::add( this, textLabel );
487 }
488 -#endif
489+#endif
490 }
491
492
493@@ -332,12 +332,12 @@
494 QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Large, QIconSet::Normal);
495 w = pm.width();
496 h = pm.height();
497 -if ( w < 32 )
498 - w = 32;
499 -if ( h < 32 )
500 - h = 32;
501 +if ( w < 24 )
502 + w = 24;
503 +if ( h < 24 )
504 + h = 24;
505 } else {
506 -w = h = 16;
507 +w = h = 14;
508 QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Small, QIconSet::Normal);
509 w = pm.width();
510 h = pm.height();
diff --git a/qt/qt-2.3.9.patch/qte239-qwsmouse.patch b/qt/qt-2.3.9.patch/qte239-qwsmouse.patch
deleted file mode 100644
index 865516e..0000000
--- a/qt/qt-2.3.9.patch/qte239-qwsmouse.patch
+++ b/dev/null
@@ -1,301 +0,0 @@
1#
2# Patch managed by http://www.holgerschurig.de/patcher.html
3#
4
5--- qt-2.3.9-snapshot-20041211/src/kernel/qwsmouse_qws.cpp~tslib.patch
6+++ qt-2.3.9-snapshot-20041211/src/kernel/qwsmouse_qws.cpp
7@@ -7,6 +7,14 @@
8 **
9 ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
10 **
11+** Portions Copyright (C) 2003 Texas Instruments, Inc.
12+** Rights to said portions for use under the GPL and QPL licenses
13+** are hereby granted to Trolltech AS.
14+**
15+** Portions Copyright (C) 2004 Holger Hans Peter Freyther <freyther@handhelds.org>
16+** Rights to said portions for use under the GPL and QPL licenses
17+** are hereby granted to Trolltech AS.
18+**
19 ** This file is part of the kernel module of the Qt GUI Toolkit.
20 **
21 ** This file may be distributed and/or modified under the terms of the
22@@ -60,6 +68,10 @@
23 #include <linux/tpanel.h>
24 #endif
25
26+#ifdef QWS_TSLIB
27+#include <tslib.h>
28+#endif
29+
30 //#define QT_QWS_K2
31
32 #if defined(QT_QWS_IPAQ) || defined(QT_QWS_K2)
33@@ -1124,6 +1136,221 @@
34 return sent;
35 }
36
37+
38+class QTSLibHandler : public QCalibratedMouseHandler
39+{
40+ Q_OBJECT
41+public:
42+ QTSLibHandler();
43+ ~QTSLibHandler();
44+
45+ virtual void clearCalibration();
46+ virtual void calibrate( QWSPointerCalibrationData * );
47+
48+ static int sortByX( const void*, const void* );
49+ static int sortByY( const void*, const void* );
50+private:
51+ void openTs();
52+ void closeTs();
53+ void interpolateSample();
54+
55+private:
56+ bool raw : 1;
57+#ifdef QWS_TSLIB
58+ struct tsdev *ts;
59+#endif
60+ QSocketNotifier *m_notify;
61+
62+private slots:
63+ void readMouseData();
64+};
65+
66+QTSLibHandler::QTSLibHandler()
67+ : raw(false), m_notify(0l)
68+{
69+ openTs();
70+}
71+
72+QTSLibHandler::~QTSLibHandler()
73+{
74+ closeTs();
75+}
76+
77+void QTSLibHandler::openTs()
78+{
79+#ifdef QWS_TSLIB
80+ char *tsdevice;
81+
82+ if( ( tsdevice = getenv( "TSLIB_TSDEVICE" ) ) != NULL ) {
83+ ts = ts_open( tsdevice, 1 );
84+ } else {
85+ ts = ts_open( "/dev/ts", 1 );
86+ }
87+
88+ if (!ts) {
89+ qWarning( "Cannot open touchscreen (%s)", strerror( errno ) );
90+ return;
91+ }
92+
93+ if (ts_config( ts )) {
94+ qWarning( "Cannot configure touchscreen (%s)", strerror( errno ) );
95+ return;
96+ }
97+
98+
99+ m_notify = new QSocketNotifier( ts_fd(ts), QSocketNotifier::Read, this );
100+ connect( m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
101+#endif
102+}
103+
104+void QTSLibHandler::closeTs()
105+{
106+#ifdef QWS_TSLIB
107+ if (ts)
108+ ts_close(ts);
109+
110+ delete m_notify;
111+ m_notify = 0; ts = 0;
112+ raw = false;
113+#endif
114+
115+}
116+
117+void QTSLibHandler::clearCalibration()
118+{
119+ raw = true;
120+}
121+
122+
123+void QTSLibHandler::calibrate( QWSPointerCalibrationData *cd )
124+{
125+ QPoint dev_tl = cd->devPoints[ QWSPointerCalibrationData::TopLeft ];
126+ QPoint dev_br = cd->devPoints[ QWSPointerCalibrationData::BottomRight ];
127+ QPoint screen_tl = cd->screenPoints[ QWSPointerCalibrationData::TopLeft ];
128+ QPoint screen_br = cd->screenPoints[ QWSPointerCalibrationData::BottomRight ];
129+ int a, b, c, d, e, f, s;
130+
131+ s = 1 << 16;
132+
133+ a = s * (screen_tl.x() - screen_br.x() ) / (dev_tl.x() - dev_br.x());
134+ b = 0;
135+ c = s * screen_tl.x() - a * dev_tl.x();
136+
137+ d = 0;
138+ e = s * (screen_tl.y() - screen_br.y() ) / (dev_tl.y() - dev_br.y());
139+ f = s * screen_tl.y() - e * dev_tl.y();
140+
141+ QString calFile = "/etc/pointercal";
142+#ifndef QT_NO_TEXTSTREAM
143+ QFile file( calFile );
144+ if ( file.open( IO_WriteOnly ) ) {
145+ QTextStream t( &file );
146+ t << a << " " << b << " " << c << " ";
147+ t << d << " " << e << " " << f << " " << s;
148+ file.flush(); closeTs();
149+ openTs();
150+ } else
151+#endif
152+ {
153+ qDebug( "Could not save calibration: %s", calFile.latin1() );
154+ }
155+}
156+
157+void QTSLibHandler::readMouseData()
158+{
159+#ifdef QWS_TSLIB
160+ if(!qt_screen)
161+ return;
162+
163+ /*
164+ * After clear Calibration
165+ * we're in raw mode and do some easy median
166+ * search.
167+ */
168+ if (raw )
169+ return interpolateSample();
170+
171+ static struct ts_sample sample;
172+ static int ret;
173+
174+ /*
175+ * Ok. We need to see if we can read more than one event
176+ * We do this not to lose an update.
177+ */
178+ while ( true ) {
179+ if ((ret = ts_read(ts, &sample, 1)) != 1 )
180+ return;
181+
182+
183+ QPoint pos( sample.x, sample.y );
184+ emit mouseChanged( pos, sample.pressure != 0 ? 1 : 0 );
185+ }
186+#endif
187+}
188+
189+
190+/*
191+ * Lets take all down events and then sort them
192+ * and take the event in the middle.
193+ *
194+ * inspired by testutils.c
195+ */
196+void QTSLibHandler::interpolateSample() {
197+ static struct ts_sample samples[25];
198+ int index = 0;
199+ int ret;
200+
201+ do {
202+ /* fill only the last sample again */
203+ if ( index >= 25 )
204+ index = 24;
205+
206+ /* we're opened non-blocking */
207+ if((ret= ts_read_raw(ts, &samples[index], 1 ) ) != 1 ) {
208+ /* no event yet, so try again */
209+ if (ret==-1 ) {
210+ index--;
211+ continue;
212+ }
213+ }
214+ }while (samples[index++].pressure != 0);
215+
216+ /*
217+ * index is maximal 25 and we at least one sample
218+ */
219+ if( index >= 25 )
220+ index = 24;
221+ int x, y;
222+
223+ /*
224+ * now let us use the median value
225+ * even index does not have an item in the middle
226+ * so let us take the average of n/2 and (n/2)-1 as the middle
227+ */
228+ int m = index/2;
229+ ::qsort(samples, index, sizeof(ts_sample), QTSLibHandler::sortByX);
230+ x = (index % 2 ) ? samples[m].x :
231+ ( samples[m-1].x + samples[m].x )/2;
232+
233+ ::qsort(samples, index, sizeof(ts_sample), QTSLibHandler::sortByY);
234+ y = (index % 2 ) ? samples[m].y :
235+ ( samples[m-1].y + samples[m].y )/2;
236+
237+ emit mouseChanged( QPoint(x, y), 1 );
238+ emit mouseChanged( QPoint(0, 0), 0 );
239+}
240+
241+int QTSLibHandler::sortByX( const void* one, const void* two) {
242+ return reinterpret_cast<const struct ts_sample*>(one)->x -
243+ reinterpret_cast<const struct ts_sample*>(two)->x;
244+}
245+
246+int QTSLibHandler::sortByY( const void* one, const void* two) {
247+ return reinterpret_cast<const struct ts_sample*>(one)->y -
248+ reinterpret_cast<const struct ts_sample*>(two)->y;
249+}
250+
251+
252 /*
253 * Handler for /dev/tpanel Linux kernel driver
254 */
255@@ -1731,7 +1958,9 @@
256
257 case TPanel:
258 #if defined(QWS_CUSTOMTOUCHPANEL)
259- handler = new QCustomTPanelHandlerPrivate(mouseProtocol,mouseDev);
260+ handler = new QCustomTPanelHandlerPrivate(mouseProtocol,mouseDev);
261+#elif defined(QWS_TSLIB)
262+ handler = new QTSLibHandler();
263 #elif defined(QT_QWS_YOPY)
264 handler = new QYopyTPanelHandlerPrivate(mouseProtocol,mouseDev);
265 #elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2)
266--- qt-2.3.9-snapshot-20041211/configure~tslib.patch
267+++ qt-2.3.9-snapshot-20041211/configure
268@@ -406,6 +406,9 @@
269 -kde)
270 KDE=yes
271 ;;
272+ -tslib)
273+ TSLIB=YES
274+ ;;
275 -no-g++-exceptions)
276 GPLUSPLUS_EXCEPTIONS=no
277 ;;
278@@ -1290,6 +1293,9 @@
279 set to point to a KDE 2 installation.
280 See http://www.kde.org
281
282+ -tslib ............. Use the TSLib (touchscreen access library) mouse handler
283+ by default, instead of the normal device default.
284+
285 -no-g++-exceptions . Disable exceptions on platforms using the GNU C++
286 compiler by using the -fno-exceptions flag.
287
288@@ -1353,6 +1359,13 @@
289 [ "x$SM" = "xno" ] && QT_CXX="${QT_CXX} -DQT_NO_SM_SUPPORT"
290 [ "x$XFT" = "xyes" ] && QT_CXX="${QT_CXX} -DQT_XFT"
291 [ "x$XFT" = "xno" ] && QT_CXX="${QT_CXX} -DQT_NO_XKB"
292+
293+if [ "x$TSLIB" = "xyes" ]
294+then
295+ QT_CXX="${QT_CXX} -DQWS_TSLIB"
296+ QT_LIBS="${QT_LIBS} -lts"
297+fi
298+
299 if [ "x$THREAD" = "xyes" ]
300 then
301 cat >src-mt.mk <<EOF