Annotation of /trunk/qt4/patches/qt-4.8.7-glib-honor-excludesocketnotifiers-flag.patch
Parent Directory | Revision Log
Revision 2918 -
(hide annotations)
(download)
Wed May 17 09:07:28 2017 UTC (7 years, 4 months ago) by niro
File size: 2726 byte(s)
Wed May 17 09:07:28 2017 UTC (7 years, 4 months ago) by niro
File size: 2726 byte(s)
-fixed a typo
1 | niro | 2917 | Author: Jan-Marek Glogowski <glogow@fbihome.de> |
2 | niro | 2913 | 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 | niro | 2917 | --- 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 | niro | 2913 | struct GSocketNotifierSource |
14 | { | ||
15 | GSource source; | ||
16 | niro | 2917 | + QEventLoop::ProcessEventsFlags processEventsFlags; |
17 | QList<GPollFDWithQSocketNotifier *> pollfds; | ||
18 | niro | 2913 | }; |
19 | |||
20 | niro | 2917 | @@ -80,6 +81,9 @@ static gboolean socketNotifierSourceChec |
21 | GSocketNotifierSource *src = reinterpret_cast<GSocketNotifierSource *>(source); | ||
22 | niro | 2913 | |
23 | bool pending = false; | ||
24 | niro | 2917 | + 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 | niro | 2913 | |
30 | niro | 2917 | @@ -103,6 +107,9 @@ static gboolean socketNotifierSourceDisp |
31 | niro | 2913 | QEvent event(QEvent::SockAct); |
32 | |||
33 | niro | 2917 | 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 | niro | 2913 | |
40 | niro | 2917 | @@ -330,6 +337,7 @@ QEventDispatcherGlibPrivate::QEventDispa |
41 | reinterpret_cast<GSocketNotifierSource *>(g_source_new(&socketNotifierSourceFuncs, | ||
42 | niro | 2913 | sizeof(GSocketNotifierSource))); |
43 | niro | 2917 | (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 | niro | 2913 | |
48 | niro | 2917 | @@ -415,6 +423,7 @@ bool QEventDispatcherGlib::processEvents |
49 | niro | 2913 | // tell postEventSourcePrepare() and timerSource about any new flags |
50 | niro | 2917 | QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags; |
51 | d->timerSource->processEventsFlags = flags; | ||
52 | + d->socketNotifierSource->processEventsFlags = flags; | ||
53 | niro | 2913 | |
54 | niro | 2917 | if (!(flags & QEventLoop::EventLoopExec)) { |
55 | niro | 2913 | // force timers to be sent at normal priority |
56 | niro | 2917 | @@ -426,6 +435,7 @@ bool QEventDispatcherGlib::processEvents |
57 | result = g_main_context_iteration(d->mainContext, canWait); | ||
58 | niro | 2913 | |
59 | niro | 2917 | d->timerSource->processEventsFlags = savedFlags; |
60 | + d->socketNotifierSource->processEventsFlags = savedFlags; | ||
61 | niro | 2913 | |
62 | if (canWait) | ||
63 | emit awake(); |