U++ framework
Do not panic. Ask here before giving up.

Home » Developing U++ » U++ Developers corner » Native Browser inside U++ Ctrl
Re: Native Browser inside U++ Ctrl [message #62014 is a reply to message #62013] Thu, 28 May 2026 19:33 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1244
Registered: March 2006
Location: Italy
Senior Contributor
zsolt wrote on Thu, 28 May 2026 17:23
Did you use a wrapper library like this one or use the platform's webviews solutions directly?
No, we do NOT use the webview wrapper. We use the platform's native APIs directly.

The reason is exactly what you might expect: webview is designed to create its own top-level window and run its own event loop via `webview::run()`. This makes it fundamentally incompatible with embedding inside an existing U++ `Ctrl` — two event loops cannot coexist in the same application.

Instead we call the platform APIs directly:

- **Windows**: `ICoreWebView2` COM API (WebView2 SDK). Loaded at runtime via `LoadLibrary("WebView2Loader.dll")` to avoid static linking issues with Clang. The WebView2 controller is created as a child of the `TopWindow` HWND.

- **macOS**: `WKWebView` (WebKit.framework) via Objective-C++ in a file that is kept completely separate from U++ code to avoid namespace conflicts between Cocoa types (`NSRect`, `NSPoint`) and U++ types (`Rect`, `Point`).

- **Linux**: `WebKitWebView` (webkit2gtk-4.1). Since U++ renders everything with Cairo on a single `GtkDrawingArea` (not a `GtkContainer`), true embedding is not possible without patching U++ core. We currently use a `GTK_WINDOW_TOPLEVEL` with `GDK_WINDOW_TYPE_HINT_UTILITY`, synchronized with the U++ window via `configure-event` and `focus-in/out` signals for correct z-order management.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: HTML viewer
Next Topic: Compilation of reference/GLDrawDemo is broken
Goto Forum:
  


Current Time: Sat Jul 11 16:25:41 GMT+2 2026

Total time taken to generate the page: 0.00542 seconds