mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
Everywhere: Replace uses of GUI::Desktop's on_rect_change and remove it
This commit is contained in:
parent
5367bbb82c
commit
96b26ec125
7 changed files with 16 additions and 16 deletions
|
@ -39,14 +39,14 @@ namespace NotificationServer {
|
|||
|
||||
static HashMap<u32, RefPtr<NotificationWindow>> s_windows;
|
||||
|
||||
void update_notification_window_locations()
|
||||
static void update_notification_window_locations(const Gfx::IntRect& screen_rect)
|
||||
{
|
||||
Gfx::IntRect last_window_rect;
|
||||
for (auto& window_entry : s_windows) {
|
||||
auto& window = window_entry.value;
|
||||
Gfx::IntPoint new_window_location;
|
||||
if (last_window_rect.is_null())
|
||||
new_window_location = GUI::Desktop::the().rect().top_right().translated(-window->rect().width() - 24, 26);
|
||||
new_window_location = screen_rect.top_right().translated(-window->rect().width() - 24, 26);
|
||||
else
|
||||
new_window_location = last_window_rect.bottom_left().translated(0, 10);
|
||||
if (window->rect().location() != new_window_location) {
|
||||
|
@ -117,7 +117,7 @@ NotificationWindow::NotificationWindow(i32 client_id, const String& text, const
|
|||
|
||||
on_close = [this] {
|
||||
s_windows.remove(m_id);
|
||||
update_notification_window_locations();
|
||||
update_notification_window_locations(GUI::Desktop::the().rect());
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -149,4 +149,9 @@ void NotificationWindow::set_image(const Gfx::ShareableBitmap& image)
|
|||
}
|
||||
}
|
||||
|
||||
void NotificationWindow::screen_rect_change_event(GUI::ScreenRectChangeEvent& event)
|
||||
{
|
||||
update_notification_window_locations(event.rect());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue