]>
Commit | Line | Data |
---|---|---|
85e3a333 AM |
1 | --- src/corelib/kernel/qeventdispatcher_glib.cpp.sav 2014-03-28 15:26:37.000000000 +0100 |
2 | +++ src/corelib/kernel/qeventdispatcher_glib.cpp 2014-04-24 09:44:09.358659204 +0200 | |
3 | @@ -255,22 +255,30 @@ struct GPostEventSource | |
4 | GSource source; | |
5 | QAtomicInt serialNumber; | |
6 | int lastSerialNumber; | |
7 | + QEventLoop::ProcessEventsFlags processEventsFlags; | |
8 | QEventDispatcherGlibPrivate *d; | |
9 | }; | |
10 | ||
11 | static gboolean postEventSourcePrepare(GSource *s, gint *timeout) | |
12 | { | |
13 | + GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s); | |
14 | QThreadData *data = QThreadData::current(); | |
15 | if (!data) | |
16 | return false; | |
17 | ||
18 | + QEventLoop::ProcessEventsFlags excludeAllFlags | |
19 | + = QEventLoop::ExcludeUserInputEvents | |
20 | + | QEventLoop::ExcludeSocketNotifiers | |
21 | + | QEventLoop::X11ExcludeTimers; | |
22 | + if ((source->processEventsFlags & excludeAllFlags) == excludeAllFlags) | |
23 | + return false; | |
24 | + | |
25 | gint dummy; | |
26 | if (!timeout) | |
27 | timeout = &dummy; | |
28 | const bool canWait = data->canWaitLocked(); | |
29 | *timeout = canWait ? -1 : 0; | |
30 | ||
31 | - GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s); | |
32 | return (!canWait | |
33 | || (source->serialNumber != source->lastSerialNumber)); | |
34 | } | |
35 | @@ -284,8 +292,14 @@ static gboolean postEventSourceDispatch( | |
36 | { | |
37 | GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s); | |
38 | source->lastSerialNumber = source->serialNumber; | |
39 | - QCoreApplication::sendPostedEvents(); | |
40 | - source->d->runTimersOnceWithNormalPriority(); | |
41 | + QEventLoop::ProcessEventsFlags excludeAllFlags | |
42 | + = QEventLoop::ExcludeUserInputEvents | |
43 | + | QEventLoop::ExcludeSocketNotifiers | |
44 | + | QEventLoop::X11ExcludeTimers; | |
45 | + if ((source->processEventsFlags & excludeAllFlags) != excludeAllFlags) { | |
46 | + QCoreApplication::sendPostedEvents(); | |
47 | + source->d->runTimersOnceWithNormalPriority(); | |
48 | + } | |
49 | return true; // i dunno, george... | |
50 | } | |
51 | ||
52 | @@ -329,6 +343,7 @@ QEventDispatcherGlibPrivate::QEventDispa | |
53 | postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs, | |
54 | sizeof(GPostEventSource))); | |
55 | postEventSource->serialNumber = 1; | |
56 | + postEventSource->processEventsFlags = QEventLoop::AllEvents; | |
57 | postEventSource->d = this; | |
58 | g_source_set_can_recurse(&postEventSource->source, true); | |
59 | g_source_attach(&postEventSource->source, mainContext); | |
60 | @@ -423,6 +438,7 @@ bool QEventDispatcherGlib::processEvents | |
61 | ||
62 | // tell postEventSourcePrepare() and timerSource about any new flags | |
63 | QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags; | |
64 | + d->postEventSource->processEventsFlags = flags; | |
65 | d->timerSource->processEventsFlags = flags; | |
66 | d->socketNotifierSource->processEventsFlags = flags; | |
67 | ||
68 | @@ -435,6 +451,7 @@ bool QEventDispatcherGlib::processEvents | |
69 | while (!result && canWait) | |
70 | result = g_main_context_iteration(d->mainContext, canWait); | |
71 | ||
72 | + d->postEventSource->processEventsFlags = savedFlags; | |
73 | d->timerSource->processEventsFlags = savedFlags; | |
74 | d->socketNotifierSource->processEventsFlags = savedFlags; | |
75 | ||
76 | --- src/corelib/kernel/qeventdispatcher_unix.cpp.sav 2013-06-07 07:16:52.000000000 +0200 | |
77 | +++ src/corelib/kernel/qeventdispatcher_unix.cpp 2014-04-24 09:43:06.927589535 +0200 | |
78 | @@ -905,7 +905,15 @@ bool QEventDispatcherUNIX::processEvents | |
79 | ||
80 | // we are awake, broadcast it | |
81 | emit awake(); | |
82 | - QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); | |
83 | + | |
84 | + QEventLoop::ProcessEventsFlags excludeAllFlags | |
85 | + = QEventLoop::ExcludeUserInputEvents | |
86 | + | QEventLoop::ExcludeSocketNotifiers | |
87 | + | QEventLoop::X11ExcludeTimers; | |
88 | + if ((flags & excludeAllFlags) == excludeAllFlags) | |
89 | + return false; | |
90 | + if(( flags & excludeAllFlags ) != excludeAllFlags ) | |
91 | + QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); | |
92 | ||
93 | int nevents = 0; | |
94 | const bool canWait = (d->threadData->canWaitLocked() |