Commit Graph
22516 Commits
Author SHA1 Message Date
Vadim Zeitlin 881d0f0461 Implement wxAcceleratorTable::GetEntry() in all ports
It was previously available only in the generic version which was used
by wxGTK and wxUniv, add it to the other ports too as it's going to be
needed in the upcoming commit.

In wxMSW this required storing the accelerators, as it is simpler than
converting them back from the native HACCEL and more consistent with the
other ports that already did this.
2026-09-26 19:30:40 +02:00
Vadim Zeitlin de0c03d5ab Add wxMenuBar::FindItemForAccelKey() and unit test for it
This function will be used in the upcoming commits, for now just add it
and a simple test showing that it works as intended.
2026-09-26 19:00:15 +02:00
Vadim Zeitlin 833dcf56f9 Add const wxWindow::GetAcceleratorTable() overload
This will allow const member functions to call GetAcceleratorTable()
without const_casts.
2026-09-25 18:21:23 +02:00
Vadim Zeitlin fb1258f87d Extract existing code into wxAcceleratorEntry::MatchesEvent()
Add the new function checking if a (key) event and wxAcceleratorEntry
correspond to the same key combination.

This was already used in the generic wxAccelerator implementation and
wxOSX and will be used in the other ports too soon, so move this code
into common function.

It can also be useful for the applications, so document it as well.
2026-09-25 03:20:14 +02:00
Vadim Zeitlin 8f82bf6edf Merge branch 'ime-control'
Provide some control over IME and use it to fix wxGrid when using IME.

See #27026.
2026-09-25 00:05:20 +02:00
Vadim Zeitlin 1afd6fba71 Merge branch 'msw-non-bmp-keys'
Add support for handling characters outside of BMP to wxMSW.

See #27016.
2026-09-25 00:04:20 +02:00
Avery King 2446cea5cc wxQt: Add missing wxFont::Create() overload
Add an overload accepting a regular int instead of wxSize for the font
size.

Closes #27080.
2026-09-25 00:02:07 +02:00
Steve Cornett 8926764e03 Remove MSWSetDarkOrLightMode() SetMode parameter
The MSWSetDarkOrLightMode() SetMode parameter was only ever used in one
place, and not really needed there.

Closes #27076.
2026-09-24 23:55:10 +02:00
Quin Gillespie f91f5ae270 Allow giving focus to read-only wxTextCtrl from keyboard in wxMSW
In wxMSW, single line read-only wxTextCtrl doesn't accept focus from
keyboard, so keyboard and screen reader users can't Tab to it and read
its contents.

Add wxWindow::EnableFocusFromKeyboard(), the counterpart of the existing
DisableFocusFromKeyboard(), to let the application allow this.

Update the documentation and add a wxMSW-only unit test.

Fixes #10760.

Closes #27054.
2026-09-22 23:07:25 +02:00
Vadim Zeitlin a16da69037 Merge branch 'generic-treectrl-getbestclientwidth'
Fix best size computation in wxGenericTreeCtrl and several bugs
discovered while working on this.

