1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:07:45 +00:00

LibGUI+LibGfx: Let Desktop::the() set widget effects

Scrolling can now be set Coarse or Smooth system-wide, Splitter
knurls and Tab accents toggled on and off, and Menu flashing
disabled.
This commit is contained in:
thankyouverycool 2022-08-07 20:08:16 -04:00 committed by Andreas Kling
parent 1d445356b6
commit 5917545633
8 changed files with 28 additions and 19 deletions

View file

@ -6,6 +6,7 @@
*/
#include <LibCore/Timer.h>
#include <LibGUI/Desktop.h>
#include <LibGUI/Painter.h>
#include <LibGUI/Scrollbar.h>
#include <LibGfx/CharacterBitmap.h>
@ -98,15 +99,15 @@ void Scrollbar::set_value(int value, AllowCallback allow_callback, DoClamp do_cl
void Scrollbar::set_target_value(int new_target_value)
{
if (m_scroll_animation == Animation::CoarseScroll)
return set_value(new_target_value);
new_target_value = clamp(new_target_value, min(), max());
// If we are already at or scrolling to the new target then don't touch anything
if (m_target_value == new_target_value)
return;
if (m_scroll_animation == Animation::CoarseScroll || !Desktop::the().system_effects().smooth_scrolling())
return set_value(new_target_value);
m_animation_time_elapsed = 0;
m_start_value = value();
m_target_value = new_target_value;