[gnome-control-center] power: Stop the brightness slider from jumping
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] power: Stop the brightness slider from jumping
- Date: Thu, 31 Oct 2019 20:10:14 +0000 (UTC)
commit 3a1d6295cd512c9c481e466ab4f209e6a70c4319
Author: Diego Escalante Urrelo <diegoe gnome org>
Date: Mon Oct 21 02:29:15 2019 -0500
power: Stop the brightness slider from jumping
The GtkScale widget for screen brightness has a tendency to jump around
because GtkRange defaults to NOT rounding values (round_digits = -1).
This means that the widget is constantly set with values that have
decimals (say 10.3) which it then tries to correct to fit the step size.
The solution for this particular UI quirk is to make sure to set
round-digits to 0, as that will force GtkRange to provide GtkScale with
rounded-down numbers. See gtkrange.c.
Fixes: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/405
panels/power/cc-power-panel.c | 1 +
1 file changed, 1 insertion(+)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index 1cc689f27..f65a80730 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -1767,6 +1767,7 @@ add_brightness_row (CcPowerPanel *self,
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
gtk_size_group_add_widget (self->level_sizegroup, scale);
+ gtk_range_set_round_digits (GTK_RANGE (scale), 0);
g_signal_connect (scale, "value-changed",
G_CALLBACK (brightness_slider_value_changed_cb), self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]