Commit Graph

70478 Commits

Author SHA1 Message Date
Vadim Zeitlin
4c19572d9d Use switch over enum-valued variable rather than "if"s
No real changes, just make sure we use an (exhaustive) switch rather
than a less obvious sequence of if statements.
2021-01-16 23:33:18 +01:00
Artur Wieczorek
9fe7e0a78e Get rid of unnecessary static casts 2021-01-16 23:01:50 +01:00
Artur Wieczorek
ef9cd70b21 Avoid converting wxBitmap to wxImage
We can set wxBitmap colour mask directly so there is no need
to do it with converting wxBitmap to wxImage.
2021-01-16 23:01:49 +01:00
Artur Wieczorek
321f38831e Fix sizes of images stored in generic wxImageList
Sizing the images stored in the list should stick to the convention
adopted in the native wxImageList implemented in wxMSW.
Images stored in the list should have the sizes as it is declared for
the list even if provided bitmaps have different sizes.
In case of discrepancies their dimensions should be adjusted accordingly
(cropped or extended).
2021-01-16 23:01:49 +01:00
Artur Wieczorek
bde82aa9fb Fix adding image using bitmap and mask colour to nonmasked wxImageList (wxMSW)
If image using bitmap and mask colour is added to nonmasked wxImageList we
need to convert effective mask to alpha channel values prior to adding the
image to the native list to preserve transparency.
2021-01-16 23:01:48 +01:00
Stefan Csomor
b1cf40868d Fix memory leak in wxOverlay in wxOSX
Define dealloc explicitly to make sure the property is released.
2021-01-16 22:20:10 +01:00
Stefan Csomor
458d4666df Fix wxBundleResourceHandler::LoadFile() return value
Return true in case of success instead of always returning false.
2021-01-16 22:18:43 +01:00
Vadim Zeitlin
c41041a3b6 Show error description if available when Cancel() test fails
Hopefully this might provide more information about the failure of this
test in MSVS 2008 build on AppVeyor.
2021-01-16 21:21:08 +01:00
Vadim Zeitlin
4a5de04ece Fix background colour drawing in wxGenericTreeCtrl under Mac
Revert 8535cde836 (Remove apparently unnecessary m_hasExplicitFont,
2020-07-14) and make 9cd3ab5ebd (Improve wxGenericTreeCtrl colours/fonts
updating on theme change, 2020-07-14) really work as expected by using
not only m_hasExplicitFont, but also m_hasExplicit{Fg,Bg}Col in order to
ensure that we only update the attributes if they hadn't been explicitly
set.

This is necessary because the hack with reusing m_has{Fg,Bg}Col didn't
work under Mac where the colour wasn't used at all when they were false.
This still seems to be a problem as the behaviour is different from that
of the other ports, but fixing this in wxOSX doesn't seem to be simple,
so don't rely on this working and use separate variables instead.

Closes #18940.
2021-01-16 19:17:57 +01:00
Vadim Zeitlin
9c66a9a8db Merge branch 'macos-native-statusbar' of https://github.com/vslavik/wxWidgets
Improve macOS status bar appearance and simplify code.

See https://github.com/wxWidgets/wxWidgets/pull/2160
2021-01-16 18:57:23 +01:00
Vadim Zeitlin
ce4cb33c20 Remove tooltip tracking code from wxOSX
This doesn't seem to be necessary and is actually actively harmful, as
this code prevented tooltips from working with non-native windows, such
as those used inside wxSplitterWindow in the splitter sample.

Just remove this code entirely and add SetToolTip() calls to the sample
to show that they do work now.

Closes https://github.com/wxWidgets/wxWidgets/pull/1978

Closes #14220.
2021-01-16 18:54:27 +01:00
Václav Slavík
634f60ff23 Remove redundant code from wxStatusBarMac
Remove a lot of Mac-specific code from wxStatusBarMac in favour of using
shared wxStatusBarGeneric:

- Now that wxFRAME_EX_METAL aka NSWindowStyleMaskTexturedBackground
  doesn’t affect text placement, there’s no reason for customized
  DrawFieldText(). As a side effect of this removal, ellipsizing fields
  is now supported.

- Remove customized DoUpdateStatusText() code that is no longer needed.

See https://github.com/wxWidgets/wxWidgets/pull/2160#pullrequestreview-563916013
2021-01-16 18:30:55 +01:00
Vadim Zeitlin
717e6590bd Merge branch 'macos_wkwebview' of https://github.com/TcT2k/wxWidgets
Use WKWebView for wxWebView Implementation under Apple systems.

See https://github.com/wxWidgets/wxWidgets/pull/2113
2021-01-16 16:20:58 +01:00
Vadim Zeitlin
588dcab629 Merge branch 'cmake-min-ios-version' of https://github.com/discnl/wxWidgets
Differentiate between macOS and iOS minimal supported version for CMake
builds.

See https://github.com/wxWidgets/wxWidgets/pull/2146
2021-01-16 16:16:16 +01:00
Scott Talbert
fb815d400f Fix quoting in Doxyfile ALIASES
This fixes documentation generation using Doxygen 1.9.0.

