[Git][wxwidgets/wxwidgets][3.2] 4 commits: Use better name for wxSpinCtrl::SetIncrement() arg in the docs

1 view
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Dec 6, 2025, 12:45:46 PM (10 days ago) Dec 6
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch 3.2 at wxWidgets / wxWidgets

Commits:

  • eec6c4dd
    by Robert Roebling at 2025-12-06T18:16:12+01:00
    Use better name for wxSpinCtrl::SetIncrement() arg in the docs
    
    Call it "inc" instead of "value" because this is what it actually is and
    for consistency with the actual header and SetIncrement() in
    wxSpinCtrlDouble.
    
    See #26002.
    
    (cherry picked from commit 666966acbf09eb382469f93d1e4eb0a6cb0a3d6e)
    
  • 21e076fa
    by Robert Roebling at 2025-12-06T18:17:00+01:00
    Correct wxSpinEvent GetPosition() if start value is non-zero
    
    Set wxSpinButton start value to start value of wxSpinCtrl, otherwise the
    generic control used in OSX would report a wrong value in EVT_SPIN.
    
    See #26002.
    
    (cherry picked from commit 5178043b3e48031bab291d31f2f781fdcb3917eb)
    
  • c1129d0f
    by Vadim Zeitlin at 2025-12-06T18:17:23+01:00
    Don't use border for button part of generic wxSpinCtrl
    
    Limit explicit border to be around text control, not the spin button,
    which looks very wrong.
    
    See #26002.
    
    Co-authored-by: Vadim Zeitlin <va...@wxwidgets.org>
    
    (cherry picked from commit 0b97a4f25eb54ce83e009614e36f85c83feb64da)
    
  • e9dcd4cc
    by Paul Cornett at 2025-12-06T18:35:42+01:00
    Fix deleting wxTextCtrl in wxEVT_TEXT_ENTER handler in wxGTK
    
    Disconnect the signal handler to ensure it doesn't get called during the
    control deletion.
    
    See #26006.
    
    (cherry picked from commit e6318ca7d57807307c30fdbd3b51de378d3554ad)
    

4 changed files:

