This was broken by bfdf70d14a, so keep one of
the changes done there conditional on the platform to avoid changing behaviour
for the non-Mac ones.
Closes#17251.
This was broken since 39ad820bee which added
wxSEH_TRY to wxWndProc() which uses a local object with dtor when
wxDEBUG_LEVEL>=2 and so broke its compilation with MSVC which doesn't allow
the use of dtors in functions also using SEH.
Closes#17095.
Don't erase alpha channel of the entire destination image after drawing on it
using AlphaBlend(), we only need to do it for the area corresponding to the
bitmap drawn on it. This speeds things up when drawing small bitmaps with
alpha on a big bitmap without alpha selected into wxMemoryDC which is a common
case.
See #16766.
"%d" can't be used for size_t which may be of greater size than int, so use
"%lu" with a cast to unsigned long, as is done elsewhere because "%z" is
unfortunately not portable.
Closes#17255.
Explicitly mention that IDs effectively used when wxID_ANY is specified as
well as IDs returned by NewControlId() are negative and that the user IDs
should be positive to avoid clashing with such auto-generated ones.
Fix several problems with surrogates in UTF-16-encoded wchar_t strings:
correct bugs in UTF-8 and UTF-32 conversion code and add surrogates support to
wxText{Input,Output}Stream classes.
Closes#17070.
::SetWindowLong() can return 0 even if no error occurred but the previous
value of the ID just was 0, so we need to examine the last error to know
whether there really was an error -- and also to reset it to 0 before calling
the function as it wouldn't reset it if it succeeds, it only sets it if it
fails.
For the programs that use wxWidgets but can also run using just CLI, exiting
the program would show a bogus GTK error
GLib-GObject-CRITICAL **: g_type_class_unref: assertion 'g_class != NULL' failed
Fix this by only releasing the references to GTK_TYPE_WIDGET if we had
acquired it in the first place.
Closes https://github.com/wxWidgets/wxWidgets/pull/129
After the fixes in the previous commits conversions between wchar_t containing
surrogates and UTF-{8,16,32} work correctly, so add a test ensuring that this
is the case.
Notice that other conversions are still broken in presence of surrogates.
See #17070.
Correctly account for the second half of the surrogate in
wxMBConvUTF8::FromWChar() implementation, this makes it actually work for the
strings containing surrogates on the platforms using UTF-16 encoding for
wchar_t (such as MSW).
See #17070.
UTF-32 conversions use a useful optimization by avoiding the extra scan of the
input wchar_t string in their FromWChar() and cWC2MB() implementation when
they are only asked to compute the required buffer size without actually doing
the conversion. However this means that for an input string containing UTF-16
surrogates (which is possible under MSW where wchar_t is 16 bits) the actual
size of the output string can be smaller than that returned by FromWChar(NULL).
Document that this may happen and avoid relying on the exact equality in the
tests.
See #17070.
On the platforms using UTF-16 for wchar_t we can't read nor write Unicode data
one wchar_t at a time as a single half of a surrogate character can't be
converted to or from the encoding of the stream.
To fix this, we may need to store the last wchar_t already read from the
stream but not returned yet in wxTextInputStream::NextChar() and store,
without writing it, the wchar_t passed to wxTextOutputStream::PutChar() until
the second half of the surrogate is written.
See #17070.
UTF-32 conversions only estimate, from above, the size of the output buffer
needed, so the value returned from the first call to FromWChar(NULL) in
cWC2MB() can be inexact for them and we need to return the value returned by
the second call to FromWChar() doing the real conversion from cWC2MB() itself
to ensure that we return the correct output length.
See #17070.
Correctly fail if the wide string being converted is UTF-16 encoded (which can
only happen on platforms using 16 bit wchar_t, i.e. MSW) and ends in the
middle of a surrogate pair.
Notice that other conversions still wrongly encode invalid wchar_t sequences
such as 0xd800 not followed by anything, this will need to be fixed in the
future, but for now at least make it work for the most commonly used
conversion.
See #17070.
Some files only appear in Cocoa builds now which iOS is not a part of,
resulting in link errors. Add (Carbon's) settings.cpp and (Cocoa's)
stdpaths.mm to the list of iOS sources to fix this.
The regenerated Xcode projects also include other additions since the
last time they were updated using makeprojects.applescript (and
overwrites project changes that were made manually).
During the transition of wxSystemSettings from a Carbon to Cocoa
implementation some previously available values weren't implemented any
more. Fix by restoring the missing values for GetMetric() :
wxSYS_SCREEN_X, wxSYS_SCREEN_Y, and (stub) wxSYS_DCLICK_MSEC.
Used values for Cocoa's wxSystemSetting::GetColour() and GetFont() have
also been compared to the Carbon implementation and found to be intact.
Regression since 515fcc66e6 .
Closes#17141
This style was unconditionally used for all multiline controls for some
reason, meaning that wxEVT_TEXT_ENTER could be received even for the controls
not using wxTE_PROCESS_ENTER explicitly, which was unexpected.
Don't do this any more to conform to the expected behaviour.
Also do use wxTE_PROCESS_ENTER for the text control supposed to allow handling
"Enter" in the text sample: surprisingly, it didn't have this style before,
although it was clearly supposed to.
Closes#1913.