Commit Graph

70478 Commits

Author SHA1 Message Date
Maarten Bent
a8b726359b Format wxWebViewEdge Callback code 2021-03-01 00:09:23 +01:00
Maarten Bent
ad1219d0a2 Fix building with MSVC 32 bit 2021-03-01 00:09:23 +01:00
Maarten Bent
84b19a0ce0 Use the same function signature as the WebView2 SDK 2021-03-01 00:09:23 +01:00
nns52k
b465a95dcc Make it possible to compile wxWebView Edge backend with gcc
Remove the requirement to include wrl/event.h so that GNU C++ (maybe
Clang C++ as well) can compile this file without error.
2021-03-01 00:08:08 +01:00
nns52k
df20e5ec76 Fix case of WebView2.h in the #inclue directive
Using the correct case is important when using case-sensitive file
systems as when cross-compiling, for example.
2021-03-01 00:08:08 +01:00
PB
a75aa78263 Fix dragging file in DnD sample
At least on Microsoft Windows, it is possible to start dragging an unselected
wxTreeCtrl item. Therefore, in wxEVT_TREE_BEGIN_DRAG handler do not use the
path that is currently selected in the control but the one that is actually
being dragged.

Closes https://github.com/wxWidgets/wxWidgets/pull/2258
2021-03-01 00:03:21 +01:00
Vadim Zeitlin
fa3cf06273 Avoid possible "unreachable statement" warnings
Don't return unconditionally before another return. Somehow gcc doesn't
warn about it, but other compilers (and static analyzer tools)
definitely do.

No real changes.
2021-02-28 23:59:51 +01:00
Vadim Zeitlin
f11db09e9b Ad wxHAS_X11_SUPPORT helper to simplify the code
This is much more readable than the existing (and now duplicated)
__WXGTK__ || !__WXGTK20__ || GDK_WINDOWING_X11 check.

No real changes.
2021-02-28 23:58:07 +01:00
Vadim Zeitlin
810b342411 Avoid useless check for GTK_CHECK_VERSION
Just use it inside the existing check for GTK itself.

No real changes.
2021-02-28 23:53:49 +01:00
Vadim Zeitlin
d03f193719 Recognize "ll_LL" as at language "ll" in GetSystemLanguage()
If we can't find an exact match for the system locale in the database,
try to at least find the corresponding language.

This is almost certainly what the intention of the original code was, as
otherwise the entire loop was useless because it couldn't find anything
that wouldn't have been found in the loop just above.

This allows to correctly load German translations when using unsupported
locale such as "de_IT", for example.

See #19082.
2021-02-28 23:39:20 +01:00
Scott Talbert
f6a53b59b2 Fix regression in wxGetKeyState() on GTK3 w/ X11
wxGetKeyStateGTK() is intended to be used only with non-X11 GTK backends.
wxGetKeyStateX11() should still be used on GTK3 w/ X11 as the GTK
variant does not provide all key states.
2021-02-28 14:11:26 -08:00
Vadim Zeitlin
73b41dda91 Remove redundant #if/#endif in Unix locale code
Put both Unix-only functions inside the same #ifdef __UNIX__.

No real changes.
2021-02-28 22:50:35 +01:00
Vadim Zeitlin
2e8e0197d7 Add wxSetlocaleTryAll() helper to simplify Unix locale code
Define the function calling setlocale("xx_YY") first and then just
setlocale("xx") if the former failed, instead of doing the same thing
manually in 3 different places.

Also avoid attempting the second setlocale() call completely if there is
no "_YY" part in the first place.

No real changes.
2021-02-28 22:48:52 +01:00
Tobias Taschner
5e35e6c635 Clear script ids in RemoveAllUserScripts() 2021-02-28 22:38:09 +01:00
Tobias Taschner
5a30bbe38f Apply suggestions from code review
Co-authored-by: PB <PBforDev@gmail.com>
2021-02-28 22:33:15 +01:00
Tobias Taschner
e8371824bd Disable new methods for webkit1 2021-02-28 20:48:01 +01:00
Tobias Taschner
f419240335 Add Apple transport security to wxWebView docs 2021-02-28 20:44:38 +01:00
Tobias Taschner
ca5133fff7 Add usage documentation to wxWebView::AddScriptMessageHandler() 2021-02-28 20:41:49 +01:00
Tobias Taschner
d4a9ec2448 Define unused parameters differently to improve intellisense 2021-02-28 20:14:38 +01:00
Tobias Taschner
166d7e2c83 Fix unused warning in sample 2021-02-28 20:06:59 +01:00
Vadim Zeitlin
91ec900034 Explicitly disallow wxLANGUAGE_UNKNOWN in wxLocale::Init()
This value doesn't make here, so be upfront about it.
2021-02-28 20:04:33 +01:00
Tobias Taschner
575ae90d85 Fix trailing whitespace 2021-02-28 20:03:36 +01:00
Tobias Taschner
2a16638e2a Fix EOL issues 2021-02-28 20:03:31 +01:00
Vadim Zeitlin
18bf718f60 Support wxLANGUAGE_DEFAULT in wxLocale even when it is unknown
Don't give an error if we can't recognize the current system language,
as we may still be able to use it even in this case.

