GNOME Bugzilla – Bug 173116
GtkSpinButton locks up with small increments, supports fewer digits than claimed in docs
Last modified: 2018-05-02 14:08:17 UTC
According to the doc gtk_spin_button_set_digits supports up to 20 digits. Try to use 10 digits, with range from 0 to 0.0000000100, increment of 0.0000000001 and the widget stopped working properly. As far as my testing goes the widget worked all right up to 9 digits. working code: spinner_adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0, 1e-7, 1e-9, 1e-8, 0.0); spinner = gtk_spin_button_new (spinner_adj, 1.0, 9); Bug code: spinner_adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0, 1e-8, 1e-10, 1e-9, 0.0); spinner = gtk_spin_button_new (spinner_adj, 1.0, 10); By stop working properly I mean: Buttons arrow up and arrow down don't work, key arrow up and arrow down don't work.
#include <gtk/gtk.h> int main (int argc, char **argv) { gtk_init (&argc, &argv); GtkAdjustment *spinner_adj = (GtkAdjustment *) gtk_adjustment_new (0, 0.000000000, 1, 0.0000000001, 0.000000001, 0); GtkWidget *spinner = gtk_spin_button_new (spinner_adj, 1.0, 10); GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_add ((GtkContainer *)window, spinner); gtk_widget_show_all (window); gtk_main (); } That fails. However, change the final digit of the adjustment min argument (2nd position) to a 1, and now things work properly. Something must be going wrong with a calculation involving the lower limit. possibly related to https://bugzilla.gnome.org/show_bug.cgi?id=748392
Hm, true enough, smaller increments (larger number of digits) tend to fail at all times, without depending on the lower value. This appears to be the case in GTK+ 3, too.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/245.