Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qeventdispatcher_glib_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QEVENTDISPATCHER_GLIB_P_H
6#define QEVENTDISPATCHER_GLIB_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists for the convenience
13// of the QLibrary class. This header file may change from
14// version to version without notice, or even be removed.
15//
16// We mean it.
17//
18
21
23typedef struct _GSource GSource;
24
25QT_BEGIN_NAMESPACE
26
27class QEventDispatcherGlibPrivate;
28
29class Q_CORE_EXPORT QEventDispatcherGlib : public QAbstractEventDispatcherV2
30{
31 Q_OBJECT
32 Q_DECLARE_PRIVATE(QEventDispatcherGlib)
33
34public:
35 explicit QEventDispatcherGlib(QObject *parent = nullptr);
36 explicit QEventDispatcherGlib(GMainContext *context, QObject *parent = nullptr);
37 ~QEventDispatcherGlib();
38
39 bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
40
41 void registerSocketNotifier(QSocketNotifier *socketNotifier) final;
42 void unregisterSocketNotifier(QSocketNotifier *socketNotifier) final;
43
44 void registerTimer(Qt::TimerId timerId, Duration interval, Qt::TimerType timerType,
45 QObject *object) override final;
46 bool unregisterTimer(Qt::TimerId timerId) override final;
47 bool unregisterTimers(QObject *object) override final;
48 QList<TimerInfoV2> timersForObject(QObject *object) const override final;
49 Duration remainingTime(Qt::TimerId timerId) const override final;
50
51 void wakeUp() final;
52 void interrupt() final;
53
54 static bool versionSupported();
55
56protected:
57 QEventDispatcherGlib(QEventDispatcherGlibPrivate &dd, QObject *parent);
58};
59
60struct GPostEventSource;
62struct GTimerSource;
63struct GIdleTimerSource;
64
65class Q_CORE_EXPORT QEventDispatcherGlibPrivate : public QAbstractEventDispatcherPrivate
66{
67
68public:
69 QEventDispatcherGlibPrivate(GMainContext *context = nullptr);
70 ~QEventDispatcherGlibPrivate() override;
71
72 GMainContext *mainContext;
73 GPostEventSource *postEventSource;
74 GSocketNotifierSource *socketNotifierSource;
75 GTimerSource *timerSource;
76 GIdleTimerSource *idleTimerSource;
77 bool wakeUpCalled = true;
78
79 // Sets the source's name and makes it recursive, then attaches it to
80 // mainContext and registers it with this dispatcher. Subclasses must use
81 // this (and destroySource()) for the sources they add, so that
82 // processEvents() can include them in its guarantees. Sources must be
83 // left at G_PRIORITY_DEFAULT.
84 void attachSource(GSource *source, const char *name);
85 void destroySource(GSource *source);
86
87 void runTimersOnceWithNormalPriority();
88};
89
90QT_END_NAMESPACE
91
92#endif // QEVENTDISPATCHER_GLIB_P_H
static gboolean timerSourcePrepareHelper(GTimerSource *src, gint *timeout)
static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
static gboolean timerSourceCheck(GSource *source)
static gboolean idleTimerSourcePrepare(GSource *source, gint *timeout)
static gboolean socketNotifierSourcePrepare(GSource *, gint *timeout)
static gboolean idleTimerSourceDispatch(GSource *source, GSourceFunc, gpointer)
static gboolean postEventSourcePrepare(GSource *s, gint *timeout)
static gboolean idleTimerSourceCheck(GSource *source)
static gboolean timerSourceCheckHelper(GTimerSource *src)
static gboolean socketNotifierSourceCheck(GSource *source)
static gboolean postEventSourceCheck(GSource *source)
static gboolean socketNotifierSourceDispatch(GSource *source, GSourceFunc, gpointer)
static gboolean timerSourcePrepare(GSource *source, gint *timeout)
static gboolean timerSourceDispatch(GSource *source, GSourceFunc, gpointer)
struct _GMainContext GMainContext
struct _GSource GSource
QEventDispatcherGlibPrivate * d
QList< GPollFDWithQSocketNotifier * > pollfds
QTimerInfoList timerList
QEventLoop::ProcessEventsFlags processEventsFlags