Commit Graph

70478 Commits

Author SHA1 Message Date
Vadim Zeitlin
7d1a7ef942 Respect --disabled-sys-libs when checking for libcurl
Don't use system libcurl if --disabled-sys-libs was used, but warn about
it as this could be unexpected.

We could consider including libcurl as submodule, and use the built-in
version as a fallback, but it's a relatively big repository (100MiB+),
so it's not clear if it would be a good idea to do it.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
abcc31c6b2 Update wxCredentialEntryDialog to use wxWebCredentials
As a side effect, make wxWebCredentials default-constructible.

Also demonstrate using wxCredentialEntryDialog in the sample.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
31a441e814 Use separate test cases for wxWebRequest auth tests
This allows to easily run both auth tests at once without all the other
tests and it's not like we reuse much (or actually anything) by having
them as sections in the same test case anyhow.

This commit is best viewed ignoring whitespace-only changes.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
1e6d6be8bb Add wxWebCredentials and use it in SetCredentials()
Prefer using a class encapsulating both the user name and the password
to using a pair of variables.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
8eab460c0d Sort DEFAULT_wxUSE_XXX in alphabetical order in configure
Just sort the features in the same section in alphabetical order to make
it easier to find the given feature in the list (or confirm that it is
not present).

No real changes.
2021-01-10 19:55:37 +01:00
Vadim Zeitlin
3b214608b8 Merge branch 'wxRibbon-coord-functions'
Fix wxRibbonToolBar coordinate functions for non-first group: they only
worked correctly for the first group before.

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

Closes https://github.com/wxWidgets/wxWidgets/pull/2163
2021-01-10 19:28:18 +01:00
Vadim Zeitlin
5c1a27488f Express tool position rectangle position consistently
Use tool position as offset from group position and not vice versa, both
because this was already done like this in the other places and because
this makes more sense: the tool is inside the group, so its position is
relative to it.

No real changes.
2021-01-10 19:26:33 +01:00
Vadim Zeitlin
aed13bb9a9 Remove unnecessary temporary variable in wxRibbonToolBar
Just return the wxRect directly.

No real changes.
2021-01-10 19:25:53 +01:00
Gary Allen
ca4acfdffa Fix wxRibbon tooltips: show them only once and not over dropdown
Don't update wxRibbonToolBar and wxRibbonButtonBar tooltips each time
the mouse was moved, this was inconsistent with the standard tooltips
behaviour and resulted in flicker.

Also don't show tooltips at all over a dropdown, as they partially
covered and, again, such behaviour is very non-standard.

Closes https://github.com/wxWidgets/wxWidgets/pull/2162
2021-01-10 19:20:16 +01:00
Gary Allen
027c1b8304 Update wxRibbonToolBar docs 2021-01-10 20:18:42 +02:00
Vadim Zeitlin
b980e2e859 Fix warnings about possibly unused variable in TGA code
Just a minor fix after the changes of 0c939ae727 (Implement reading 16
and 32-bit color-mapped TGA images, 2020-12-11).

No real changes.
2021-01-10 19:03:19 +01:00
Gary Allen
0ee16339ae Fix wxRibbonToolbar Coord Functions 2021-01-10 18:34:58 +02:00
Vadim Zeitlin
fe197d7527 Add small wxSecretString helper for wiping strings values
This is simpler and more robust than remembering to call WipeString()
manually.
2021-01-10 01:21:45 +01:00
Vadim Zeitlin
f8aa5785ce Make wxSecretValue always available, even when !wxUSE_SECRETSTORE
This allows to write the code using this class without peppering it with
wxUSE_SECRETSTORE checks that would otherwise be necessary to support
Unix builds on system without libsecret.

No real changes.
2021-01-10 01:20:47 +01:00
Vadim Zeitlin
8820bb9609 Test using wrong credentials in the auth unit tests too
In addition to verifying that the correct password works, check that
using a wrong one does not.
2021-01-10 00:41:05 +01:00
Vadim Zeitlin
b64ad7f06d Test Basic, not Digest, authentication method in the test
Basic authentication method unit test somehow used Digest authentication
method.
2021-01-10 00:33:39 +01:00
Vadim Zeitlin
6bb2a3b457 Reformat WinHTTP code
No real changes, just try to avoid over long lines.

Also use early returns in case of WinHTTP functions failures everywhere
for consistency.

This commit is best viewed ignoring whitespace-only changes.
2021-01-09 21:51:38 +01:00
Vadim Zeitlin
780ce796b4 Add wxWinHTTPSetOption() helper
This allows to avoid using temporary variables just to be able to pass a
pointer to them to WinHttpSetOption().

No real changes, just a simplification.
2021-01-09 21:50:26 +01:00
Vadim Zeitlin
24c7baa07e Add wxRESERVED_PARAM symbolic constant and use it instead of 0
This is more readable than just using "0" or "NULL" and shorter than
writing a comment every time.

No real changes.
2021-01-09 21:31:41 +01:00
Vadim Zeitlin
1ebfda6d89 Remove unnecessary cast from WinHttpSetStatusCallback() call
This doesn't seem to be needed, our callback has the correct signature.

If it's required for some non-MSVC compilers (e.g. MinGW with old SDK),
it would be better to use the cast only conditionally to at least keep
the MSVC build type-safe.
2021-01-09 21:26:17 +01:00
Vadim Zeitlin
aa7c6c3aa8 Switch to using WinHTTP for parsing URLs
It seems better to rely on the well-tested WinHTTP URL parsing functions
rather than on our own wxURI. It should also allow to support any new
URI schemas if support for them is ever added to WinHTTP.
2021-01-09 21:23:31 +01:00
Vadim Zeitlin
8ace65bbec Use more readable case-insensitive comparison function
IsSameAs(..., false) is not very clear, while CmpNoCase() hopefully is.

No real changes.
2021-01-09 21:06:18 +01:00
Vadim Zeitlin
88a3e9c0a3 Use symbolic constants for HTTP ports and status codes
No real changes, just avoid using raw numbers, which is not very
readable, notably for HTTP_STATUS_PROXY_AUTH_REQ which is not really a
well-known value.
2021-01-09 21:04:18 +01:00
Vadim Zeitlin
5d236edeed Ensure wxWebRequest is in idle state before starting it
Check that current state is State_Idle in wxWebRequest itself only once
instead of doing it in 2 (out of 3) wxWebRequestImpl implementations.

Also assert if this is not the case instead of silently doing nothing
which would surely be more difficult to debug.
2021-01-09 21:00:38 +01:00
Vadim Zeitlin
af13bdde80 Remove redundant assignment in wxWebResponseWinHTTP::GetStatus()
No changes, just remove the unnecessary line -- status was already
initialized as 0.
2021-01-09 20:53:30 +01:00
Vadim Zeitlin
8c0855ad25 Fix test for invalid WinHTTP session handle
INVALID_HANDLE_VALUE is not used for WinHTTP handles and WinHttpOpen()
returns NULL (0) and not INVALID_HANDLE_VALUE (-1).
2021-01-09 18:44:05 +01:00
Vadim Zeitlin
5d256988be Add wxMSWFormatMessage() and use it from other places
Don't duplicate calls to ::FormatMessage(), which is difficult to use
correctly, in wxCrashReport and wxWebRequestWinHTTP, but just reuse the
same code that was already present in wxSysErrorMsgStr() after
refactoring it into a reusable function allowing to specify the module
name to use for the error code lookup (before falling back to
interpreting it as system error code).

