WindowServer: Cleanup packet callback calling
This commit is contained in:
parent
7aa24b6157
commit
7dcf1797e9
|
@ -356,46 +356,22 @@ int main()
|
|||
|
||||
switch (*reinterpret_cast<LibGUI::PacketType*>(client_data.packet_buffer.data()))
|
||||
{
|
||||
case LibGUI::PacketType::WindowCreate:
|
||||
if (auto ret = LibGUI::WindowPacket::WindowCreate::deserialize(client_data.packet_buffer.span()); !ret.is_error())
|
||||
window_server.on_window_create(fd, ret.release_value());
|
||||
break;
|
||||
case LibGUI::PacketType::WindowInvalidate:
|
||||
if (auto ret = LibGUI::WindowPacket::WindowInvalidate::deserialize(client_data.packet_buffer.span()); !ret.is_error())
|
||||
window_server.on_window_invalidate(fd, ret.release_value());
|
||||
break;
|
||||
case LibGUI::PacketType::WindowSetPosition:
|
||||
if (auto ret = LibGUI::WindowPacket::WindowSetPosition::deserialize(client_data.packet_buffer.span()); !ret.is_error())
|
||||
window_server.on_window_set_position(fd, ret.release_value());
|
||||
break;
|
||||
case LibGUI::PacketType::WindowSetAttributes:
|
||||
if (auto ret = LibGUI::WindowPacket::WindowSetAttributes::deserialize(client_data.packet_buffer.span()); !ret.is_error())
|
||||
window_server.on_window_set_attributes(fd, ret.release_value());
|
||||
break;
|
||||
case LibGUI::PacketType::WindowSetMouseCapture:
|
||||
if (auto ret = LibGUI::WindowPacket::WindowSetMouseCapture::deserialize(client_data.packet_buffer.span()); !ret.is_error())
|
||||
window_server.on_window_set_mouse_capture(fd, ret.release_value());
|
||||
break;
|
||||
case LibGUI::PacketType::WindowSetSize:
|
||||
if (auto ret = LibGUI::WindowPacket::WindowSetSize::deserialize(client_data.packet_buffer.span()); !ret.is_error())
|
||||
window_server.on_window_set_size(fd, ret.release_value());
|
||||
break;
|
||||
case LibGUI::PacketType::WindowSetMinSize:
|
||||
if (auto ret = LibGUI::WindowPacket::WindowSetMinSize::deserialize(client_data.packet_buffer.span()); !ret.is_error())
|
||||
window_server.on_window_set_min_size(fd, ret.release_value());
|
||||
break;
|
||||
case LibGUI::PacketType::WindowSetMaxSize:
|
||||
if (auto ret = LibGUI::WindowPacket::WindowSetMaxSize::deserialize(client_data.packet_buffer.span()); !ret.is_error())
|
||||
window_server.on_window_set_max_size(fd, ret.release_value());
|
||||
break;
|
||||
case LibGUI::PacketType::WindowSetFullscreen:
|
||||
if (auto ret = LibGUI::WindowPacket::WindowSetFullscreen::deserialize(client_data.packet_buffer.span()); !ret.is_error())
|
||||
window_server.on_window_set_fullscreen(fd, ret.release_value());
|
||||
break;
|
||||
case LibGUI::PacketType::WindowSetTitle:
|
||||
if (auto ret = LibGUI::WindowPacket::WindowSetTitle::deserialize(client_data.packet_buffer.span()); !ret.is_error())
|
||||
window_server.on_window_set_title(fd, ret.release_value());
|
||||
break;
|
||||
#define WINDOW_PACKET_CASE(enum, function) \
|
||||
case LibGUI::PacketType::enum: \
|
||||
if (auto ret = LibGUI::WindowPacket::enum::deserialize(client_data.packet_buffer.span()); !ret.is_error()) \
|
||||
window_server.function(fd, ret.release_value()); \
|
||||
break
|
||||
WINDOW_PACKET_CASE(WindowCreate, on_window_create);
|
||||
WINDOW_PACKET_CASE(WindowInvalidate, on_window_invalidate);
|
||||
WINDOW_PACKET_CASE(WindowSetPosition, on_window_set_position);
|
||||
WINDOW_PACKET_CASE(WindowSetAttributes, on_window_set_attributes);
|
||||
WINDOW_PACKET_CASE(WindowSetMouseCapture, on_window_set_mouse_capture);
|
||||
WINDOW_PACKET_CASE(WindowSetSize, on_window_set_size);
|
||||
WINDOW_PACKET_CASE(WindowSetMinSize, on_window_set_min_size);
|
||||
WINDOW_PACKET_CASE(WindowSetMaxSize, on_window_set_max_size);
|
||||
WINDOW_PACKET_CASE(WindowSetFullscreen, on_window_set_fullscreen);
|
||||
WINDOW_PACKET_CASE(WindowSetTitle, on_window_set_title);
|
||||
#undef WINDOW_PACKET_CASE
|
||||
default:
|
||||
dprintln("unhandled packet type: {}", *reinterpret_cast<uint32_t*>(client_data.packet_buffer.data()));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue