diff options
author | Andreas Kling <kling@serenityos.org> | 2021-06-12 11:55:13 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-12 12:01:54 +0200 |
commit | 0a98964600fffc97cfe904432be29ec13b6e91a5 (patch) | |
tree | 75b80aff415ffb9aa955386e6b00641871a38db7 /Userland/Libraries | |
parent | 77c2db41835294d60d01396865f0c9c81e7378c3 (diff) | |
download | serenity-0a98964600fffc97cfe904432be29ec13b6e91a5.zip |
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.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibGUI/Window.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index 02622d6c98..96fbdd0338 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -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, |