1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:17:45 +00:00

WindowServer: Vertically maximize window

Button now can handle middle and right clicks.
Added 2 new handlers in button class: on_right_click for Right mouse
button and on_middle_click for middle mouse button.

Added functionality to vertically maximize window with middle mouse
click on the maximize window button.

Also added a way to vertically maximize window by resizing window
height-wise lower than the maximum window height.
This commit is contained in:
Camisul 2021-01-26 23:50:02 +03:00 committed by Andreas Kling
parent e1ee59ac9d
commit 8c220dee03
6 changed files with 48 additions and 4 deletions

View file

@ -579,6 +579,15 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo
if (event.type() == Event::MouseUp && event.button() == m_resizing_mouse_button) {
dbgln_if(RESIZE_DEBUG, "[WM] Finish resizing Window({})", m_resize_window);
auto max_rect = maximized_window_rect(*m_resize_window);
if (event.y() > max_rect.bottom()) {
dbgln<RESIZE_DEBUG>("Should Maximize vertically");
m_resize_window->set_vertically_maximized();
m_resize_window = nullptr;
m_resizing_mouse_button = MouseButton::None;
return true;
}
Core::EventLoop::current().post_event(*m_resize_window, make<ResizeEvent>(m_resize_window->rect()));
m_resize_window->invalidate();
if (m_resize_window->rect().contains(event.position()))