]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/qte/qte-2.3.10/tslib.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / qte / qte-2.3.10 / tslib.patch
1 Index: qt-2.3.10/src/kernel/qwsmouse_qws.cpp
2 ===================================================================
3 --- qt-2.3.10.orig/src/kernel/qwsmouse_qws.cpp  2005-02-16 00:53:53.090339898 +0100
4 +++ qt-2.3.10/src/kernel/qwsmouse_qws.cpp       2005-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      /*