forked from Bananymous/banan-os
				
			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())) | 				switch (*reinterpret_cast<LibGUI::PacketType*>(client_data.packet_buffer.data())) | ||||||
| 				{ | 				{ | ||||||
| 					case LibGUI::PacketType::WindowCreate: | #define WINDOW_PACKET_CASE(enum, function) \ | ||||||
| 						if (auto ret = LibGUI::WindowPacket::WindowCreate::deserialize(client_data.packet_buffer.span()); !ret.is_error()) | 					case LibGUI::PacketType::enum: \ | ||||||
| 							window_server.on_window_create(fd, ret.release_value()); | 						if (auto ret = LibGUI::WindowPacket::enum::deserialize(client_data.packet_buffer.span()); !ret.is_error()) \ | ||||||
| 						break; | 							window_server.function(fd, ret.release_value()); \ | ||||||
| 					case LibGUI::PacketType::WindowInvalidate: | 						break | ||||||
| 						if (auto ret = LibGUI::WindowPacket::WindowInvalidate::deserialize(client_data.packet_buffer.span()); !ret.is_error()) | 					WINDOW_PACKET_CASE(WindowCreate,          on_window_create); | ||||||
| 							window_server.on_window_invalidate(fd, ret.release_value()); | 					WINDOW_PACKET_CASE(WindowInvalidate,      on_window_invalidate); | ||||||
| 						break; | 					WINDOW_PACKET_CASE(WindowSetPosition,     on_window_set_position); | ||||||
| 					case LibGUI::PacketType::WindowSetPosition: | 					WINDOW_PACKET_CASE(WindowSetAttributes,   on_window_set_attributes); | ||||||
| 						if (auto ret = LibGUI::WindowPacket::WindowSetPosition::deserialize(client_data.packet_buffer.span()); !ret.is_error()) | 					WINDOW_PACKET_CASE(WindowSetMouseCapture, on_window_set_mouse_capture); | ||||||
| 							window_server.on_window_set_position(fd, ret.release_value()); | 					WINDOW_PACKET_CASE(WindowSetSize,         on_window_set_size); | ||||||
| 						break; | 					WINDOW_PACKET_CASE(WindowSetMinSize,      on_window_set_min_size); | ||||||
| 					case LibGUI::PacketType::WindowSetAttributes: | 					WINDOW_PACKET_CASE(WindowSetMaxSize,      on_window_set_max_size); | ||||||
| 						if (auto ret = LibGUI::WindowPacket::WindowSetAttributes::deserialize(client_data.packet_buffer.span()); !ret.is_error()) | 					WINDOW_PACKET_CASE(WindowSetFullscreen,   on_window_set_fullscreen); | ||||||
| 							window_server.on_window_set_attributes(fd, ret.release_value()); | 					WINDOW_PACKET_CASE(WindowSetTitle,        on_window_set_title); | ||||||
| 						break; | #undef WINDOW_PACKET_CASE | ||||||
| 					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; |  | ||||||
| 					default: | 					default: | ||||||
| 						dprintln("unhandled packet type: {}", *reinterpret_cast<uint32_t*>(client_data.packet_buffer.data())); | 						dprintln("unhandled packet type: {}", *reinterpret_cast<uint32_t*>(client_data.packet_buffer.data())); | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue