1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:25:07 +00:00

Rework WindowServer to use select() in its main event loop.

The system can finally idle without burning CPU. :^)

There are some issues with scheduling making the mouse cursor sloppy
and unresponsive that need to be dealt with.
This commit is contained in:
Andreas Kling 2019-01-16 17:20:58 +01:00
parent f7ca6d254d
commit 4fef895eda
15 changed files with 121 additions and 33 deletions

View file

@ -125,7 +125,12 @@ ssize_t Keyboard::read(Process&, byte* buffer, size_t size)
while ((size_t)nread < size) {
if (m_queue.is_empty())
break;
buffer[nread++] = m_queue.dequeue().character;
// Don't return partial data frames.
if ((size - nread) < 2)
break;
auto key = m_queue.dequeue();
buffer[nread++] = key.character;
buffer[nread++] = key.modifiers;
}
return nread;
}