Magellan Linux

Contents of /trunk/qt4/patches/qt-4.8.7-glib-honor-excludenocketnotifiers-flag.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2917 - (show annotations) (download)
Wed May 17 09:04:25 2017 UTC (6 years, 11 months ago) by niro
File size: 2726 byte(s)
-fixed patches
1 Author: Jan-Marek Glogowski <glogow@fbihome.de>
2 Date: Thu Mar 06 18:44:43 2014 +0100
3
4 Honor QEventLoop::ExcludeSocketNotifiers in glib event loop.
5
6 Implements QEventLoop::ExcludeSocketNotifiers in the same way
7 QEventLoop::X11ExcludeTimers is already implemented for the glib
8 event loop.
9
10 --- qt4-x11-4.8.1.orig/src/corelib/kernel/qeventdispatcher_glib.cpp
11 +++ qt4-x11-4.8.1/src/corelib/kernel/qeventdispatcher_glib.cpp
12 @@ -65,6 +65,7 @@ struct GPollFDWithQSocketNotifier
13 struct GSocketNotifierSource
14 {
15 GSource source;
16 + QEventLoop::ProcessEventsFlags processEventsFlags;
17 QList<GPollFDWithQSocketNotifier *> pollfds;
18 };
19
20 @@ -80,6 +81,9 @@ static gboolean socketNotifierSourceChec
21 GSocketNotifierSource *src = reinterpret_cast<GSocketNotifierSource *>(source);
22
23 bool pending = false;
24 + if (src->processEventsFlags & QEventLoop::ExcludeSocketNotifiers)
25 + return pending;
26 +
27 for (int i = 0; !pending && i < src->pollfds.count(); ++i) {
28 GPollFDWithQSocketNotifier *p = src->pollfds.at(i);
29
30 @@ -103,6 +107,9 @@ static gboolean socketNotifierSourceDisp
31 QEvent event(QEvent::SockAct);
32
33 GSocketNotifierSource *src = reinterpret_cast<GSocketNotifierSource *>(source);
34 + if (src->processEventsFlags & QEventLoop::ExcludeSocketNotifiers)
35 + return true;
36 +
37 for (int i = 0; i < src->pollfds.count(); ++i) {
38 GPollFDWithQSocketNotifier *p = src->pollfds.at(i);
39
40 @@ -330,6 +337,7 @@ QEventDispatcherGlibPrivate::QEventDispa
41 reinterpret_cast<GSocketNotifierSource *>(g_source_new(&socketNotifierSourceFuncs,
42 sizeof(GSocketNotifierSource)));
43 (void) new (&socketNotifierSource->pollfds) QList<GPollFDWithQSocketNotifier *>();
44 + socketNotifierSource->processEventsFlags = QEventLoop::AllEvents;
45 g_source_set_can_recurse(&socketNotifierSource->source, true);
46 g_source_attach(&socketNotifierSource->source, mainContext);
47
48 @@ -415,6 +423,7 @@ bool QEventDispatcherGlib::processEvents
49 // tell postEventSourcePrepare() and timerSource about any new flags
50 QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags;
51 d->timerSource->processEventsFlags = flags;
52 + d->socketNotifierSource->processEventsFlags = flags;
53
54 if (!(flags & QEventLoop::EventLoopExec)) {
55 // force timers to be sent at normal priority
56 @@ -426,6 +435,7 @@ bool QEventDispatcherGlib::processEvents
57 result = g_main_context_iteration(d->mainContext, canWait);
58
59 d->timerSource->processEventsFlags = savedFlags;
60 + d->socketNotifierSource->processEventsFlags = savedFlags;
61
62 if (canWait)
63 emit awake();