mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:48:14 +00:00
WindowServer+LibGUI: Make window creation asynchronous :^)
Let clients manage their own window ID's. If you try to create a new window with an existing ID, WindowServer will simply disconnect you for misbehaving. This removes the need for window creation to be synchronous, which means that most GUI applications can now batch their entire GUI initialization sequence without having to block waiting for responses.
This commit is contained in:
parent
77c2db4183
commit
0a98964600
4 changed files with 17 additions and 10 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/IDAllocator.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/NeverDestroyed.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
|
@ -30,6 +31,7 @@
|
|||
namespace GUI {
|
||||
|
||||
static i32 s_next_backing_store_serial;
|
||||
static IDAllocator s_window_id_allocator;
|
||||
|
||||
class WindowBackingStore {
|
||||
public:
|
||||
|
@ -118,7 +120,10 @@ void Window::show()
|
|||
|
||||
auto* parent_window = find_parent_window();
|
||||
|
||||
m_window_id = WindowServerConnection::the().create_window(
|
||||
m_window_id = s_window_id_allocator.allocate();
|
||||
|
||||
WindowServerConnection::the().async_create_window(
|
||||
m_window_id,
|
||||
m_rect_when_windowless,
|
||||
!m_moved_by_client,
|
||||
m_has_alpha_channel,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue