mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
WindowServer: don't send resize on resolution change unless needed
fixes #2575 The extra ResizeEvent would be handled after on_rect_change, and would reset the size of main_widget to what it was before the resize. Bonus: Less unnecessary events.
This commit is contained in:
parent
951a429268
commit
f833362536
Notes:
sideshowbarker
2024-07-19 05:19:41 +09:00
Author: https://github.com/petelliott Commit: https://github.com/SerenityOS/serenity/commit/f833362536d Pull-request: https://github.com/SerenityOS/serenity/pull/2655 Issue: https://github.com/SerenityOS/serenity/issues/2575
2 changed files with 12 additions and 5 deletions
|
@ -520,11 +520,20 @@ void Window::recalculate_rect()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto old_rect = m_rect;
|
auto old_rect = m_rect;
|
||||||
if (m_tiled != WindowTileType::None)
|
bool send_event = true;
|
||||||
|
if (m_tiled != WindowTileType::None) {
|
||||||
set_rect(tiled_rect(m_tiled));
|
set_rect(tiled_rect(m_tiled));
|
||||||
else if (is_maximized())
|
} else if (is_maximized()) {
|
||||||
set_rect(WindowManager::the().maximized_window_rect(*this));
|
set_rect(WindowManager::the().maximized_window_rect(*this));
|
||||||
|
} else if (type() == WindowType::Desktop) {
|
||||||
|
set_rect(WindowManager::the().desktop_rect());
|
||||||
|
} else {
|
||||||
|
send_event = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (send_event) {
|
||||||
Core::EventLoop::current().post_event(*this, make<ResizeEvent>(old_rect, m_rect));
|
Core::EventLoop::current().post_event(*this, make<ResizeEvent>(old_rect, m_rect));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::add_child_window(Window& child_window)
|
void Window::add_child_window(Window& child_window)
|
||||||
|
|
|
@ -142,8 +142,6 @@ bool WindowManager::set_resolution(int width, int height)
|
||||||
});
|
});
|
||||||
if (success) {
|
if (success) {
|
||||||
for_each_window([](Window& window) {
|
for_each_window([](Window& window) {
|
||||||
if (window.type() == WindowType::Desktop)
|
|
||||||
window.set_rect(WindowManager::the().desktop_rect());
|
|
||||||
window.recalculate_rect();
|
window.recalculate_rect();
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue