Commit Graph

71563 Commits

Author SHA1 Message Date
Tobias Taschner
e9dc74cb6d
Add wxWebView::RunScriptAsync() 2021-11-03 11:19:07 +01:00
Tobias Taschner
cf6a947dab
Use new JS wrapper with edge and IE 2021-11-03 11:19:00 +01:00
Tobias Taschner
2fe12ae6af
Restructure javascript result wrapper 2021-11-03 11:18:53 +01:00
Tobias Taschner
fd2920ff22
Fix wxWebViewEdge tests
Edge does not support the about: URL using it in the test resulted
in various problems. Just use about:blank for now as the edge backend
does not merge them for the history checks.
2021-11-03 11:18:53 +01:00
Dominique Martinet
61d835d8b3 wxKeyCode: add WXK_LAUNCH_[0-9A-F] for gtk bindings
X11 defines Xf86Launch[0-9a-f], which are then also defined as
GDK_KEY_Launch[0-9A-F].

Unfortunately, keys which are not mapped are just plain ignored and the
application is then not able to receive these keyboard events at all.

The original PR https://github.com/wxWidgets/wxWidgets/pull/157 mapped
only LaunchA/B to WXK_LAUNCH_APP1/2, this patch adds the whole range of
keys and keeps LAUNCH_A/B as aliases for WXK_LAUNCH_APP1/2
2021-11-02 10:18:02 +09:00
Dominique Martinet
307aaf83d8 gtk/window: cleanup dead code around wxTranslateGTKKeyEventToWx
The previous commit made wxTranslateGTKKeyEventToWx never fail, so make it void
and remove all dead code resulting from the lack of failure.
2021-11-02 10:09:28 +09:00
Dominique Martinet
33553ed141 gtk/window: generate WXK_NONE key event for unknown keys
There are still plenty of X11 keys which have no WXK mapping and might be useful
for applications to act upon.

Instead of trying to remap all of them, generate a WXK_NONE key event and let
applications deal with it using GetRawKeyCode() if appropriate.
2021-11-02 10:09:28 +09:00
Vadim Zeitlin
9cc0c9a082 Only check sizer elements if there is valid containing window
This is another correction to the changes of 62c3d921b2 (Check that all
windows in a sizer use associated window as parent, 2021-10-20): we need
to restrict the part of this check in wxSizer::SetContainingWindow() to
the case when this function argument is non-null, otherwise the check
would always fail.

Notice that it is perfectly valid to call SetContainingWindow(NULL) and
wxWrapSizer does it for every re-layout, for example.

This commit is best viewed ignoring whitespace-only changes.

See #19308.
2021-10-29 16:33:10 +01:00
Vadim Zeitlin
34f430a016 Relax the sizer parent check to account for wxStaticBoxSizer
The check added in 62c3d921b2 (Check that all windows in a sizer use
associated window as parent, 2021-10-20) didn't work correctly when
using wxStaticBoxSizer, as the windows in this sizer are grandchildren
(or possibly even further descendants, in case of nested sizers) of the
window that the sizer is associated with, with the static box being the
immediate parent.

Relax the check to account for this and to avoid triggering for any use
of wxStaticBoxSizer.

Closes #19308.
2021-10-29 01:33:48 +01:00
Vadim Zeitlin
e2a0c87f1d Merge branch 'cmake-lib-dir-fix' of https://github.com/MaartenBent/wxWidgets
CMake: Fix library directory and don't use symlinks when using MinGW.

See https://github.com/wxWidgets/wxWidgets/pull/2569
2021-10-27 23:28:23 +01:00
Vadim Zeitlin
6e96c6dda0 Add "Show build environment" step
Show version of compiler and ccache being used.
2021-10-27 23:32:16 +02:00
Vadim Zeitlin
9320aeb28b Enable use of ccache for Unix CI builds
This should speed up build step for the common case when not too many
files have to be recompiled.
2021-10-27 22:58:19 +02:00
Vadim Zeitlin
b744e271e3 Create multiline controls with wxTE_RICH2 in wxTextEntryDialog
While wxMSW now turns this style on automatically if necessary, it's
still better to avoid the failure during the initial control creation,
so enable wxTE_RICH2 from the beginning in wxTextEntryDialog, where it
shouldn't result in any incompatibilities.
2021-10-27 21:41:30 +01:00
Vadim Zeitlin
d585bb1ebd Automatically turn wxTE_RICH2 for wxMSW wxTextCtrl if necessary
When creating a wxTextCtrl with the initial text which is too long to
fit into a plain EDIT, automatically create RICHEDIT instead.

