LibGUI: Add support for changing window title

This commit is contained in:
2025-05-05 01:10:05 +03:00
parent ccb81de85d
commit 76d4e6bd18
7 changed files with 50 additions and 1 deletions

View File

@@ -287,6 +287,15 @@ namespace LibGUI
return on_socket_error(__FUNCTION__);
}
void Window::set_title(BAN::StringView title)
{
WindowPacket::WindowSetTitle packet;
MUST(packet.title.append(title));
if (auto ret = packet.send_serialized(m_server_fd); ret.is_error())
return on_socket_error(__FUNCTION__);
}
void Window::set_position(int32_t x, int32_t y)
{
WindowPacket::WindowSetPosition packet;

View File

@@ -165,6 +165,7 @@ namespace LibGUI
WindowSetMouseCapture,
WindowSetSize,
WindowSetFullscreen,
WindowSetTitle,
DestroyWindowEvent,
CloseWindowEvent,
@@ -230,6 +231,11 @@ namespace LibGUI
bool, fullscreen
);
DEFINE_PACKET(
WindowSetTitle,
BAN::String, title
);
}
namespace EventPacket

View File

@@ -68,6 +68,7 @@ namespace LibGUI
void set_mouse_capture(bool captured);
void set_fullscreen(bool fullscreen);
void set_title(BAN::StringView title);
void set_position(int32_t x, int32_t y);