Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qeventdispatcher_glib.cpp
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
#
include
"qeventdispatcher_glib_p.h"
6
7
#
include
"qguiapplication.h"
8
9
#
include
"qplatformdefs.h"
10
11
#
include
<
glib
.
h
>
12
#
include
"private/qguiapplication_p.h"
13
14
QT_BEGIN_NAMESPACE
15
16
struct
GUserEventSource
17
{
18
GSource
source
;
19
QPAEventDispatcherGlib
*
q
;
20
QPAEventDispatcherGlibPrivate
*
d
;
21
};
22
23
static
gboolean
userEventSourcePrepare
(GSource *source, gint *timeout)
24
{
25
Q_UNUSED(timeout);
26
GUserEventSource
*userEventSource =
reinterpret_cast
<
GUserEventSource
*>(source);
27
return
userEventSource
->
d
->wakeUpCalled;
28
}
29
30
static
gboolean
userEventSourceCheck
(GSource *source)
31
{
32
return
userEventSourcePrepare(source,
nullptr
);
33
}
34
35
static
gboolean
userEventSourceDispatch
(GSource *source,
GSourceFunc
,
gpointer
)
36
{
37
GUserEventSource
*userEventSource =
reinterpret_cast
<
GUserEventSource
*>(source);
38
QPAEventDispatcherGlib *dispatcher = userEventSource->q;
39
QWindowSystemInterface::sendWindowSystemEvents(dispatcher->m_flags);
40
return
true
;
41
}
42
43
static
GSourceFuncs
userEventSourceFuncs
= {
44
userEventSourcePrepare,
45
userEventSourceCheck,
46
userEventSourceDispatch,
47
NULL,
48
NULL,
49
NULL
50
};
51
52
QPAEventDispatcherGlibPrivate
::QPAEventDispatcherGlibPrivate(GMainContext *context)
53
: QEventDispatcherGlibPrivate(context)
54
{
55
Q_Q(QPAEventDispatcherGlib);
56
57
GSource *source = g_source_new(&userEventSourceFuncs,
sizeof
(
GUserEventSource
));
58
g_source_set_name(source,
"[Qt] GUserEventSource"
);
59
userEventSource
=
reinterpret_cast
<
GUserEventSource
*>(source);
60
61
userEventSource
->q = q;
62
userEventSource
->
d
=
this
;
63
g_source_set_can_recurse(&
userEventSource
->source,
true
);
64
g_source_attach(&
userEventSource
->source, mainContext);
65
}
66
67
QPAEventDispatcherGlibPrivate
::~
QPAEventDispatcherGlibPrivate
()
68
=
default
;
69
70
QPAEventDispatcherGlib::QPAEventDispatcherGlib(QObject *parent)
71
: QEventDispatcherGlib(*
new
QPAEventDispatcherGlibPrivate, parent)
72
, m_flags(QEventLoop::AllEvents)
73
{
74
Q_D(QPAEventDispatcherGlib);
75
d->userEventSource->q =
this
;
76
}
77
78
QPAEventDispatcherGlib::~QPAEventDispatcherGlib()
79
{
80
Q_D(QPAEventDispatcherGlib);
81
82
g_source_destroy(&d->userEventSource->source);
83
g_source_unref(&d->userEventSource->source);
84
d->userEventSource =
nullptr
;
85
}
86
87
bool
QPAEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
88
{
89
m_flags = flags;
90
return
QEventDispatcherGlib::processEvents(m_flags);
91
}
92
93
QT_END_NAMESPACE
94
95
#
include
"moc_qeventdispatcher_glib_p.cpp"
QPAEventDispatcherGlibPrivate
Definition
qeventdispatcher_glib_p.h:43
QPAEventDispatcherGlibPrivate::~QPAEventDispatcherGlibPrivate
~QPAEventDispatcherGlibPrivate() override
QPAEventDispatcherGlibPrivate::userEventSource
GUserEventSource * userEventSource
Definition
qeventdispatcher_glib_p.h:49
userEventSourceFuncs
static GSourceFuncs userEventSourceFuncs
Definition
qeventdispatcher_glib.cpp:43
userEventSourcePrepare
static gboolean userEventSourcePrepare(GSource *source, gint *timeout)
Definition
qeventdispatcher_glib.cpp:23
userEventSourceDispatch
static gboolean userEventSourceDispatch(GSource *source, GSourceFunc, gpointer)
Definition
qeventdispatcher_glib.cpp:35
userEventSourceCheck
static gboolean userEventSourceCheck(GSource *source)
Definition
qeventdispatcher_glib.cpp:30
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
GUserEventSource
Definition
qeventdispatcher_glib.cpp:17
GUserEventSource::source
GSource source
Definition
qeventdispatcher_glib.cpp:18
GUserEventSource::q
QPAEventDispatcherGlib * q
Definition
qeventdispatcher_glib.cpp:19
GUserEventSource::d
QPAEventDispatcherGlibPrivate * d
Definition
qeventdispatcher_glib.cpp:20
qtbase
src
gui
platform
unix
qeventdispatcher_glib.cpp
Generated on
for Qt by
1.18.0