1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37:35 +00:00

WindowServer: Add Vertically/HorizontallyMaximized WindowTileTypes

VerticallyMaximized tiling replaces set_vertically_maximized() to
take advantage of tiling ergonomics.

Middle-clicking a window's maximize button now tiles vertically;
secondary-clicking tiles horizontally.

Adds Super+Alt+Arrow shortcuts for both. Super+Left/Right tiling
shortcuts now let windows shift between tile types directly.
This commit is contained in:
thankyouverycool 2022-02-07 13:46:07 -05:00 committed by Andreas Kling
parent 32be05957a
commit ee637b44fb
4 changed files with 74 additions and 32 deletions

View file

@ -84,7 +84,18 @@ void WindowFrame::window_was_constructed(Badge<Window>)
m_window.handle_window_menu_action(WindowMenuAction::MaximizeOrRestore);
});
button->on_middle_click = [&](auto&) {
m_window.set_vertically_maximized();
auto& window_screen = Screen::closest_to_location(m_window.rect().location());
if (m_window.tile_type() == WindowTileType::VerticallyMaximized)
m_window.set_untiled();
else
m_window.set_tiled(&window_screen, WindowTileType::VerticallyMaximized);
};
button->on_secondary_click = [&](auto&) {
auto& window_screen = Screen::closest_to_location(m_window.rect().location());
if (m_window.tile_type() == WindowTileType::HorizontallyMaximized)
m_window.set_untiled();
else
m_window.set_tiled(&window_screen, WindowTileType::HorizontallyMaximized);
};
m_maximize_button = button.ptr();
m_buttons.append(move(button));