1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +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

@ -360,7 +360,21 @@ void Window::set_maximized(bool maximized, Optional<Gfx::IntPoint> fixed_point)
Core::EventLoop::current().post_event(*this, make<ResizeEvent>(m_rect));
set_default_positioned(false);
}
void Window::set_vertically_maximized()
{
if (m_maximized)
return;
if (!is_resizable() || resize_aspect_ratio().has_value())
return;
auto max_rect = WindowManager::the().maximized_window_rect(*this);
auto new_rect = Gfx::IntRect(
Gfx::IntPoint(rect().x(), max_rect.y()),
Gfx::IntSize(rect().width(), max_rect.height()));
set_rect(new_rect);
Core::EventLoop::current().post_event(*this, make<ResizeEvent>(new_rect));
}
void Window::set_resizable(bool resizable)
{
if (m_resizable == resizable)