mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14: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:
parent
c41d340983
commit
a5bbe3280d
6 changed files with 20 additions and 4 deletions
|
@ -106,7 +106,7 @@ void ResizeCorner::paint_event(PaintEvent& event)
|
||||||
void ResizeCorner::mousedown_event(MouseEvent& event)
|
void ResizeCorner::mousedown_event(MouseEvent& event)
|
||||||
{
|
{
|
||||||
if (event.button() == MouseButton::Left)
|
if (event.button() == MouseButton::Left)
|
||||||
window()->start_wm_resize();
|
window()->start_interactive_resize();
|
||||||
Widget::mousedown_event(event);
|
Widget::mousedown_event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -774,9 +774,9 @@ void Window::apply_icon()
|
||||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->to_shareable_bitmap());
|
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->to_shareable_bitmap());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::start_wm_resize()
|
void Window::start_interactive_resize()
|
||||||
{
|
{
|
||||||
WindowServerConnection::the().post_message(Messages::WindowServer::WM_StartWindowResize(WindowServerConnection::the().my_client_id(), m_window_id));
|
WindowServerConnection::the().post_message(Messages::WindowServer::StartWindowResize(m_window_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Widget*> Window::focusable_widgets(FocusSource source) const
|
Vector<Widget*> Window::focusable_widgets(FocusSource source) const
|
||||||
|
|
|
@ -126,7 +126,7 @@ public:
|
||||||
virtual void close();
|
virtual void close();
|
||||||
void move_to_front();
|
void move_to_front();
|
||||||
|
|
||||||
void start_wm_resize();
|
void start_interactive_resize();
|
||||||
|
|
||||||
Widget* main_widget() { return m_main_widget; }
|
Widget* main_widget() { return m_main_widget; }
|
||||||
const Widget* main_widget() const { return m_main_widget; }
|
const Widget* main_widget() const { return m_main_widget; }
|
||||||
|
|
|
@ -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)
|
void ClientConnection::handle(const Messages::WindowServer::WM_StartWindowResize& request)
|
||||||
{
|
{
|
||||||
auto* client = ClientConnection::from_client_id(request.client_id());
|
auto* client = ClientConnection::from_client_id(request.client_id());
|
||||||
|
|
|
@ -105,6 +105,7 @@ private:
|
||||||
virtual OwnPtr<Messages::WindowServer::SetWindowTitleResponse> handle(const Messages::WindowServer::SetWindowTitle&) override;
|
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::GetWindowTitleResponse> handle(const Messages::WindowServer::GetWindowTitle&) override;
|
||||||
virtual OwnPtr<Messages::WindowServer::IsMaximizedResponse> handle(const Messages::WindowServer::IsMaximized&) 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::SetWindowRectResponse> handle(const Messages::WindowServer::SetWindowRect&) override;
|
||||||
virtual OwnPtr<Messages::WindowServer::GetWindowRectResponse> handle(const Messages::WindowServer::GetWindowRect&) override;
|
virtual OwnPtr<Messages::WindowServer::GetWindowRectResponse> handle(const Messages::WindowServer::GetWindowRect&) override;
|
||||||
virtual OwnPtr<Messages::WindowServer::GetWindowRectInMenubarResponse> handle(const Messages::WindowServer::GetWindowRectInMenubar&) override;
|
virtual OwnPtr<Messages::WindowServer::GetWindowRectInMenubarResponse> handle(const Messages::WindowServer::GetWindowRectInMenubar&) override;
|
||||||
|
|
|
@ -60,6 +60,8 @@ endpoint WindowServer = 2
|
||||||
|
|
||||||
GetWindowRectInMenubar(i32 window_id) => (Gfx::IntRect rect)
|
GetWindowRectInMenubar(i32 window_id) => (Gfx::IntRect rect)
|
||||||
|
|
||||||
|
StartWindowResize(i32 window_id) =|
|
||||||
|
|
||||||
IsMaximized(i32 window_id) => (bool maximized)
|
IsMaximized(i32 window_id) => (bool maximized)
|
||||||
|
|
||||||
InvalidateRect(i32 window_id, Vector<Gfx::IntRect> rects, bool ignore_occlusion) =|
|
InvalidateRect(i32 window_id, Vector<Gfx::IntRect> rects, bool ignore_occlusion) =|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue