Commit Graph

70049 Commits

Author SHA1 Message Date
New Pagodi
252a920bd7 Use main thread for the socket poller if possible
On windows and systems where wxUSE_EVENTLOOP_SOURCE is 1, it is
possible to monitor socket descriptors for activity from the main
thread. The SocketPoller class used with wxWebSessionCURL is modified
to use an implementation class that does so.

On windows, the implementation uses the winsock1 function
WSAAsyncSelect to send events to wxWebSessionCURL when activity is
detected. When wxUSE_EVENTLOOP_SOURCE is 1, a wxEventLoopSource is used
to monitor for socket activity. The event loop source is given a custom
wxEventLoopSourceHandler object to send the necessary event.
2021-02-07 20:55:24 -06:00
New Pagodi
88dca37b3f Change cancel method for wxWebRequestCURL objects
Previously wxWebRequestCURL objects were canceled by removing their
CURL easy handle from the CURLM multihandle. Unfortunately the really
only pauses the connection and does not truly cancel it. This commit
tries to stop the transfer by retrieving the active socket from the CURL
handle for the transfer and closing it.

There are some complications in doing this because the option curl uses
to get the socket have changed over the years. A combination of compile
time and run time checks are used to use the appropriate options to get
the socket. However in the case of 64bit windows using a curl version
older than 7.45.0 simply won’t have an usable option. In this case,
it seems nothing can be done.
2021-02-07 20:49:50 -06:00
New Pagodi
774a752bed Track active transfers in wxWebSessionCURL class
At various points in a transfer being managed by the wxWebSessionCURL
class we need to perform operations on a wxWebRequestCURL object.
However it’s possible for the request object to be deleted while the
transfer is in progress.

To ensure that the request objects are valid, keep track of the request
objects with a hash map. Objects are added to the map when a transfer is
started and removed when the transfer is complete or in the request’s
destructor.
2021-02-07 20:49:37 -06:00
New Pagodi
b0b53e8db3 Check wxWebSessionCURL::StartRequest really starts 2021-02-07 20:48:12 -06:00
New Pagodi
48cba4f88e Set wxWebResponseCURL buffer size as soon as known
Currently for wxWebRequestCURL objects using memory storage, a download
is processed by appending to a wxMemoryBuffer each time the write
callback is called. For a large transfer, this can result in many, many
reallocation calls and can block the main application.

This commit uses the progress callback for wxWebRequestCURL objects
added in a previous commit to set a minimum size for the buffer as soon
as it is known.
2021-02-07 20:43:51 -06:00
New Pagodi
3e5fd5462d Add a progress callback for wxWebRequestCURL
This commit adds a progress callback for use with wxWebRequestCURL
objects. This has some complications because over the years curl has
changed the signature of the callback.

A combination of compile-time and run-time checks is used to make sure
the appropriate callback and preferred return value are used.
2021-02-07 20:37:47 -06:00
New Pagodi
f406fcd12a Fix compilation of SocketPoller class on windows 2021-02-07 00:02:04 -06:00
VZ
38510d8e89 Normalize whitespace
No real changes.
2021-02-07 00:02:04 -06:00
New Pagodi
b1b53ed85c Remove the worker thread from wxWebSessionCURL
Instead of having wxWebSessionCURL run a worker thread that uses curl
to monitor and process network activity, set up a separate socket
poller class to monitor socket activity. The socket poller class will
throw an event back to wxWebSessionCURL when it detects activity on the
sockets so that it can tell curl to process the activity in the main
thread.
2021-02-07 00:02:04 -06:00
Artur Wieczorek
414f211b8a Add tests of wxGraphicsBitmap
Add tests of creating wxGraphicsBitmap from specific to wxMSW and wxOSX
32-bit RGB wxBitmaps (non-alpha).
2021-02-06 21:43:47 +01:00
Artur Wieczorek
5b52a8646b Use IWICBitmap to cache bitmap in wxD2DBitmapResourceHolder (Direct2D)
IWICBitmap is more native than wxBitmap so it should better represent
the internal state of D2DBitmap.
2021-02-06 21:43:46 +01:00
Paul Cornett
28d1ddec90 Set layout direction for wxClientDC
Should have been part of
62c119fa1e (Fix RTL mirroring for wxClientDC, etc with GTK3, 2021-02-06)
2021-02-06 12:31:14 -08:00
AliKet
62ae887159 minor correction to widgets sample to work correctly in RTL layout 2021-02-06 08:39:01 -08:00
Paul Cornett
62c119fa1e Fix RTL mirroring for wxClientDC, etc with GTK3
The changes to the Cairo context must be done before wxGC::CreateFromNative()
is called, otherwise they will be overwritten
2021-02-06 08:28:13 -08:00
Vadim Zeitlin
67fc7c5508 Merge branch 'remove-setup0.h'
Drop wx/setup0.h files hack and just use wx/setup.h.

See https://github.com/wxWidgets/wxWidgets/pull/2205
2021-02-06 14:26:25 +01:00
Vadim Zeitlin
6e145f8f9f Merge branch 'msw_edge_fixed' of https://github.com/TcT2k/wxWidgets
Allow using a fixed Edge version with wxWebViewEdge and other
wxWebView-related improvements and refactoring.

See https://github.com/wxWidgets/wxWidgets/pull/2212
2021-02-06 14:22:42 +01:00
Vadim Zeitlin
7cca64bb0e Merge branch 'i18n-enh' of https://github.com/lanurmi/wxWidgets
Keep strings in wxstd.pot in the natural, but the same under all
platforms, order.

See https://github.com/wxWidgets/wxWidgets/pull/2214
2021-02-06 14:21:25 +01:00
Artur Wieczorek
27141e6a7c Fix test of wxImage::InitAlpha() 2021-02-06 01:37:05 +01:00
Artur Wieczorek
1adc38c42b Add tests of wxImage::InitAlpha() 2021-02-06 01:07:32 +01:00
Artur Wieczorek
46302896e1 Fix caching source bitmap in wxD2DBitmapResourceHolder (Direct2D)
Because cached wxBitmap is used only to help in representing native D2D
bitmap in some operations it shouldn't be exposed directly and dedicated
methods should be implemented instead.
2021-02-06 00:36:45 +01:00
Artur Wieczorek
8c599408ab Fix creating GDI+ Bitmap from wxBitmap having both alpha channel and mask
If source wxBitmap has both alpha channel and mask we have to apply mask
to the target GDI+ Bitmap on our own by blending its alpha values with
mask. For non-masked pixels alpha channel values will remain intact and
for masked pixels they will be set to the transparent value (0).
2021-02-05 23:55:58 +01:00
Artur Wieczorek
20fc422550 Fix creating sub-bitmap of wxGraphicsBitmap (GDI+)
Retrieved sub-bitmap should have the same pixel format like
the source bitmap.
2021-02-05 23:53:28 +01:00
Artur Wieczorek
e73cb85246 Add tests of wxGraphicsBitmap 2021-02-05 23:52:29 +01:00
Artur Wieczorek
de7115b9ed Added missing references to some dynamically loaded Cairo API's 2021-02-05 23:05:50 +01:00
Artur Wieczorek
cda4e94a7b Add to ImageRGBMatcher ability to check alpha values in wxImage tests 2021-02-05 23:04:55 +01:00
Artur Wieczorek
c8a47a4313 Fix comparing wxImages in tests
Iterate through pixels instead of individual RGB components to report
proper coordinates of found mismatch.
2021-02-05 23:03:59 +01:00
Tobias Taschner
d17e8978a6 Make wxWebView::RunScript() const 2021-02-05 22:18:31 +01:00
Vadim Zeitlin
e88b55bfe1 Apply suggestions from code review 2021-02-05 22:18:30 +01:00
Tobias Taschner
d11ab7f751 Skip some unsupported tests with wxWebViewEdge 2021-02-05 22:18:30 +01:00
Tobias Taschner
2e94551f6f Clear string in wxJSON::DecodeString() to avoid unintentional appending 2021-02-05 22:18:30 +01:00
Tobias Taschner
788bef2cf2 Select Edge as the default backend on MSW
If enabled and available at runtime use the Edge backend.
This is probably more useful for most users.
2021-02-05 22:18:29 +01:00
Tobias Taschner
b351e7762d Move common wxWebView code to base class
Removes duplicate code in the various webview backends
2021-02-05 22:18:29 +01:00
Tobias Taschner
0d82348328 Add wxWebView::GetBackendVersionInfo()
Allows to get the WebView backend version if available
Currently implemented for IE, Edge and webkit2.
2021-02-05 22:18:28 +01:00
Tobias Taschner
489afb3336 Allow using a fixed version with wxWebViewEdge
A fixed version may be distributed with the application
and wxWebViewEdge::MSWSetBrowserExecutableDir() allows
it's usage with wxWebViewEdge.
2021-02-05 22:18:28 +01:00
Vadim Zeitlin
49fcd34335 Merge branch 'rerun-test-on-asan-failure'
Try to work around a spurious failure in ASAN builds on GitHub Actions.

See https://github.com/wxWidgets/wxWidgets/pull/2217
2021-02-05 21:38:42 +01:00
Vadim Zeitlin
a8d869f2c8 Merge branch 'docs/avoid-recommending-wxNewId' of https://github.com/catalinr/wxWidgets
Fixes for wxNewId() documentation.

See https://github.com/wxWidgets/wxWidgets/pull/2211
2021-02-05 21:38:16 +01:00
Vadim Zeitlin
b90cca5103 Fix ignoring docs changes in GitHub Actions CI builds
The path expression must match the full path, not just be its prefix.

Co-Authored-By: PB <PBfordev@gmail.com>
2021-02-05 21:35:51 +01:00
Vadim Zeitlin
211cde11d4 Rerun the test if LeakSanitizer crashed while running it
This crash (see https://github.com/google/sanitizers/issues/1353)
happens sporadically but regularly enough to be annoying, so try to work
around it by rerunning the test and hope that it doesn't happen twice in
a row.
2021-02-05 19:14:06 +01:00
Vadim Zeitlin
53ece3c2ed Don't use pushd/popd unnecessarily
Each step executes in its own shell, so it's not necessary to restore
the previous working directory and a simple "cd" would do just fine but,
in fact, we don't even need this as we can just set the working
directory at the step level.
2021-02-05 19:07:28 +01:00
Vadim Zeitlin
1aae6e26ca Remove useless echo from GitHub CI script
"Testing" is already shown as the step title.
2021-02-05 18:56:27 +01:00
Dan Gudmundsson
93160b9667 Make non-bundled apps work on recent macOS versions
Currently non-bundled apps don't work on Catalina and Big Sur and what's
worse is that old the code makes it impossible to make it work in user
code.

Remove the old workaround, and replace it with an alternative one, which
seems to work under all supported macOS versions and is also used by
Tcl/Tk.

Closes https://github.com/wxWidgets/wxWidgets/pull/2216
2021-02-05 18:02:25 +01:00
Gary Allen
f4172b0b46 Allow overriding wxMenu::MSWCommand() in wxMSW
This can be useful to implement custom handling of WM_COMMAND for the
popup menus, so make this function virtual and document it to indicate
that it is now part of the public API.

Closes https://github.com/wxWidgets/wxWidgets/pull/2170
2021-02-05 12:04:25 +01:00
Lauri Nurmi
232d1c1156 Feed sorted output to xargs when generating wxstd.pot
The `find' command isn't generally guaranteed to output filenames in
particular order, and without sorting, the resulting .pot from identical
input files could have its source line comment entries in different order
depending on what OS and filesystem it was generated on.

Co-authored-by: VZ <vz-github@zeitlins.org>
2021-02-05 00:50:33 +02:00
Lauri Nurmi
87c56c7c1d Do not sort content of generated POT files alphabetically
Sorting is discouraged even by the GNU gettext documentation:
https://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html#Output-details

Alphabetical order means related messages that are close to each other
in a source file are likely to be far far away from each other in the .po
file that a translator works on.

Sorting was added in ea8849aaf6 (updated to use msgmerge, 2000-03-07)
2021-02-04 23:01:07 +02:00
catalinr
bfa4dd01d7 Link wxNewId() with wxRegisterId() in the docs 2021-02-03 12:20:07 +02:00
catalinr
baabb37f8f Avoid recommending deprecated wxNewId in the docs 2021-02-03 12:10:37 +02:00
Paul Cornett
a571ec6fbb Fix GTK wxPrinterDC gradient fill radius
All the other implementations use the rect width/height, not the diagonal
2021-02-02 10:16:42 -08:00
Paul Cornett
55b7198e92 Remove some run-time dependencies on X11 backend with GTK3
As with Wayland, the X11 backend may not be available at run-time,
so types defined in it can't be used
2021-02-02 10:15:35 -08:00
Lauri Nurmi
3514dda407 Fix compilation with curl <7.21.6 used under CentOS 6
According to cURL documentation, the CURLOPT_ACCEPT_ENCODING symbol
was called CURLOPT_ENCODING earlier.

Closes https://github.com/wxWidgets/wxWidgets/pull/2210
2021-02-02 13:03:06 +01:00
Vadim Zeitlin
56017bfffb Merge branch 'generic-dvc-multisel-fixes'
Fix selection handling by Left/Right key handlers in generic
wxDataViewCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/2207

Closes #19068.
2021-02-02 13:01:37 +01:00