Commit graph

74355 commits

Author SHA1 Message Date
Vadim Zeitlin
5cc2983bee Test UTF-8 build variant with ASAN too
To avoid adding yet another build, enable UTF-8 and ASAN for the
existing C++20 build.
2023-03-24 19:17:59 +01:00
Vadim Zeitlin
b01faaafa5 Merge branch 'webview_webkitgtk_config' of https://github.com/TcT2k/wxWidgets
WebKit2GTK: Add wxWebViewConfiguration and child window support.

See #23374.
2023-03-24 18:09:27 +01:00
Paul Cornett
2d32b8cdd8 Fix GSource leak from idle processing
It is apparently not safe to call gtk_events_pending() from the idle
callback, as it can result in GLib failing to properly dereference some
GSource objects.

This leads to increasingly large amounts of CPU time being spent in GLib
processing internal lists of these GSource objects. So avoid calling
gtk_events_pending(), as it is not strictly necessary because our idle
source will remain installed if wxIdleEvent::RequestMore() is used, and
if no events have arrived the idle callback will be invoked again.

Closes #23364.

See #23368.
2023-03-24 18:08:41 +01:00
Tobias Taschner
49f7af6100
Add navigation action for webkitgtk2 backend 2023-03-24 15:10:42 +01:00
Tobias Taschner
1970806829
Remove unused GTK WebView new window handling code 2023-03-24 15:10:42 +01:00
Tobias Taschner
8038195952
Unify entries in wxWebViewEvent table 2023-03-24 15:10:42 +01:00
Tobias Taschner
e15a1ac18e
Add wxWebViewWindowFeatures and event
This replaces the previously implemented wxWebViewWindowInfo.

It explicitly breaks the previous API to enable WebKitGTK
integration and to make the usage in application code less error prone.

A new event wxEVT_WEBVIEW_NEWWINDOW_FEATURES is added to allow
access to the window features and the child web view.
2023-03-24 15:10:21 +01:00
Tobias Taschner
8d0685ee08
Add wxWebViewConfiguration support for webkitgtk2
Allows setting some webview settings which would be unavailable after
creation.
2023-03-24 15:10:20 +01:00
Tobias Taschner
42ca043d54
Add wx_check_webkit_version()
This function allows for runtime checks of the webkit version
2023-03-24 09:45:28 +01:00
Tobias Taschner
86ba6f979a
Implement wxEVT_WEBVIEW_WINDOW_CLOSE_REQUESTED
Implement wxEVT_WEBVIEW_WINDOW_CLOSE_REQUESTED for webkitgtk2.
2023-03-23 09:34:17 +01:00
Dan Gudmundsson
23ccdb23c8 Improve and document wxGLCanvas::CreateSurface()
This function must be called to be able to re-create the EGL drawing
surface after the window layout have changed, such as after a reparent
of the canvas or of it's grandparents.

Make it suitable for use in this case by re-creating the surface if
there already was one and document this function to make it part of the
public API.

Closes #23366.
2023-03-22 18:41:27 +01:00
Ryan Norton
e1c3962aa9 Improve wxURI parsing
- Update parsing IPvX addresses to follow RFC and add many more tests.
- Rework authority parsing for RFC edge cases.
- Fix a couple of other extreme edge cases.

Closes #23360.
2023-03-22 18:35:45 +01:00
Blake Madden
11358d7dcc Don't expose internal strings to translation in samples
Remove _() around string which it doesn't make sense to translate in the
sockets sample.

This doesn't actually change anything as this sample doesn't use
translations in any case, but still show a good example.

Closes #23362.
2023-03-22 18:26:05 +01:00
Artur Wieczorek
35a8d0f908 Fix building wxPropertyGrid with v3.0 compatibility enabled
Closes #23369.
2023-03-22 17:07:41 +01:00
Vadim Zeitlin
eaa326a93d Temporarily disable deprecation warnings in webkit2gtk code
Version 2.40 deprecates a few functions used in wxWebViewWebKit
implementation, resulting in new warnings breaking CI builds.

Avoid these warnings by suppressing them for now before the real
solution, involving using the new functions if they're available, can be
implemented.

See #23367.
2023-03-22 12:19:39 +01:00
Adrian Lopez
0331057aba Fix wxPropertyGrid tab traversal under wxGTK
Tab traversal from a wxPropertyGrid didn't work across wxPanel
instances or when the property grid was followed by a static control
such as wxStaticText due to implementing it "manually".

Fix this by using Navigate() to implement this instead, and just keep a
SetFocus() hack which is still needed for wxGTK.

Fixes #23354.

Closes #23358.
2023-03-18 21:00:48 +01:00
Tobias Taschner
1edb38b548 Fix MSW lib names for ARM64 with CMake build
Any 64 platform had the added _x64 suffix. This will now be _arm64
when building for ARM64.

Fixes: #23347

Closes #23355.
2023-03-18 20:58:15 +01:00
Vadim Zeitlin
f82bd9ea67 Merge branch 'webview_configuration' of https://github.com/TcT2k/wxWidgets
Add wxWebViewConfiguration.

See #23349.
2023-03-18 20:55:39 +01:00
Vadim Zeitlin
9ad79ba03a Merge branch 'thread-fixes'
Fix TSAN errors in thread unit tests.

See #23340.
2023-03-18 20:53:10 +01:00
Stefan Csomor
9c8dfe5b2a Wrap wxStaticText contents under Mac too
Instead of just clipping the label, wrap it. This is more consistent
with wxMSW and wxGTK and also generally more useful.

See #23345.

Closes #23341.
2023-03-18 20:51:28 +01:00
Vadim Zeitlin
c202385f3a Add a note about icons to wxMessageDialog documentation
Explain that the requested icon is not always used.

Closes #23353.
2023-03-18 20:50:10 +01:00
Vadim Zeitlin
28e0a7e01d Fix using Wine in wxMSW cross-CI workflow
Since 8.0~repack-3 version of the Debian Wine package, installing wine64
doesn't create wine64 symlink any more and wine package needs to be
installed to do it, apparently due to the changes done to fix
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029536

This resulted in the tests not running any more because we used wine64
for running them. Just use "wine" now and install wine package, as it
should still run 64-bit binaries just fine.
2023-03-18 18:00:36 +01:00
Paul Cornett
30181a9dd9 Fix handling of duplicate -arch or -framework options
See #23356
2023-03-17 11:56:59 -07:00
Tobias Taschner
235e71ef28
Edge: Hold environment in configuration 2023-03-17 11:58:35 +01:00
Tobias Taschner
05c77757e2
Edge: Send an error event for various API errors
These errors are rare, but can happen. This way user code can react to
Previously they where just logged.
2023-03-17 09:29:46 +01:00
Tobias Taschner
b48e5b4c66
Add wxWebViewConfiguration::SetDataPath()
While currently only implemented for the Edge backend GTK webkit could
also make use of such a setting.

Fixes: #19317
2023-03-17 09:29:46 +01:00
Tobias Taschner
dd4d5c75af
Add wxWebViewConfiguration
In 40ff38b63b wxWebView::GetNativeConfiguration() was
added which isn't suitable if multiple wxWebViewEdge instances are created with
different options (as they must share the same options). To prevent such errors
the previous method is replaced by the new class wxWebViewConfiguration which
can be shared between various wxWebView instances.

This explicitly breaks API to improve usage.

In the future the new class could also enable a good way to wrap various
common options/configurations available via native API.
2023-03-17 09:29:46 +01:00
Artur Wieczorek
8ad0f52da0 Include header with basic wxPGProperty classes in main wxPG header
This header shouldn't be included here but it was included here in
the previous versions of wxPG and user apps can be broken by removing it.
2023-03-15 19:10:02 +01:00
Artur Wieczorek
a07d17a8a4 Implement comparison operators for bitmasks with enum classes
Implementing bitmask-to-int comparison operators can help
in migrating from int-based bitfields to enum class bitmasks.
2023-03-15 19:02:29 +01:00
Vadim Zeitlin
8b2e010841 Stop using macro-based array in wxThread unit test
Use vector of unique_ptr instead.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin
b3ff1f3e61 Fix data race in wxGetTimeZone()
We could return a wrong value from this function if two threads called
it simultaneously, as gmtoffset value could be returned without DST
adjustment in one of them. And just accessing it from two different
threads without synchronization was a data race on its own.

Fix both problems by using an atomic int for it and taking care to only
set it to the correct value.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin
dd8935b07d Fix waiting for threads to exit in wxCondition unit test
Using sleep was not only fragile but also resulted in tons of TSAN
errors, so replace it by the similar approach to the one which was
already used to wait for the threads to start up.

This is horribly inefficient but we don't care about this in the test
and, at least, this does ensure that the threads exit before it ends.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin
0bc7aed861 Fix data race when resuming the thread in Delete()
Changing the state without a lock was a bug and resulted in a TSAN
error.

Fix this by moving the call to Resume() inside the region holding the
lock.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin
59312f5ba0 Fix possibly fatal race condition when calling OnDelete()
This function could be called on an already deleted object, which could
result in a crash, and always resulted in a TSAN error.

Fix this by calling it before releasing the internal lock, which
prevents this from happening, but will result in a deadlock if this
function is overridden to do something requiring any lock held by the
thread.

This is not ideal, but still seems to be like a lesser evil.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin
345b8ff505 Fix some brokenness in wxThread::Delete() unit test
Don't use sleep in this test as the thread may terminate before it
returns, possibly resulting in crashes that the existing comment warned
about, and definitely resulting in TSAN errors.

Also ensure that the thread doesn't terminate instead of just hoping
that it doesn't do it because it doesn't have time to run 30 iterations
of its entry function by passing the special value of 0 to ctor, which
explicitly prevents the thread from terminating on its own.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin
4f8f38a99c Fix calling wxThread::Delete() after thread exit in wxMSW
Contrary to what an existing unit test claimed to do, it did not test
deleting a joinable thread that had already terminated because it
actually hasn't had the time to terminate yet in the existing test (but
this will be changed soon). And calling Delete() on a thread which
really did already terminate resulted in error messages because it tried
to wait on an already invalid thread handle and ended up by returning
wxTHREAD_KILLED which was wrong (killing a dead thread failed too) and
was different from wxTHREAD_NO_ERROR expected by the test.

Fix this by not closing the thread handle when the thread terminates in
order to allow waiting for it again later, if necessary. This shouldn't
be a big deal because in normal circumstances the thread object will be
destroyed very soon, closing the handle anyhow. But the comment about
"not needing the handle any more" was wrong, as we may need it to get
the thread exit code again in the future.
2023-03-13 01:16:01 +01:00
Vadim Zeitlin
3cbab2d76b Fix data race on wxThreadInternal::m_cancelled
Don't access this variable outside of the critical section protecting
it.
2023-03-12 17:59:07 +01:00
Vadim Zeitlin
ee416b5b4b Use std::unique_ptr and not wxSharedPtr<> in wxThreadSpecificInfo
There is no need to share ownership with anybody here and unique_ptr<>
can be stored in a vector in C++11, so just use it.

No real changes.
2023-03-12 17:47:34 +01:00
Vadim Zeitlin
47092cff83 Move thread-specific info cleanup to wxThread::Exit()
This function was somehow being called too late, at least according to
TSAN, and resulted in a data race on the global wxAllThreadInfos vector
because the main thread could destroy it before the worker thread
exited, apparently.

It's not really clear how it happened but it seems that the dtor of a
local object in PthreadStart was called at unexpected moment, so don't
rely on RAII scope guard and just call ThreadCleanUp() manually right
before exiting the thread in Exit().

This mechanism is still fragile, not to say broken, e.g. we don't seem
to clean up thread-specific info at all if the thread is killed, but at
least we don't get TSAN data race warnings whenever a detached thread is
destroyed now.
2023-03-12 17:38:30 +01:00
Vadim Zeitlin
19100f63ca Merge branch 'cmake-large-files' of https://github.com/MaartenBent/wxWidgets
CMake: Enable large file support and other fixes.

See #23336.
2023-03-12 14:01:39 +01:00
Vadim Zeitlin
1c0e4dbf8e Merge branch 'webview_window_handling'
Add wxWebView child window handling.

See #23334.
2023-03-12 13:58:01 +01:00
Vadim Zeitlin
63ee6a3aa4 Consistently use "JavaScript", not "javascript", in documentation 2023-03-12 13:56:24 +01:00
Tobias Taschner
41194a7b2a CMake: silence shorten-64-to-32 warnings on macOS
See #23331.

Closes #23329.
2023-03-12 13:47:56 +01:00
Vadim Zeitlin
0fe6f04bfc Merge branch 'customize-dark-mode'
Allow customizing appearance in dark mode in wxMSW.

See #23275.
2023-03-12 13:42:45 +01:00
Vadim Zeitlin
24e8297bdd Change example in wxDarkModeSettings docs to avoid -Wswitch
As written, the code snippet in the docs would result in a warning from
gcc, so change it to avoid this.

See #23028.
2023-03-12 13:41:08 +01:00
Vadim Zeitlin
2ad3c0b428 Document restrictions on changing menu items appearance
Make it more clear that doing this should be avoided in portable code
and mention that owner drawn items are incompatible with dark mode.

See #23028.
2023-03-12 13:35:51 +01:00
Vadim Zeitlin
67683ab72a Don't reset wxMSW wxHeaderCtrl colours in dark mode on DPI change
We still need to use custom colours even if we don't have any user-set
colours when using dark mode, otherwise the colours reverted to the
normal ones for light mode (and hence wrong in the dark one) on DPI
change.

Closes #23322.
2023-03-12 13:21:25 +01:00
Artur Wieczorek
3142e028b2 Move wxPropertyGrid internal stuff to the separate private header 2023-03-10 23:57:43 +01:00
Maarten Bent
865f7aced2
CMake: Apply no-RTTI compile options directly to targets
Don't set global compile options or defines.
2023-03-10 00:04:51 +01:00
Maarten Bent
ea56496e0a
CMake: Update documentation of wxWidgets_USE_FILE
This is not defined in CONFIG mode, so check its availability before using.
2023-03-09 23:59:13 +01:00