Skip to content

adjustment: Update the value with the boundaries

Adrien Plazas requested to merge aplazas/gtk:adjustment-boundaries into main

This updates an adjustment's value when updating its boundaries, to help ensure the value remains within them. The reasoning is that there are three components in gtk_adjustment_sanitize_value(), the value, the lower bound, and the upper bound, but we currently only call it when the value changes and not any of these three components, and IMO we should.

This fixes the issue where a new GtkSpinButton is created with a new GtkAdjustment with a lower value greater than 0, leading to the value being out of bounds. It also fixes when the spin button's value is then incorrectly set to 0, making it not update the adjustment's out-of-bounds value as it didn't change. These are issues I encountered while developing and I had to work around (no big deal, but let's fix it at the source).

Signed-off-by: Adrien Plazas aplazas@gnome.org

Merge request reports

Loading