Commit Graph

73222 Commits

Author SHA1 Message Date
Vadim Zeitlin
dc9baf6426 Add automatic check for not using nullptr etc in 3.2 branch
This is similar to the check in master but here it checks that the C++
keywords are not used, as we still support C++98 in this branch.
2023-01-31 15:06:47 +01:00
Vadim Zeitlin
43994dddbd Fix compilation with C++98 compilers after recent change
Use NULL instead of nullptr after the recent 03ccc88db8 (Support
Caps/Num/Scroll Lock in wxGetKeyState() in wxGTK, 2023-01-30).

See #23195.
2023-01-31 15:02:10 +01:00
Paul Cornett
fdf43f8049 Fix build with wxUSE_SEARCHCTRL==0 2023-01-30 19:33:25 -08:00
Paul Cornett
3619d347ee Update TLW size before showing on Wayland when decoration size becomes known
Fixes initial TLW size being larger than requested
See #23041

(cherry picked from commit 997d20e0b2137ee61dfd209b3aa853f3ca80bec8)
2023-01-30 19:31:11 -08:00
Paul Cornett
0a8a62481e Ensure that TLW size is updated when decoration size changes on Wayland
In particular this fixes reported size in some situations where
SetSize() has been called before decoration size is known.
See #23041

(cherry picked from commit 08301b1b4ae6b54ee0f0a5dc6eb1f4468635954d)
2023-01-30 19:30:47 -08:00
elfmz
03ccc88db8 Support Caps/Num/Scroll Lock in wxGetKeyState() in wxGTK
Add support for more keys to this function, which previously only
supported the modifiers.

See #23195, #23198.

(cherry picked from commit 228bae0d91739fb3d405d9d6801e998ea55bad31)
2023-01-31 01:45:32 +01:00
Vadim Zeitlin
edbd9094e8 Work around wxPropertyGrid state loss on modules reinitialization
Don't reallocate wxPGGlobalVars if it's somehow already allocated when
wxPGGlobalVarsClassManager::OnInit() is called: this is not supposed to
happen but it does when wxPython redoes the modules initialization after
loading another module.

See #23165.
2023-01-30 21:16:48 +01:00
Maarten Bent
9b4ec1963f Work around MSVS 2022 optimizer bug in wxImage::ShrinkBy()
Move "alpha" initialization inside the conditional to ensure that it's
calculated correctly, as it was apparently hoisted out of the loop due
to an optimizer bug otherwise.

This commit is best viewed with Git --color-moved option.

See #23164.

(cherry picked from commit e51bc7365904b0fc3a35038457c907e2f6c08eb0)
2023-01-30 21:16:48 +01:00
Stefan Csomor
cd6499a9b0 Fix for routing ordinary selectors in Mac wxWebView
This is a fix for the changes of the previous commit repairing handling
of arrow keys in the text controls after it.

See #23151.

(cherry picked from commit 6eb6c52bee43eb38a211f4760f35187be9815198)
2023-01-30 21:16:48 +01:00
Stefan Csomor
ac625b1e81 Fix keyboard shortcuts handling in wxWebView under macOS
Feed back selectors on WebView to process them correctly.

See #23174, #23151.

(cherry picked from commit bf9076e2cd313175af8cf2631681f13e0a438ae0)
2023-01-29 01:49:15 +01:00
Vadim Zeitlin
54cecd590b Update bundled zlib to 1.2.13.1
This fixes CVE-2022-37434 (which shouldn't normally affect the use of
zlib in wxWidgets but it still seems better to not have it than to
have).

See #22919.

(cherry picked from commit b4f1ae68b5961e0a309b10f9114be6a55a7f1a21)
2023-01-29 01:48:24 +01:00
Ian McInerney
e2470b2c8b Allow selecting and copying text in wxMessageDialog on GTK
Normally the GTK message dialogs have non-selectable text, but that also
means users can't copy the text. This can be inconvenient if the dialog
is used for error messages, since then the error message can't be
copied.

Instead, make the text labels used in the GTK message dialog selectable
to fix that.

See #23039.

(cherry picked from commit a8ea3eda116ae895446fc720943702f0c9c52b90)
2023-01-26 22:56:51 +01:00
Vadim Zeitlin
0fd9546295 Fix a possible crash in Mac menu item event handling
See #23040, #23100.

(cherry picked from commit d868c3b3e2a9bf2ccf9db176ea0e428b9e4b2c68)
2023-01-26 22:54:47 +01:00
Vadim Zeitlin
42f3fb44cd Use named links in Markdown instead of numbered ones
This is more clear and avoids problems with mis-numbering.

See #23090.

(cherry picked from commit 06f5267582584cecd91d74a534fca9bc03082920)
2023-01-26 22:50:21 +01:00
Khem Raj
71636307f0 Fix wxUILocale compilation with musl
Avoid using glibc specific defines when using musl, which does not
provide glibc-only enum members such as _NL_ADDRESS_LANG_NAME.

Signed-off-by: Khem Raj <raj.khem@gmail.com>

See #23050.

(cherry picked from commit 1faf1796b23b2503296d9b1e9ad39047d633f8c9)
2023-01-26 22:48:43 +01:00
William
af2f7f2008 Fix drawing wxTaskBarIcon under macOS in high DPI
Use a workaround to ensure the image is not distorted due to using a
wrong scale.

See #23042.

(cherry picked from commit 83e47a6be33190f5a0974dc52fc38c44840660e1)
2023-01-26 22:47:21 +01:00
Vadim Zeitlin
f16387bb9c Fix support for high DPI icons in generic wxListCtrl
This is a cherry pick of the merge commit 5845312825 (Merge branch
'generic-listctrl-hidpi-images', 2022-10-26) from master including the
following commits:

* Support high DPI bitmaps in wxGenericListCtrl.
* Rename variable to have a less confusing name.
* Add wxDrawImageBitmap() helper and use it in wx{List,Tree}Ctrl.
* Don't duplicate same code for small icon, list and report modes.

See #22907, #22916.
2023-01-26 22:44:37 +01:00
Vadim Zeitlin
c1b27f3c1e Fix size of native icons in MSW wxArtProvider in high DPI
This is a cherry pick of the merge commit 4f6aa5aee9 (Merge branch
'print-preview-hidpi', 2023-01-15) from master comprising the following
commits:

* Use correct size for SVG art provider bitmaps in high DPI.
* Use wxBitmapBundle for print preview frame buttons.
* Really DPI-independent size from GetNativeDIPSizeHint() in wxMSW.
* Fix using art provider on secondary monitor with standard DPI.

See #23127, #23131.
2023-01-26 20:20:58 +01:00
Vadim Zeitlin
f2b8938525 Avoid expanding the window size by too much on DPI change
Don't make the window size at least equal to GetBestSize() when the DPI
changes as this could result in it becoming far too big, e.g. if it
contains any controls whose current size is significantly smaller than
their best size, as could be the case for just about any control using
scrollbars and notably wxListCtrl.

Instead amend the changes of b66e63e (Fix windows becoming smaller than
best size on DPI change, 2022-06-24) to only do this for the windows
using sizers as we can determine the minimal acceptable size for them
and we really shouldn't shrinking them beneath it.

See #23091, #23134.

(cherry picked from commit 0ccf6813d2154b68622a12664fef588145fee208)
2023-01-26 20:20:58 +01:00
Maarten Bent
e350ebbe47 Fix determining joystick product name
Check both HKCU and HKLM registry hives.

See #23172.

(cherry picked from commit ab12443d0f5460da5c121be7d17d52460e40dfe3
after modifying it to use a function instead of a lambda).
2023-01-26 20:20:58 +01:00
ali kettab
05f67dfbab Fix initializing wxFont from wxNativeFontInfo in wxQt
Don't round the fractional point size.

See #23163.

(cherry picked from commit eeaef96d826ab67e3e052576824a2bb762a1a6de)
2023-01-25 14:34:11 +01:00
Vadim Zeitlin
2bad14d76a Fix using pkg-config when cross-compiling to Linux targets
Restrict the hack disabling the use of build system pkg-config files
added in 893ebbab0c (Disable use of build system pkg-config files when
cross-compiling, 2020-12-13) to the case of using non-host-prefixed
pkg-config script and cross-compiling to non-Linux targets, as we're
very unlikely to have the correct .pc files installed on the build
system, but do use pkg-config in the other cases, as we do want to use
the system-provided .pc files then.

This is a combined cherry-pick of d6ddfe87e1 (Disable build system
pkg-config when cross-compiling to non-Linux, 2022-11-30), 7899850496
(Do use host-specific pkg-config when cross-compiling, 2022-12-15) and
b0056f8ce5 (Re-re-enable using pkg-config when targeting Linux systems,
2023-01-25) from master.

See #22886, #23037, #23171.
2023-01-25 14:30:28 +01:00
Vadim Zeitlin
49c14faec3 Use margins around the text in wxGenericListCtrl on all platforms
For some reason, the margin was only used in wxGTK ever since it was
added back in ccdbdc8936 (Added native selection rectangle drawing.,
2006-11-11) even though it came with a comment saying that this
should be done for all platforms.

