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
userEventSource
=
reinterpret_cast
<
GUserEventSource
*>(source);
59
userEventSource
->q = q;
60
userEventSource
->
d
=
this
;
61
attachSource(source,
"[Qt] GUserEventSource"
);
62
}
63
64
QPAEventDispatcherGlibPrivate
::~
QPAEventDispatcherGlibPrivate
()
65
=
default
;
66
67
QPAEventDispatcherGlib::QPAEventDispatcherGlib(QObject *parent)
68
: QEventDispatcherGlib(*
new
QPAEventDispatcherGlibPrivate, parent)
69
, m_flags(QEventLoop::AllEvents)
70
{
71
Q_D(QPAEventDispatcherGlib);
72
d->userEventSource->q =
this
;
73
}
74
75
QPAEventDispatcherGlib::~QPAEventDispatcherGlib()
76
{
77
Q_D(QPAEventDispatcherGlib);
78
79
d->destroySource(&d->userEventSource->source);
80
d->userEventSource =
nullptr
;
81
}
82
83
bool
QPAEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
84
{
85
m_flags = flags;
86
return
QEventDispatcherGlib::processEvents(m_flags);
87
}
88
89
QT_END_NAMESPACE
90
91
#
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