Closes https://github.com/wxWidgets/wxWidgets/pull/2159
2021-01-16 16:12:13 +01:00
Václav Slavík
287ee5e4c7 Fix window background tinting on macOS 11
macOS 11 has an option (on by default) to tint window backgrounds with
wallpaper colors. This means that standard window background color is
not a constant anymore and can change as the window is moved across the
screen.

The key to supporting this is to _not set background color_ internally
to what we think is the correct default color, or to repaint
backgrounds. Let the OS handle the default behavior instead.

Closes https://github.com/wxWidgets/wxWidgets/pull/2158
2021-01-16 16:10:02 +01:00
Vadim Zeitlin
bc4f78598d Improve instructions about using git notes
Notable record the commands that can be used to recover from a conflict
with the server version of the notes (merging notes is more involved and
usually not worth it, they can just be re-added after resetting).
2021-01-16 16:08:32 +01:00
Vadim Zeitlin
1065e61ab7 Merge branch 'log-ms'
Use milliseconds in wxLog timestamps.

See https://github.com/wxWidgets/wxWidgets/pull/2164
2021-01-16 16:00:57 +01:00
Vadim Zeitlin
0777fda680 Rearrange states in the switch in a more logical order
No real changes, just try to organize the code in a more logical order.
2021-01-16 15:07:18 +01:00
Vadim Zeitlin
0742ae9091 Verify that native handle is available when state becomes active
Check that GetNativeHandle() behaves as documented.
2021-01-16 15:05:38 +01:00
Vadim Zeitlin
204ae594a2 Check that we never get events about switching to State_Idle
This state can never be returned to, once the state becomes active.
2021-01-16 15:02:06 +01:00
Vadim Zeitlin
3241c443c5 Process event about the request becoming active synchronously
This is required in order to allow doing something with the request when
it already have a valid native handle, but hasn't actually started yet.
2021-01-16 14:59:41 +01:00
Vadim Zeitlin
1bf6d5e188 Slightly refactor wxWebRequestImpl::ProcessStateEvent()
Call GetResponse() only once.

Also put the code for State_Completed inside the case for this state in
the switch instead of testing for it separately later.

No real changes.
2021-01-16 14:49:25 +01:00
Vadim Zeitlin
3107a17353 Remove wxWebRequestImpl::IsActiveState()
Semantics of this function wasn't really clear and it was used only
once, so just inline it at the point of use and define better what
happens for various states there.

Also use a switch rather than testing for individual states to make sure
this code is updated if another state is added in the future.

No real changes.
2021-01-16 14:48:47 +01:00
Vadim Zeitlin
a52f353321 Set state to Active slightly earlier in wxWebRequestWinHTTP
This is more consistent with the other backends, which all change the
state before actually launching the asynchronous request.
2021-01-16 14:40:08 +01:00
Vadim Zeitlin
5babe577ce Check that SetState() always actually switches states
We shouldn't call SetState() to switch to the state that we're currently
already in, normally. Add an assert to verify that this indeed doesn't
happen.

Also improve the logging statement to show both the old and the new
states.
2021-01-16 13:50:32 +01:00
Vadim Zeitlin
508a4f6ca8 Fix Cancel() semantics under MSW and other improvements to it
Under MSW, don't set the state to State_Cancelled as soon as Cancel()
was called, as the request was still used from the other threads
afterwards, resulting in race conditions and crashes.

Fix this by just removing the SetState(State_Cancelled) call from the
main thread, as it was redundant anyhow. This also makes the behaviour
correspond to the documentation, which indicates that Cancel() works
asynchronously.

Also ensure, for all backends, that we actually cancel the request only
once, even if public Cancel() is called multiple times. This required
renaming the existing wxWebRequestImpl::Cancel() to DoCancel().
2021-01-16 13:50:29 +01:00
Vadim Zeitlin
b428e531ee Check for errors when calling WinHttpCloseHandle()
Add a trivial wxWinHTTPCloseHandle() wrapper calling wxLogLastError() if
closing the handle failed -- this is really not expected to happen, so
make sure to at least log it if it does.
2021-01-16 13:47:58 +01:00
Vadim Zeitlin
65aad890e3 Add GetNativeHandle() to wxWebSession and wxWebRequest
This allows to retrieve the handles used internally in order to do
something not supported by the public API yet.
2021-01-16 00:21:00 +01:00
Vadim Zeitlin
a561cf199b Remove semi-public wxWebSession::GetImpl()
It's better not to have this method in the public class, even if it
means that we need to pass a wxWebSessionImpl object to wxWebRequestImpl
ctor explicitly now.