This is not perfect, e.g. it still doesn't make calling SetValue() with
long text later work, but it seems to still be preferable to failing to
create the window completely, which results in many other more difficult
to diagnose problems later.
2021-10-27 21:39:37 +01:00
Vadim Zeitlin
a8c05945b4 Log the length of the window label if creating it fails in wxMSW
This can be useful in case of unexpected window creation failure, so log
it because it doesn't cost much for something that is supposed to
practically never happen anyhow.
2021-10-27 21:38:41 +01:00
Maarten Bent
ad75a77bc6 CMake: Cleanup the wx_configure_script macro 2021-10-27 22:28:33 +02:00
Maarten Bent
f59bbcd3e1 CMake: Don't create symlinks with MinGW
On Windows, user might not have the correct permissions to create symlinks.

Closes #19304
2021-10-27 22:27:35 +02:00
Maarten Bent
4f0d9d3346 CMake: Fix library directory when using MinGW
This was broken in b102afc316 (CMake: Don't include generator expression in
wxPLATFORM_LIB_DIR, 2021-10-17).
And for clarity, always add a '/' after directories.

Closes #19305
2021-10-27 21:27:41 +02:00
Vadim Zeitlin
f9621cb888 Merge branch 'grid-selection-compat'
Fix wxGrid selection functions compatibility.

