From 36e0ab3f189b25a1d2d502f3f65ac67c8e6c3fe2 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 17 Jan 2019 02:42:52 +0100 Subject: [PATCH] Ignore WM_Invalidate events if there is an unprocessed one in the queue. --- WindowServer/WSEventLoop.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/WindowServer/WSEventLoop.cpp b/WindowServer/WSEventLoop.cpp index f5f7e105a4..95f2493260 100644 --- a/WindowServer/WSEventLoop.cpp +++ b/WindowServer/WSEventLoop.cpp @@ -74,11 +74,23 @@ int WSEventLoop::exec() void WSEventLoop::post_event(WSEventReceiver* receiver, OwnPtr&& event) { - //ASSERT_INTERRUPTS_ENABLED(); + ASSERT_INTERRUPTS_ENABLED(); LOCKER(m_lock); #ifdef WSEVENTLOOP_DEBUG dbgprintf("WSEventLoop::post_event: {%u} << receiver=%p, event=%p\n", m_queued_events.size(), receiver, event.ptr()); #endif + + if (event->type() == WSEvent::WM_Invalidate) { + for (auto& queued_event : m_queued_events) { + if (receiver == queued_event.receiver && queued_event.event->type() == WSEvent::WM_Invalidate) { +#ifdef WSEVENTLOOP_DEBUG + dbgprintf("Swallow WM_Invalidate\n"); +#endif + return; + } + } + } + m_queued_events.append({ receiver, move(event) }); if (current != m_server_process)