From 012706817713f026d2f5ded69bdbde492f2b712d Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 14 Aug 2023 18:15:38 +0200 Subject: [PATCH] gclient: Create two example windows --- apps/gclient.cpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/apps/gclient.cpp b/apps/gclient.cpp index aeb0a9b2..3d4fde4b 100644 --- a/apps/gclient.cpp +++ b/apps/gclient.cpp @@ -1,5 +1,23 @@ #include +#include #include +#include +#include + +Result handle_ipc_client_event(os::LocalClient&, u8) +{ + todo(); +} + +Result create_window(os::LocalClient& client, ui::Rect rect, StringView name, ui::Color color) +{ + ui::CreateWindowRequest request; + request.rect = rect; + SET_IPC_STRING(request.name, name.chars()); + request.color = color; + auto response = TRY(os::IPC::send_sync(client, request)); + return response.window; +} Result luna_main(int argc, char** argv) { @@ -13,8 +31,16 @@ Result luna_main(int argc, char** argv) auto client = TRY(os::LocalClient::connect(socket_path, false)); - StringView message = "hello"; - TRY(client->send((const u8*)message.chars(), message.length())); + int id = TRY(create_window(*client, ui::Rect { 200, 200, 400, 300 }, "My Window", ui::CYAN)); + os::println("Created new window with id %d!", id); + + sleep(3); + + id = + TRY(create_window(*client, ui::Rect { 100, 100, 200, 150 }, "Super Long Name that is Way Too Long ", ui::BLUE)); + os::println("Created new window with id %d!", id); + + sleep(6); return 0; }