immediately. Does nothing on platforms other than X11.
*/
-// ### DOC: Are these called when the _application_ starts/stops or just
-// when the current _event loop_ starts/stops?
-/*! \internal */
-void QAbstractEventDispatcher::startingUp()
-{ }
-
-/*! \internal */
-void QAbstractEventDispatcher::closingDown()
-{ }
-
/*!
\typedef QAbstractEventDispatcher::TimerInfo
virtual void interrupt() = 0;
virtual void flush() = 0;
- virtual void startingUp();
- virtual void closingDown();
-
typedef bool(*EventFilter)(void *message);
EventFilter setEventFilter(EventFilter filter);
bool filterEvent(void *message);
: QObject(p, 0)
{
init();
- // note: it is the subclasses' job to call
- // QCoreApplicationPrivate::eventDispatcher->startingUp();
}
/*!
: QObject(*new QCoreApplicationPrivate(argc, argv))
{
init();
- d_func()->threadData->eventDispatcher->startingUp();
}
globalThreadPool->waitForDone();
#endif
- if (d->threadData->eventDispatcher)
- d->threadData->eventDispatcher->closingDown();
-
#ifndef QT_NO_LIBRARY
delete coreappdata()->app_libpaths;
coreappdata()->app_libpaths = 0;
void QThreadPrivate::createEventDispatcher(QThreadData *data)
{
QMutexLocker l(&data->postEventList.mutex);
-
data->eventDispatcher = new QEventDispatcherUNIX;
-
- l.unlock();
- data->eventDispatcher->startingUp();
}
#ifndef QT_NO_THREAD
if (eventDispatcher) {
d->data->eventDispatcher = Q_NULLPTR;
locker.unlock();
- eventDispatcher->closingDown();
delete eventDispatcher;
locker.relock();
}
if (qt_is_gui_used)
initializeMultitouch();
- threadData->eventDispatcher->startingUp();
-
#ifndef QT_NO_LIBRARY
//make sure the plugin is loaded
if (qt_is_gui_used)
d->toolTipWakeUp.stop();
d->toolTipFallAsleep.stop();
- d->threadData->eventDispatcher->closingDown();
QApplicationPrivate::is_app_closing = true;
QApplicationPrivate::is_app_running = false;
{
Q_DECLARE_PUBLIC(QEventDispatcherX11)
public:
- inline QEventDispatcherX11Private()
- : xfd(-1)
- { }
- int xfd;
QList<XEvent> queuedUserInputEvents;
};
XFlush(qt_x11Data->display);
}
-void QEventDispatcherX11::startingUp()
-{
- Q_D(QEventDispatcherX11);
- d->xfd = XConnectionNumber(qt_x11Data->display);
-}
-
-void QEventDispatcherX11::closingDown()
-{
- Q_D(QEventDispatcherX11);
- d->xfd = -1;
-}
-
int QEventDispatcherX11::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
timeval *timeout)
{
Q_D(QEventDispatcherX11);
- if (d->xfd > 0) {
- nfds = qMax(nfds - 1, d->xfd) + 1;
- FD_SET(d->xfd, readfds);
+ int xfd = ConnectionNumber(qt_x11Data->display);
+ if (Q_LIKELY(xfd > 0)) {
+ nfds = qMax(nfds - 1, xfd) + 1;
+ FD_SET(xfd, readfds);
}
return QEventDispatcherUNIX::select(nfds, readfds, writefds, exceptfds, timeout);
}
void flush();
- void startingUp();
- void closingDown();
-
protected:
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
timeval *timeout);