Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
5
6#include "qguiapplication.h"
7
8#include "qplatformdefs.h"
9
10#include <glib.h>
11#include "private/qguiapplication_p.h"
12
14
21
22static gboolean userEventSourcePrepare(GSource *source, gint *timeout)
23{
25 GUserEventSource *userEventSource = reinterpret_cast<GUserEventSource *>(source);
26 return userEventSource->d->wakeUpCalled;
27}
28
29static gboolean userEventSourceCheck(GSource *source)
30{
31 return userEventSourcePrepare(source, nullptr);
32}
33
34static gboolean userEventSourceDispatch(GSource *source, GSourceFunc, gpointer)
35{
36 GUserEventSource *userEventSource = reinterpret_cast<GUserEventSource *>(source);
37 QPAEventDispatcherGlib *dispatcher = userEventSource->q;
39 return true;
40}
41
42static GSourceFuncs userEventSourceFuncs = {
46 NULL,
47 NULL,
48 NULL
49};
50
53{
55
56 GSource *source = g_source_new(&userEventSourceFuncs, sizeof(GUserEventSource));
57 g_source_set_name(source, "[Qt] GUserEventSource");
58 userEventSource = reinterpret_cast<GUserEventSource *>(source);
59
61 userEventSource->d = this;
62 g_source_set_can_recurse(&userEventSource->source, true);
63 g_source_attach(&userEventSource->source, mainContext);
64}
65
66
69 , m_flags(QEventLoop::AllEvents)
70{
72 d->userEventSource->q = this;
73}
74
76{
78
79 g_source_destroy(&d->userEventSource->source);
80 g_source_unref(&d->userEventSource->source);
81 d->userEventSource = nullptr;
82}
83
84bool QPAEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
85{
86 m_flags = flags;
88}
89
91
92#include "moc_qeventdispatcher_glib_p.cpp"
bool processEvents(QEventLoop::ProcessEventsFlags flags) override
Processes pending events that match flags until there are no more events to process.
\inmodule QtCore
Definition qeventloop.h:16
\inmodule QtCore
Definition qobject.h:103
QPAEventDispatcherGlibPrivate(GMainContext *context=nullptr)
bool processEvents(QEventLoop::ProcessEventsFlags flags) override
Processes pending events that match flags until there are no more events to process.
QEventLoop::ProcessEventsFlags m_flags
QPAEventDispatcherGlib(QObject *parent=nullptr)
static bool sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
static gboolean userEventSourcePrepare(GSource *source, gint *timeout)
static GSourceFuncs userEventSourceFuncs
static gboolean userEventSourceDispatch(GSource *source, GSourceFunc, gpointer)
static gboolean userEventSourceCheck(GSource *source)
struct _GMainContext GMainContext
Combined button and popup list for selecting options.
static void * context
GLbitfield GLuint64 timeout
[4]
GLbitfield flags
GLsizei GLsizei GLchar * source
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
#define Q_UNUSED(x)
QPAEventDispatcherGlibPrivate * d
QPAEventDispatcherGlib * q