mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
WindowServer: Reuse existing WindowManager::desktop_rect()
method
This commit is contained in:
parent
1cb306cbe3
commit
a19e54c1db
2 changed files with 4 additions and 10 deletions
|
@ -10,7 +10,6 @@
|
||||||
#include <LibGfx/Painter.h>
|
#include <LibGfx/Painter.h>
|
||||||
#include <LibGfx/StylePainter.h>
|
#include <LibGfx/StylePainter.h>
|
||||||
#include <LibGfx/WindowTheme.h>
|
#include <LibGfx/WindowTheme.h>
|
||||||
#include <Services/Taskbar/TaskbarWindow.h>
|
|
||||||
#include <WindowServer/Button.h>
|
#include <WindowServer/Button.h>
|
||||||
#include <WindowServer/Compositor.h>
|
#include <WindowServer/Compositor.h>
|
||||||
#include <WindowServer/Event.h>
|
#include <WindowServer/Event.h>
|
||||||
|
@ -978,10 +977,7 @@ void WindowFrame::latch_window_to_screen_edge(ResizeDirection resize_direction)
|
||||||
auto window_rect = m_window.rect();
|
auto window_rect = m_window.rect();
|
||||||
auto frame_rect = rect();
|
auto frame_rect = rect();
|
||||||
auto& screen = Screen::closest_to_rect(window_rect);
|
auto& screen = Screen::closest_to_rect(window_rect);
|
||||||
auto screen_rect = screen.rect();
|
auto screen_rect = WindowManager::the().desktop_rect(screen);
|
||||||
|
|
||||||
if (screen.is_main_screen())
|
|
||||||
screen_rect.shrink(0, 0, TaskbarWindow::taskbar_height(), 0);
|
|
||||||
|
|
||||||
if (resize_direction == ResizeDirection::UpLeft
|
if (resize_direction == ResizeDirection::UpLeft
|
||||||
|| resize_direction == ResizeDirection::Up
|
|| resize_direction == ResizeDirection::Up
|
||||||
|
|
|
@ -1958,10 +1958,7 @@ Gfx::IntRect WindowManager::tiled_window_rect(Window const& window, WindowTileTy
|
||||||
VERIFY(tile_type != WindowTileType::None);
|
VERIFY(tile_type != WindowTileType::None);
|
||||||
|
|
||||||
auto& screen = Screen::closest_to_rect(window.frame().rect());
|
auto& screen = Screen::closest_to_rect(window.frame().rect());
|
||||||
Gfx::IntRect rect = screen.rect();
|
auto rect = desktop_rect(screen);
|
||||||
|
|
||||||
if (screen.is_main_screen())
|
|
||||||
rect.set_height(rect.height() - TaskbarWindow::taskbar_height());
|
|
||||||
|
|
||||||
if (tile_type == WindowTileType::Maximized) {
|
if (tile_type == WindowTileType::Maximized) {
|
||||||
auto border_thickness = palette().window_border_thickness();
|
auto border_thickness = palette().window_border_thickness();
|
||||||
|
@ -2181,9 +2178,10 @@ Gfx::IntPoint WindowManager::get_recommended_window_position(Gfx::IntPoint desir
|
||||||
Gfx::IntPoint point;
|
Gfx::IntPoint point;
|
||||||
if (overlap_window) {
|
if (overlap_window) {
|
||||||
auto& screen = Screen::closest_to_location(desired);
|
auto& screen = Screen::closest_to_location(desired);
|
||||||
|
auto available_rect = desktop_rect(screen);
|
||||||
point = overlap_window->position() + shift;
|
point = overlap_window->position() + shift;
|
||||||
point = { point.x() % screen.width(),
|
point = { point.x() % screen.width(),
|
||||||
(point.y() >= (screen.height() - (screen.is_main_screen() ? TaskbarWindow::taskbar_height() : 0)))
|
(point.y() >= available_rect.height())
|
||||||
? Gfx::WindowTheme::current().titlebar_height(Gfx::WindowTheme::WindowType::Normal, Gfx::WindowTheme::WindowMode::Other, palette())
|
? Gfx::WindowTheme::current().titlebar_height(Gfx::WindowTheme::WindowType::Normal, Gfx::WindowTheme::WindowMode::Other, palette())
|
||||||
: point.y() };
|
: point.y() };
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue