[2] | 1 | /****************************************************************************
|
---|
| 2 | ** $Id: qeventloop_p.h 116 2006-08-11 13:01:59Z dmik $
|
---|
| 3 | **
|
---|
| 4 | ** Definition of QEventLoop class
|
---|
| 5 | **
|
---|
| 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
|
---|
| 7 | **
|
---|
| 8 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
| 9 | **
|
---|
| 10 | ** This file may be distributed and/or modified under the terms of the
|
---|
| 11 | ** GNU General Public License version 2 as published by the Free Software
|
---|
| 12 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 13 | ** packaging of this file.
|
---|
| 14 | **
|
---|
| 15 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
| 16 | ** licenses for Qt/Embedded may use this file in accordance with the
|
---|
| 17 | ** Qt Embedded Commercial License Agreement provided with the Software.
|
---|
| 18 | **
|
---|
| 19 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
| 20 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 21 | **
|
---|
| 22 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
| 23 | ** information about Qt Commercial License Agreements.
|
---|
| 24 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
| 25 | **
|
---|
| 26 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
| 27 | ** not clear to you.
|
---|
| 28 | **
|
---|
| 29 | **********************************************************************/
|
---|
| 30 |
|
---|
| 31 | #ifndef QEVENTLOOP_P_H
|
---|
| 32 | #define QEVENTLOOP_P_H
|
---|
| 33 |
|
---|
| 34 | //
|
---|
| 35 | // W A R N I N G
|
---|
| 36 | // -------------
|
---|
| 37 | //
|
---|
| 38 | // This file is not part of the Qt API. This header file may
|
---|
| 39 | // change from version to version without notice, or even be
|
---|
| 40 | // removed.
|
---|
| 41 | //
|
---|
| 42 | // We mean it.
|
---|
| 43 | //
|
---|
| 44 | //
|
---|
| 45 |
|
---|
| 46 | #ifndef QT_H
|
---|
| 47 | #include "qplatformdefs.h"
|
---|
| 48 | #endif // QT_H
|
---|
| 49 |
|
---|
| 50 | // SCO OpenServer redefines raise -> kill
|
---|
| 51 | #if defined(raise)
|
---|
| 52 | # undef raise
|
---|
| 53 | #endif
|
---|
| 54 |
|
---|
| 55 | #include "qwindowdefs.h"
|
---|
| 56 |
|
---|
| 57 | class QSocketNotifier;
|
---|
| 58 | #ifdef Q_OS_MAC
|
---|
| 59 | class QMacSockNotPrivate;
|
---|
| 60 | #endif
|
---|
| 61 |
|
---|
[8] | 62 | #if defined(Q_OS_UNIX) || defined(Q_WS_WIN) || defined(Q_WS_PM)
|
---|
[2] | 63 | #include "qptrlist.h"
|
---|
[8] | 64 | #endif // Q_OS_UNIX || Q_WS_WIN || Q_WS_PM
|
---|
[2] | 65 |
|
---|
[8] | 66 | #if defined(Q_OS_UNIX) || defined(Q_WS_PM)
|
---|
[2] | 67 | struct QSockNot
|
---|
| 68 | {
|
---|
| 69 | QSocketNotifier *obj;
|
---|
| 70 | int fd;
|
---|
| 71 | fd_set *queue;
|
---|
[116] | 72 | #if defined(Q_WS_PM)
|
---|
| 73 | fd_set *active;
|
---|
| 74 | #endif
|
---|
[2] | 75 | };
|
---|
| 76 |
|
---|
| 77 | class QSockNotType
|
---|
| 78 | {
|
---|
| 79 | public:
|
---|
| 80 | QSockNotType();
|
---|
| 81 | ~QSockNotType();
|
---|
| 82 |
|
---|
| 83 | QPtrList<QSockNot> *list;
|
---|
| 84 | fd_set select_fds;
|
---|
| 85 | fd_set enabled_fds;
|
---|
| 86 | fd_set pending_fds;
|
---|
| 87 |
|
---|
| 88 | };
|
---|
| 89 | #endif // Q_OS_UNIX
|
---|
| 90 |
|
---|
[8] | 91 | #if defined(Q_WS_WIN)
|
---|
[2] | 92 | struct QSockNot {
|
---|
| 93 | QSocketNotifier *obj;
|
---|
| 94 | int fd;
|
---|
| 95 | };
|
---|
| 96 | #endif // Q_WS_WIN
|
---|
| 97 |
|
---|
| 98 | class QEventLoopPrivate
|
---|
| 99 | {
|
---|
| 100 | public:
|
---|
| 101 | QEventLoopPrivate()
|
---|
| 102 | {
|
---|
| 103 | reset();
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | void reset() {
|
---|
| 107 | looplevel = 0;
|
---|
| 108 | quitcode = 0;
|
---|
| 109 | quitnow = FALSE;
|
---|
| 110 | exitloop = FALSE;
|
---|
| 111 | shortcut = FALSE;
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 | int looplevel;
|
---|
| 115 | int quitcode;
|
---|
| 116 | unsigned int quitnow : 1;
|
---|
| 117 | unsigned int exitloop : 1;
|
---|
| 118 | unsigned int shortcut : 1;
|
---|
| 119 |
|
---|
| 120 | #if defined(Q_WS_MAC)
|
---|
| 121 | uchar next_select_timer;
|
---|
| 122 | EventLoopTimerRef select_timer;
|
---|
| 123 | #endif
|
---|
| 124 |
|
---|
| 125 | #if defined(Q_WS_X11)
|
---|
| 126 | int xfd;
|
---|
| 127 | #endif // Q_WS_X11
|
---|
| 128 |
|
---|
[8] | 129 | #if defined(Q_OS_UNIX)
|
---|
[2] | 130 | int thread_pipe[2];
|
---|
[8] | 131 | #endif
|
---|
| 132 | #if defined(Q_OS_UNIX) || defined(Q_WS_PM)
|
---|
[2] | 133 | // pending socket notifiers list
|
---|
| 134 | QPtrList<QSockNot> sn_pending_list;
|
---|
| 135 | // highest fd for all socket notifiers
|
---|
| 136 | int sn_highest;
|
---|
[116] | 137 | #if defined(Q_WS_PM)
|
---|
| 138 | // fd for cancelling select()
|
---|
| 139 | int sn_cancel;
|
---|
| 140 | #endif
|
---|
[2] | 141 | // 3 socket notifier types - read, write and exception
|
---|
| 142 | QSockNotType sn_vec[3];
|
---|
| 143 | #endif
|
---|
| 144 |
|
---|
[8] | 145 | #if defined(Q_WS_WIN)
|
---|
[2] | 146 | // pending socket notifiers list
|
---|
| 147 | QPtrList<QSockNot> sn_pending_list;
|
---|
| 148 | #endif // Q_WS_WIN
|
---|
| 149 |
|
---|
[8] | 150 | #if defined(Q_WS_PM)
|
---|
| 151 | HAB hab;
|
---|
| 152 | HMQ hmq;
|
---|
| 153 | #endif
|
---|
| 154 |
|
---|
[2] | 155 | };
|
---|
| 156 |
|
---|
| 157 | #endif // QEVENTLOOP_P_H
|
---|