Finally do this now to make the list look better under e.g. macOS.

See #23155.

(cherry picked from commit b6071fc6c65efd2922e54c8dd916432739c12988)
2023-01-19 21:50:39 +01:00
Vadim Zeitlin
40885eb753 Fix painting artifacts with AUI and wxGTK3 in some environments
Using wxClientDC can actually be worse than useless with wxGTK3 as not
only it does nothing when used under Wayland, but it may also draw at
the wrong position when using X11 with some WMs, notably Openbox or
fvwm.

Simply don't use at all with wxGTK3, it should be never needed there, to
fix the painting artifacts that it created.

See #23135.

(cherry picked from commit 12497372fc01a512c0d392ec612b2359206c80c7)
2023-01-13 19:17:41 +01:00
Vadim Zeitlin
ece23268f3 Merge branch 'c++98-fixes' into 3.2
Fixes for C++98 support on 3.2 branch.

See #23136.
2023-01-13 17:55:41 +01:00
Vadim Zeitlin
e3c869ee98 Use C++98 for some CI builds in 3.2 branch
This should help to detect any future breakages of building the library
with a C++98 compiler.
2023-01-12 17:49:28 +01:00
Vadim Zeitlin
37d5bf363d Disable using [[deprecated]] attribute when not using C++11
At least with g++ 10, but presumably with other versions too, the
compiler still predefines __has_cpp_attribute(deprecated) even when
using it with -std=c++98 or similar option, but it does not accept this
attribute unless it's actually using C++11 or higher, resulting in
compilation errors.

Simply avoid defining wxHAS_DEPRECATED_ATTR when not using C++11 to fix
this.
2023-01-12 17:49:28 +01:00
Vadim Zeitlin
3a621d7cb5 Don't use C++11 features in wxGdkAtom backported from master
This fixes compilation with C++98 compiler after the changes of
25c5f57f0b (Initialize atoms used in wxGTK wxDataObject on demand,
2022-12-06).

See #23018.
2023-01-12 17:49:28 +01:00
Oleksandra Yushchenko
ac29c30b8a Fix wrongly recreating wxComboBox in disabled state in wxMSW
When recreating a wxComboBox, as sometimes needs to be done when adding
a new bitmap to wxBitmapComboBox, for example, we should only disable it
if the old combobox itself was disabled, not if (any of) its parent(s)
were disabled, but IsEnabled() returned true even in this case.

Use IsThisEnabled() instead to ensure that we only disable the new
combobox if necessary.

See #23132.

(cherry picked from commit 8e604926c3a726c93b2df2c162be57b94a10cb61)
2023-01-12 17:40:15 +01:00
Blake-Madden
1d32868d36 Fix typo in wxDEFINE_EVENT macro name in the documentation
Should be wxDEFINE_EVENT, not wxDEFINE_EVENT_TYPE.

See #23126.

(cherry picked from commit 451772530c670b91f06c77e84198898700645091)
2023-01-12 17:37:25 +01:00
Maarten Bent
3c18113980 Only build memcheck sample when debugging is enabled
This sample is not useful and doesn't build otherwise.

See #23106, #23133.
2023-01-12 17:36:51 +01:00
Danny Scott
4cef9529db Include wxrc.exe in the 64-bit wxMSW MSVC binary package
Correct path for x64 wxrc.exe file which prevented it from being
included in the vc14x_x64_Dev archive.

See #23122.

(cherry picked from commit 70667fc8ab012fc4ab63d187062e5a28834dc5fc)
2023-01-10 00:28:19 +01:00
PB
b8c4d5428a Improve comments in samples/sample.rc
Provide more information about application manifest, High DPI support,
and contents of wx/msw/wx.rc file.

Use the correct file extension for docs/msw/winxp.md.

See #23116.

(cherry picked from commit 42c2cb9936c7341f365afef1466aa5181df18261)
2023-01-06 00:57:39 +01:00
Vadim Zeitlin
203e501a51 Fix peeking into an already closed socket
Crazily enough, this seems to have been broken ever since a324a7bccf
(Added GSocket for Unix [...], 1999-07-22) which removed the call to
GetPushback(true) from Peek(), making its "peek" parameter unused until
now.

Restore this call in order to return the correct data from the internal
buffer even if the socket has been closed since the last read.

This fixes wxURI tests as the new test HTTP server returns smaller
response which can be typically read entirely at once.

