Commit Graph

71396 Commits

Author SHA1 Message Date
Tobias Taschner
e8dd552696 Add webrequest sample to documentation
Co-authored-by: PB <PBforDev@gmail.com>
2021-01-19 13:00:19 +01:00
Paul Cornett
4a3ff8c180 Fix bitmap tests with GTK2
wxGTK2 does not support drawing bitmaps with both alpha
and a mask, so it doesn't bother to implement having both.
So skip the test for that case.
2021-01-19 01:35:28 -08:00
Paul Cornett
cea8e60dea Don't set focus from wxTimePickerCtrl::SetValue() on GTK
Match the wxMSW behavior. See #19047
2021-01-18 22:24:39 -08:00
Artur Wieczorek
72ac21cf18 Fix wxBitmap tests under wxOSX
Under wxOSX wxBitmaps have always 32-bit depth.
2021-01-18 23:01:20 +01:00
Artur Wieczorek
79be42122f Don't convert mask to alpha values while converting wxImage to wxBitmap (wxOSX)
wxImage with mask should be converted to wxBitmap with mask and not to
wxBitmap with alpha channel values. Converting wxImage mask to wxBitmap
alpha is not implemented under wxMSW and wxGTK and wxOSX implementation
should adhere to this convention.
2021-01-18 22:29:40 +01:00
Artur Wieczorek
6b572bf694 Add tests of converting wxImage to wxBitmap 2021-01-18 22:14:43 +01:00
Daniel Kulp
3c28244806 Improve wxGrid appearance in dark mode under macOS
Use more appropriate colours for the row/column cell headers and don't
hardcode black (i.e. at least use white instead in dark mode) for the
frozen border.

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

See #18941.
2021-01-18 00:03:10 +01:00
Stefan Csomor
f8af2601c2 Add wxOSX_VERIFY_NOERR macro and use it in wxOSX code
This macro replaces the deprecated __Verify_noErr defined in the SDK.

It is different from assert, as the expression given to the macro is
always evaluated and then, if the result is not zero, and asserts are
on, an assert containing a human readable message with the description
of the error code is triggered.

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

Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
2021-01-17 23:57:38 +01:00
Vadim Zeitlin
51cc083f31 Cast error code only once in wxSysErrorMsgStr()
No real changes, just simplify code a little bit by replacing multiple
casts with a single one -- and explaining why is it necessary.
2021-01-17 23:37:38 +01:00
Vadim Zeitlin
febd185fc6 Merge branch 'web-request'
Add wxWebViewRequest and related classes allowing to use HTTPS and
HTTP/2.

See https://github.com/wxWidgets/wxWidgets/pull/977
2021-01-17 18:19:47 +01:00
Vadim Zeitlin
10c85670dc Merge branch 'choice-getstring'
Make wxChoice::GetString() consistently assert in all ports when given
invalid index.

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

Closes #18852.
2021-01-17 18:18:44 +01:00
Vadim Zeitlin
cc28cd6816 Fix logging when timestamps are disabled after recent changes
The changes of 1065e61ab7 (Merge branch 'log-ms', 2021-01-16) broke
logging when timestamps were disabled as they still tried to format the
timestamp in this case, using empty timestamp, which resulted in an
assert.

Fix this and also make new code more similar to the existing one by
adding wxLog::TimeStampMS() helper parallel to the already existing
TimeStamp() and write it in the same way -- which notably ensures that
it does nothing when the timestamp is empty.

See #13059.
2021-01-17 17:44:51 +01:00
Vadim Zeitlin
4eb345f8fe Fix typo in configure --enable-metafile option help string
Remove the extra "s".

Closes #19045.
2021-01-17 17:33:38 +01:00
Vadim Zeitlin
4a7b6d7e8f Document that index must be valid in wxChoice::GetString()
This is now the case in all ports, and not just in wxOSX, so document
this behaviour and also document that it has changed compared to 3.0.
2021-01-17 00:41:26 +01:00
Vadim Zeitlin
1ddf2ee303 Check that calling GetString() with invalid index asserts
This is the behaviour that would be normally expected and now really
happens for all the controls, including wxChoice.
2021-01-17 00:41:15 +01:00
Vadim Zeitlin
910dfbc010 Assert in wxGTK wxChoice::GetString() if the index is invalid
Similar to the previous commit for wxMSW.

This commit is best viewed ignoring whitespace-only changes.
2021-01-17 00:41:15 +01:00
Vadim Zeitlin
98aaeadf54 Assert in wxMSW wxChoice::GetString() if the index is invalid
Do it for consistency with SetString() and other controls.
2021-01-17 00:41:15 +01:00
Vadim Zeitlin
970ab0a1ae Make sure wxEVT_WEBREQUEST_DATA is processed in the main thread
This event was processed in a worker thread, which was different from
all the other events and also almost surely not thread-safe, so change
this and queue it for processing in the main thread instead.

Use wxMemoryBuffer instead of non-owning pointer in wxWebRequestEvent
and reset the buffer used internally every time to ensure the data is
still available by the time the event is processed.

Also increase the amount of data downloaded in the "advanced" page of
the sample as it has to be greater than wxWEBREQUEST_BUFFER_SIZE, which
is currently 64KiB, to have a chance of seeing the value actually
change, otherwise all the data arrives in a single event. As it is,
using the maximal size supported by the httpbin service, we only get 2
events.
2021-01-16 23:53:15 +01:00
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