[Git][wxwidgets/wxwidgets][3.2] 3 commits: Use Scintilla as win32 classname for wxStyledTextCtrl

2 views
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Nov 9, 2025, 11:48:03 AMNov 9
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch 3.2 at wxWidgets / wxWidgets

Commits:

  • 11d7b6fb
    by Maarten Bent at 2025-11-09T12:33:46+01:00
    Use Scintilla as win32 classname for wxStyledTextCtrl
    
    This way applications like screen readers know how to interface with it.
    
  • a5973f19
    by Maarten Bent at 2025-11-09T12:44:26+01:00
    Forward all win32 messages to the Scintilla control
    
    And if they are not processed, continue with the normal message handler.
    
  • d921cac9
    by Vadim Zeitlin at 2025-11-09T17:24:43+01:00
    Merge branch 'scintilla-screenreader-3.2' of github.com:MaartenBent/wxWidgets into 3.2
    
    Improve wxStyledTextCtrl compatibility with screen readers (3.2).
    
    See #18683, #25956, #25963.
    

4 changed files:

Changes:

  • docs/changes.txt
    ... ... @@ -285,6 +285,7 @@ wxMSW
    285 285
     - Fix using wxNO_IMPLICIT_WXSTRING_ENCODING with PCH (#25568).
    
    286 286
     - Fix crash when copying wxBitmaps if GDI resources are exhausted (#24703).
    
    287 287
     - Fix MSVS debug visualizer for wxString (#25684).
    
    288
    +- Fix wxStyledTextCtrl support in screen readers (Maarten Bent, #25963).
    
    288 289
     - Fix TAB behaviour in a panel with notebook as only active child (#25443).
    
    289 290
     - Reduce GDI resource usage in wxStaticBitmap (Alex Shvartzkop, #25698).
    
    290 291
     
    

  • src/stc/ScintillaWX.cpp
    ... ... @@ -752,8 +752,15 @@ void ScintillaWX::FineTickerCancel(TickReason reason) {
    752 752
     //----------------------------------------------------------------------
    
    753 753
     
    
    754 754
     
    
    755
    -sptr_t ScintillaWX::DefWndProc(unsigned int /*iMessage*/, uptr_t /*wParam*/, sptr_t /*lParam*/) {
    
    755
    +sptr_t ScintillaWX::DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
    
    756
    +#ifdef __WXMSW__
    
    757
    +    return stc->wxControl::MSWWindowProc(iMessage, wParam, lParam);
    
    758
    +#else
    
    759
    +    wxUnusedVar(iMessage);
    
    760
    +    wxUnusedVar(wParam);
    
    761
    +    wxUnusedVar(lParam);
    
    756 762
         return 0;
    
    763
    +#endif
    
    757 764
     }
    
    758 765
     
    
    759 766
     sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
    
    ... ... @@ -829,13 +836,13 @@ sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam)
    829 836
                         InvalidateStyleRedraw();
    
    830 837
                     }
    
    831 838
                 }
    
    832
    -            break;
    
    839
    +            return 0;
    
    833 840
     #endif
    
    834 841
     
    
    835 842
     #ifdef SCI_LEXER
    
    836 843
           case SCI_LOADLEXERLIBRARY:
    
    837 844
                 LexerManager::GetInstance()->Load((const char*)lParam);
    
    838
    -            break;
    
    845
    +            return 0;
    
    839 846
     #endif
    
    840 847
           case SCI_GETDIRECTFUNCTION:
    
    841 848
                 return reinterpret_cast<sptr_t>(DirectFunction);
    
    ... ... @@ -848,24 +855,25 @@ sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam)
    848 855
           case WM_IME_STARTCOMPOSITION:
    
    849 856
               // Always use windowed IME in ScintillaWX for now. Inline IME not implemented yet
    
    850 857
               ImeStartComposition();
    
    851
    -          return stc->wxControl::MSWWindowProc(iMessage, wParam, lParam);
    
    858
    +          break;
    
    852 859
     
    
    853 860
           case WM_IME_ENDCOMPOSITION:
    
    854 861
               ImeEndComposition();
    
    855
    -          return stc->wxControl::MSWWindowProc(iMessage, wParam, lParam);
    
    862
    +          break;
    
    856 863
     
    
    857 864
           case WM_IME_KEYDOWN:
    
    858 865
           case WM_IME_REQUEST:
    
    859 866
           case WM_IME_COMPOSITION:
    
    860 867
           case WM_IME_SETCONTEXT:
    
    861 868
               // These events are forwarded here for future inline IME implementation
    
    862
    -          return stc->wxControl::MSWWindowProc(iMessage, wParam, lParam);
    
    869
    +          break;
    
    863 870
     #endif
    
    864 871
     
    
    865 872
           default:
    
    866
    -          return ScintillaBase::WndProc(iMessage, wParam, lParam);
    
    873
    +          break;
    
    867 874
           }
    
    868
    -      return 0;
    
    875
    +
    
    876
    +    return ScintillaBase::WndProc(iMessage, wParam, lParam);
    
    869 877
     }
    
    870 878
     
    
    871 879
     
    

  • src/stc/stc.cpp
    ... ... @@ -195,10 +195,22 @@ bool wxStyledTextCtrl::Create(wxWindow *parent,
    195 195
                                   long style,
    
    196 196
                                   const wxString& name)
    
    197 197
     {
    
    198
    -    style |= wxVSCROLL | wxHSCROLL;
    
    199
    -    if (!wxControl::Create(parent, id, pos, size,
    
    200
    -                           style | wxWANTS_CHARS | wxCLIP_CHILDREN,
    
    201
    -                           wxDefaultValidator, name))
    
    198
    +    style |= wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN;
    
    199
    +
    
    200
    +    // We want to use a specific class name for this window in wxMSW to make it
    
    201
    +    // possible to configure screen readers to handle it specifically.
    
    202
    +    bool created =
    
    203
    +#ifdef __WXMSW__
    
    204
    +        CreateUsingMSWClass(
    
    205
    +            wxApp::GetRegisteredClassName(wxT("Scintilla")),
    
    206
    +            parent, id, pos, size, style, name
    
    207
    +        );
    
    208
    +#else
    
    209
    +        wxControl::Create(
    
    210
    +            parent, id, pos, size, style, wxDefaultValidator, name
    
    211
    +        );
    
    212
    +#endif
    
    213
    +    if ( !created )
    
    202 214
             return false;
    
    203 215
     
    
    204 216
     #ifdef LINK_LEXERS
    
    ... ... @@ -5678,18 +5690,10 @@ WXLRESULT wxStyledTextCtrl::MSWWindowProc(WXUINT nMsg,
    5678 5690
         WXWPARAM wParam,
    
    5679 5691
         WXLPARAM lParam)
    
    5680 5692
     {
    
    5681
    -    switch(nMsg) {
    
    5682
    -    // Forward IME messages to ScintillaWX
    
    5683
    -    case WM_IME_KEYDOWN:
    
    5684
    -    case WM_IME_REQUEST:
    
    5685
    -    case WM_IME_STARTCOMPOSITION:
    
    5686
    -    case WM_IME_ENDCOMPOSITION:
    
    5687
    -    case WM_IME_COMPOSITION:
    
    5688
    -    case WM_IME_SETCONTEXT:
    
    5693
    +    if ( m_swx )
    
    5689 5694
             return SendMsg(nMsg, wParam, lParam);
    
    5690
    -    default:
    
    5695
    +    else
    
    5691 5696
             return wxControl::MSWWindowProc(nMsg, wParam, lParam);
    
    5692
    -    }
    
    5693 5697
     }
    
    5694 5698
     #endif
    
    5695 5699
     
    

  • src/stc/stc.cpp.in
    ... ... @@ -195,10 +195,22 @@ bool wxStyledTextCtrl::Create(wxWindow *parent,
    195 195
                                   long style,
    
    196 196
                                   const wxString& name)
    
    197 197
     {
    
    198
    -    style |= wxVSCROLL | wxHSCROLL;
    
    199
    -    if (!wxControl::Create(parent, id, pos, size,
    
    200
    -                           style | wxWANTS_CHARS | wxCLIP_CHILDREN,
    
    201
    -                           wxDefaultValidator, name))
    
    198
    +    style |= wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN;
    
    199
    +
    
    200
    +    // We want to use a specific class name for this window in wxMSW to make it
    
    201
    +    // possible to configure screen readers to handle it specifically.
    
    202
    +    bool created =
    
    203
    +#ifdef __WXMSW__
    
    204
    +        CreateUsingMSWClass(
    
    205
    +            wxApp::GetRegisteredClassName(wxT("Scintilla")),
    
    206
    +            parent, id, pos, size, style, name
    
    207
    +        );
    
    208
    +#else
    
    209
    +        wxControl::Create(
    
    210
    +            parent, id, pos, size, style, wxDefaultValidator, name
    
    211
    +        );
    
    212
    +#endif
    
    213
    +    if ( !created )
    
    202 214
             return false;
    
    203 215
     
    
    204 216
     #ifdef LINK_LEXERS
    
    ... ... @@ -1205,18 +1217,10 @@ WXLRESULT wxStyledTextCtrl::MSWWindowProc(WXUINT nMsg,
    1205 1217
         WXWPARAM wParam,
    
    1206 1218
         WXLPARAM lParam)
    
    1207 1219
     {
    
    1208
    -    switch(nMsg) {
    
    1209
    -    // Forward IME messages to ScintillaWX
    
    1210
    -    case WM_IME_KEYDOWN:
    
    1211
    -    case WM_IME_REQUEST:
    
    1212
    -    case WM_IME_STARTCOMPOSITION:
    
    1213
    -    case WM_IME_ENDCOMPOSITION:
    
    1214
    -    case WM_IME_COMPOSITION:
    
    1215
    -    case WM_IME_SETCONTEXT:
    
    1220
    +    if ( m_swx )
    
    1216 1221
             return SendMsg(nMsg, wParam, lParam);
    
    1217
    -    default:
    
    1222
    +    else
    
    1218 1223
             return wxControl::MSWWindowProc(nMsg, wParam, lParam);
    
    1219
    -    }
    
    1220 1224
     }
    
    1221 1225
     #endif
    
    1222 1226
     
    

Reply all
Reply to author
Forward
0 new messages