Commit graph

6976 commits

Author SHA1 Message Date
Vadim Zeitlin
b5e278c0eb Link CEF files into webview sample build directory under Unix
Ensure that the sample can run using wxWebViewChromium backend out of
the box by setting things up so that it can find the CEF files. Note
that we use symlinks instead of actually copying these files, to avoid
wasting so much disk space (CEF libraries take more than 1GiB).
2023-09-15 01:56:08 +02:00
Vadim Zeitlin
ae8619b6dd Don't build separate webview_chromium library
Just include wxWebViewChromium in the webview library if it's enabled
during the build.

There doesn't seem to be any reason to build a separate library for it,
it's not really different from the other disabled by default wxWebView
backend (Edge).

And now that we don't need to link with an extra library, there is also
no need to have a separate webview_chromium sample, so just add a
possibility to run webview sample itself using Chromium backend by
setting WX_WEBVIEW_BACKEND environment variable.
2023-09-15 01:56:08 +02:00
Vadim Zeitlin
168ca9403d Return version information for wxWebViewChromium
This can be useful for diagnostic purposes and looks better than "0.0"
in the webview sample.

Notice that currently we return the compile-time version and not the
run-time version that could be retrieved using cef_version_info()
because this is simpler and we shouldn't be ever using a different
version from the one we were compiled with anyhow.
2023-09-14 19:20:11 +02:00
Vadim Zeitlin
ad69f3779a Remove "adv" library from webview sample
This library doesn't contain anything any more and exists only for
compatibility, so don't reference it.
2023-09-13 21:27:06 +02:00
Vadim Zeitlin
2ef44570fd Work around bug with out of order JS execution results
Modify the sample to show the correct value of the user agent when using
WebKit backend as this got broken by calling it inside an event handler
executed later but before the idle event handler could dispatch the
result of JS executed from inside WebKit AddScriptMessageHandler()
implementation, resulting in misinterpreting this result ("{}") as the
user agent string.

The real fix is, of course, to deal with the JS execution results coming
out of order in some way.
2023-09-08 01:51:47 +02:00
Vadim Zeitlin
81283f84dd Merge branch 'master' into webview-chromium-new
This pulls in wxWebView::SetProxy() addition.
2023-09-08 01:34:21 +02:00
Vadim Zeitlin
ff5c972b7f Set proxy to the environment variable value for all backends
Don't do it just for Edge one, as WebKit-based one supports it too and
the example code is nicer without the extra checks.
2023-09-07 15:33:39 +02:00
Vadim Zeitlin
0fd6cf99a3 Implement wxWebView::SetProxy() for Edge backend
Currently it can only be called before Create() because it has to be
passed via the additional browser arguments and can't be changed later.
2023-09-07 15:33:39 +02:00
Vadim Zeitlin
7c5d30fb32 Add wxWebView::SetProxy() and implement it for WebKit2 backend
Update the sample to allow specifying the proxy in it.
2023-09-07 15:33:39 +02:00
Vadim Zeitlin
a10ae82250 De TAB-ify Info.plist files
There doesn't seem to be any reason to use hard TABs in them, so don't.

No real changes.
2023-09-06 18:54:32 +02:00
Vadim Zeitlin
06c62f9aa4 Create all macOS helper apps required by current CEF version
For some reason we need 5 of them instead of just one now.

At least save some space by using links instead of duplicating the same
file 5 times.
2023-09-06 18:21:29 +02:00
Vadim Zeitlin
9f11557717 Adjust makefiles to the new CEF framework install name
It is now defined as

@executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework

in the framework itself, which means that we don't need to change it at
all for the main application and the wx library it uses.

We still need to change it for the helper application, but the command
doing it must be adjusted.
2023-09-06 03:50:34 +02:00
Vadim Zeitlin
7231a2d771 Fix parallel build of webview_chromium_helper under Mac
Make fix_cef_link target depend on webview_chromium_helper itself,
otherwise it could try to copy this file before it was created.
2023-09-06 03:50:34 +02:00
Vadim Zeitlin
784121a07a Remove apparently accidental condition in webview sample bakefile
"target" doesn't seem to make sense nor be needed here, as removing it
doesn't change anything in the generated files.
2023-09-06 03:50:34 +02:00
Vadim Zeitlin
9f2fce3859 Ensure that libcef.so is loaded first in webview sample
Use --no-as-needed linker flag to make this happen as otherwise it is
still loaded after libc.so (unless LD_PRELOAD is used).
2023-09-06 03:50:34 +02:00
Vadim Zeitlin
92f6f164b3 Add wxEVT_WEBVIEW_CREATED for wxWebViewChromium async creation
wxWebViewChromium creation is asynchronous and the object can't be
really used until OnAfterCreated() is called, so expose this in the
public API via a new event sent when the object becomes actually usable.

As a side effect, add a convenient wxWebViewEvent ctor taking wxWebView
as argument and calling SetEventObject() itself, instead of forcing all
code creating wxWebViewEvents to do it.
2023-09-06 03:50:34 +02:00
Vadim Zeitlin
7aec5a7e62 Implement browser window resizing correctly under Mac too
While the window was somehow resized on its own under Mac (and only
there) after the initial creation, it didn't have the correct size
initially if we didn't give it to it, so provide a Mac-specific
implementation of wxEVT_SIZE handler too, which fixes this and allows to
remove an ugly Mac-specific workaround from the sample.
2023-09-06 03:50:05 +02:00
Vadim Zeitlin
db255db61c Use C++11 nullptr in CEF helper process in the sample
This fixes its compilation under Mac and also avoids triggering the
check forbidding the use of NULL in the new code.
2023-09-06 03:50:05 +02:00
Vadim Zeitlin
dfe4fc858f Add x64 support and improve wxWebViewChromium sample MSVS project
Use variables defined in our .props files instead of hard-coded values
and use DPI aware manifest instead of using "compatibility" one with
which the sample didn't work correctly in high DPI.
2023-09-06 03:50:05 +02:00
Vadim Zeitlin
f5e2af9a28 Make wxWebViewChromium work with wxGTK3 and X11
Make browser creation actually work by postponing it until the host
window is realized and so has a valid X11 Window.

Remove unnecessary code manually creating GTK widget and just use the
standard wxGTK wxWindow instead.

Add code for setting the visual compatible with CEF to avoid X11 errors,
see https://github.com/chromiumembedded/cef/issues/3564, with many
thanks to Jiří Janoušek for finding and solving this problem originally.

Adjust the sample to handle wxWebView::Create() failure (not very
gracefully, but still better than just crashing) and to avoid using it
until it is fully created.

Update documentation to mention GTK limitations.
2023-09-06 03:50:05 +02:00
Vadim Zeitlin
18456e7de2 Add tracing messages to wxWebViewChromium code
Log calls to some callbacks using "cef" trace mask.

To make these messages actually visible in the sample, use a log target
showing only debug messages and pass messages through to it from
wxLogWindow.
2023-09-01 21:18:17 +02:00
Vadim Zeitlin
b6bfdd97c9 Merge branch 'master' into webview-chromium
Update to the latest master.
2023-08-30 02:03:00 +02:00
Vadim Zeitlin
00366cbaae Merge branch 'animation-hidpi'
Add support for specifying multiple animations to allow automatically
showing a higher resolution version when using high DPI, just as it was
already possible with the bitmaps.

See #23817.
2023-08-29 01:53:36 +02:00
Darrell Wright
13aa094ea6 Fix crash in "View text" dialog of the webview sample
Set the sizer on the dialog and not the main frame itself.

Closes #23830.
2023-08-28 02:14:00 +02:00
PB
7a3f6b6847 Fix displaying file size in sockets/client sample
When testing downloading with wxURL and header Content-Length
is not available, display "n/a" as the file size instead of
the value of (unsigned long)-1.

Closes #23825.
2023-08-26 23:20:36 +02:00
Vadim Zeitlin
7f5899e139 Improve manifest-related comments in samples resource file
In particular explicitly mention that wxUSE_DPI_AWARE_MANIFEST has no
effect unless wxUSE_RC_MANIFEST is set to 1.

Closes #23816.
2023-08-26 17:20:19 +02:00
Vadim Zeitlin
27e80f81b4 Add high DPI support to generic wxAnimationCtrl
Allow specifying multiple animation versions, for different resolutions,
when setting the animation to use via wxAnimationBundle class which is a
much simpler version of wxBitmapBundle used elsewhere.

This is not implemented for the native GTK version yet.

Update the sample, even though the difference in it is not really
noticeable as the "high DPI" throbber is just a scaled up version of the
existing standard DPI animation produced using gifsicle.
2023-08-25 20:51:21 +02:00
Vadim Zeitlin
cc5f5f90b0 Show high resolution bitmaps in wxBusyInfo if available
Instead of always scaling the single bitmap passed to it, allow passing
wxBitmapBundle and select the bitmap most appropriate for the current
resolution from it.

Closes #23813.
2023-08-25 20:32:07 +02:00
Vadim Zeitlin
d69ddb8656 Revert all recent wxUSE_DPI_AWARE_MANIFEST-related changes
This reverts 5d630caabd (Make it enough to predefine only
wxUSE_DPI_AWARE_MANIFEST, 2023-08-23) and all the commits which tried to
fix the breakage caused by it.

While the original change had merit, it seems to be too difficult to fix
all our build systems to avoid embedding manifest when defining this in
the code, like samples/sample.rc does, so revert this change for now.

Maybe it can be reintroduced in the future after switching to some other
build system.
2023-08-25 00:03:47 +02:00
Maarten Bent
026528f861
Fix CMake build issues after enabling manifest from rc file 2023-08-24 16:26:47 +02:00
Vadim Zeitlin
f6255e456b Don't embed default manifest in minimal samples MSVC project
This clashes with the wx manifest which is getting included now after
the changes of 5d630caabd (Make it enough to predefine only
wxUSE_DPI_AWARE_MANIFEST, 2023-08-23).
2023-08-24 03:28:12 +02:00
PB
61bae154d3 Improve samples appearance in dark mode
- caret: Use the system color for window background instead of
  hard-coded white.

- image: Use hard-coded black for the text drawing since all other
  drawings on the image canvas use hard-coded colours too. The default
  text colour was barely readable in dark mode.

- joytest: Use wxCYAN_PEN instead of wxBLACK_PEN to ensure the line is
  visible both in light and dark colour system mode.

- ownerdrw: Use such background colour that there is good contrast
  between text and background both in light and dark colour system mode.

- popup: Use such background colour for the pop up so that there is a
  good contrast between text and background both in light and dark
  colour system mode.

Closes #23773.
2023-08-24 02:22:19 +02:00
PB
9536583c0f Improve the combo sample
In the dialog, create the controls put in the static box sizer
with the sizer's static box as the parent instead of the dialog.

Improve appearance of custom drawn items in dark mode.

Closes #23765.
2023-08-23 23:08:52 +02:00
Vadim Zeitlin
ec4777bbbf Rebake after the previous commit
This just separates the automatically-generated changes from the manual
ones in the parent commit.
2023-07-29 18:13:29 +02:00
Vadim Zeitlin
b6ea233845 Fix missing "net" library in webrequest makefile.unx
"base" library must always come last in the samples bakefiles as the
list of wx libraries to link with is generated when processing it, so
putting the "net" library after it had no effect.

See #23723.
2023-07-21 20:37:00 +02:00
Vadim Zeitlin
626f781840 Link penguin OpenGL sample with GLU too when building out of tree
This sample is the only one to use a GLU function too.

It would probably be better to drop GLU dependency entirely, but until
this is done (see #23721), do link with it.

This commit is best viewed ignoring whitespace-only changes.
2023-07-20 15:14:10 +02:00
Vadim Zeitlin
0ab31edc17 Use flags required for using GTK in widgets sample
As we use GTK directly in this sample, we need to use the appropriate
compiler and link flags, so add them depending on the port in the
makefile.
2023-07-11 13:40:23 +02:00
Vadim Zeitlin
2e22666db8 Compile Cocoa control example in Unix "widgets" sample makefile
Previously this was never done, as we couldn't determine if we were
using Cocoa or not at generation time, but we can determine it in the
makefile itself.
2023-07-11 13:40:21 +02:00
Vadim Zeitlin
033dfd2d68 Don't use GUI settings for "archive" sample
This samples used "wx_append" in its bakefile, but should be using
"wx_append_base", as it's a console application.

This fixes its build with makefile.unx, as wxUSE_GUI wasn't properly
defined as 0 before.
2023-07-11 01:59:19 +02:00
Vadim Zeitlin
db785155aa Link OpenGL samples with GL library under Unix
This is not needed when building as part of the build tree, as it's
already part of EXTRALIBS_OPENGL then, but is required when building the
samples against installed libraries.

This commit is best viewed ignoring whitespace-only changes.
2023-07-10 19:47:14 +02:00
Vadim Zeitlin
121631514c Fix building non-GUI samples out of tree
Define wxUSE_GUI=0 for them.
2023-07-10 19:37:21 +02:00
ollydbg
25ff038c80 Remove unnecessary variable in dataview sample
No real changes, just simplify the code.

Closes #23687.
2023-07-08 01:28:00 +01:00
Vadim Zeitlin
e802eaa44d Suppress a warning for g_object_ref_sink() use in widgets sample
The glib macro always triggers this warning when -Wextra is on, so we
have no choice but to suppress it.
2023-07-04 02:19:14 +02:00
Vadim Zeitlin
4040e35f41 Use wxEVENT_HANDLER_CAST() in socket sample
This macro avoids a -Wcast-function-type from gcc 8+.
2023-07-04 02:19:07 +02:00
Vadim Zeitlin
d5ef9d4387 Add wxGenericAboutDialog::GetCustomControlParent()
This function should be used to get the parent for the custom controls
instead of relying on them being reparented under it by the code added
in the last commit.

Change the type of m_contents to be wxWindow and not wxPanel as it
doesn't really matter, but wxPanel is not fully declared in this header
while wxWindow is.
2023-06-20 19:19:49 +02:00
Bill Su
6ab144f9bf samples/mfc: disable composition to allow wxClientDC to work 2023-06-11 01:56:21 -04:00
Bill Su
6b1683757f samples/mfc: building with UNICODE requires wide strings 2023-06-11 01:56:21 -04:00
Bill Su
d970c8eeae samples/mfc: needs #define UNICODE
The header-order workaround for WINVER should also be used for
UNICODE and _UNICODE
2023-06-11 01:56:21 -04:00
Vadim Zeitlin
865def904b Merge branch 'html-dark-mode'
Fixes for wxHtmlWindow in dark mode.

See #23588.
2023-06-02 19:15:45 +02:00
PB
885c87d865 Fix storing DXF entities in penguin sample
The code in b76ebc6 switched from wxList to std::vector but the changes
did not account that we must store the pointers to derived classes in
the entity list, not just the struct they derive from.

Closes #23582.
2023-06-02 19:11:11 +02:00