During the lifetime of my application, the user may open several browser windows, and possibly several at any one time. The intention with most of these windows is to display a website in a borderless window, with a few native functions exported in a "window" variable, and a mostly-transparent control overlay.
The transparency is a big concern because it doesn't seem to be a core feature of CEF (even though it is in both CefSharp and Electron?) but regardless, I haven't got that far yet: I'm still trying to work out how to add my overlay in the first place.
The overlay is a .html file so I thought this would be pretty simple to do using CefWindow::AddOverlayView. But it seems loading a file from anywhere other than a http/https URL is nigh-on-impossible in CEF - so that's a no-go. An overlay view does show but it's just a white rectangle covering up the whole page underneath, because it hasn't attempted to load any contents.
The next thing I tried was using a render process handler to intercept the overlay's creation and fill out the DOM myself. That isn't possible, either: I would need to know exactly which DOM belongs to my overlay, and the render process handler doesn't get informed about each of the views; when I create my first window and overlay, my render process handler gets one OnBrowserCreated and 13 OnContextCreated callbacks. (But only 8 OnContextReleased and 0 OnBrowserDestroyed, concerningly...)
I had the idea to pass a CefDictionaryValue into CefBrowserView::CreateBrowserView so I can identify browser views like that. But since I'm calling CreateBrowserView twice with two different dictionaries and only getting one OnBrowserCreated callback with one dictionary in it, it doesn't particularly help.
I'm starting to suspect the only way of achieving this relatively simple use-case will be to turn on windowless rendering, write my own code for opening a native x11/wayland/win32/cocoa window depending on platform, and set up a whole OpenGL or Vulkan context purely for drawing the pixels CEF sends me - thus taking up precious CPU bandwidth with work the GPU should rightly be doing. Even for a CEF application this seems like an insane level of design complexity just for one part of it to be possible. Please tell me there's a simpler way or something I'm missing? Thanks in advance.
Relevant repo links:
https://github.com/Adamcake/Bolt/blob/m ... rowser.cxx
https://github.com/Adamcake/Bolt/blob/m ... xx#L20-L25
https://github.com/Adamcake/Bolt/blob/m ... andler.cxx