gclient: Create two example windows
Some checks failed
continuous-integration/drone/pr Build is failing
Some checks failed
continuous-integration/drone/pr Build is failing
This commit is contained in:
parent
4bcea9b141
commit
397ed396d8
@ -1,5 +1,23 @@
|
|||||||
#include <os/ArgumentParser.h>
|
#include <os/ArgumentParser.h>
|
||||||
|
#include <os/File.h>
|
||||||
#include <os/LocalClient.h>
|
#include <os/LocalClient.h>
|
||||||
|
#include <ui/ipc/Server.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
Result<void> handle_ipc_client_event(os::LocalClient&, u8)
|
||||||
|
{
|
||||||
|
todo();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<int> 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<ui::CreateWindowResponse>(client, request));
|
||||||
|
return response.window;
|
||||||
|
}
|
||||||
|
|
||||||
Result<int> luna_main(int argc, char** argv)
|
Result<int> luna_main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
@ -13,8 +31,16 @@ Result<int> luna_main(int argc, char** argv)
|
|||||||
|
|
||||||
auto client = TRY(os::LocalClient::connect(socket_path, false));
|
auto client = TRY(os::LocalClient::connect(socket_path, false));
|
||||||
|
|
||||||
StringView message = "hello";
|
int id = TRY(create_window(*client, ui::Rect { 200, 200, 400, 300 }, "My Window", ui::CYAN));
|
||||||
TRY(client->send((const u8*)message.chars(), message.length()));
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user