Skip to content

Commit

Permalink
T830-003: Disable scrolling event for Spin button preferences
Browse files Browse the repository at this point in the history
In some case, the user will scroll the list of pref and unwantedly
change a Spin button value => there is no feedback and this is
troublesome to debug/detect.
This patch prevents such cases.

Change-Id: I906ad9c4cd9ef0c18a38eb2aa98d1dc05ae0d7ea
  • Loading branch information
AdrienBoulanger committed Sep 1, 2020
1 parent 649fef9 commit 5de1081
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/src/default_preferences.adb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ with XML_Utils; use XML_Utils;
with Default_Preferences.GUI; use Default_Preferences.GUI;
with Dialog_Utils;

with Gdk.Event; use Gdk.Event;
with Gtk.Adjustment; use Gtk.Adjustment;
with Gtk.Box; use Gtk.Box;
with Gtk.Button; use Gtk.Button;
Expand Down Expand Up @@ -2160,6 +2161,8 @@ package body Default_Preferences is
Page_Increment => 10.0);
Gtk_New (Spin, Adj, 1.0, The_Digits => 0);
Spin.Set_Editable (True);
-- Disable the incrementation by scrolling
Spin.Set_Events (Spin.Get_Events and not Scroll_Mask);

Preference_Handlers.Connect
(Adj, Gtk.Adjustment.Signal_Value_Changed, Gint_Changed'Access, P);
Expand Down
4 changes: 4 additions & 0 deletions widgets/src/switches_chooser-gtkada.adb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
------------------------------------------------------------------------------

with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Gdk.Event; use Gdk.Event;
with Glib; use Glib;
with Glib.Object; use Glib.Object;
with Gtk.Adjustment; use Gtk.Adjustment;
Expand Down Expand Up @@ -533,6 +534,9 @@ package body Switches_Chooser.Gtkada is
Set_Tooltip (Editor, Spin, Switch, S);
Pack_Start (Hbox, Spin, True, True, 0);

-- Disable the incrementation by scrolling
Spin.Set_Events (Spin.Get_Events and not Scroll_Mask);

User_Widget_Callback.Connect
(Spin, Gtk.Spin_Button.Signal_Value_Changed,
On_Spin_Changed'Access,
Expand Down

0 comments on commit 5de1081

Please sign in to comment.