From 619c924042d5e9b466467b40dbdc2952d37d8519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Fri, 30 Jul 2021 12:42:58 +0200 Subject: [PATCH] AudioWidget: Proper volume changes when scrolling on the widget Because setting the slider's value in the mousewheel handler will cause the volume logarithm logic and the volume setting to happen anyways, we don't need to do it in the mousewheel handler again. By just moving the slider up and down with the scroll wheel, we mimic normal SliderWidget behavior that doesn't exhibit the multiple previous bugs. --- Userland/Applets/Audio/main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp index 110fef0dbf..bbe16a3593 100644 --- a/Userland/Applets/Audio/main.cpp +++ b/Userland/Applets/Audio/main.cpp @@ -123,10 +123,8 @@ private: { if (m_audio_muted) return; - int volume = clamp(m_audio_volume - event.wheel_delta() * 5, 0, 100); - float volume_log = ((volume / 100.0f) * (volume / 100.0f)) * 100.0f; - m_audio_client->set_main_mix_volume(volume_log); - m_slider->set_value(20 - (volume / 5)); + int new_slider_value = m_slider->value() + event.wheel_delta() / 4; + m_slider->set_value(new_slider_value); update(); }