1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:57:35 +00:00

LibGUI+WindowServer: Don't use a WM IPC to initiate own window resize

The WM_* IPC messages are intended for "outsider" window management,
not for a client's own windows. Make a separate StartWindowResize
message for this.

This was the only reason that every IPC client had to know its server
side client ID.
This commit is contained in:
Andreas Kling 2021-02-01 11:23:54 +01:00
parent c41d340983
commit a5bbe3280d
6 changed files with 20 additions and 4 deletions

View file

@ -673,6 +673,19 @@ void ClientConnection::handle(const Messages::WindowServer::WM_PopupWindowMenu&
}
}
void ClientConnection::handle(const Messages::WindowServer::StartWindowResize& request)
{
auto it = m_windows.find(request.window_id());
if (it == m_windows.end()) {
did_misbehave("WM_StartWindowResize: Bad window ID");
return;
}
auto& window = *(*it).value;
// FIXME: We are cheating a bit here by using the current cursor location and hard-coding the left button.
// Maybe the client should be allowed to specify what initiated this request?
WindowManager::the().start_window_resize(window, Screen::the().cursor_location(), MouseButton::Left);
}
void ClientConnection::handle(const Messages::WindowServer::WM_StartWindowResize& request)
{
auto* client = ClientConnection::from_client_id(request.client_id());

View file

@ -105,6 +105,7 @@ private:
virtual OwnPtr<Messages::WindowServer::SetWindowTitleResponse> handle(const Messages::WindowServer::SetWindowTitle&) override;
virtual OwnPtr<Messages::WindowServer::GetWindowTitleResponse> handle(const Messages::WindowServer::GetWindowTitle&) override;
virtual OwnPtr<Messages::WindowServer::IsMaximizedResponse> handle(const Messages::WindowServer::IsMaximized&) override;
virtual void handle(const Messages::WindowServer::StartWindowResize&) override;
virtual OwnPtr<Messages::WindowServer::SetWindowRectResponse> handle(const Messages::WindowServer::SetWindowRect&) override;
virtual OwnPtr<Messages::WindowServer::GetWindowRectResponse> handle(const Messages::WindowServer::GetWindowRect&) override;
virtual OwnPtr<Messages::WindowServer::GetWindowRectInMenubarResponse> handle(const Messages::WindowServer::GetWindowRectInMenubar&) override;

View file

@ -60,6 +60,8 @@ endpoint WindowServer = 2
GetWindowRectInMenubar(i32 window_id) => (Gfx::IntRect rect)
StartWindowResize(i32 window_id) =|
IsMaximized(i32 window_id) => (bool maximized)
InvalidateRect(i32 window_id, Vector<Gfx::IntRect> rects, bool ignore_occlusion) =|