diff --git a/Libraries/LibGUI/Event.h b/Libraries/LibGUI/Event.h index a36e081017..ca906a5783 100644 --- a/Libraries/LibGUI/Event.h +++ b/Libraries/LibGUI/Event.h @@ -221,18 +221,15 @@ private: class ResizeEvent final : public Event { public: - explicit ResizeEvent(const Gfx::IntSize& old_size, const Gfx::IntSize& size) + explicit ResizeEvent(const Gfx::IntSize& size) : Event(Event::Resize) - , m_old_size(old_size) , m_size(size) { } - const Gfx::IntSize& old_size() const { return m_old_size; } const Gfx::IntSize& size() const { return m_size; } private: - Gfx::IntSize m_old_size; Gfx::IntSize m_size; }; diff --git a/Libraries/LibGUI/Widget.cpp b/Libraries/LibGUI/Widget.cpp index 4dd69b9b79..7da18926c6 100644 --- a/Libraries/LibGUI/Widget.cpp +++ b/Libraries/LibGUI/Widget.cpp @@ -151,7 +151,7 @@ void Widget::set_relative_rect(const Gfx::IntRect& a_rect) m_relative_rect = rect; if (size_changed) { - ResizeEvent resize_event(m_relative_rect.size(), rect.size()); + ResizeEvent resize_event(rect.size()); event(resize_event); } diff --git a/Libraries/LibGUI/WindowServerConnection.cpp b/Libraries/LibGUI/WindowServerConnection.cpp index 231760798f..8f846e7a46 100644 --- a/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Libraries/LibGUI/WindowServerConnection.cpp @@ -90,7 +90,7 @@ void WindowServerConnection::handle(const Messages::WindowClient::Paint& message void WindowServerConnection::handle(const Messages::WindowClient::WindowResized& message) { if (auto* window = Window::from_window_id(message.window_id())) { - Core::EventLoop::current().post_event(*window, make(message.old_rect().size(), message.new_rect().size())); + Core::EventLoop::current().post_event(*window, make(message.new_rect().size())); } } diff --git a/Services/WindowServer/Event.h b/Services/WindowServer/Event.h index 550c8275e9..ed9fbf2524 100644 --- a/Services/WindowServer/Event.h +++ b/Services/WindowServer/Event.h @@ -56,12 +56,12 @@ public: WindowResized, }; - Event() {} + Event() { } explicit Event(Type type) : Core::Event(type) { } - virtual ~Event() {} + virtual ~Event() { } bool is_mouse_event() const { return type() == MouseMove || type() == MouseDown || type() == MouseDoubleClick || type() == MouseUp || type() == MouseWheel; } bool is_key_event() const { return type() == KeyUp || type() == KeyDown; } @@ -144,18 +144,15 @@ private: class ResizeEvent final : public Event { public: - ResizeEvent(const Gfx::IntRect& old_rect, const Gfx::IntRect& rect) + ResizeEvent(const Gfx::IntRect& rect) : Event(Event::WindowResized) - , m_old_rect(old_rect) , m_rect(rect) { } - Gfx::IntRect old_rect() const { return m_old_rect; } Gfx::IntRect rect() const { return m_rect; } private: - Gfx::IntRect m_old_rect; Gfx::IntRect m_rect; }; diff --git a/Services/WindowServer/Window.cpp b/Services/WindowServer/Window.cpp index ab785e3162..f089b10a75 100644 --- a/Services/WindowServer/Window.cpp +++ b/Services/WindowServer/Window.cpp @@ -302,7 +302,6 @@ void Window::set_maximized(bool maximized) set_tiled(WindowTileType::None); m_maximized = maximized; update_menu_item_text(PopupMenuItem::Maximize); - auto old_rect = m_rect; if (maximized) { m_unmaximized_rect = m_rect; set_rect(WindowManager::the().maximized_window_rect(*this)); @@ -310,7 +309,7 @@ void Window::set_maximized(bool maximized) set_rect(m_unmaximized_rect); } m_frame.did_set_maximized({}, maximized); - Core::EventLoop::current().post_event(*this, make(old_rect, m_rect)); + Core::EventLoop::current().post_event(*this, make(m_rect)); set_default_positioned(false); } @@ -376,11 +375,7 @@ void Window::event(Core::Event& event) m_client->post_message(Messages::WindowClient::WindowCloseRequest(m_window_id)); break; case Event::WindowResized: - m_client->post_message( - Messages::WindowClient::WindowResized( - m_window_id, - static_cast(event).old_rect(), - static_cast(event).rect())); + m_client->post_message(Messages::WindowClient::WindowResized(m_window_id, static_cast(event).rect())); break; default: break; @@ -400,9 +395,9 @@ void Window::set_visible(bool b) Compositor::the().invalidate_occlusions(); if (m_visible) - invalidate(true); + invalidate(true); else - Compositor::the().invalidate_screen(frame().rect()); + Compositor::the().invalidate_screen(frame().rect()); } void Window::invalidate(bool invalidate_frame) @@ -472,7 +467,7 @@ Window* Window::is_blocked_by_modal_window() { // A window is blocked if any immediate child, or any child further // down the chain is modal - for (auto& window: m_child_windows) { + for (auto& window : m_child_windows) { if (window && !window->is_destroyed()) { if (window->is_modal()) return window; @@ -591,7 +586,7 @@ void Window::set_fullscreen(bool fullscreen) new_window_rect = m_saved_nonfullscreen_rect; } - Core::EventLoop::current().post_event(*this, make(m_rect, new_window_rect)); + Core::EventLoop::current().post_event(*this, make(new_window_rect)); set_rect(new_window_rect); } @@ -622,11 +617,10 @@ void Window::set_tiled(WindowTileType tiled) return; m_tiled = tiled; - auto old_rect = m_rect; if (tiled != WindowTileType::None) m_untiled_rect = m_rect; set_rect(tiled_rect(tiled)); - Core::EventLoop::current().post_event(*this, make(old_rect, m_rect)); + Core::EventLoop::current().post_event(*this, make(m_rect)); } void Window::detach_client(Badge) @@ -639,7 +633,6 @@ void Window::recalculate_rect() if (!is_resizable()) return; - auto old_rect = m_rect; bool send_event = true; if (m_tiled != WindowTileType::None) { set_rect(tiled_rect(m_tiled)); @@ -652,7 +645,7 @@ void Window::recalculate_rect() } if (send_event) { - Core::EventLoop::current().post_event(*this, make(old_rect, m_rect)); + Core::EventLoop::current().post_event(*this, make(m_rect)); } } diff --git a/Services/WindowServer/WindowClient.ipc b/Services/WindowServer/WindowClient.ipc index 0c5056db53..da28bac7ca 100644 --- a/Services/WindowServer/WindowClient.ipc +++ b/Services/WindowServer/WindowClient.ipc @@ -16,7 +16,7 @@ endpoint WindowClient = 4 WindowDeactivated(i32 window_id) =| WindowStateChanged(i32 window_id, bool minimized, bool occluded) =| WindowCloseRequest(i32 window_id) =| - WindowResized(i32 window_id, Gfx::IntRect old_rect, Gfx::IntRect new_rect) =| + WindowResized(i32 window_id, Gfx::IntRect new_rect) =| MenuItemActivated(i32 menu_id, i32 identifier) =| diff --git a/Services/WindowServer/WindowManager.cpp b/Services/WindowServer/WindowManager.cpp index 32ab9583fe..2d860dea60 100644 --- a/Services/WindowServer/WindowManager.cpp +++ b/Services/WindowServer/WindowManager.cpp @@ -179,7 +179,7 @@ void WindowManager::add_window(Window& window) m_windows_in_order.append(&window); if (window.is_fullscreen()) { - Core::EventLoop::current().post_event(window, make(window.rect(), Screen::the().rect())); + Core::EventLoop::current().post_event(window, make(Screen::the().rect())); window.set_rect(Screen::the().rect()); } @@ -577,7 +577,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo #ifdef RESIZE_DEBUG dbg() << "[WM] Finish resizing Window{" << m_resize_window << "}"; #endif - Core::EventLoop::current().post_event(*m_resize_window, make(m_resize_window->rect(), m_resize_window->rect())); + Core::EventLoop::current().post_event(*m_resize_window, make(m_resize_window->rect())); m_resize_window->invalidate(); if (m_resize_window->rect().contains(event.position())) hovered_window = m_resize_window; @@ -589,8 +589,6 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo if (event.type() != Event::MouseMove) return false; - auto old_rect = m_resize_window->rect(); - int diff_x = event.x() - m_resize_origin.x(); int diff_y = event.y() - m_resize_origin.y(); @@ -679,7 +677,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo dbg() << "[WM] Resizing, original: " << m_resize_window_original_rect << ", now: " << new_rect; #endif m_resize_window->set_rect(new_rect); - Core::EventLoop::current().post_event(*m_resize_window, make(old_rect, new_rect)); + Core::EventLoop::current().post_event(*m_resize_window, make(new_rect)); return true; }