No real changes.
2021-01-15 23:50:52 +01:00
Vadim Zeitlin
7677552087 Rename wxWebRequestWinHTTP::m_sessionWinHTTP to m_sessionImpl
No real changes, just use the same name as in the other backends for
consistency (we could also rename m_sessionImpl in the other ones to
m_sessionCURL and m_sessionURLSession respectively, but this would have
been more work and the latter name is really not great).
2021-01-15 23:48:01 +01:00
Vadim Zeitlin
60d429047e Fix workaround for the test failure with Ubuntu 14.04 libcurl
Don't check for 200 status code. Also don't check the response body if
we don't get it at all.
2021-01-15 23:14:14 +01:00
Paul Cornett
35b04278c8 Always set focus on mouse click in generic wxTimePickerCtrl 2021-01-15 09:40:33 -08:00
Paul Cornett
e734e4d88d Allow TAB navigation to work with wxTimePickerCtrl on GTK
See #19039
2021-01-15 09:28:16 -08:00
Vadim Zeitlin
af160f3d3e Use CHECK() when REQUIRE() is not needed in wxWebRequest tests
Continue performing the other checks unless we really can't do it.
2021-01-15 15:42:12 +01:00
Vadim Zeitlin
1e8fe318ed Work around wxWebRequest test failure under Ubuntu 14.04
Ignore wrong status code returned by libcurl on this ancient version,
it's not worth dealing with it.
2021-01-15 15:40:32 +01:00
Vadim Zeitlin
e6cedf6649 Really support milliseconds in wxLog
Although this was supposed to work, specifying "%l" in wxLog time stamp
format actually didn't because wxLog timestamps were stored as seconds.

Fix this by storing them as milliseconds and add a simple test (not
executed by default) showing that "%l" works correctly now.

Still keep the old wxLogRecordInfo::timestamp field for compatibility,
as it was documented.

See #13059.
2021-01-15 14:55:06 +01:00
Vadim Zeitlin
420160f0a2 Fix format specifier for DWORD in wxWebRequestWinHTTP code
This fixes assertion failure when running under Win64 due to the size
mismatch between DWORD and size_t on this platform.
2021-01-15 13:00:19 +01:00
Vadim Zeitlin
ef08d499ce Remove unnecessary SetIgnoreServerErrorStatus() from the API
It's up to the application code to decide how it handles the HTTP status
codes it gets back from server, there is no need to have a special
method for handling them in wxWebRequest itself.

We also shouldn't skip downloading the response body just because it was
unsuccessful, we may still need it (e.g. it's very common to return the
detailed error description in a JSON object in the message body when
returning some 4xx error), so don't do it in wxMSW implementation and
add a test verifying that we still get the expected body even for an
error status.

Also improve wxWebRequest::State values documentation.
2021-01-15 03:08:18 +01:00
Vadim Zeitlin
bafbcfa90f Add tracing statements to WinHTTP code too
This again can be very useful for debugging.
2021-01-15 02:56:45 +01:00
Vadim Zeitlin
798d2bb080 Accept everything instead of nothing in wxWebRequestWinHTTP
This is consistent with the other implementations and generally makes
more sense.
2021-01-15 02:54:30 +01:00
Vadim Zeitlin
f85f716cea Show more information about the request result in manual test
Show the HTTP status as well as data retrieved by the server.
2021-01-15 02:52:15 +01:00
Vadim Zeitlin
f9d7a06c37 Fix tags for WebRequest::Manual() unit test
Don't give it any tags other than "." as we don't want to execute it
when these tags are specified, only when it's explicitly selected by
using its name on the command line.
2021-01-15 00:56:49 +01:00
Vadim Zeitlin
168408620d Add wxWebRequest::Cancel() unit test
Check that the request does get cancelled and has the correct state.
2021-01-15 00:53:45 +01:00
Vadim Zeitlin
4e1bece87e Fix end state of cancelled requests in Mac implementation
Don't set the state to State_Failed if the request was cancelled.
2021-01-15 00:53:21 +01:00
Vadim Zeitlin
70e7861a7d Implement authentication support for wxWebRequest under Mac
Add wxWebAuthChallengeURLSession and use the appropriate delegate
callback to create it.
2021-01-15 00:46:45 +01:00
Vadim Zeitlin
e80b65b132 Add timeout to wxWebRequest test
Ensure that the test terminates even if we don't get the expected event.
2021-01-15 00:45:54 +01:00
Dominic Letz
156045b73b Use consistent event names in wxNotificationMessage documentation
Follow the convention of using the event macro names (rather than the
event type) names in @event documentation in wxNotificationMessage
documentation too, e.g. use EVT_NOTIFICATION_MESSAGE_CLICK rather than
wxEVT_NOTIFICATION_MESSAGE_CLICK.

Closes https://github.com/wxWidgets/wxWidgets/pull/2166
2021-01-14 18:25:56 +01:00
Vadim Zeitlin
ec0734f96f Install DLLs in bindir, not libdir, when using MSW toolchains
Use the hack with __dllinstdir variable just added to bakefile to
override the installation location for the DLLs to put them into the
expected location.

Closes #14601.
2021-01-14 18:20:11 +01:00
Vadim Zeitlin
89bc7b522f Use standard timestamp format for debug messages in the tests
Don't use the current locale format which doesn't provide all the
information (e.g. never includes milliseconds) and explicitly set the
format providing it instead when showing wxLogTrace() messages.
2021-01-13 19:01:20 +01:00