This fixes not trimming the trailing "\r\n" from the string in the other
places (wxWinHTTPErrorToString() had code to do it, but it was wrong,
while wxCrashContext::GetExceptionString() didn't do it at all) and
avoids duplication.
2021-01-09 17:41:49 +01:00
Paul Cornett
4ed8ccff95 Use a better method of drawing a point in wxGCDC::DrawPoint()
Drawing a circular point into a square pixel does not completely fill the pixel
with the new color, resulting in an alpha-blended appearance. Instead, draw a
square into the pixel. As a bonus, this is much faster, at least with Cairo.
See #19037
2021-01-09 08:39:17 -08:00
Vadim Zeitlin
2869e1ccd6 Implement wxSysErrorMsg() in terms of wxSysErrorMsgStr()
Instead of doing it the other way round, as it has several advantages:

1. wxSysErrorMsgStr() is not limited by the static buffer size any
   longer, i.e. doesn't truncate errors even longer than 1KiB.
2. Code is much simpler and more obviously correct.
3. We avoid an extra and absolutely unnecessary buffer copy.

No real changes.
2021-01-09 17:32:12 +01:00
Vadim Zeitlin
ccd2064ae8 Remove unnecessary use of __WXFUNCTION__ from wxLog code
Just micro cleanup: there doesn't seem to be any need to show which
function we're in as FormatMessage() is only called from a single place
anyhow, so shorten and simplify the code.
2021-01-09 17:21:02 +01:00
Vadim Zeitlin
c70ac66200 Simplify and make more robust wxWebSessionWinHTTP initialization
Rename Init() to Open() as we need this method to return bool to
indicate its success in order to avoid using non-initialized handle
later. Init() is also reserved, by convention, for the common part of
all class ctors in wx code.

Remove m_initialized entirely, it doesn't seem to be obviously better to
cache the failure to create a session than to retry doing it every time
(in fact, it would seem to be worse) and not having it is simpler.

This commit is best viewed ignoring white space.
2021-01-09 16:56:04 +01:00
Stefan Csomor
108b48f691 fixing bug concerning retain counts for native representation of custom data formats
The native NSPasteboardType is a CFStringRef. Assigning this had two leaks, also the array iteration was not properly reflecting the desired direction
2021-01-09 13:43:54 +01:00
Dimitri Schoolwerth
b86bcb09ce Travis CI: Use default target for CMake iOS build
Remove an explicitly set CMAKE_OSX_DEPLOYMENT_TARGET from the CMake iOS
build in order to use the default value which is now also set to an iOS
instead of macOS version.
2021-01-08 13:03:24 +01:00
Dimitri Schoolwerth
086ad7bc9a CMake: Fix out of sync iOS/macOS deployment target
The minimal sample doesn't have an implicit deployment target set, while
the library does through CMakeLists.txt in root. This can result in iOS
link errors when not explicitly setting CMAKE_OSX_DEPLOYMENT_TARGET as
the sample will then use a target OS with an architecture that may not
be present in the library with its current target OS version.

Fix by copying the part setting CMAKE_OSX_DEPLOYMENT_TARGET in the
library to the minimal sample as well. Both parts should be kept in sync
but that still seemed preferable to additionally polluting an example
file for CMake usage with a dependency by introducing a common include
file.
2021-01-08 13:02:30 +01:00
Dimitri Schoolwerth
161ecbf01d CMake: Separate minimal support for iOS and macOS
Differentiate between the minimal supported version of macOS (10.10)
and iOS (12.0) instead of setting CMAKE_OSX_DEPLOYMENT_TARGET to
(macOS-only) 10.10 for both platforms.
2021-01-08 13:00:02 +01:00
Jouk
003d24d3c1 workaround for which is probably a compiler-bug on OpenVMS-AXP 2021-01-07 09:47:46 +01:00
Vadim Zeitlin
ec2ea5c7fa Handle request still in progress gracefully on shut down
Cancel the request and wait until it actually is cancelled when exiting
the sample.

This is a bit ugly, especially the busy-waiting part, but still better
than potentially crashing.
2021-01-06 23:54:51 +01:00
Stefan Csomor
86c1fe4c79 Fixing crash under BigSur
We get a late redraw event in the current 11.X versions, fixes #19030
2021-01-05 15:35:48 +01:00
Vadim Zeitlin
d22956a56a Tiny simplification in wxWebRequestWinHTTP code
Add and use SetFailed(error) function for symmetry with the existing
SetFailedWithLastError().
2021-01-05 00:41:21 +01:00
Vadim Zeitlin
dbc1d9c40e Fix cancelling wxWebRequest under MSW
A cancelled request is not supposed to end up in the "failed" state, but
it did, resulting in showing an error in the webrequest sample after
pressing on the "Cancel" button, which was clearly unwanted.
2021-01-05 00:38:16 +01:00
Vadim Zeitlin
dd23d2cf25 Fix and simplify wxWebRequestImpl objects ref counting
When cancelling a request it was possible for it to be deleted while it
was still used from another thread.

Fix this and make the code much more obviously correct by simply
"locking" the request until the event generated by it is processed: now
IncRef() and DecRef() calls are always balanced as they're called from
ctor and dtor of StateEventProcessor helper only.
2021-01-05 00:26:49 +01:00
Vadim Zeitlin
d2dc11da4f Allow starting request by pressing "Enter" in the sample
Just a small ergonomic improvement.
2021-01-04 23:16:52 +01:00
Vadim Zeitlin
f89781bfdd Simplify status bar updates in the webrequest sample
Use wxLogStatus() to update the status bar, this is shorter and simpler
than using GetStatusBar()->SetStatusText(wxString::Format(...)).

Also use wxFrame::SetStatusText() which forwards to wxStatusBar method
with the same name when we want to just clear the status bar.

No real changes.
2021-01-04 02:13:53 +01:00
Vadim Zeitlin
6e546a3d4b Don't use wxSharedPtr<> in factory registration code
Shared ownership semantics again seems inappropriate here as we're not
actually sharing the pointers here, so just use raw pointers instead
(with C++11 we could use std::unique_ptr<>, but this is impossible with
our own map and scoped pointer implementations).

No real changes.
2021-01-04 02:06:10 +01:00
Vadim Zeitlin
989cafe535 Take raw pointer and not wxSharedPtr<> in SetData()
Using shared pointer seems to be ill-advised here, the stream shouldn't
be shared as it's going to be used by wxWebRequest itself and can't be
used by the application code in parallel, so the ownership transfer
semantics is more appropriate.

We could take a wxScopedPtr<> instead, but wx API takes ownership of raw
pointers everywhere else, so do it here too.

Incidentally fix a bug with calling IsOk() on a possibly null pointer.
2021-01-04 01:57:36 +01:00
Vadim Zeitlin
b58ee58a7b Update copyright years to 2021
Just run misc/scripts/inc_year and commit the results.

See #18690.
2021-01-03 18:12:37 +01:00
Vadim Zeitlin
b2cb5e7f3b Fix wxChoice drop down height without visual theme in wxMSW
When using pre-v6 comctl32.dll (e.g. by disabling the visual styles
explicitly or by just not using the manifest), we need to update the
drop down height manually, and for this we must ensure that overridden
wxChoice::DoMoveWindow() is called from MSWUpdateDropDownHeight().

Closes #19026.
2021-01-03 18:10:03 +01:00
Vadim Zeitlin
35b0d4e696 Merge branch 'update-third-party-libs'
Update third party libraries to their latest releases.

See https://github.com/wxWidgets/wxWidgets/pull/2157
2021-01-03 15:35:23 +01:00
Artur Wieczorek
31ae1f8094 Fix build with wxUSE_OLE==0 2021-01-02 10:20:12 +01:00
Vadim Zeitlin
faff721ef0 Merge branch 'image_data_object' of https://github.com/a-wi/wxWidgets
Implement wxImageDataObject to allow copying wxImage, including its
metadata, to/from clipboard.

See https://github.com/wxWidgets/wxWidgets/pull/2156
2021-01-02 00:27:44 +01:00