From c2f62a03ff25fdaebabd054ee69800bf3885ee97 Mon Sep 17 00:00:00 2001 From: Joe Bentley Date: Tue, 24 Aug 2021 13:03:42 +0100 Subject: [PATCH] AudioApplet: Fix applet positioning bug Currently when clicking the percentage toggle, there is a delay in moving the applet window position. This is because after the applet is resized, the applet area is repositioned asynchronously. This takes advantage of the new AppletAreaRectChange event to reposition the slider window when necessary. --- Userland/Applets/Audio/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp index 0a86f2afd5..295a72253f 100644 --- a/Userland/Applets/Audio/main.cpp +++ b/Userland/Applets/Audio/main.cpp @@ -81,7 +81,6 @@ public: window()->resize(44, 16); m_percent_box->set_tooltip("Hide percent"); } - reposition_slider_window(); GUI::Application::the()->hide_tooltip(); Config::write_bool("AudioApplet", "Applet", "ShowPercent", m_show_percent); @@ -152,6 +151,11 @@ private: } } + virtual void applet_area_rect_change_event(GUI::AppletAreaRectChangeEvent&) override + { + reposition_slider_window(); + } + void open() { reposition_slider_window();