Closes #19082.
2021-02-28 20:00:27 +01:00
Tobias Taschner
2c3d179923 Implement common web message identifier for macOS 2021-02-28 19:57:33 +01:00
Tobias Taschner
a27f73367c Implement AddUserScript() for WKWebView backend 2021-02-28 19:55:19 +01:00
Vadim Zeitlin
3e395f9b5f Micro optimization for wxLANGUAGE_UNKNOWN in GetLanguageInfo()
Don't bother iterating over all the languages if we can be sure we're
not going to find anything anyhow.
2021-02-28 01:12:57 +01:00
Vadim Zeitlin
d029279227 Rename local variable to a more consistent name
Call the info->CanonicalName "shortName", as it's done in many other
places in the code instead of using "locale" for it here, even though we
do use it as a name of locale.

No real changes.
2021-02-28 01:11:34 +01:00
Vadim Zeitlin
5fd85d422f Add a trivial test for setting default locale
Initializing wxLocale using wxLANGUAGE_DEFAULT should work, unless
LC_ALL is explicitly set to an invalid value.
2021-02-28 01:07:47 +01:00
Vadim Zeitlin
7b6894ea41 Reuse Unix branch of wxLocale::Init() for macOS too
There doesn't seem to be any reason to partially duplicate Unix-specific
code in a separate Mac branch when we can just use the same code. Parts
of it which are not necessary under Mac, such as trying ".UTF-8" locales
in wxSetlocaleTryUTF8(), can be separately disabled there (even though
they are harmless), but other parts are probably needed, e.g. setting
Norwegian locale failed under macOS before because we didn't translate
nb_NO that we use to no_NO actually supported under macOS.
2021-02-28 01:02:59 +01:00
Vadim Zeitlin
0aba9fe112 Remove useless fallback from wxLocale::Init()
There is no need to try setting "loc.UTF-8" and "loc.UTF8" when we had
just called wxSetlocaleTryUTF8() which tried these variants and also
their lower-case equivalents already.
2021-02-27 17:52:08 +01:00
Artur Wieczorek
04ea7b552a Fix wxBitmapButon used as wxPG editor button under wxGTK2
wxBitmapButton without inner border should work better with themes
if we reduce inner border in a more GTK-compliant way by applying
a dedicated GTK style to the button.
2021-02-27 17:15:39 +01:00
Artur Wieczorek
9a29ea6e63 Fix setting wxBU_EXACTFIT style for wxButton under wxGTK2
The way wxBU_EXACTFIT is implemented in commit c1bb80987f
("Improve implementation of wxBU_EXACTFIT style for wxButton under wxGTK2",
2020-04-12) is too intrusive and disrupts button's appearance in some
themes. It should work better with themes if we reduce inner border in
a more GTK-compliant way by applying a dedicated GTK style to the button.

Closes #19081.
2021-02-27 17:08:37 +01:00
Tobias Taschner
29bfcdfd5e Add common web message identifier 2021-02-27 11:55:50 +01:00
Tobias Taschner
c9606d7b5a Implement AddUserScript() for GTK 2021-02-27 10:59:23 +01:00
Tobias Taschner
4d78437a77 Implement AddUserScript() for edge backend 2021-02-26 23:41:39 +01:00
Tobias Taschner
6f7ac6a934 Add wxWebView::AddUserScript()
This allows to inject javascript code across multiple pages
2021-02-26 23:41:39 +01:00
Tobias Taschner
f2bfa7d446 Initial AddScriptMessageHandler() documentation 2021-02-26 22:35:49 +01:00
Tobias Taschner
b1d558a612 Disabled dev tools per default for Edge
This unifies the behavior among backends and is probably
the more useful default for most applications.
2021-02-26 21:55:10 +01:00
Tobias Taschner
2d007ff3f1 Add named script handler to edge 2021-02-26 21:51:15 +01:00
Tobias Taschner
140e9825b7 Log error if script handler cannot be added 2021-02-26 21:41:02 +01:00
Tobias Taschner
a09713de5f Decode web message result like RunScript() result 2021-02-26 21:37:23 +01:00
Tobias Taschner
71f745e647 Implement script message for GTK backend 2021-02-26 21:27:50 +01:00
Tobias Taschner
3af4702b11 Implement wxWebView::EnableAccessToDevTools() for GTK 2021-02-26 18:53:46 +01:00
Tobias Taschner
302ae644dd Fix mixed EOL 2021-02-26 17:11:33 +01:00
Tobias Taschner
3f23273f46 Fix typo in sample 2021-02-26 16:59:57 +01:00
Tobias Taschner
04d22cc9f6 Add RemoveScriptMessage handler and return bool 2021-02-26 16:59:57 +01:00
Tobias Taschner
c3d0d7d000 Identify script handler in message event 2021-02-26 16:59:56 +01:00
Tobias Taschner
c78147b267 Add script command handler to sample 2021-02-26 16:59:56 +01:00
Tobias Taschner
5b838ae6c1 Fix unused warning 2021-02-26 16:59:56 +01:00