mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
WindowServer: Properly determine where a window may be
This also fixes weird behavior of WindowManager::desktop_rect(). None of the callers seem to ever expect an empty Rect, so return a non-empty Rect.
This commit is contained in:
parent
af605afb27
commit
3fd5aec187
3 changed files with 22 additions and 2 deletions
|
@ -183,7 +183,7 @@ void Window::normalize_rect()
|
||||||
// For example, the windows that make the desktop rect smaller
|
// For example, the windows that make the desktop rect smaller
|
||||||
// than the display resolution (e.g. the TaskBar).
|
// than the display resolution (e.g. the TaskBar).
|
||||||
auto min_visible = -1;
|
auto min_visible = -1;
|
||||||
auto desktop = WindowManager::the().desktop_rect();
|
auto desktop = WindowManager::the().arena_rect_for_type(type())
|
||||||
auto min_y = 0;
|
auto min_y = 0;
|
||||||
if (type() == WindowType::Normal) {
|
if (type() == WindowType::Normal) {
|
||||||
min_size = 50;
|
min_size = 50;
|
||||||
|
|
|
@ -1043,7 +1043,7 @@ Gfx::IntRect WindowManager::menubar_rect() const
|
||||||
Gfx::IntRect WindowManager::desktop_rect() const
|
Gfx::IntRect WindowManager::desktop_rect() const
|
||||||
{
|
{
|
||||||
if (active_fullscreen_window())
|
if (active_fullscreen_window())
|
||||||
return {};
|
return Screen::the().rect();
|
||||||
return {
|
return {
|
||||||
0,
|
0,
|
||||||
menubar_rect().bottom() + 1,
|
menubar_rect().bottom() + 1,
|
||||||
|
@ -1052,6 +1052,25 @@ Gfx::IntRect WindowManager::desktop_rect() const
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gfx::IntRect WindowManager::arena_rect_for_type(WindowType type) const
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case WindowType::Desktop:
|
||||||
|
case WindowType::Normal:
|
||||||
|
return desktop_rect();
|
||||||
|
case WindowType::Menu:
|
||||||
|
case WindowType::WindowSwitcher:
|
||||||
|
case WindowType::Taskbar:
|
||||||
|
case WindowType::Tooltip:
|
||||||
|
case WindowType::Menubar:
|
||||||
|
case WindowType::MenuApplet:
|
||||||
|
case WindowType::Notification:
|
||||||
|
return Screen::the().rect();
|
||||||
|
default:
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManager::event(Core::Event& event)
|
void WindowManager::event(Core::Event& event)
|
||||||
{
|
{
|
||||||
if (static_cast<Event&>(event).is_mouse_event()) {
|
if (static_cast<Event&>(event).is_mouse_event()) {
|
||||||
|
|
|
@ -120,6 +120,7 @@ public:
|
||||||
|
|
||||||
Gfx::IntRect menubar_rect() const;
|
Gfx::IntRect menubar_rect() const;
|
||||||
Gfx::IntRect desktop_rect() const;
|
Gfx::IntRect desktop_rect() const;
|
||||||
|
Gfx::IntRect arena_rect_for_type(WindowType) const;
|
||||||
|
|
||||||
const Cursor& active_cursor() const;
|
const Cursor& active_cursor() const;
|
||||||
const Cursor& hidden_cursor() const { return *m_hidden_cursor; }
|
const Cursor& hidden_cursor() const { return *m_hidden_cursor; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue