more webview support and lld-link compat hacks

This commit is contained in:
Adam D. Ruppe 2022-04-03 14:54:00 -04:00
parent 77bc2828c3
commit 7f31dfbace
1 changed files with 58 additions and 4 deletions

View File

@ -327,6 +327,9 @@ version(Windows) {
}
version(Windows) {
version(minigui_manifest) {} else version=minigui_no_manifest;
version(minigui_no_manifest) {} else
static if(__VERSION__ >= 2_083)
version(CRuntime_Microsoft) { // FIXME: mingw?
// assume we want commctrl6 whenever possible since there's really no reason not to
@ -4204,6 +4207,19 @@ template classStaticallyEmits(This, EventType) {
class NestedChildWindowWidget : Widget {
SimpleWindow win;
/++
Used on X to send focus to the appropriate child window when requested by the window manager.
Normally returns its own nested window. Can also return another child or null to revert to the parent
if you override it in a child class.
History:
Added April 2, 2022 (dub v10.8)
+/
SimpleWindow focusableWindow() {
return win;
}
///
// win = new SimpleWindow(640, 480, null, OpenGlOptions.yes, Resizability.automaticallyScaleIfPossible, WindowTypes.nestedChild, WindowFlags.normal, getParentWindow(parent));
this(SimpleWindow win, Widget parent) {
@ -4236,6 +4252,18 @@ class NestedChildWindowWidget : Widget {
return pwin;
}
/++
Called upon the nested window being destroyed.
Remember the window has already been destroyed at
this point, so don't use the native handle for anything.
History:
Added April 3, 2022 (dub v10.8)
+/
protected void dispose() {
}
protected void windowsetup(SimpleWindow w) {
/*
win.onFocusChange = (bool getting) {
@ -4244,6 +4272,23 @@ class NestedChildWindowWidget : Widget {
};
*/
/+
win.onFocusChange = (bool getting) {
if(getting) {
this.parentWindow.focusedWidget = this;
this.emit!FocusEvent();
this.emit!FocusInEvent();
} else {
this.emit!BlurEvent();
this.emit!FocusOutEvent();
}
};
+/
win.onDestroyed = () {
this.dispose();
};
version(win32_widgets) {
Widget.nativeMapping[win.hwnd] = this;
this.originalWindowProcedure = cast(WNDPROC) SetWindowLongPtr(win.hwnd, GWL_WNDPROC, cast(size_t) &HookedWndProc);
@ -4259,8 +4304,7 @@ class NestedChildWindowWidget : Widget {
parentWindow.dispatchMouseEvent(e);
},
(KeyEvent e) {
//import std.stdio;
//writefln("%x %s", cast(uint) e.key, e.key);
//import std.stdio; writefln("%s %x %s", cast(void*) win, cast(uint) e.key, e.key);
parentWindow.dispatchKeyEvent(e);
},
(dchar e) {
@ -7926,11 +7970,21 @@ class Window : Widget {
if(Runtime.args.length)
title = Runtime.args[0];
}
win = new SimpleWindow(width, height, title, OpenGlOptions.no, Resizability.allowResizing, WindowTypes.normal, WindowFlags.dontAutoShow);
win = new SimpleWindow(width, height, title, OpenGlOptions.no, Resizability.allowResizing, WindowTypes.normal, WindowFlags.dontAutoShow | WindowFlags.managesChildWindowFocus);
win.setRequestedInputFocus = &this.setRequestedInputFocus;
this(win);
}
private SimpleWindow setRequestedInputFocus() {
if(auto fw = cast(NestedChildWindowWidget) focusedWidget) {
// sdpyPrintDebugString("heaven");
return fw.focusableWindow;
}
return win;
}
/// ditto
this(string title, int width = 500, int height = 500) {
this(width, height, title);
@ -9715,7 +9769,7 @@ class MenuBar : Widget {
Status bars appear at the bottom of a MainWindow.
They are made out of Parts, with a width and content.
They can have multiple parts or be in simple mode. FIXME: implement
They can have multiple parts or be in simple mode. FIXME: implement simple mode.
sb.parts[0].content = "Status bar text!";