After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 173116 - GtkSpinButton locks up with small increments, supports fewer digits than claimed in docs
GtkSpinButton locks up with small increments, supports fewer digits than clai...
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkSpinButton
3.22.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-04-08 20:43 UTC by Felipe Heidrich
Modified: 2018-05-02 14:08 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Felipe Heidrich 2005-04-08 20:43:40 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.
Comment 1 Daniel Boles 2017-08-29 22:48:56 UTC
#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
Comment 2 Daniel Boles 2017-08-29 22:57:25 UTC
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.
Comment 3 GNOME Infrastructure Team 2018-05-02 14:08:17 UTC
-- 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.