vcl/unx/gtk3/gtkinst.cxx |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 20f11f328df152c3c7faf4f89f3dea206f45892d
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Feb 14 14:01:40 2026 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat Feb 14 17:14:16 2026 +0100

    tdf#168434 skip gtk_spin_button_update when blanking
    
    We are trying to basically emulate the behaviour of the default
    m_bEnableEmptyField as true of vcl's Formatter.
    
    The misunderstanding was that setting blank would produce
    a 0 value, but show a blank, it should retain its pre-blank
    value.
    
    So the the later get_value() == 0 doesn't make sense and didn't take
    minimum into account anyway. We can rely on set_floating_point_value
    unsetting the blanking.
    
    Double checked that tdf#122786 didn't return as a problem.
    
    Change-Id: I5c44eaf60e309a229a0233482bcbfa5972f47264
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199377
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 35e6624bd66f..4037b6986831 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -17052,22 +17052,25 @@ public:
             gtk_entry_set_text(GTK_ENTRY(m_pButton), OUStringToOString(rText, 
RTL_TEXTENCODING_UTF8).getStr());
 #endif
 
-            m_bBlockOutput = true;
-            gtk_spin_button_update(m_pButton);
+            // tdf#168434 skip gtk_spin_button_update when blanking, otherwise
+            // GTK parses the empty text and clamps the value to the minimum
             m_bBlank = rText.isEmpty();
-            m_bBlockOutput = false;
+            if (!m_bBlank)
+            {
+                m_bBlockOutput = true;
+                gtk_spin_button_update(m_pButton);
+                m_bBlockOutput = false;
+            }
         }
         else
         {
-            bool bKeepBlank = m_bBlank && get_value() == 0;
-            if (!bKeepBlank)
+            if (!m_bBlank)
             {
 #if GTK_CHECK_VERSION(4, 0, 0)
                 gtk_editable_set_text(m_pEditable, OUStringToOString(rText, 
RTL_TEXTENCODING_UTF8).getStr());
 #else
                 gtk_entry_set_text(GTK_ENTRY(m_pButton), 
OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr());
 #endif
-                m_bBlank = false;
             }
         }
         enable_notify_events();

Reply via email to