Commit graph

74928 commits

Author SHA1 Message Date
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
QuentinC
cec057519e Add a few missing and fix a few fuzzy French translations
Closes #23645.
2023-06-17 17:41:27 +02:00
Maarten Bent
d215181c38
Add lexilla to wx-config --libs in static build
Fixes #23643
2023-06-17 15:13:03 +02:00
Maarten Bent
47041389f5
CMake: Don't show warning when webkit2 4.1 cannot be found
It will still show a warning when webkit2 4.00 can also not be found.

See #23633
2023-06-17 15:13:02 +02:00
Vadim Zeitlin
f88c9b7fb7 Make wxWindowMSW::TranslateBorder() non-virtual
It doesn't seem like it is meant to be overridden, so don't imply that
it should be possible to do it and make it non-virtual.

Also rename to DoTranslateBorder() to make it more clear that this is a
private function and not part of the public API.

Finally, improve its comment and never return wxBORDER_THEME from this
functions if themes support is off.
2023-06-16 16:22:40 +01:00
Vadim Zeitlin
f5dd5eaf19 Use darker border in wxMSW dark mode by default
The default wxBORDER_SUNKEN uses 2px border and one of those pixels is
white, which is too light in the dark mode, so don't use it by default.

See #23622.
2023-06-16 16:10:52 +01:00
Vadim Zeitlin
4f54919bda Remove overridden wxWindowMSW::GetDefaultBorder()
It simply called the base class function, so just don't override it in
the first place.

No real changes.
2023-06-16 15:55:59 +01:00
Vadim Zeitlin
a89577e8a4 Deprecate useless wxWindow::GetDefaultBorderForControl()
This function was added back in a047aff270 (Added wxBORDER_THEME,
wxWindow::GetDefaultBorderForControl(), wxWindow::CanApplyThemeBorder(),
2007-08-07) but seems to have been made completely unnecessary by
dc797d8e1b (More border rationalisation. GetDefaultBorder is now mostly
defined in base class files., 2007-11-13) soon afterwards and never did
anything other than returning wxBORDER_THEME, with no explanation as to
when it might be useful to override it not to do it.

It also doesn't seem to be really used anywhere outside wxWidgets and
has never been documented, so make it non-virtual and deprecate it to
avoid confusion and simplify things.
2023-06-16 15:55:35 +01:00
Vadim Zeitlin
f50fb719e8 Merge branch 'samples-mfc-update' of https://github.com/wsu-cb/wxWidgets
Fix build and behaviour of the MFC sample.

See #23574.
2023-06-16 00:02:43 +02:00
PB
81ce7edb75 Improve documentation about parallel builds with MinGW makefile
In the note about building wxWidgets with MinGW makefile and using
parallel build, explain that "-jN" option cannot be used when building
"setup_h" target.

Closes #23642.
2023-06-16 00:01:39 +02:00
Maarten Bent
11ee5b4df5 Only draw selection rectangle for selected items in wxVListBox
Closes #22562.

Closes #23641.
2023-06-15 23:57:41 +02:00
Hartwig Wiesmann
f8af562b20 Avoid spurious clang "undeclared selector" warnings
We check that the selector is really supported before using it, so
suppress the unwanted warnings about doing this.

Closes #23639.
2023-06-15 23:55:51 +02:00
Hartwig Wiesmann
837382510d Avoid using invalid column index in wxOSX wxDataViewCtrl
We need to check for the column row to avoid generating an event with an
invalid index, which may result in a crash in the application code.

Closes #23636.
2023-06-15 23:50:07 +02:00
Vadim Zeitlin
5cef6223c3 Merge branch 'cmake-imported-libs' of https://github.com/MaartenBent/wxWidgets
CMake: Improve finding library name or path of imported targets.

See #23635.
2023-06-15 23:47:44 +02:00
Vadim Zeitlin
d78399dcc9 Merge branch 'webkit2_support_4.1' of https://github.com/swt2c/wxWidgets
Add support for building WebView with libwebkit2gtk-4.1.

See #23633.
2023-06-15 23:42:11 +02:00
Scott Talbert
411e183cd0 Switch Fedora CI to use libwebkit2gtk-4.1 2023-06-13 18:14:04 -04:00
Scott Talbert
1b86644266 Add support for building WebView with libwebkit2gtk-4.1
libwebkit2gtk-4.1 has the same API as libwebkit2gtk-4.0, except that the
former links with libsoup-3.0 and the latter links with libsoup-2.4.

Fixes #23630.
2023-06-13 18:13:59 -04:00