See #27043.
2026-09-22 23:03:06 +02:00
Quin Gillespie 950d4918cf Fix wxCollapsibleHeaderCtrl accessibility in wxMSW
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK UTF-8 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxQt (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxX11 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK 2 (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK gcc 7 static compatible 3.0 (push) Canceled after 0s
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxDFB (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Canceled after 0s
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Canceled after 0s
CMake builds / macOS latest wxGTK 3 Unix Makefiles (push) Canceled after 0s
CMake builds / MSW/MSVC wxMSW (push) Canceled after 0s
CMake builds / MSW/Clang wxMSW (push) Canceled after 0s
CMake builds / macOS latest wxOSX Ninja (push) Canceled after 0s
CMake builds / macOS 14 wxOSX Xcode (push) Canceled after 0s
CMake builds / macOS 14 wxIOS (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 5.15 (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 6.10 (push) Canceled after 0s
Mac builds / wxMac ARM ASAN not compatible (push) Canceled after 0s
Mac builds / wxMac Universal C++14 (push) Canceled after 0s
Mac builds / wxiOS Simulator on Silicon Mac (push) Canceled after 0s
Mac builds / wxiOS (push) Canceled after 0s
Mac builds / wxMac Intel C++17 (push) Canceled after 0s
Mac Xcode builds / iOS Simulator static (push) Canceled after 0s
Mac Xcode builds / macOS dynamic Release (push) Canceled after 0s
Mac Xcode builds / iOS static Debug (push) Canceled after 0s
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Canceled after 0s
MSW builds / wxMSW vs2022 DLL Release x64 (push) Canceled after 0s
MSW builds / wxMSW vs2022 Debug Win32 (push) Canceled after 0s
MSW builds / wxMSW vs2022 Release arm64 (push) Canceled after 0s
MSW builds / wxMSW vs2026 DLL Release x64 (push) Canceled after 0s
MSW cross-builds / wxMSW 64 bits not compatible (push) Canceled after 0s
MSW cross-builds / wxMSW/Univ (push) Canceled after 0s
MSW cross-builds / wxMSW 32 bits (push) Canceled after 0s
Code Checks / Check Spelling (push) Canceled after 0s
Code Checks / Check Whitespace (push) Canceled after 0s
Code Checks / Check Mixed EOL (push) Canceled after 0s
Code Checks / Check C++ Style (push) Canceled after 0s
Code Checks / Check All Headers In allheaders.h (push) Canceled after 0s
The generic collapsible header, used by wxCollapsiblePane and so by the
generic about dialog, had two problems for keyboard and screen reader
users under MSW:

- Pressing Enter on the header activated the default button of the
  dialog. In wxAboutBox this closed the dialog. Enter now toggles the
  header, the same as Space.

- Screen readers could not tell what the header was or if it was open.
  It now reports itself as a button with an expanded or collapsed state,
  sends a state change event when it toggles, and has a default action.
  This also stops screen readers from reading the label twice.

Closes #27048.
2026-09-22 13:04:27 +02:00
Quin Gillespie b841d3c0f5 Announce generic wxInfoBar messages for the screen reader
When the generic wxInfoBar showed a message, screen readers said
nothing, so their users did not know it had appeared.

The info bar now has the alert accessible role with the message as its
name, and sends an alert event every time ShowMessage() is called. NVDA
reads the message when it is shown, and also when a new message is shown
while the bar is already visible.

Closes #27053.
2026-09-22 02:33:28 +02:00
Quin Gillespie ef316972b3 Fix Tab navigation in generic wxInfoBar
The generic wxInfoBar was a plain wxControl, not a container, so Tab
gave focus to the info bar window itself and never moved to the close
button or other buttons inside it.

wxInfoBarGeneric now derives from wxNavigationEnabled, the same as
wxGenericCollapsiblePane, so Tab moves to the buttons inside it.

Closes #27052.
2026-09-22 02:03:14 +02:00
Quin Gillespie ffb5580936 Fix missing accessible name for bitmap-only buttons in wxMSW
Buttons that show only a bitmap have no label, so screen readers only
announce them as "button". This affects, for example, the buttons of
wxEditableListBox and the close button of the generic wxInfoBar.

When a button has no label but has a tooltip, its tooltip is now used as
its accessible name. Buttons with a label are not changed.

Closes #27051.
2026-09-22 01:43:24 +02:00
Blake-Madden bf5e42866c Fix confusing var names, improve comment 2026-09-21 16:04:44 -04:00
Blake-Madden 065d774ee5 Handle tabbing in/out when not inside of navigation supporting parent
This will get the demo to work without integrating a wxPanel into it.
2026-09-21 11:44:46 -04:00
Blake-Madden 71494f3265 Add keyboard navigation to ribbon gallery 2026-09-21 11:35:45 -04:00
Blake-Madden 6275a0e00d Add ribbon toolbar keyboard navigation 2026-09-21 11:19:23 -04:00
Blake-Madden a7de985504 Add keyboard navigation to ribbon panel 2026-09-21 11:14:56 -04:00
Blake-Madden c33455a85d Add keyboard navigation to ribbon button bar (tabs and buttons) 2026-09-21 11:09:17 -04:00
Robert RoeblingandVadim Zeitlin 15df498092 Fix best size computation in wxGenericTreeCtrl
Implement DoGetBestClientWidth() so that the control can compute the
appropriate width when its height is known, as is the case when it's
used as wxTreeBook controller: this prevents the appearance of ugly
and unnecessary horizontal scrollbar in this case.

Add a unit test checking that the best size is computed correctly.

Closes #26097.

Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
2026-09-21 16:46:55 +02:00
Vadim Zeitlin 81ea3c8854 Handle characters outside of BMP in wxRichTextCtrl under MSW
Change wxRichTextEvent::m_char to be of type wxUniChar and not wxChar.
This is mildly backwards-incompatible but the break is arguably worth
not adding some new GetUnicodeCharacter().
2026-09-20 22:17:37 +02:00
Vadim Zeitlin 9bf5a10d99 Pass wxUniChar to wxVListBoxComboPopup::HandleKey()
wxChar can't hold all possible characters under MSW, so prefer using
wxUniChar even if it's not clear if this have any practical benefits in
this particular case.
2026-09-20 22:12:27 +02:00
Vadim Zeitlin 6b4a5fd64c Add support for non-BMP characters in wxKeyEvent in wxMSW
Recombine the 2 WM_CHAR messages we receive for high and low surrogate
pair into a single Unicode character which can be retrieved using the
new wxKeyEvent::GetUnicodeChar() member function.

Update documentation and comments to recommend using the new function
instead of GetUnicodeKey().

Also update the keyboard sample to use it to be able to show events for
supplementary characters under MSW.

Closes #25135.
2026-09-20 21:46:44 +02:00
Vadim Zeitlin 82f2d9bddb Add wxWindow::SendAfterCharEvent()
This trivial helper can be used from wxComboBox too, which will be
useful for the upcoming commits.

No real changes yet.
2026-09-20 21:40:55 +02:00
Vadim Zeitlin dbf58d2748 Always initialize wxKeyEvent::m_rawCode and m_rawFlags
They are supposed to be initialized from platform-specific code, but
don't leave them with garbage values if they are somehow not.
2026-09-20 21:40:55 +02:00
Vadim Zeitlin 1e2e4d794d Initialise wxKeyEvent members in their declarations
No real changes, just make it clear what values are various members
initialized with.
2026-09-20 21:40:55 +02:00
Vadim Zeitlin b03f1b57a1 Make wxConvFile safe to use during static initialization phase
wxConvFileName may not be initialized yet and there is nothing we can do
about this because it has to remain a simple variable to allow setting
it.

However we can change wxConvFile and wxFNCONV to use wxGetFileNameConv()
accessor function which ensures that we initialize wxConvFileName before
using it at least via these functions.

Also update a couple of direct references to wxConvFileName in the code
which might conceivably be used at this stage.
2026-09-20 19:07:50 +02:00
Vadim Zeitlin 801f91d8ab Merge branch 'fix-fmt-uchar-msw'
Fix formatting wxUniChar outside of BMP under MSW.

See #27023.
2026-09-20 17:51:08 +02:00
Vadim Zeitlin 068588b2f7 Provide a way to position IME window
Add wxWindow::UpdateInputMethodCursorRect() which can be used to let the
IME know where to place its window and use it in wxGrid to show it near
the cell being edited.

See #24558.
2026-09-20 02:49:35 +02:00
Vadim Zeitlin cc43fa9e22 Add wxWindow::EnableInputMethod() for disabling IME
Implement it in wxMSW, wxGTK and wxOSX.

This will be used to prevent IME window from appearing for windows that
currently don't accept keyboard input even if they accept focus.
2026-09-20 02:32:07 +02:00
Vadim Zeitlin b01632cf3b Implement wxAnimation::Get{FrameCount,Delat,Frame}() in wxGTK
Iterate over the animation manually to find the frame we need.

Update the sample to allow showing individual animation frames.

Closes #27009.

Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
2026-09-19 12:57:54 +02:00
Vadim Zeitlin 593e5d1321 Fix formatting non-BMP wxUniChars using wx functions under MSW
Previously wxString::Format("%c", wxUniChar{0x1F600}) produced broken
"\uF600" under MSW because this was all that fit into a wchar_t there
which can only contain 16-bits. And using "%d" or "%x" was broken in the
same way, as wxArgNormalizer<wxUniChar> always used wx_truncate_cast()
to wchar_t which is not lossless when sizeof(wchar_t)==2.

Fix this with the following horrible/ingenuous/crazy (choose your own
adjective) hack: because we can't fit supplementary Unicode characters
into a wchar_t, don't even try doing it and instead inject the bytes
representing the character into the format string itself (suitable
padded/aligned depending on the formatting flags) and replace the
format specifier used for wxUniChar with "%.0d" and feed it 0, which
ensures that no output is produced for it.

This can be done with surprisingly little amount of changes and should
be completely transparent to any code not formatting wxUniChars outside
of the BMP -- while such code will now behave correctly, instead of
silently producing wrong output as before, under MSW too.

Note that we do this unconditionally, i.e. without preprocessor checks
for SIZEOF_WCHAR_T, even if old code worked when it was 4, because using
the same code under all platforms should make finding and fixing bugs in
it simpler and also because this code is already hairy enough to not
need any extra complications.
2026-09-18 18:04:16 +02:00
Vadim Zeitlin cc729694f0 Add wxFormatString::Preprocess() and use it instead of Validate()
No real changes yet, just add a function with a name indicating that it
can do more than just validate the format string (because it will soon)
and call it instead of Validate().
2026-09-18 18:04:14 +02:00
Vadim Zeitlin 54b55ed92d Merge branch 'MSW-fswatcher' of github.com:sethhillbrand/wxWidgets
Fix the remaining races in MSW file watcher and keep watching if a
directory is removed.

See #27012.
2026-09-16 23:14:55 +02:00
Seth Hillbrand 0b744dd44c Fix remaining MSW wxFileSystemWatcher threading races
The worker thread checked whether a watch was still used by looking it up
in wxFSWatcherImpl::m_watches, which is modified by the main thread in
Add(), Remove() and RemoveAll() without any locking. And even with the
locking added in wxIOCPService, the watch could still be removed between
checking for its removal and starting a new read for it, leaving a pending
read on a watch nobody uses any more.

Check whether the watch was scheduled for removal and start the new read
while holding the wxIOCPService lock, and complete the removal instead if
it was.

Also register the watch with wxIOCPService before starting the first read
for it, so that the worker thread can't get a completion for a watch it
doesn't know about yet.
2026-09-16 13:02:39 -07:00
Vadim Zeitlin 21a11df9b7 Merge branch 'persist-dpi'
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK UTF-8 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxQt (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxX11 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK 2 (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK gcc 7 static compatible 3.0 (push) Canceled after 0s
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxDFB (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Canceled after 0s
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Canceled after 0s
CMake builds / macOS latest wxGTK 3 Unix Makefiles (push) Canceled after 0s
CMake builds / MSW/MSVC wxMSW (push) Canceled after 0s
CMake builds / MSW/Clang wxMSW (push) Canceled after 0s
CMake builds / macOS latest wxOSX Ninja (push) Canceled after 0s
CMake builds / macOS 14 wxOSX Xcode (push) Canceled after 0s
CMake builds / macOS 14 wxIOS (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 5.15 (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 6.10 (push) Canceled after 0s
Mac builds / wxMac ARM ASAN not compatible (push) Canceled after 0s
Mac builds / wxMac Universal C++14 (push) Canceled after 0s
Mac builds / wxiOS Simulator on Silicon Mac (push) Canceled after 0s
Mac builds / wxiOS (push) Canceled after 0s
Mac builds / wxMac Intel C++17 (push) Canceled after 0s
Mac Xcode builds / iOS Simulator static (push) Canceled after 0s
Mac Xcode builds / macOS dynamic Release (push) Canceled after 0s
Mac Xcode builds / iOS static Debug (push) Canceled after 0s
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Canceled after 0s
MSW builds / wxMSW vs2022 DLL Release x64 (push) Canceled after 0s
MSW builds / wxMSW vs2022 Debug Win32 (push) Canceled after 0s
MSW builds / wxMSW vs2022 Release arm64 (push) Canceled after 0s
MSW builds / wxMSW vs2026 DLL Release x64 (push) Canceled after 0s
MSW cross-builds / wxMSW 64 bits not compatible (push) Canceled after 0s
MSW cross-builds / wxMSW/Univ (push) Canceled after 0s
MSW cross-builds / wxMSW 32 bits (push) Canceled after 0s
Code Checks / Check Spelling (push) Canceled after 0s
Code Checks / Check Whitespace (push) Canceled after 0s
Code Checks / Check Mixed EOL (push) Canceled after 0s
Code Checks / Check C++ Style (push) Canceled after 0s
Code Checks / Check All Headers In allheaders.h (push) Canceled after 0s
Update Documentation / Update Online Documentation (push) Canceled after 0s
Handle restoring settings saved by persistent objects after DPI change.

Closes #18752.

See #27006.
2026-09-16 00:43:14 +02:00
Steve Cornett e9d032d517 Fix wxStaticBox for dark mode with double buffering
Set custom painting mode for dark mode in MSWSetDarkOrLightMode()
because custom painting mode is not set in Create() when double
buffering.

Fixes #27004.

Closes #27007.
2026-09-16 00:42:50 +02:00
Vadim Zeitlin 8a78656005 Account for DPI in wxPersistentSplitter too
Rescale the saved splitter position if the DPI has changed when
restoring it by using {Save,Restore}Coord().
2026-09-14 14:03:23 +02:00
Vadim Zeitlin a02e4dac14 Fix restoring wrong last split position in wxPersistentSplitter
This was broken since f24b3d5483 (Save last wxSplitterWindow position
before it was unsplit, 2024-02-12) which accidentally used the wrong
lastSplitPos component when restoring.
2026-09-14 14:03:23 +02:00
Vadim Zeitlin c2d78e955a Account for DPI in wxPersistentDataViewCtrl too
Just use {Save,Restore}Coord() to restore the columns widths instead of
{Save,Restore}Value() to rescale the saved values if necessary.

Add a unit test checking that this works as expected.
2026-09-14 14:03:23 +02:00
Vadim Zeitlin 3cdb10d42d Save DPI in wxPersistentTLW to handle DPI change correctly
Add support at wxPersistentWindow level for saving the DPI at which the
window coordinates were saved to allow rescaling the values by the ratio
of this DPI to the current one if the DPI has changed between saving and
restoring.

This allows keeping the same proportional size of the window after DPI
change on the platforms not using DPI-independent pixels (such as wxMSW)
too by just using the new {Save,Restore}Coord() functions instead of
{Save,Restore}Value() for any quantities that need to be scaled.

Do this for wxPersistentTLW to update the window size to remain
proportionally the same after DPI change.
2026-09-14 02:39:45 +02:00
Vadim Zeitlin 793883bf19 Add wxFFile::FlushAndSync() calling fsync() too
The existing Flush() only called fflush() but this is not enough to
really flush the file to the disk.

We can't start calling fsync() from Flush() as this may significantly
slow down the existing code. We could add a separate Sync() but as it
almost always makes sense to flush the file before syncing it, add a new
function doing both at once instead.
2026-09-11 17:36:13 +02:00
Vadim Zeitlin e88fd128cd Add wxGetFileDescriptor()
This function already existed internally, make it public as it can be
useful and will be used by wxFFile itself in the upcoming commit.
2026-09-11 17:36:13 +02:00
Vadim Zeitlin 36dd2f5613 Merge branch 'msw-rename-fixes'
Make wxRenameFile() really atomic under MSW.

See #26998.
2026-09-11 16:08:22 +02:00
Vadim Zeitlin 0c23bd2924 Factor out wxInitTempFile() from wxTemp{F,}File
Don't duplicate the same code in both classes, it has already diverged
in the past and could do it again, so extract it into a common function
and just call it from both places.

No real changes, this is just a refactor.
2026-09-11 02:36:34 +02:00
Vadim Zeitlin f47de7bfd8 Add wxFileName::CopyAttributesFrom() and use it in wxTemp{F,}File
Copy the target attributes that are easy to copy and make sense to
preserve under Windows too instead of only doing it under Unix in
wxTemp{F,}File and do it in a new wxFileName::CopyAttributesFrom()
function instead of duplicating the same code in both classes.

The new function can be potentially useful on its own, so make it public
and document it.

Add a unit test verifying that the attributes are preserved after
overwriting the file with wxTemp{F,}File.
2026-09-11 02:28:00 +02:00
ali kettab fc0bb12049 wxQt: Allow using Qt's standard font dialog instead of the native one 2026-09-10 23:45:39 +01:00
ali kettab 904adb25a2 wxQt: Add a convenience function to wxFontDialog
No real changes, just for consistency with the other classes, we add an
accessor that returns the actual Qt widget type used by wxFontDialog.

The base class already has m_fontData, so the unused member m_data was removed.
2026-09-10 22:58:55 +01:00
Vadim Zeitlin ab3f5e7299 Merge branch 'aui-button-event'
Restore generation of wxEVT_AUINOTEBOOK_BUTTON events.

See #26978.
2026-09-10 17:58:22 +02:00