Change type of `wxKeyEvent::m_uniChar` to `wxUniChar`
Author: vadzCreated Feb 1, 2025Updated Sep 17, 2026
While looking at #25128 I've realized that we have a problem with char events: they can't represent characters such as `` (U+1F60A) which can't fit in a single wxChar on the platforms using 16 bit wchar_t, i.e. MSW.
And this looks like a real problem because even though such characters can't be entered from physical keyboards (I think?), they definitely can be entered from on-screen keyboards and can also be pasted.
So I think we need to do one of
- Change type of
m_uniChartowxUniChar. This has the advantage of simplicity and consistency, but will break existing code if only becauseswitch ( event.GetUnicodeKey() )won't work any longer. - Change type of
m_uniChartowxUint32. This should be mostly compatible, AFAICS, but I can still imagine some code that would be broken by this, the simplest example being passing the key value to some overloaded function. - Keep
m_uniCharas is, and add somem_uniChar32. This has the advantage of being 100% backwards-compatible, but ugly and confusing. But if we could come up with some better name thanGetUnicodeKey32()for it, maybe it could work?GetUniChar(), perhaps?
What do people think?
Source: wxWidgets/wxWidgets