See https://github.com/wxWidgets/wxWidgets/pull/2568
2021-10-27 18:42:57 +01:00
Stefan Csomor
a7f5e3c5c3
OSX wxBitmapBundle::FromFiles implementation for macOS (#2561)
* adding macOS wxBitmapBundle::FromFiles implementation

* adding FromFiles overload, generic implementation

* Update interface/wx/bmpbndl.h

* Removing outdated comment

Co-authored-by: VZ <vz-github@zeitlins.org>
2021-10-26 22:27:36 +02:00
Vadim Zeitlin
c28c7edbb4 Let wxGrid::GetSelectionBlockTopLeft/BottomRight work in any mode
These functions used to work in any mode until the changes of 02509cbc39
(Refactor wxGridSelection to store selection as blocks only, 2020-03-03)
and should continue to do so, if only for compatibility.
2021-10-26 19:51:26 +01:00
Vadim Zeitlin
9b820b74b2 Fix handling selection in wxGrid::Render()
Temporarily reset the m_selection pointer itself instead of clearing the
selection, this is much more efficient, especially for big grids, and
also more correct, as the old code simply lost the original selection in
non-block selection modes.
2021-10-26 19:41:06 +01:00
Vadim Zeitlin
5f8e9c14ae Merge branch 'wxrichtextctrl_word_wrapping_opt' of https://github.com/mehmet-soyturk/wxWidgets
Optimize wrapping long lines in wxRichTextCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/2523
2021-10-26 19:43:03 +02:00
PB
f8dda6db65 Do not use calendar.rc for calendar sample in CMake
The file was removed in  16f2c7bb89 (Remove unused samples resource
files, 2021-10-20) merged as part of 3d5664cabe (Merge branch
'samples-dpi-v2-aware', 2021-10-25).

Closes https://github.com/wxWidgets/wxWidgets/pull/2565
2021-10-26 19:40:18 +02:00
Vadim Zeitlin
8d14270636 Merge branches 'statbmp-bundle', 'upscale-only-bitmap' and 'bitmap-from-icon'
Fixes for wxBitmapBundle behaviour and use it in wxStaticBitmap too now.

See https://github.com/wxWidgets/wxWidgets/pull/2560,
    https://github.com/wxWidgets/wxWidgets/pull/2566,
    https://github.com/wxWidgets/wxWidgets/pull/2567
2021-10-26 19:38:21 +02:00
Vadim Zeitlin
04828b7225 Update wxStaticBitmap in wxMSW on DPI change
Use the appropriately sized bitmap when the resolution changes.
2021-10-26 00:11:57 +02:00
Vadim Zeitlin
0a91a2f40b Use wxBitmap::Rescale() in wxGenericStaticBitmap code
No real changes, just reuse the existing function instead of redoing it
one more time.
2021-10-26 00:11:57 +02:00
Vadim Zeitlin
3abec9254f Take wxBitmapBundle in wxStaticBitmap::SetBitmap()
This allows using higher resolution bitmaps when using high DPI
automatically in this control too.
2021-10-26 00:11:57 +02:00
Vadim Zeitlin
da73be0d77 Upscale the biggest bitmap in the bundle if it's too small
The changes of b20552116c (Allow wxBitmapBundle to specify its preferred
bitmap size, 2021-10-19) resulted in never rescaling the bitmaps in
standard size in high DPI at all, which isn't the right thing to do: by
default, i.e. if just a single bitmap is specified, we should scale it
up as necessary in order to show the UI elements in the correct sizes.
2021-10-26 00:04:22 +02:00
Vadim Zeitlin
41b1ba3c9e Replace many identical wxBitmap::CopyFromIcon() with a single one
Define CopyFromIcon() directly in wxBitmapBase for the non-MSW ports, as
it was implemented exactly in the same way in all ports using this class
anyhow.

This means this function is not virtual any longer, but this shouldn't
be a problem as it was never supposed to be overridden in application
code and this couldn't be done with wxMSW, where it never was virtual in
the first place, anyhow.

No real changes, just a simplification.
2021-10-25 23:36:45 +02:00
Vadim Zeitlin
568411347b Make wxOSX wxBitmap::CopyFromIcon() work as in the other ports
Just use the same object, as wxIcon is the same thing as wxBitmap
anyhow, instead of re-creating another wxBitmap which can be subtly
different from the original one.

Notably, converting an icon with default scale factor of 1 to bitmap
when using a high DPI display resulted in a bitmap with the same
physical size but scale factor of 2, as wxOSXGetImageScaleFactor()
returned 2 in this case, i.e. changed the logical bitmap size.

This couldn't be anything other than a bug, so fix this and, at the same
time, simplify the code and make it consistent with the other ports.
2021-10-25 23:36:45 +02:00
Vadim Zeitlin
9ffa5cf4f0 Use 16x16 default size for wxStaticBitmap in wxMotif too
Nobody cares about Motif, but still use the same default size there as
under the other platforms.
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
0f9cb0fce1 Refresh wxStaticBitmap and update its size in wxUniv SetBitmap()
Make wxUniv behave consistently with the other ports.
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
dc1c2c91b3 Fix setting size of wxStaticBitmap in wxOSX too
This is the same change as was done in the previous commit for
wxGenericStaticBitmap, see that commit message for more details.
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
eba93fb5e7 Fix setting size of wxGenericStaticBitmap
We must call SetInitialSize() in Create() in order to take the size
argument passed to ctor/Create() into account -- it was completely
ignored previously.

But calling SetBitmap() must not change the initial size, as it can also
be done later, so just change the current size there instead (which is
consistent with wxMSW version and original behaviour, so keep it like
this, even though it's not totally clear if all ports do it).

Remove the now unused wxGenericStaticBitmap::GetBitmapSize().
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
b403624f22 Add common implementations of wxStaticBitmap icon methods
Instead of defining them, slightly differently, in all the non-MSW
ports, define them once in wxStaticBitmapBase.

No real changes, this is just a simplification.
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
5773a8736c Define wxICON_IS_BITMAP when this is indeed the case
This symbol is useful for testing if wxIcon can be just converted to
wxBitmap, as is the case in all ports except for wxMSW currently.
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
e126ddc11c Use more suitable type for MSWReplaceImageHandle() parameter
It's a handle, so make it a WXHANDLE rather than WXLPARAM and avoid
casting the handle when calling it (there is still a cast when calling
::SendMessage() inside this function, but this is unavoidable and this
cast was already there anyhow).

No real changes.
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
c1abbe6473 Refactor wxMSW wxStaticBitmap to separate bitmaps and icons
Use different members for storing wxBitmap and wxIcon instead of using a
single pointer for storing a heap-allocated copy of either of them
because this is simpler, more efficient due to avoiding unnecessary
conversions and RTTI, and will be simpler to generalize to using
wxBitmapBundle instead of wxBitmap in the upcoming commits.

As a side effect, don't assert in GetIcon() or GetBitmap() if there is
no valid icon or bitmap, as this is inconsistent with the other ports
and wasn't even consistent between these functions in wxMSW itself.

There should be no other changes in behaviour.
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
373653e4e5 Remove unnecessary wxStaticBitmap::DeleteCurrentHandleIfNeeded()
This function was used exactly once and it's simpler and more clear to
just inline it into Free() where it was called.

No real changes, this is just a small simplification.
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
1d6e3e3693 Move wxStaticBitmapBase methods to the appropriate file
For some reason, wxStaticBitmapBase methods were defined in the wrong
ctrlcmn.cpp file rather than statbmpcmn.cpp. Just move them there to
avoid confusion.

No real changes.

This commit is best viewed with --color-moved git option.
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
9326aa3b6c Add wxBitmapBundle::GetBitmapFor() helper
This can be used to get the bitmap of the size appropriate for the DPI
scaling used for the given window.
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
e5a7e9ccbd Take const wxWindow in wxBitmapBundle::GetPreferredSizeFor()
This function should be usable in const methods of wxWindow-derived
classes too.
2021-10-25 12:21:15 +01:00
Vadim Zeitlin
c119e84370 Merge branch 'bundle-scaled-bitmaps'
Make wxBitmapBundle compatible with bitmap scale factor > 1, both when
converting the latter to the former and when retrieving bitmaps from the
bundle.

See https://github.com/wxWidgets/wxWidgets/pull/2564
2021-10-25 13:18:47 +02:00
Vadim Zeitlin
33a56f74d5 Merge branch 'check-sizer-window-parent'
Check that all windows in a sizer use associated window as parent.

See https://github.com/wxWidgets/wxWidgets/pull/2559
2021-10-25 13:18:07 +02:00
Vadim Zeitlin
3d5664cabe Merge branch 'samples-dpi-v2-aware'
Build all samples, not just one of them, as per-monitor DPI v2 programs
under MSW and minor cleanup of the samples .rc files.

See https://github.com/wxWidgets/wxWidgets/pull/2557
2021-10-25 13:16:55 +02:00
Vadim Zeitlin
7b4257b9cd Respect the scale of the bitmap converted to wxBitmapBundle
Use the scaled size, different from the default size, when constructing
wxBitmapBundle from an existing wxBitmap to keep the existing code using
scaled bitmaps working.

Add a unit test checking that this now works as expected under the
platforms where scale factor is used.
2021-10-24 23:15:04 +02:00
Vadim Zeitlin
30aad30a0a Don't create unnecessary vector in wxBitmapBundle::FromBitmap()
Just use wxBitmapBundle ctor instead, this is both simpler and more
efficient.

No real changes.
2021-10-24 23:09:31 +02:00
Vadim Zeitlin
8f74ac7def Adjust scale of bitmaps returned by wxBitmapBundle::GetBitmap()
Bitmaps returned from this function must have the appropriate scale
factor, e.g. 2 in standard high DPI case, in order to be drawn at
correct size in the ports where logical pixels are different from the
physical ones, such as wxOSX and wxGTK3.

Notably, this allows wxGenericStaticBitmap to work correctly in high DPI
in these ports too.

This also allows to undo some of the changes done in 399b0ff9ae (Use
wxBitmapBundle instead of bitmap scale factor in wxGtkImage, 2021-10-16)
to wxGtkImage code and keep using the same code that had been used
before.
2021-10-24 23:04:45 +02:00
Vadim Zeitlin
1056ba19af Move scale factor-related wxBitmap functions out of line
This will make it possible to change them later without breaking ABI,
which is probably worth paying the price of a function call (assuming
the compiler could de-virtualize this call and inline it before).

No real changes.
2021-10-24 23:04:45 +02:00