LibGUI: Add support for changing window title
This commit is contained in:
@@ -307,7 +307,7 @@ void WindowServer::on_window_set_fullscreen(int fd, const LibGUI::WindowPacket::
|
||||
|
||||
if (!target_window)
|
||||
{
|
||||
dwarnln("client tried to set window size while not owning a window");
|
||||
dwarnln("client tried to set window fullscreen while not owning a window");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -316,6 +316,32 @@ void WindowServer::on_window_set_fullscreen(int fd, const LibGUI::WindowPacket::
|
||||
invalidate(m_framebuffer.area());
|
||||
}
|
||||
|
||||
void WindowServer::on_window_set_title(int fd, const LibGUI::WindowPacket::WindowSetTitle& packet)
|
||||
{
|
||||
BAN::RefPtr<Window> target_window;
|
||||
for (auto& window : m_client_windows)
|
||||
{
|
||||
if (window->client_fd() != fd)
|
||||
continue;
|
||||
target_window = window;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!target_window)
|
||||
{
|
||||
dwarnln("client tried to set window title while not owning a window");
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto ret = target_window->set_title(packet.title); ret.is_error())
|
||||
{
|
||||
dwarnln("failed to set window title: {}", ret.error());
|
||||
return;
|
||||
}
|
||||
|
||||
invalidate(target_window->title_bar_area());
|
||||
}
|
||||
|
||||
void WindowServer::on_key_event(LibInput::KeyEvent event)
|
||||
{
|
||||
// Mod key is not passed to clients
|
||||
|
||||
Reference in New Issue
Block a user