Handling native windows on all platforms

Several facts on the windowing on OS level, so we are on track :

  • webview.h creates a window out of convenience for other developers
  • We can get control over that window from reference
  • webview.h can also run without a window, wich is useless to all other devs except us
  • We need control over windows from api namespace, like warp::api::windows::height(“Window2”, 360), so we create our own wrappers for them in Win**.h classes, for each OS;
  • it is our goal, in every moment, to put as much logic as we can to warp::api methods rather than classes them selfes : this code is shared for all OS’s

Yes, we can get a reference to the working window from webview and use this one, we could also pass this reference to instantiate our Win** instance but it all seems like workarounds around something we should have in our base…a controllable window.

Window State table

NameValueDescription
Normal0The window is restored.
Minimized1The window is minimized.
Maximized2The window is maximized.

In this example we can use existing ref wrapped in a GTK_WINDOW (I guess) so its doable but read on, i think the latter approach is even better.

From all the posibilities, and from what we need (controlable windows) it seems the best (to me, right now) to instantiate a win throough our Win**.h instance and run a webview.h inside it, BUT a webview.h without a win, like in this example.

creating a window separately (in our case we create it with api::windows::create) :

In the end we will probably wrap webview in our wrapper, called Web abreviated…why?
Well it will give us same API over all platforms, but a better one then Webview :

  • cross platform async eval with return
  • separation of windowing logic to Win** class and webview logic to Web component
  • history[] on Web component level and forward, back, canFroward, canBack functions (yes believe it or not even the most advanced “webview” MS WebView2 doesnt have it)
  • a bonus : serving from a folder, specially https (in this case server would be a dep of Web, not root project)

This file already exists in the git, actually.