mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:07:45 +00:00
WindowServer: Don't nap in the message loop if there's a queued message.
This fixes a bug where clicking on a button would sometimes take a while before showing up visually.
This commit is contained in:
parent
1c6dfc3282
commit
d3dcb42227
1 changed files with 12 additions and 10 deletions
|
@ -131,8 +131,9 @@ void WSMessageLoop::wait_for_message()
|
||||||
});
|
});
|
||||||
|
|
||||||
struct timeval timeout = { 0, 0 };
|
struct timeval timeout = { 0, 0 };
|
||||||
bool had_any_timer = false;
|
|
||||||
|
|
||||||
|
if (m_queued_messages.is_empty()) {
|
||||||
|
bool had_any_timer = false;
|
||||||
for (auto& it : m_timers) {
|
for (auto& it : m_timers) {
|
||||||
auto& timer = *it.value;
|
auto& timer = *it.value;
|
||||||
if (!had_any_timer) {
|
if (!had_any_timer) {
|
||||||
|
@ -143,8 +144,9 @@ void WSMessageLoop::wait_for_message()
|
||||||
if (timer.next_fire_time.tv_sec > timeout.tv_sec || (timer.next_fire_time.tv_sec == timeout.tv_sec && timer.next_fire_time.tv_usec > timeout.tv_usec))
|
if (timer.next_fire_time.tv_sec > timeout.tv_sec || (timer.next_fire_time.tv_sec == timeout.tv_sec && timer.next_fire_time.tv_usec > timeout.tv_usec))
|
||||||
timeout = timer.next_fire_time;
|
timeout = timer.next_fire_time;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int rc = select(max_fd + 1, &rfds, nullptr, nullptr, m_timers.is_empty() && m_queued_messages.is_empty() ? nullptr : &timeout);
|
int rc = select(max_fd + 1, &rfds, nullptr, nullptr, m_queued_messages.is_empty() ? nullptr : &timeout);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue