summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2010-06-11 00:16:37 -0700
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-06-11 00:16:37 -0700
commita261c9e5a17b502e3ef03d6cfee7bc65b973ed18 (patch)
tree44600388440d7187108478e35cdce8e0eb30a5f2 /src
parentd19a2319fba4e00345298318b3889c5886305207 (diff)
Use glib dispatcher on wayland
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/kernel.pri13
-rw-r--r--src/gui/kernel/qeventdispatcher_glib_wayland.cpp32
2 files changed, 31 insertions, 14 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index ba7618c237..d682724ab3 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -173,7 +173,8 @@ unix:x11 {
wayland {
HEADERS += \
- kernel/qeventdispatcher_wayland_p.h
+ kernel/qeventdispatcher_wayland_p.h \
+ kernel/qeventdispatcher_glib_wayland_p.h
SOURCES += \
kernel/qapplication_wayland.cpp \
@@ -185,15 +186,9 @@ wayland {
kernel/qsound_wayland.cpp \
kernel/qwidget_wayland.cpp \
kernel/qkeymapper_wayland.cpp \
-
- contains(QT_CONFIG, glib) {
- SOURCES += \
kernel/qeventdispatcher_glib_wayland.cpp
- HEADERS += \
- kernel/qeventdispatcher_glib_wayland_p.h
- QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
- LIBS_PRIVATE +=$$QT_LIBS_GLIB
- }
+ QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
+ LIBS_PRIVATE +=$$QT_LIBS_GLIB
}
embedded {
diff --git a/src/gui/kernel/qeventdispatcher_glib_wayland.cpp b/src/gui/kernel/qeventdispatcher_glib_wayland.cpp
index 9b4ce0eee6..1ccc2e2107 100644
--- a/src/gui/kernel/qeventdispatcher_glib_wayland.cpp
+++ b/src/gui/kernel/qeventdispatcher_glib_wayland.cpp
@@ -46,6 +46,8 @@
#include "qplatformdefs.h"
#include "qapplication.h"
+#include "qt_wayland_p.h"
+
#include <glib.h>
QT_BEGIN_NAMESPACE
@@ -70,16 +72,30 @@ public:
static gboolean waylandEventSourcePrepare(GSource *s, gint *timeout)
{
+ GWaylandEventSource *source = reinterpret_cast<GWaylandEventSource *>(s);
+
+ if (timeout)
+ *timeout = -1;
+#if 0
+ while (source->mask & WL_DISPLAY_WRITABLE)
+ wl_display_iterate(qWayland->display, WL_DISPLAY_WRITABLE);
+#endif
return false;
}
static gboolean waylandEventSourceCheck(GSource *s)
{
- return true;
+ GWaylandEventSource *source = reinterpret_cast<GWaylandEventSource *>(s);
+
+ return false;
}
static gboolean waylandEventSourceDispatch(GSource *s, GSourceFunc callback, gpointer user_data)
{
+ GWaylandEventSource *source = reinterpret_cast<GWaylandEventSource *>(s);
+
+ wl_display_iterate(qWayland->display, WL_DISPLAY_READABLE);
+
return true;
}
@@ -88,13 +104,18 @@ static GSourceFuncs waylandEventSourceFuncs = {
waylandEventSourceCheck,
waylandEventSourceDispatch,
NULL,
- NULL,
- NULL
};
QWaylandEventDispatcherGlibPrivate::QWaylandEventDispatcherGlibPrivate()
{
- //g_source_attach(&waylandEventSource->source, mainContext);
+ waylandEventSource = reinterpret_cast<GWaylandEventSource *>(g_source_new(&waylandEventSourceFuncs, sizeof(GWaylandEventSource)));
+ g_source_set_can_recurse(&waylandEventSource->source, true);
+
+ waylandEventSource->flags = QEventLoop::AllEvents;
+ waylandEventSource->q = 0;
+ waylandEventSource->d = 0;
+
+ g_source_attach(&waylandEventSource->source, mainContext);
}
QWaylandEventDispatcherGlib::QWaylandEventDispatcherGlib(QObject *parent)
@@ -106,7 +127,8 @@ QWaylandEventDispatcherGlib::~QWaylandEventDispatcherGlib()
{
Q_D(QWaylandEventDispatcherGlib);
- //g_source_destroy(&d->waylandEventSource->source);
+ g_source_destroy(&d->waylandEventSource->source);
+ d->waylandEventSource = 0;
}
bool