(cherry picked from commit 001fbe120f54c141db950137fc00e29fb56c6f16)
2023-01-03 18:50:08 +01:00
Vadim Zeitlin
e1a6bb2944 Disable test for loading images using wxURL
This requires an image accessible via HTTP (and not HTTPS) but we don't
have any such working URLs any longer since the recent change on
www.wxwidgets.org.

Still make it possible to test this manually by predefining an
environment variable containing the URL.

(cherry picked from commit 2b5bb6217d9bc9076c283e785f3b8fa43c05e109)
2023-01-03 18:49:04 +01:00
Vadim Zeitlin
c3f34bfb4d Switch to using detectportal.firefox.com for wxURL HTTP test
http://www.wxwidgets.org/ now redirects even image assets to HTTPS all
of a sudden.

(cherry picked from commit b5d7112583446074ee24a800b54be9a6af9e2de0)
2023-01-03 18:49:04 +01:00
Vadim Zeitlin
974b5965b6 Rebake after the copyright year update
This should have been part of the parent commit.
2023-01-03 18:48:19 +01:00
Vadim Zeitlin
68f6dc2cb6 Update copyright years to 2023 in 3.2 branch too
Just run misc/scripts/inc_year and commit the results.

See #18690.
2023-01-03 04:21:29 +01:00
Vadim Zeitlin
2ca3d25963 Avoid warnings about signed/unsigned comparison in wxGrid code
Explicitly cast wxNumberFormatter::GetDecimalSeparator() to int before
comparing it with int keycode.