Changes:

  • docs/changes.txt
    ... ... @@ -296,6 +296,7 @@ wxMSW
    296 296
     wxOSX:
    
    297 297
     
    
    298 298
     - Fix crash on startup when using Farsi as system language (#25561).
    
    299
    +- Fix crash deleting wxTextCtrl from wxEVT_TEXT_ENTER handler (#26006).
    
    299 300
     - Fix showing extra controls in wxFileDialog (jey5nd6, #25717).
    
    300 301
     - Do not activate "Close" button on Cmd-C (nobugshere, #25346).
    
    301 302
     - Fix memory leak in wxColour::Set() (#25569).
    
    ... ... @@ -305,6 +306,8 @@ wxOSX:
    305 306
     - Fix nested markup attributes handling (Václav Slavík, #25864).
    
    306 307
     - Fix possible use of already destroyed wxTimers (Federico Perini, #25871).
    
    307 308
     - Fix handling of multiple filters in wxFileDialog (#25918).
    
    309
    +- Fix value in wxEVT_SPIN with non-0 initial value (Robert Roebling, #26002).
    
    310
    +- Improve appearance of wxSpinCtrl (Robert Roebling, #26002).
    
    308 311
     
    
    309 312
     
    
    310 313
     3.2.8.1: (released 2025-05-25)
    

  • interface/wx/spinctrl.h
    ... ... @@ -238,7 +238,7 @@ public:
    238 238
     
    
    239 239
             @since 3.1.6
    
    240 240
         */
    
    241
    -    void SetIncrement(int value);
    
    241
    +    void SetIncrement(int inc);
    
    242 242
     };
    
    243 243
     
    
    244 244
     /**
    

  • src/generic/spinctlg.cpp
    ... ... @@ -216,8 +216,10 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent,
    216 216
         // don't use borders for this control itself, it wouldn't look good with
    
    217 217
         // the text control borders (but we might want to use style border bits to
    
    218 218
         // select the text control style)
    
    219
    +    const long styleWithoutBorder = (style & ~wxBORDER_MASK) | wxBORDER_NONE;
    
    220
    +
    
    219 221
         if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize,
    
    220
    -                            (style & ~wxBORDER_MASK) | wxBORDER_NONE,
    
    222
    +                            styleWithoutBorder,
    
    221 223
                                 wxDefaultValidator, name) )
    
    222 224
         {
    
    223 225
             return false;
    
    ... ... @@ -243,7 +245,10 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent,
    243 245
         }
    
    244 246
     
    
    245 247
         m_textCtrl   = new wxSpinCtrlTextGeneric(this, DoValueToText(m_value), style);
    
    246
    -    m_spinButton = new wxSpinCtrlButtonGeneric(this, style);
    
    248
    +    m_spinButton = new wxSpinCtrlButtonGeneric(this, styleWithoutBorder);
    
    249
    +
    
    250
    +    // ensure correct start value also if non-zero
    
    251
    +    m_spinButton->SetValue( m_value );
    
    247 252
     
    
    248 253
     #if wxUSE_TOOLTIPS
    
    249 254
         m_textCtrl->SetToolTip(GetToolTipText());
    

  • src/gtk/textentry.cpp
    ... ... @@ -43,6 +43,7 @@ class wxTextCoalesceData
    43 43
     public:
    
    44 44
         wxTextCoalesceData(GtkWidget* widget, gulong handlerAfterKeyPress)
    
    45 45
             : m_handlerAfterKeyPress(handlerAfterKeyPress)
    
    46
    +        , m_widget(widget)
    
    46 47
         {
    
    47 48
             m_inKeyPress = false;
    
    48 49
             m_pendingTextChanged = false;
    
    ... ... @@ -52,12 +53,17 @@ public:
    52 53
             g_signal_handler_block(widget, m_handlerAfterKeyPress);
    
    53 54
         }
    
    54 55
     
    
    55
    -    void StartHandlingKeyPress(GtkWidget* widget)
    
    56
    +    ~wxTextCoalesceData()
    
    57
    +    {
    
    58
    +        g_signal_handler_disconnect(m_widget, m_handlerAfterKeyPress);
    
    59
    +    }
    
    60
    +
    
    61
    +    void StartHandlingKeyPress()
    
    56 62
         {
    
    57 63
             m_inKeyPress = true;
    
    58 64
             m_pendingTextChanged = false;
    
    59 65
     
    
    60
    -        g_signal_handler_unblock(widget, m_handlerAfterKeyPress);
    
    66
    +        g_signal_handler_unblock(m_widget, m_handlerAfterKeyPress);
    
    61 67
         }
    
    62 68
     
    
    63 69
         bool SetPendingIfInKeyPress()
    
    ... ... @@ -70,9 +76,9 @@ public:
    70 76
             return true;
    
    71 77
         }
    
    72 78
     
    
    73
    -    bool EndHandlingKeyPressAndCheckIfPending(GtkWidget* widget)
    
    79
    +    bool EndHandlingKeyPressAndCheckIfPending()
    
    74 80
         {
    
    75
    -        g_signal_handler_block(widget, m_handlerAfterKeyPress);
    
    81
    +        g_signal_handler_block(m_widget, m_handlerAfterKeyPress);
    
    76 82
     
    
    77 83
             wxASSERT( m_inKeyPress );
    
    78 84
             m_inKeyPress = false;
    
    ... ... @@ -89,6 +95,7 @@ private:
    89 95
         bool m_inKeyPress;
    
    90 96
         bool m_pendingTextChanged;
    
    91 97
         const gulong m_handlerAfterKeyPress;
    
    98
    +    GtkWidget* const m_widget;
    
    92 99
     
    
    93 100
         wxDECLARE_NO_COPY_CLASS(wxTextCoalesceData);
    
    94 101
     };
    
    ... ... @@ -120,14 +127,14 @@ extern "C" {
    120 127
     // to send a single wxEVT_TEXT even if we received several (typically two, when
    
    121 128
     // the selected text in the control is replaced by new text) "changed" signals.
    
    122 129
     static gboolean
    
    123
    -wx_gtk_text_after_key_press(GtkWidget* widget,
    
    130
    +wx_gtk_text_after_key_press(GtkWidget*,
    
    124 131
                                 GdkEventKey* WXUNUSED(gdk_event),
    
    125 132
                                 wxTextEntry* entry)
    
    126 133
     {
    
    127 134
         wxTextCoalesceData* const data = entry->GTKGetCoalesceData();
    
    128 135
         wxCHECK_MSG( data, FALSE, "must be non-null if this handler is called" );
    
    129 136
     
    
    130
    -    if ( data->EndHandlingKeyPressAndCheckIfPending(widget) )
    
    137
    +    if ( data->EndHandlingKeyPressAndCheckIfPending() )
    
    131 138
         {
    
    132 139
             entry->GTKOnTextChanged();
    
    133 140
         }
    
    ... ... @@ -981,7 +988,7 @@ void wxTextEntry::GTKEntryOnKeypress(GtkWidget* widget) const
    981 988
             m_coalesceData = new wxTextCoalesceData(widget, handler);
    
    982 989
         }
    
    983 990
     
    
    984
    -    m_coalesceData->StartHandlingKeyPress(widget);
    
    991
    +    m_coalesceData->StartHandlingKeyPress();
    
    985 992
     }
    
    986 993
     
    
    987 994
     int wxTextEntry::GTKEntryIMFilterKeypress(GdkEventKey* event) const
    

Reply all
Reply to author
Forward
0 new messages