Commit graph

74944 commits

Author SHA1 Message Date
Vadim Zeitlin
008e72c3ac Avoid using implicit assignment operator in wxAny test
This implicitly declared operator is deprecated because MyClass has an
explicitly defined copy ctor, so we either need to define the assignment
explicitly too or just not use it at all, as done by this commit.
2023-07-04 02:08:32 +02:00
Vadim Zeitlin
b6d082a7a6 Suppress warning in tests checking legacy Connect()
This code can't be modified as it tests for compatibility with the
existing code of this form, so just disable the warnings it now triggers
with -Wextra.
2023-07-04 02:08:32 +02:00
Vadim Zeitlin
9952af8e93 Define explicit copy ctor for classes with assignment operator
This avoids clang -Wdeprecated-copy enabled by -Wextra when building the
test.
2023-07-04 01:29:51 +02:00
Vadim Zeitlin
0f73473ae6 Update Scintilla submodules to avoid warnings with -Wextra
No real changes, just suppress some warnings (that we don't really care
about as we won't be fixing warnings in 3rd party code anyhow).
2023-07-04 01:25:03 +02:00
Vadim Zeitlin
41b61aad59 Initialize base class in copy ctor in the other ports too
This was already done in wxGTK, do it in wxX11 and wxQt too as not doing
it triggers a (not very useful, but not completely specious) warning
when -Wextra is in effect.
2023-07-04 01:24:43 +02:00
Vadim Zeitlin
3b0aecf254 Disable missing initializers warnings in wxGTK webview code
Just suppress the warnings, this is better than specifying useless
initializers.
2023-07-03 21:25:48 +02:00
Vadim Zeitlin
b692eaa112 Avoid missing initializer warnings in wxrc
Just suppress the warnings because adding all the missing initializers
would make the command line initialization less readable for no real
gain.
2023-07-03 20:55:18 +02:00
Vadim Zeitlin
6881109a22 Avoid always true comparison in wxThread::SetPriority()
Don't compare unsigned priority value with wxPRIORITY_MIN which is 0,
this is useless and results in -Wtype-limits enabled by -Wextra.
2023-07-03 20:55:18 +02:00
Vadim Zeitlin
c2de3b1a5e Rewrite generic wxPaletteRefData to use vector
Don't bother with manual memory allocation of palette entries, just
store them in a vector.

No real changes.
2023-07-03 20:55:18 +02:00
Vadim Zeitlin
4ff436ecc1 Fix xkb_rule_names struct initializer
Use "{}" to initialize all struct fields to the default values instead
of "{0}" which only initializes the first of them.

This also fixes a warning given when building with -Wextra.
2023-07-03 20:51:09 +02:00
Vadim Zeitlin
39045e1ce5 Ignore keys with modifiers in wxNumValidatorBase
This allows to use accelerators, such as Alt-X, when the focus is on a
key control using numeric validator in wxGTK.
2023-07-02 22:43:15 +02:00
Vadim Zeitlin
67f634dfc4 Don't normalize the value of empty text control on focus loss
This is unexpected, as just TAB-bing in and out of the control changes
its value since the recent changes to wxNumValidator.
2023-07-02 22:40:42 +02:00
Vadim Zeitlin
1c16055713 Still enforce validity on focus loss in numeric validators
The changes of c269932c4e (Relax checks on character entry in numeric
validators, 2023-07-02) went a bit too far and not just relaxed the
checks but removed them entirely.

Correct this by ensuring we have a valid value after focus loss.

See #12968.
2023-07-02 19:13:41 +01:00
Vadim Zeitlin
dccddcdd59 Fix wrong use of WXUNUSED() in the last commit
See #12968.
2023-07-02 18:35:31 +01:00
Vadim Zeitlin
c269932c4e Relax checks on character entry in numeric validators
We can't perform the check for the invalid number in IsCharOk() because
it's perfectly normal for the number to be temporarily invalid while
it's being entered and, worse, sometimes this can't be avoided at all
and the existing behaviour prevented the user from entering _anything_
into a control limited to the values between 10 and 20.

See #23561.

Closes #12968.
2023-07-02 18:27:22 +01:00
Vadim Zeitlin
c2e5749443 Fix crash when reading truncated GIF image
Add a unit test case checking that we don't crash any longer and still
read the image meta data correctly, even if not the image itself.

Also add another check for EOF and possibly invalid "bits" value in
another place where we were not checking for it when reading from the
stream.

Closes #23409.

Co-authored-by: PB <PBfordev@gmail.com>
2023-07-02 18:06:03 +01:00
Vadim Zeitlin
e5e37d9878 Add link to the binaries instructions to the release notes
Although the release notes themselves partially repeat the information
there, the manual is more complete, so still link to it.
2023-06-30 17:55:34 +02:00
Vadim Zeitlin
3bd5063886 Slightly clarify the code in wxBitmapDataObject::GetDataSize()
The change of 675728e1c0 (Fix crash when using wxDataObjectComposite
with bitmap in wxMSW, 2023-06-20) forgot to replace GetBitmap() call
with the local variable -- even if GetBitmap() returns the same thing,
as this local variable is just a reference to the member one which it
returns, it's more clear to use it here directly instead of using this
function and it was already done like this in GetDataHere(), so this is
also more consistent.
2023-06-30 00:30:53 +01:00
Vadim Zeitlin
b882eb96c3 Ensure CMake tests don't fail due to -Werror being used
Disable warnings while compiling the tests to avoid unnecessary noise in
the CMake output/error files (because we don't really care about
warnings in the test code at all) and also, and more importantly, to
ensure that the tests don't fail even when -Werror is specified in the
CMAKE_CXX_FLAGS globally, as it may happen when wxWidgets is used via
add_subdirectory() from a superproject.

See #23665.
2023-06-30 00:26:58 +01:00
Vadim Zeitlin
f072544bd5 Assume sigaction::sa_handler always takes "int"
This is the standard and there doesn't seem to be any contemporary
systems where this is not the case. The configure check for it was
originally added in 101c20d554 (attempting to fix sa_handler signature
for IRIX, 2000-04-01), but IRIX is not supported/doesn't exist any
longer, so don't waste time on checking for this.

The real motivation for this change is that the test failed in CMake
builds, showing just

-- Performing Test wxTYPE_SA_HANDLER_IS_INT - Failed

in the log and then resulting in -fpermissive warnings when assigning
wxFatalSignalHandler to sa_handler and it's simpler to just remove the
check than to debug it.

See #23664.
2023-06-30 00:26:19 +01:00
Vadim Zeitlin
4cd8869218 Merge branch 'html-dataobj-mem-fix'
Fix problems flagged by ASAN in clipboard/data object code and improve
wxMSW HTML data object.

See #23661.
2023-06-30 00:24:52 +01:00
Vadim Zeitlin
de0595108a Merge branch 'bmp-dataobj-fix'
Fix crash when using wxDataObjectComposite and other clipboard-related
cleanup.

See #23659.
2023-06-30 00:20:12 +01:00
Vadim Zeitlin
0e14cf19d1 Merge branch 'border-fixes'
Various border-related fixes for wxMSW.

See #23644.
2023-06-30 00:19:00 +01:00
Konstantin Bolshakov
691adc8241 Document wxDataViewCheckIconText
This will make wrapping it in wxPython easier.

Closes #23668.

Closes #23669.
2023-06-27 23:41:46 +02:00
Ian McInerney
7669a7e1bd Document already existing wxPrintPreview::GetZoom function
This base function was added over 16 years ago but never documented.

Closes #23667.
2023-06-27 19:21:39 +02:00
taler21
eae24cc3b2 Fix bitmap returned from wxAuiToolBarItem::GetDisabledBitmap()
Return the disabled bitmap and not the normal one.

This fixes a regression introduced in 9a5123afed (Use wxBitmapBundle in
wxAuiToolBar and wxAuiPaneInfo too, 2021-11-14).

Closes #23666.
2023-06-27 19:16:40 +02:00
Vadim Zeitlin
72c5691d2f Fix buffer overrun in wxHTMLDataObject under non-MSW platforms
Using strcpy() in GetDataHere() added an extra NUL at the end which
didn't fit into the buffer of the size returned by GetDataSize(). This
could have been also fixed by returning an extra byte from the latter
function, but as the string doesn't need to be NUL-terminated,
apparently, just use memcpy() with the correct number of bytes instead.

Also, because the string is not necessarily NUL-terminated, use the
provided length in wxHTMLDataObject::SetData() instead of relying on the
buffer being NUL-terminated and reading uninitialized memory beyond its
size.

Add a unit test confirming that there are no more ASAN errors when using
this class.

Closes #23660.

Co-Authored-By: mcorino <martin@corino.nl>
2023-06-21 20:38:25 +01:00
Vadim Zeitlin
e4bec18505 Compute exact length needed for CF_HTML contents
Instead of just adding 400 and leaving unused and uninitialized data in
the clipboard data, compute exactly the size of the data we need.

Also replace multiple strlen() calls that are not really needed because
we already know the various lengths.

Still NUL-terminate clipboard data because everybody else does it, even
if it's not totally clear if it is required.
2023-06-21 20:38:25 +01:00
Vadim Zeitlin
c7d414bbed Make HTML pasting code more robust and efficient
Use StartFragment and EndFragment headers values in order to extract the
HTML fragment from the entire CF_HTML string, instead of searching for
"<!--StartFragment-->" and "<!--EndFragment-->" comments which could be
wrong (e.g. if a StartFragment comment actually appeared inside the HTML
fragment) and less efficient too.

Also add a simple pseudo-test, disabled by default, allowing to view the
clipboard contents if HTML is available on it.
2023-06-21 20:38:25 +01:00
Vadim Zeitlin
355db874bc Fix offsets in HTML copied to clipboard
Notable use the correct value for StartFragment: header which must
contain the start of the HTML fragment data and not the start of
"<--StartFragment-->" comment.

Also make this code simpler and more efficient by remembering the
offsets as we're creating the string instead of using strstr() to find
them later.
2023-06-21 20:38:25 +01:00
Vadim Zeitlin
93729d8875 Remove extra new lines from HTML copied to clipboard
No other program does it and having these extra new lines means that our
own GetData() returns extra new lines compared to the value passed to
SetData().
2023-06-21 20:24:39 +01:00
Vadim Zeitlin
ede59ecb16 Add a symbolic constant for the offsets lengths too
Get rid of the last hardcoded number in CF_HTML code.
2023-06-21 20:24:39 +01:00
Vadim Zeitlin
649843a646 Use symbolic constants in CF_HTML-related code
No real changes, just use constants instead of a bunch of hardcoded
strings and numbers.
2023-06-21 20:24:39 +01:00
Vadim Zeitlin
1cf83980a2 Refactor wxHTMLDataObject to keep wxMSW-specific parts together
Also add a link to the official CF_HTML format documentation.

No real changes, just prepare for further ones.
2023-06-21 20:24:34 +01:00
Vadim Zeitlin
b52728a62a Fix memory leak of wxClipboard data on exit
When wxClipboard is destroyed as part of the program shutdown,
gdk_selection_owner_get() doesn't return our clipboard widget as owner
any more, so we don't reset the owner when Clear() is called and hence
never free the data.

Do it explicitly if we don't have clipboard ownership in Clear() any
longer to avoid memory leaks -- even though they are mostly harmless (as
they happen only once, on exit), they still show up in LSAN and similar
tools reports.
2023-06-21 18:19:15 +01:00
Brian Nixon
e1e2e982e3 Restore old delta-RLE bitmap background setting
Revert the change introduced in b473163da2
and restore the setting of the background of delta-RLE bitmaps to the
first entry in the colour table. This retains earlier wxWidgets
behaviour and matches Windows `LoadImage()` with `LR_CREATEDIBSECTION`.

Closes #23638.

Closes #23657.
2023-06-20 22:19:47 +02:00
Vadim Zeitlin
b9fd9c7c8e Merge branch 'about-dialog-compat'
Restore compatibility with the existing code using custom controls in
the "About" dialog.

See #23658.
2023-06-20 22:15:17 +02:00
Vadim Zeitlin
89930c9e5e Deprecate old wxMSW-specific clipboard functions
Formally deprecate these functions that shouldn't be used since a couple
of decades already.
2023-06-20 21:13:45 +01:00
Vadim Zeitlin
bbbc85e52f Use wxClipboard instead of obsolete functions in wxMetafile
Just call wxClipboard::SetData() instead of using obsolete functions for
working with clipboard.

This shouldn't result in any changes in behaviour.
2023-06-20 21:11:44 +01:00
Vadim Zeitlin
8a95a93a1d Remove wxUSE_OLE_CLIPBOARD and always use OLE for wxClipboard
It doesn't make sense to keep the old and almost never used alternative
wxClipboard implementation which has known fatal bugs (such as casts of
wxDataObject that could be wxDataObjectComposite to wxBitmapDataObject,
see #23564) when wxUSE_OLE is never going to be disabled anyhow.

Note that this means wxSetClipboardData() function doesn't exist at all
any longer when previously it was available in the wxUSE_OLE==0 builds.
As the official builds always used wxUSE_OLE==1, this doesn't look like
a huge loss, but if needed, we could add it back later and reimplement
it in terms of wxClipboard::SetData().
2023-06-20 21:00:59 +01:00
Vadim Zeitlin
675728e1c0 Fix crash when using wxDataObjectComposite with bitmap in wxMSW
This reverts the changes of b1fad4da44 (Convert 0RGB wxBitmaps to RGB
when copying them to clipboard, 2017-04-30) that added a cast from
wxDataObject to wxBitmapDataObject for any object supporting bitmaps,
which resulted in a crash when this happened to be wxDataObjectComposite
and not wxBitmapDataObject, and does the same thing in
wxBitmapDataObject itself which now converts 0RGB bitmaps to RGB ones
when asked for the bitmap data.

The main change is that the code using wxDataObjectComposite doesn't
crash any longer, but another nice side effect is that this is possibly
more efficient as well because the conversion could be skipped entirely
if the bitmap is never pasted.

See #17640.

Closes #23564.
2023-06-20 20:42:26 +01:00
Vadim Zeitlin
d5ef9d4387 Add wxGenericAboutDialog::GetCustomControlParent()
This function should be used to get the parent for the custom controls
instead of relying on them being reparented under it by the code added
in the last commit.

Change the type of m_contents to be wxWindow and not wxPanel as it
doesn't really matter, but wxPanel is not fully declared in this header
while wxWindow is.
2023-06-20 19:19:49 +02:00
Vadim Zeitlin
6e0198fffb Make existing code overriding DoAddCustomControls() work again
Existing code uses the dialog itself for the custom controls created in
this function, so make this work by reparenting them under m_contents.

This fixes an assert about the wrong parent window when showing a custom
about dialog in the dialogs sample.

Closes #23653.
2023-06-20 18:51:27 +02:00
Vadim Zeitlin
fe66c0e38c Exclude a couple of makefile-like files from whitespace checks
It's require to use TAB for indentation in these files.
2023-06-20 15:12:34 +02:00
Vadim Zeitlin
b93de740c8 Document that wxRB_SINGLE only works in wxMSW
In the other ports it can't be turned off, making it useless.

See #17022, #23652.
2023-06-19 18:58:36 +02:00
Vadim Zeitlin
44da7cb14a Merge branch 'msw-radiobox-tab'
Fix TAB navigation in MSW radio box.

See #23648.
2023-06-19 14:44:07 +02:00
Vadim Zeitlin
a249e21f65 Fix scrollbar creation for Mac windows not using standard peer
This avoids crash if wxVSCROLL or wxHSCROLL is used with wxGLCanvas
which calls wxWindow::Create() after calling DontCreatePeer() because
the Create() tries to use the not (yet) existent peer in
MacCreateScrollBars().

Avoid this problem by moving the call to MacCreateScrollBars() to
MacPostControlCreate(), which doesn't change anything for the windows
that do not call DontCreatePeer(), but ensures that the peer already
exists by the time MacPostControlCreate() is called for those that do.

Closes #23536.
2023-06-18 17:41:05 +02:00
Vadim Zeitlin
f42cc5abfe Fix TAB navigation when focus is in wxRadioBox under MSW
This was broken in ce1ee46 (Use wxRadioButton in MSW wxRadioBox
implementation, 2022-12-24), fix it by using a wxRadioButton subclass
processing just the cursor arrow keys but not TAB.

Closes #23647.
2023-06-18 17:02:56 +02:00
Vadim Zeitlin
f99009d693 Simplify wxRadioBox button click handler a little
Now that we have wxRadioBoxButton we can simply store its index in it
and use it directly when it's clicked instead of finding the button in
m_radioButtons vector.
2023-06-18 16:55:50 +02:00
Vadim Zeitlin
4be9a7568b Create a helper wxRadioBoxButton class
No real changes yet, just prepare for the upcoming commits by adding a
custom subclass that will be used by wxRadioBox instead of using
wxRadioButton directly.
2023-06-18 16:55:50 +02:00