Master contains a better fix for this problem (see #23103), but this one
is simpler and works also in non-Unicode build.

See #23101.
2022-12-30 19:25:12 +01:00
Vadim Zeitlin
6c2c9220cd Restore private wxDataFormat::PrepareFormats() to preserve ABI
Even though this function is private, the ABI checker script still
complains if it is removed, so restore it, even if it doesn't do
anything any longer after the changes of the grandparent commit.
2022-12-28 00:55:36 +01:00
Vadim Zeitlin
fcf6ff8904 Don't append extra NUL to URLs in wxGTK wxURLDataObject
The buffer size includes the trailing NUL, but we shouldn't make it part
of the string contents as it's not really part of the data at all.

The next commit will add a test verifying that retrieving an URL from
clipboard now gets the right string, without an extra trailing NUL, i.e.
fixes a bug similar to #22928 but in wxGTK.

As with the grandparent commit, this commit is a modified version of the
master one accepting non-NUL-terminated strings too for compatibility.

See #23018.

(cherry picked from commit c93c346adcd0f7cb443f6e8307aed6ccb59637af)
2022-12-28 00:46:58 +01:00
Vadim Zeitlin
25c5f57f0b Initialize atoms used in wxGTK wxDataObject on demand
This allows to avoid having to call PrepareFormats() manually which was
not only verbose, but also error-prone as proved by the fact that
wxURLDataObject used wxTextURIListDataObject which used g_fileAtom in
its ctor without calling PrepareFormats() first and meant that this
class didn't work correctly unless some other wxDataObject had been
created before it.

See #23018.

(cherry picked from commit a577af1ca656e1f7060cbe47ce7ac92162e87386)
2022-12-28 00:45:01 +01:00
Vadim Zeitlin
2892794d70 Consistently include trailing NUL in wxMSW wxTextDataObject size
Fix a long-standing bug in wxMSW wxTextDataObject which returned the
size including the trailing NUL from its GetDataSize() and used the same
convention in GetData(), but didn't account for this NUL being included
into the buffer passed to SetData().

This was partially compensated by also passing the wrong (too small)
buffer size when calling SetData() from wxIDataObject, but still
resulted in problems when using SetData() with the length returned from
GetDataSize(), as done in wxDataViewCtrl code.

Fix this by now always considering NUL part of the buffer (as this is
the platform convention, i.e. all CF_TEXT data on the system clipboard
must include the trailing NUL) and taking it into account when
determining the buffer size in wxIDataObject.

This change is not fully backwards-compatible as it breaks any code
calling SetData() directly, as e.g. wxURLDataObject in wxMSW itself did,
so document it as such, but it's still worth making it as there doesn't
seem to be any other way of fixing the problem described in the linked
issue and direct calls to SetData() should be rare as simpler SetText()
should be used instead.

Also add a unit test for wxTextDataObject and extend the existing test
of wxURLDataObject.

This commit is a modified version of the master one as it still accepts
non-NUL terminated strings too, for compatibility, so it shouldn't break
any existing code.

See #22928, #23018.

(cherry picked from commit d737d98d278a43ef4b16a756f3115bbf65962358)
2022-12-27 23:37:55 +01:00
Vadim Zeitlin
92073680aa Fix scaling of standard MSW platform icons in high DPI
Use the correct scaling factor when creating the bitmap in
wxWindowsArtProvider, otherwise the bitmap was wrongly rescaled again
when actually using it.

It still seems wrong to always use the primary display scaling here, but
we just don't have any window to use in this code and at least it is
consistent and works when primary display scaling is not 100% now.

See #23031, #23038.

(cherry picked from commit 5a23fd7a6e3ea70f168645f575d59b3007e3635f)
2022-12-27 23:03:13 +01:00
Vadim Zeitlin
e934e0ec9f Move wxTextCtrl constructors out of line in wxMSW
When inheriting from std::streambuf, as is the case by default, and
creating wxTextCtrl in the application (as is common) and destroying it
in the library (as is even more so, as it's typically done when the
parent window is destroyed), having inline constructor but not inline
destructor apparently results in std::locale, which is part of
std::streambuf, to be allocated and destroyed using different heaps or
something similar when using TDM-GCC libstdc++, as destroying
std::locale inside the library corrupts the heap and results in crashes
when the next std::locale object is destroyed -- i.e. creating, and then
destroying, more than one wxTextCtrl results in a crash.

Work around this by moving the constructors out of line, as this is
sufficient to avoid the problem, even if it's exact causes are not
exactly clear.

This commit is best viewed with Git --color-moved option.

See #22639, #22735.

(cherry picked from commit 70c5ec6effb73330d025f8c4e9951c1ef582bfc6)
2022-12-27 21:57:53 +00:00
Vadim Zeitlin
d979a7f0d8 Fix memory leak of command line arguments in wxMSW
Use the same hack already used for wxEntryReal() before to define a
MSW-specific wxEntryCleanup() which frees the memory allocated by
::CommandLineToArgvW() after performing the common cleanup.

Also refactor the code dealing with them to avoid having different
wxArgs variables in wxBase and wxCode, which was almost certainly
unintentional and definitely very confusing. Now we keep just a single
wxArgs in wxBase and provide access to it from wxCore via the exported
functions.

See #23081, #23082.

(cherry picked from commit 3edc2982890246797295b10be1ec621ff96e64f0)
2022-12-27 22:24:20 +01:00
Maarten Bent
4705cb3a7a Simplify defining manifest in wx.rc
Avoid complicated preprocessor manipulations not needed any more since
the simplifications of 10d2354125 (Merge branch
'simplify-application-manifests', 2021-12-18).

See #23057, #23065.

(cherry picked from commit ddea807a2a904c7c5e0b0ac2a274ee8480eb5ce0)
2022-12-23 20:20:30 +01:00
Stefan Ziegler
2efb6e748a Fix retrieving printer information in wxMSW print dialog code
This didn't work because the result of the first call to GetPrinter(),
done only to retrieve the buffer size, doesn't matter and should _not_
be checked as otherwise we're never going to succeed retrieving anything
at all.

See #23068.

(cherry picked from commit 00f89c69deaf416ab1bc3b89bc5f7f9c986c37e6)
2022-12-23 20:18:54 +01:00
Vadim Zeitlin
39c2a485d5 Fix type of values passed to TIFFSetField()
This vararg function accepts any kind of values, without any checks, but
actually needs double for TIFFTAG_[XY]RESOLUTION and not int that we
passed to it, and which could result in the double values actually
having a NaN value of the word on the stack before the int happened to
have just the wrong value and which, in turn, resulted in a failure to
save the TIFF file later as libtiff checks that the values are valid,
i.e. positive and not-NaN. Note that we really need to pass the values
as doubles, even if they're stored as floats internally and returned as
such by TIFFGetField().

Also fix the types for all the other calls of this function, even if
this hasn't been observed to result in any problems so far.

See #23048, #23056.

(cherry picked from commit af923360abf278bf8a488238a85547d06344d4e4)
2022-12-23 19:49:50 +01:00
Vadim Zeitlin
d17f35d2ee Use wxLogNull to temporarily disable logging in wxZipInputStream
Using this class is simpler, more efficient and MT-safe, which is
important because wxZipInputStream can be used from a background thread
(e.g. to decompress a file downloaded from the network etc).

(cherry picked from commit c7255734dd71a7884e9c8f4d6a02c4e7b558fca6)

See #23054.
2022-12-23 19:46:07 +01:00