From 9f9bb66d185f87b3bd65dbcd307ed300558a435f Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 23 Apr 2020 08:55:46 -0700 Subject: [PATCH] Fix for GTK2 wxSpinCtrl SetIncrement() not immediately updating increment See #18735 --- src/gtk/spinctrl.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index 150a6284ec..ebc501113b 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -284,11 +284,10 @@ void wxSpinCtrlGTKBase::DoSetIncrement(double inc) wxSpinCtrlEventDisabler disable(this); - // Preserve the old page value when changing just the increment. - double page = 10*inc; - gtk_spin_button_get_increments( GTK_SPIN_BUTTON(m_widget), NULL, &page); - - gtk_spin_button_set_increments( GTK_SPIN_BUTTON(m_widget), inc, page); + // With GTK2, gtk_spin_button_set_increments() does not emit the GtkAdjustment + // "changed" signal, which is needed to properly update the state of the control + GtkAdjustment* adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(m_widget)); + gtk_adjustment_set_step_increment(adj, inc); } void wxSpinCtrlGTKBase::GtkDisableEvents()