recipes: libs/libtirpc: Resolved a build a error
[dragora.git] / patches / gtk2 / GDK-W32-Always-process-all-available-messages.patch
blob2aa1e803e87d605cf8a087effa305d820d350bde
1 From: Jeremy Tan <jtanx@outlook.com>
2 Date: Sat, 17 Sep 2016 17:19:59 +0800
3 Subject: GDK W32: Always process all available messages
5 The GLib main loop blocks on MsgWaitForMultipleObjectsEx to
6 determine if there are any incoming messages while also allowing
7 for background tasks to run. If all available messages are not
8 processed after MsgWaitForMultipleObjectsEx has signaled that
9 there are available, CPU usage will skyrocket.
11 From my limited understanding (by inspection of profiling
12 under Visual Studio):
13 Key is pressed - MsgWaitForMultipleObjectsEx unblocks, and
14 sends message to GDK's event handler. Some event is now queued.
16 g_poll unblocks, calls the g_event_dispatch which finally
17 resolves to gdk_event_dispatch. This then calls
18 _gdk_win32_display_queue_events, but since a message is already
19 queued, it fails to call PeekMessage and returns immediately.
21 At the next iteration, g_poll again calls MsgWaitForMultipleObjectsEx
22 which queues yet another event and returns almost immediately, since
23 there are events available which haven't been processed by PeekMessage.
25 The dispatch function is then called and the process repeats.
27 Bug: https://bugzilla.gnome.org/show_bug.cgi?id=771568
28 Origin: upstream, 2.24.33, commit:bfdac2f70e005b2504cc3f4ebbdab328974d005a
29 ---
30 gdk/win32/gdkevents-win32.c | 3 +--
31 1 file changed, 1 insertion(+), 2 deletions(-)
33 diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
34 index 9b09edd..e52f21c 100644
35 --- a/gdk/win32/gdkevents-win32.c
36 +++ b/gdk/win32/gdkevents-win32.c
37 @@ -3622,8 +3622,7 @@ _gdk_events_queue (GdkDisplay *display)
38 if (modal_win32_dialog != NULL)
39 return;
41 - while (!_gdk_event_queue_find_first (display) &&
42 - PeekMessageW (&msg, NULL, 0, 0, PM_REMOVE))
43 + while (PeekMessageW (&msg, NULL, 0, 0, PM_REMOVE))
45 TranslateMessage (&msg);
46 DispatchMessageW (&msg);