LibGUI: Add support for focusable windows and mouse capturing

These are essential parts of a window server! This allows making TaskBar
non-focusable.
This commit is contained in:
2024-11-08 02:54:27 +02:00
parent 12bc7480e0
commit da8170c5b6
9 changed files with 164 additions and 46 deletions

View File

@@ -267,6 +267,20 @@ namespace LibGUI
return true;
}
bool Window::set_mouse_capture(bool captured)
{
WindowPacket::WindowSetMouseCapture packet;
packet.captured = captured;
if (auto ret = packet.send_serialized(m_server_fd); ret.is_error())
{
dprintln("failed to set mouse capture: {}", ret.error());
return false;
}
return true;
}
bool Window::set_position(int32_t x, int32_t y)
{
WindowPacket::WindowSetPosition packet;
@@ -285,10 +299,7 @@ namespace LibGUI
bool Window::set_attributes(Attributes attributes)
{
WindowPacket::WindowSetAttributes packet;
packet.title_bar = attributes.title_bar;
packet.movable = attributes.movable;
packet.rounded_corners = attributes.rounded_corners;
packet.alpha_channel = attributes.alpha_channel;
packet.attributes = attributes;
if (auto ret = packet.send_serialized(m_server_fd); ret.is_error())
{