]> git.pld-linux.org Git - packages/qt4.git/blob - qt4-tools.patch
- add files needed by qvfb which have been removed from qt 4.1.4 sources
[packages/qt4.git] / qt4-tools.patch
1 --- qt-copy/tools/tools.pro.orig        2005-05-13 16:39:18.000000000 +0200
2 +++ qt-copy/tools/tools.pro     2005-05-13 20:02:31.761482520 +0200
3 @@ -7,7 +7,7 @@
4                         assistant \
5                         linguist \
6                         porting \
7 -                        qtestlib
8 +                        qtestlib qvfb
9      !contains(QT_EDITION, Console):SUBDIRS += designer
10      unix:!embedded:SUBDIRS        += qtconfig
11      win32:!contains(QT_EDITION, OpenSource|Console):SUBDIRS       += activeqt
12 --- qt-x11-opensource-src-4.1.4/tools/qvfb/qvfbhdr.h.orig       1970-01-01 01:00:00.000000000 +0100
13 +++ qt-x11-opensource-src-4.1.4/tools/qvfb/qvfbhdr.h    2006-07-02 11:34:33.753478750 +0200
14 @@ -0,0 +1,63 @@
15 +/****************************************************************************
16 +**
17 +** Copyright (C) 1992-2006 Trolltech AS. All rights reserved.
18 +**
19 +** This file is part of the QtGui module of the Qt Toolkit.
20 +**
21 +** This file may be used under the terms of the GNU General Public
22 +** License version 2.0 as published by the Free Software Foundation
23 +** and appearing in the file LICENSE.GPL included in the packaging of
24 +** this file.  Please review the following information to ensure GNU
25 +** General Public Licensing requirements will be met:
26 +** http://www.trolltech.com/products/qt/opensource.html
27 +**
28 +** If you are unsure which license is appropriate for your use, please
29 +** review the following information:
30 +** http://www.trolltech.com/products/qt/licensing.html or contact the
31 +** sales department at sales@trolltech.com.
32 +**
33 +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
34 +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
35 +**
36 +****************************************************************************/
37 +
38 +#ifndef QVFBHDR_H
39 +#define QVFBHDR_H
40 +
41 +#include <QtGui/qcolor.h>
42 +#include <QtCore/qrect.h>
43 +
44 +QT_BEGIN_HEADER
45 +
46 +QT_MODULE(Gui)
47 +
48 +#define QT_VFB_MOUSE_PIPE        "/tmp/.qtvfb_mouse-%1"
49 +#define QT_VFB_KEYBOARD_PIPE        "/tmp/.qtvfb_keyboard-%1"
50 +
51 +struct QVFbHeader
52 +{
53 +    int width;
54 +    int height;
55 +    int depth;
56 +    int linestep;
57 +    int dataoffset;
58 +    QRect update;
59 +    bool dirty;
60 +    int  numcols;
61 +    QRgb clut[256];
62 +    int viewerVersion;
63 +    int serverVersion;
64 +};
65 +
66 +struct QVFbKeyData
67 +{
68 +    unsigned int keycode;
69 +    Qt::KeyboardModifiers modifiers;
70 +    unsigned short int unicode;
71 +    bool press;
72 +    bool repeat;
73 +};
74 +
75 +QT_END_HEADER
76 +
77 +#endif // QVFBHDR_H
78 diff -Nur qt-x11-opensource-src-4.1.4/src/gui/embedded.orig/qlock.cpp qt-x11-opensource-src-4.1.4/src/gui/embedded/qlock.cpp
79 --- qt-x11-opensource-src-4.1.4/src/gui/embedded.orig/qlock.cpp 1970-01-01 01:00:00.000000000 +0100
80 +++ qt-x11-opensource-src-4.1.4/src/gui/embedded/qlock.cpp      2006-07-02 11:35:54.386518000 +0200
81 @@ -0,0 +1,289 @@
82 +/****************************************************************************
83 +**
84 +** Copyright (C) 1992-2006 Trolltech AS. All rights reserved.
85 +**
86 +** This file is part of the QtGui module of the Qt Toolkit.
87 +**
88 +** This file may be used under the terms of the GNU General Public
89 +** License version 2.0 as published by the Free Software Foundation
90 +** and appearing in the file LICENSE.GPL included in the packaging of
91 +** this file.  Please review the following information to ensure GNU
92 +** General Public Licensing requirements will be met:
93 +** http://www.trolltech.com/products/qt/opensource.html
94 +**
95 +** If you are unsure which license is appropriate for your use, please
96 +** review the following information:
97 +** http://www.trolltech.com/products/qt/licensing.html or contact the
98 +** sales department at sales@trolltech.com.
99 +**
100 +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
101 +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
102 +**
103 +****************************************************************************/
104 +
105 +#include "qlock_p.h"
106 +
107 +#ifndef QT_NO_QWS_MULTIPROCESS
108 +
109 +#include <unistd.h>
110 +#include <sys/types.h>
111 +#if defined(Q_OS_DARWIN)
112 +#define Q_NO_SEMAPHORE
113 +#include <sys/stat.h>
114 +#include <sys/file.h>
115 +#else
116 +#include <sys/sem.h>
117 +#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) \
118 +    || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_BSDI)
119 +/* union semun is defined by including <sys/sem.h> */
120 +#else
121 +/* according to X/OPEN we have to define it ourselves */
122 +union semun {
123 +    int val;                    /* value for SETVAL */
124 +    struct semid_ds *buf;       /* buffer for IPC_STAT, IPC_SET */
125 +    unsigned short *array;      /* array for GETALL, SETALL */
126 +};
127 +#endif
128 +#endif
129 +#include <sys/ipc.h>
130 +#include <string.h>
131 +#include <errno.h>
132 +#include <qdebug.h>
133 +
134 +#define MAX_LOCKS   200            // maximum simultaneous read locks
135 +
136 +class QLockData
137 +{
138 +public:
139 +#ifdef Q_NO_SEMAPHORE
140 +    QByteArray file;
141 +#endif
142 +    int id;
143 +    int count;
144 +    bool owned;
145 +};
146 +
147 +#endif
148 +
149 +/*!
150 +    \class QLock qlock_p.h
151 +    \brief The QLock class is a wrapper for a System V shared semaphore.
152 +
153 +    \ingroup qws
154 +    \ingroup io
155 +
156 +    \internal
157 +
158 +    It is used by \l {Qtopia Core} for synchronizing access to the graphics
159 +    card and shared memory region between processes.
160 +*/
161 +
162 +/*!
163 +    \enum QLock::Type
164 +
165 +    \value Read
166 +    \value Write
167 +*/
168 +
169 +/*!
170 +    \fn QLock::QLock(const QString &filename, char id, bool create)
171 +
172 +    Creates a lock. \a filename is the file path of the Unix-domain
173 +    socket the \l {Qtopia Core} client is using. \a id is the name of the
174 +    particular lock to be created on that socket. If \a create is true
175 +    the lock is to be created (as the \l {Qtopia Core} server does); if \a
176 +    create is false the lock should exist already (as the \l {Qtopia Core}
177 +    client expects).
178 +*/
179 +
180 +QLock::QLock(const QString &filename, char id, bool create)
181 +{
182 +#ifdef QT_NO_QWS_MULTIPROCESS
183 +    Q_UNUSED(filename);
184 +    Q_UNUSED(id);
185 +    Q_UNUSED(create);
186 +#else
187 +    data = new QLockData;
188 +    data->count = 0;
189 +#ifdef Q_NO_SEMAPHORE
190 +    data->file = QString(filename+id).toLocal8Bit().constData();
191 +    for(int x = 0; x < 2; x++) {
192 +        data->id = open(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU);
193 +        if(data->id != -1 || !create) {
194 +            data->owned = x;
195 +            break;
196 +        }
197 +    }
198 +#else
199 +    key_t semkey = ftok(filename.toLocal8Bit().constData(), id);
200 +    data->id = semget(semkey,0,0);
201 +    data->owned = create;
202 +    if (create) {
203 +        semun arg; arg.val = 0;
204 +        if (data->id != -1)
205 +            semctl(data->id,0,IPC_RMID,arg);
206 +        data->id = semget(semkey,1,IPC_CREAT|0600);
207 +        arg.val = MAX_LOCKS;
208 +        semctl(data->id,0,SETVAL,arg);
209 +    }
210 +#endif
211 +    if (data->id == -1) {
212 +        qWarning("Cannot %s semaphore %s '%c'", (create ? "create" : "get"),
213 +                 qPrintable(filename), id);
214 +        qDebug() << "Error" << errno << strerror(errno);
215 +    }
216 +#endif
217 +}
218 +
219 +/*!
220 +    \fn QLock::~QLock()
221 +
222 +    Destroys a lock
223 +*/
224 +
225 +QLock::~QLock()
226 +{
227 +#ifndef QT_NO_QWS_MULTIPROCESS
228 +    if (locked())
229 +        unlock();
230 +#ifdef Q_NO_SEMAPHORE
231 +    if(isValid()) {
232 +        close(data->id);
233 +        if(data->owned)
234 +            unlink(data->file);
235 +    }
236 +#else
237 +    if(data->owned) {
238 +        semun arg; arg.val = 0;
239 +        semctl(data->id, 0, IPC_RMID, arg);
240 +    }
241 +#endif
242 +    delete data;
243 +#endif
244 +}
245 +
246 +/*!
247 +    \fn bool QLock::isValid() const
248 +
249 +    Returns true if the lock constructor was successful; returns false if
250 +    the lock could not be created or was not available to connect to.
251 +*/
252 +
253 +bool QLock::isValid() const
254 +{
255 +#ifndef QT_NO_QWS_MULTIPROCESS
256 +    return (data->id != -1);
257 +#else
258 +    return true;
259 +#endif
260 +}
261 +
262 +/*!
263 +    Locks the semaphore with a lock of type \a t. Locks can either be
264 +    \c Read or \c Write. If a lock is \c Read, attempts by other
265 +    processes to obtain \c Read locks will succeed, and \c Write
266 +    attempts will block until the lock is unlocked. If locked as \c
267 +    Write, all attempts to lock by other processes will block until
268 +    the lock is unlocked. Locks are stacked: i.e. a given QLock can be
269 +    locked multiple times by the same process without blocking, and
270 +    will only be unlocked after a corresponding number of unlock()
271 +    calls.
272 +*/
273 +
274 +void QLock::lock(Type t)
275 +{
276 +#ifdef QT_NO_QWS_MULTIPROCESS
277 +    Q_UNUSED(t);
278 +#else
279 +    if (!data->count) {
280 +#ifdef Q_NO_SEMAPHORE
281 +        int op = LOCK_SH;
282 +        if(t == Write)
283 +            op = LOCK_EX;
284 +        for(int rv=1; rv;) {
285 +            rv = flock(data->id, op);
286 +            if (rv == -1 && errno != EINTR)
287 +                qDebug("Semop lock failure %s",strerror(errno));
288 +        }
289 +#else
290 +        sembuf sops;
291 +        sops.sem_num = 0;
292 +        sops.sem_flg = SEM_UNDO;
293 +
294 +        if (t == Write) {
295 +            sops.sem_op = -MAX_LOCKS;
296 +            type = Write;
297 +        } else {
298 +            sops.sem_op = -1;
299 +            type = Read;
300 +        }
301 +
302 +        int rv;
303 +        do {
304 +            rv = semop(data->id,&sops,1);
305 +            if (rv == -1 && errno != EINTR)
306 +                qDebug("Semop lock failure %s",strerror(errno));
307 +        } while (rv == -1 && errno == EINTR);
308 +#endif
309 +    }
310 +    data->count++;
311 +#endif
312 +}
313 +
314 +/*!
315 +    \fn void QLock::unlock()
316 +
317 +    Unlocks the semaphore. If other processes were blocking waiting to
318 +    lock() the semaphore, one of them will wake up and succeed in
319 +    lock()ing.
320 +*/
321 +
322 +void QLock::unlock()
323 +{
324 +#ifndef QT_NO_QWS_MULTIPROCESS
325 +    if(data->count) {
326 +        data->count--;
327 +        if(!data->count) {
328 +#ifdef Q_NO_SEMAPHORE
329 +            for(int rv=1; rv;) {
330 +                rv = flock(data->id, LOCK_UN);
331 +                if (rv == -1 && errno != EINTR)
332 +                    qDebug("Semop lock failure %s",strerror(errno));
333 +            }
334 +#else
335 +            sembuf sops;
336 +            sops.sem_num = 0;
337 +            sops.sem_op = 1;
338 +            sops.sem_flg = SEM_UNDO;
339 +            if (type == Write)
340 +                sops.sem_op = MAX_LOCKS;
341 +
342 +            int rv;
343 +            do {
344 +                rv = semop(data->id,&sops,1);
345 +                if (rv == -1 && errno != EINTR)
346 +                    qDebug("Semop unlock failure %s",strerror(errno));
347 +            } while (rv == -1 && errno == EINTR);
348 +#endif
349 +        }
350 +    } else {
351 +        qDebug("Unlock without corresponding lock");
352 +    }
353 +#endif
354 +}
355 +
356 +/*!
357 +    \fn bool QLock::locked() const
358 +
359 +    Returns true if the lock is currently held by the current process;
360 +    otherwise returns false.
361 +*/
362 +
363 +bool QLock::locked() const
364 +{
365 +#ifndef QT_NO_QWS_MULTIPROCESS
366 +    return (data->count > 0);
367 +#else
368 +    return false;
369 +#endif
370 +}
371 diff -Nur qt-x11-opensource-src-4.1.4/src/gui/embedded.orig/qlock_p.h qt-x11-opensource-src-4.1.4/src/gui/embedded/qlock_p.h
372 --- qt-x11-opensource-src-4.1.4/src/gui/embedded.orig/qlock_p.h 1970-01-01 01:00:00.000000000 +0100
373 +++ qt-x11-opensource-src-4.1.4/src/gui/embedded/qlock_p.h      2006-07-02 11:36:23.952365750 +0200
374 @@ -0,0 +1,78 @@
375 +/****************************************************************************
376 +**
377 +** Copyright (C) 1992-2006 Trolltech AS. All rights reserved.
378 +**
379 +** This file is part of the QtGui module of the Qt Toolkit.
380 +**
381 +** This file may be used under the terms of the GNU General Public
382 +** License version 2.0 as published by the Free Software Foundation
383 +** and appearing in the file LICENSE.GPL included in the packaging of
384 +** this file.  Please review the following information to ensure GNU
385 +** General Public Licensing requirements will be met:
386 +** http://www.trolltech.com/products/qt/opensource.html
387 +**
388 +** If you are unsure which license is appropriate for your use, please
389 +** review the following information:
390 +** http://www.trolltech.com/products/qt/licensing.html or contact the
391 +** sales department at sales@trolltech.com.
392 +**
393 +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
394 +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
395 +**
396 +****************************************************************************/
397 +
398 +#ifndef QLOCK_P_H
399 +#define QLOCK_P_H
400 +
401 +//
402 +//  W A R N I N G
403 +//  -------------
404 +//
405 +// This file is not part of the Qt API.  This header file may
406 +// change from version to version without notice, or even be
407 +// removed.
408 +//
409 +// We mean it.
410 +//
411 +
412 +#include "QtCore/qstring.h"
413 +
414 +class QLockData;
415 +
416 +class Q_GUI_EXPORT QLock
417 +{
418 +public:
419 +    QLock(const QString &filename, char id, bool create = false);
420 +    ~QLock();
421 +
422 +    enum Type { Read, Write };
423 +
424 +    bool isValid() const;
425 +    void lock(Type type);
426 +    void unlock();
427 +    bool locked() const;
428 +
429 +private:
430 +    Type type;
431 +    QLockData *data;
432 +};
433 +
434 +
435 +// Nice class for ensuring the lock is released.
436 +// Just create one on the stack and the lock is automatically released
437 +// when QLockHandle is destructed.
438 +class Q_GUI_EXPORT QLockHandle
439 +{
440 +public:
441 +    QLockHandle(QLock *l, QLock::Type type) : qlock(l) { qlock->lock(type); }
442 +    ~QLockHandle() { if (locked()) qlock->unlock(); }
443 +
444 +    void lock(QLock::Type type) { qlock->lock(type); }
445 +    void unlock() { qlock->unlock(); }
446 +    bool locked() const { return qlock->locked(); }
447 +
448 +private:
449 +    QLock *qlock;
450 +};
451 +
452 +#endif // QLOCK_P_H
This page took 0.057944 seconds and 4 git commands to generate.