Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LedDialog: fix buggy effect duration slider #980

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

ptosi
Copy link

@ptosi ptosi commented Aug 22, 2024

Get the step increment from the Gtk.Adjustment instead of relying on a magic number (500), which was wrong to begin with (actual value is 100).

Round the received float value to the nearest multiple of the step increment, instead of rounding it down.

This fixes control of the slider through the arrow keys and improves the accuracy of the "step snapping" when clicking the slider.

As a result, the UI now allows the user to pass values with a step (100) instead of page (500) resolution to libratbag but that shouldn't be an issue as drivers are expected to support any integer value within the range 0-10000; see ratbag_led_set_effect_duration().

Get the step increment from the Gtk.Adjustment instead of relying on a
magic number (500), which was wrong to begin with (actual value is 100).

Round the received float value to the nearest multiple of the step
increment, instead of rounding it down.

This fixes control of the slider through the arrow keys and improves the
accuracy of the "step snapping" when clicking the slider.

As a result, the UI now allows the user to pass values with a step (100)
instead of page (500) resolution to libratbag but that shouldn't be an
issue as drivers are expected to support any integer value within the
range 0-10000; see ratbag_led_set_effect_duration().
Copy link
Member

@staticssleever668 staticssleever668 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Tested and it's working nice.

As a note, the step increment seems to be defined here:

<object class="GtkAdjustment" id="adjustment_effect_duration">
<property name="upper">10000</property>
<property name="step-increment">100</property>
<property name="page-increment">500</property>
</object>

@staticssleever668 staticssleever668 merged commit 8e12afb into libratbag:master Aug 22, 2024
5 checks passed
@ptosi ptosi deleted the fix-led-dialog branch August 23, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants