diff --git a/docs/subsystems/gui-shell.md b/docs/subsystems/gui-shell.md index 9044cbcde..34cd240ad 100644 --- a/docs/subsystems/gui-shell.md +++ b/docs/subsystems/gui-shell.md @@ -35,7 +35,7 @@ three. 4. The page reads `GET /api/state` and writes through `POST` routes. Each write answers with the new state, built under `held`. 5. Closing the window hides it. On the Mac a full-screen window first leaves full screen (`closeStep`). The system's close on the panel (a title bar's X, Alt+F4, a window manager's close key) hides it as Escape does, so the tray icon opens it again; a panel lightweight mode let go, no longer `h.panel`, closes (`makePanel`, `TestPanelCloseHidesIt`). A hidden macOS window keeps its WKWebView's page marked visible, so `hideWebview` tells the page it is out of sight before `orderOut`; that makes `document.hidden` and `visibilityState` true, stops the page's polling and frame loops, and pauses CSS animations. `showWebview` tells it it is visible again (#4293). Lightweight mode lets go only of a window closed this way: one covered by another app's window, minimised, or open as magpie was hidden is still open (`windowUp`, not Wails' `IsVisible`, which is the occlusion state), and so is it for the Dock while the window is open and for a restart (#1381, `TestCoveredWindowStaysUp`). On the Mac the tray icon and a usage cell close an open panel by the same test (`windowOpen` in `togglePanelNow` and `trayCellClick`, not Wails' `ToggleWindow`), so under a window over the whole screen, such as a remote-desktop server's privacy curtain, the icon still closes the panel instead of showing it again (#1661, `TestTrayCellClickReleasedPanel`). On Windows a hidden window's WebView2 is put on its low memory target (`lowWhileHidden`, [`memtarget_windows.go`](../../internal/gui/memtarget_windows.go): `ICoreWebView2_19::put_MemoryUsageTargetLevel`, on each hide, on a page that comes while hidden, and back to normal on each show), so the panel and the window kept loaded in the tray stop holding what they last drew; the page stays loaded and running, unlike lightweight mode. In the tray the WebView2 processes' private working set went from ~170 MB to 20 to 40 MB, while their commit charge stayed where it was (molamaker11 on X). WKWebView and WebKitGTK have nothing magpie can set for it. 6. The window opens as it was last left. Its settled size and whether it was maximised are kept in `settings.Window` and `settings.WindowMaximised` (`settle`; per machine, see `KeepOwn`). A maximised window keeps the size it restores to. `makeMain` opens it at that size (`openSize`). On its first show, `placeMain` maximises it again on the Mac and Windows (on Windows once the page has come). On Linux, `makeMain` makes it maximised with `StartState`. On Windows a size larger than the screen's work area is fitted and centred (`fitRoom`), and the larger size stays kept. Where it was left is kept too, in `settings.WindowAt` (its top left corner across every screen, in the system's coordinates), so after a restart or an update it opens there rather than in the middle (jorbenzhu on Discord). `keepAt` saves it once a move or resize has rested for half a second, unless the window is maximised, full screen, minimised or hidden; `settings.Save` writes through temp and rename, and a settings file that can't be read is left alone. On its first show `placeMain` puts it back (`putBack`): `openAt` takes the screen holding most of the window, moves the window fully onto that screen's work area, and leaves it centred when no screen holds any of it, such as a monitor that is gone, or when the screens or the file can't be read (`TestOpenAt`). Under Wayland a window can't place itself, so nothing is kept or put back there unless GDK_BACKEND is x11 (`keepsPlace`, `TestKeepsPlace`). The pin in the window's title bar, between Refresh and Settings (`#pin`, `renderOnTop`; NovaStudiosss on X, to watch Usage and Routing while working in another app), keeps the window above other apps' windows: `POST /api/window/ontop?on=1` (or `0`) saves `settings.OnTop` (`SetOnTop`, this computer's own, kept through a Settings save) and calls `SetAlwaysOnTop`, and `makeMain` opens the window pinned when it is set. boot.js says whether there is a pin (`pin`, `pinnable` in `ontop.go`) and whether it is pressed (`onTop`) before the first paint. There is none in the panel, in a browser page or `magpie web`, or under Wayland (the same `keepsPlace`: GTK's keep-above does nothing there), and the route refuses there with 400 and saves nothing (`TestPinKeepsWindowOnTop`, `TestPinRefusedWithoutAWindowToPin`, `window-pin.test.cjs`). The tray's panel isn't kept: on the Mac and Windows it opens under the tray icon, and on Linux where the click was. -7. The page's header is the window's title bar. `plainTitlebar` sets it up once the app has started, and again on a window lightweight mode made again (`madeAgain`). On Linux it hides GTK's title bar and keeps the shadow and the resize edges; GTK 3 leaves the corners square. On the Mac the traffic lights are inset into the header (`MacTitleBarHiddenInset`). In the design of macOS 26 a window with a toolbar has larger corners than one with a plain title bar, so `insetLights` ([`titlebar_darwin.go`](../../internal/gui/titlebar_darwin.go)) takes the toolbar off, and `MagpieLights` keeps the lights and the title bar's height where the toolbar had them: after a resize, a new title, light or dark, more contrast or less transparency, and leaving full screen. A sheet, such as the folder chooser, still begins below the title bar. A first press while another app is in front still moves the window from anywhere in that title bar (`firstPress`), as AppKit moved it with the toolbar; AppKit itself now does so only in a plain title bar's top 32pt. AppKit gives a program that design from macOS 26 when the program is linked against the macOS 26 SDK or a later one and its Info.plist doesn't ask for the earlier design (`UIDesignRequiresCompatibility`); `designOf26` reads each at run time, as the SDK depends on the toolchain that built magpie. The toolbar stays where it doesn't change the corners: in the earlier design, and on macOS 27, which gives a window with a toolbar a plain title bar's 16pt corners (`toolbarRounder` holds the window's radius against a window of its style with no toolbar, never shown); with the lights on the right (a right-to-left language), or when the title bar isn't laid out as expected; this is decided once, when the window is set up. In full screen the title bar is AppKit's own. On Windows the main window is frameless (`mainFrameless` in [`mainwindow.go`](../../internal/gui/mainwindow.go)), so a wallpaper or the page's colour runs to its top instead of stopping under a separate strip (258a14 on X). Wails keeps the frame's styles, so it still has its shadow and Windows 11's rounded corners, and snaps with Win+arrows and by dragging to a screen's edge. The page draws the caption buttons at the header's right (`#wincap`, shown by app.css under `html.win` from `layout.js` in the window and not on the web, run by `wincap.js`, which app.js imports in that window alone, Segoe Fluent Icons' glyphs, Close red on hover); they minimise, maximise or restore, and close (hide; the tray stays), and stay over a dialog's scrim (`wincap.js` undoes the `inert` that `modalBackground` sets on them). The header's own tools sit left of them. A double click on anything that drags the window maximises or restores it. The app tells the page whether the window is maximised (`captionJS`, on Wails' runtime ready and on a resize that changes it), which swaps maximise for restore and keeps Wails' resize edges inside the page off while maximised, so the top-right pixel is Close's (`TestCaptionKeepsEdgesOffWhileMaximised`, `win-caption.test.cjs`). Windows 11's snap layouts flyout over maximise isn't shown: it needs Wails' composition hosting (`--wails-non-client-region`), which forwards input by `SendMouseInput` only. The panel keeps its own window as before. +7. The page's header is the window's title bar. `plainTitlebar` sets it up once the app has started, and again on a window lightweight mode made again (`madeAgain`). On Linux it hides GTK's title bar and keeps the shadow and the resize edges; GTK 3 leaves the corners square. On the Mac the traffic lights are inset into the header (`MacTitleBarHiddenInset`). In the design of macOS 26 a window with a toolbar has larger corners than one with a plain title bar, so `insetLights` ([`titlebar_darwin.go`](../../internal/gui/titlebar_darwin.go)) takes the toolbar off, and `MagpieLights` keeps the lights and the title bar's height where the toolbar had them: after a resize, a new title, light or dark, more contrast or less transparency, and leaving full screen. A sheet, such as the folder chooser, still begins below the title bar. A first press while another app is in front still moves the window from anywhere in that title bar (`firstPress`), as AppKit moved it with the toolbar; AppKit itself now does so only in a plain title bar's top 32pt. AppKit gives a program that design from macOS 26 when the program is linked against the macOS 26 SDK or a later one and its Info.plist doesn't ask for the earlier design (`UIDesignRequiresCompatibility`); `designOf26` reads each at run time, as the SDK depends on the toolchain that built magpie. The toolbar stays where it doesn't change the corners: in the earlier design, and on macOS 27, which gives a window with a toolbar a plain title bar's 16pt corners (`toolbarRounder` holds the window's radius against a window of its style with no toolbar, never shown); with the lights on the right (a right-to-left language), or when the title bar isn't laid out as expected; this is decided once, when the window is set up. In full screen the title bar is AppKit's own. On Windows the main window is frameless (`mainFrameless` in [`mainwindow.go`](../../internal/gui/mainwindow.go)), so a wallpaper or the page's colour runs to its top instead of stopping under a separate strip (258a14 on X). Wails keeps the frame's styles, so it still has its shadow and Windows 11's rounded corners, and snaps with Win+arrows and by dragging to a screen's edge. Wails' frameless window has no frame left to resize from, only a band 4px wide inside the page, and the page's scrollbar covers it on the right (Puremilk_chun on X), so the main window keeps Windows' own resize border on its left, right and bottom, outside the page as on a framed window (`mainFrameCalc` in [`mainframe_windows.go`](../../internal/gui/mainframe_windows.go), asked first by `appWndProc`; `keepResizeFrame` names the window once Wails' runtime is ready; `TestMainWindowKeepsResizeBorder`). Its top is still the page's, resized by Wails' band; maximised or in full screen Wails sizes it as before. The page draws the caption buttons at the header's right (`#wincap`, shown by app.css under `html.win` from `layout.js` in the window and not on the web, run by `wincap.js`, which app.js imports in that window alone, Segoe Fluent Icons' glyphs, Close red on hover); they minimise, maximise or restore, and close (hide; the tray stays), and stay over a dialog's scrim (`wincap.js` undoes the `inert` that `modalBackground` sets on them). The header's own tools sit left of them. A double click on anything that drags the window maximises or restores it. The app tells the page whether the window is maximised (`captionJS`, on Wails' runtime ready and on a resize that changes it), which swaps maximise for restore and keeps Wails' resize edges inside the page off while maximised, so the top-right pixel is Close's (`TestCaptionKeepsEdgesOffWhileMaximised`, `win-caption.test.cjs`). Windows 11's snap layouts flyout over maximise isn't shown: it needs Wails' composition hosting (`--wails-non-client-region`), which forwards input by `SendMouseInput` only. The panel keeps its own window as before. 8. On the Mac, Settings › Show in Dock puts magpie in the Dock never (`DockNever`), while the window is open (the default; `DockWindow` records it chosen, for an older magpie that took none for never) or always (`Dock`, which wins). The default was never until ShouguangCao on X found the open window out of Command-Tab, so going back to it to paste a key copied elsewhere took the menu bar; a new install (no settings.json) reads With window, and Hide is a choice of its own (`inDock`, `dockChoice` in app.js, `TestDockFollowsWindowByDefault`, `dock-choice.test.cjs`). A file written before that has no `dockSettled`, and stored Hide as nothing, so a user who chose Hide can't be told from one who never chose: such a file with no Dock choice reads as Hide, and the first save writes it so with `dockSettled` (`settleDock`, `TestOlderSettingsKeepHide`, `TestNewInstallFollowsWindow`). A file nobody can read reads the same way. The page never sends `dockSettled`; the save keeps the file's (`TestSettingsSaveKeepsDockReading`). It is this computer's own, as the Dock choice is (`KeepOwn`). A full-screen window joins it whatever the setting (`inDock`, `dockOnFullscreen`). `openMain` joins before it shows the window (`setDock` runs on the main thread at once). An app activated out of the Dock (the quick panel's focus) that then joins it stays last in Command-Tab's order though it is in front, so joining to the front activates magpie by way of the Dock (`dockStep`, `activateAgain`; #1381, `TestDockStep`, `TestDockJoinLeadsCommandTab`). It does so without asking NSApp whether magpie is active: the Mac makes it the front app at once, and NSApp says so only once the main thread has taken that in, after the join on a busy Mac (#1651). 9. Settings › General › Quick panel shortcut binds a key combination that opens the tray's panel from any app (ben hanks on Discord); none is set by default. The page records the keys and posts them to `POST /api/settings/panel-shortcut`, which checks them (`panelShortcut`: a letter, digit, Space or F1–F20 with Ctrl, Alt/Option or Cmd/Super, or an F key alone, written as Wails' accelerator), has the running app bind them (`onPanelShortcut`, `bindPanelKey` through Wails' `GlobalShortcut`: Carbon's hot keys on the Mac, `RegisterHotKey` on Windows, `XGrabKey` on X11) and saves them only once bound. One the system refuses (on Windows and X11, another app holding it) is not saved and the old one stays bound; one saved but refused as magpie starts is retried after a handed-over magpie exits and else said in the row (`panelKeysJSON.Taken`). A pressed shortcut toggles the panel as a tray click does (`togglePanel`). The Mac's Carbon hot keys don't refuse a combination another app registered too, so there both are taken and magpie can't tell the user. The shortcut is per computer (`KeepOwn`), and the Mac's old process lets go of it as it hands over (`leaveMenuBar`). On Wayland no app may grab keys itself, so the field is off and the row says the command to bind in the desktop's own keyboard settings (`magpie panel`); Wails' GlobalShortcuts portal is not used, since the compositor decides its keys and Hyprland binds none unless configured. From there a not-connected Claude Code's or Codex's opened row switches its account (shuizhuyu on X, [Switch accounts only](providers-accounts.md)). 10. A click on the tray icon opens the quick panel, or the main window when Settings › General › Click the tray icon to says so. The panel opens the main window from one control, on its edge nearest the tray (isaac_bai on Discord): hung below its icon (the Mac's menu bar, a taskbar or bar at the top) it is the header's icon (`#open`, named "Open the main window"); standing above it (Windows' taskbar at the bottom, a bottom panel on Linux) it is the foot's "Open the main window" left of Quit (`#openMain`), and the header has no icon. The two are never shown together (yogurt36 on Discord). Once `togglePanelNow` has placed and shown the panel, `tellPanelSide` reads the panel's bounds and its screen's and sends `magpiePanelOpenAt("foot")` when the panel is nearer the screen's bottom, `"head"` otherwise (`panelOpenAt`; the Mac is always `head`). Under Wayland a window can't read where the compositor put it, and until the app says, layout.js sets `body[data-open-at]` by the system: `foot` on Windows, `head` elsewhere ([`panelside.go`](../../internal/gui/panelside.go), `TestPanelOpensTheWindowFromTheEdgeNearestTheTray`, `panel-open-once.test.cjs`). On Windows a double-click on the icon opens the main window too (isaac_bai on Discord): Wails passes the icon's `WM_LBUTTONDBLCLK` on as `OnDoubleClick`, the panel its first click opened is hidden by `openMain`, and the `WM_LBUTTONUP` that ends the double-click is swallowed once (`trayDouble`, within `trayDoubleRelease`) so it does not open the panel over the window. The Mac's status item calls its action on each mouse-down with no click count, and Linux's StatusNotifierItem has only `Activate`, so there a double-click is two clicks and is left as such (`trayDoubleClicks`, `TestTrayDoubleClickOpensTheWindowOnWindowsOnly`, `TestTrayDoubleClickReleaseSwallowedOnce`; [`traydouble.go`](../../internal/gui/traydouble.go)). diff --git a/internal/gui/lightweight.go b/internal/gui/lightweight.go index 8bb194b2c..fe9ac1edc 100644 --- a/internal/gui/lightweight.go +++ b/internal/gui/lightweight.go @@ -65,6 +65,8 @@ func (h *host) makeMain(url string) *application.WebviewWindow { lowWhileHidden(w) h.mendWebView(w) if mainFrameless(runtime.GOOS) { + // resized from Windows' own border too, not the page's edge alone + keepResizeFrame(w) // the page's caption buttons follow the window's maximised state // (captionJS); a resize that changes it says so, once var maxed atomic.Bool diff --git a/internal/gui/mainframe_windows.go b/internal/gui/mainframe_windows.go new file mode 100644 index 000000000..2a6ae4855 --- /dev/null +++ b/internal/gui/mainframe_windows.go @@ -0,0 +1,63 @@ +//go:build windows && !nogui + +package gui + +import ( + "sync/atomic" + "unsafe" + + "github.com/wailsapp/wails/v3/pkg/application" + "github.com/wailsapp/wails/v3/pkg/events" + "github.com/wailsapp/wails/v3/pkg/w32" +) + +// The frameless main window (mainFrameless) keeps Windows' own resize +// border on its left, right and bottom. Puremilk_chun on X: after 0.1.4274 +// the window couldn't be resized. Wails' frameless window answers +// WM_NCCALCSIZE with the whole window as its client area, so nothing is +// left of the frame, and only Wails' page script resizes it: a band +// SM_CXSIZEFRAME pixels wide (4 at 100%) inside the page's edge, which on +// the right is under the page's scrollbar and does nothing. Windows +// 11 is resized from the invisible band outside a window's visible edge, +// where 0.1.4273's framed window answered HTRIGHT and the like; on 4281 +// it answered nothing and a drag there did nothing (tried on the Windows +// box). mainFrameCalc lets Windows work out the frame as for any framed +// window, then puts the client area's top back at the window's top, so +// the header is still the title bar and the page runs to the top edge; +// the top is resized by Wails' band inside the page. Maximised, the window +// has no frame to keep and Wails fits it to the work area; full screen it +// has no WS_THICKFRAME. + +// mainHwnd is the main window's handle once it is made; 0 before. +var mainHwnd atomic.Uintptr + +// mainFrameCalc answers WM_NCCALCSIZE for the main window (appWndProc). +func mainFrameCalc(hwnd uintptr, msg uint32, wParam, lParam uintptr) (uintptr, bool) { + if msg != w32.WM_NCCALCSIZE || wParam == 0 || hwnd == 0 || hwnd != mainHwnd.Load() { + return 0, false + } + if uint32(w32.GetWindowLong(hwnd, w32.GWL_STYLE))&w32.WS_THICKFRAME == 0 || w32.IsZoomed(hwnd) { + return 0, false + } + r := *(**w32.RECT)(unsafe.Pointer(&lParam)) // rgrc[0], the window rect, first in NCCALCSIZE_PARAMS + top := r.Top + w32.DefWindowProc(hwnd, msg, wParam, lParam) + r.Top = top + return 0, true +} + +// keepResizeFrame has the main window w keep its resize border: it is told +// apart from magpie's other windows by its handle, and its frame worked +// out again once the handle is known. That waits for the page to be +// ready: the first main window is made before Wails' main loop runs. +func keepResizeFrame(w *application.WebviewWindow) { + w.OnWindowEvent(events.Common.WindowRuntimeReady, func(*application.WindowEvent) { + application.InvokeAsync(func() { + p := uintptr(w.NativeWindow()) + if p == 0 || mainHwnd.Swap(p) == p { + return + } + w32.SetWindowPos(p, 0, 0, 0, 0, 0, w32.SWP_NOMOVE|w32.SWP_NOSIZE|w32.SWP_NOZORDER|w32.SWP_NOACTIVATE|w32.SWP_FRAMECHANGED) + }) + }) +} diff --git a/internal/gui/mainframe_windows_test.go b/internal/gui/mainframe_windows_test.go new file mode 100644 index 000000000..5d7af52d8 --- /dev/null +++ b/internal/gui/mainframe_windows_test.go @@ -0,0 +1,101 @@ +//go:build windows && !nogui + +package gui + +import ( + "runtime" + "testing" + "unsafe" + + "github.com/wailsapp/wails/v3/pkg/w32" + "golang.org/x/sys/windows" +) + +// framelessTestProc answers as Wails' frameless window does: magpie's +// interceptor first (mainFrameCalc, which appWndProc asks first), then +// WM_NCCALCSIZE with the whole window as the client area. +var framelessTestProc = windows.NewCallback(func(hwnd, msg, wParam, lParam uintptr) uintptr { + if r, ok := mainFrameCalc(hwnd, uint32(msg), wParam, lParam); ok { + return r + } + if msg == w32.WM_NCCALCSIZE && wParam != 0 { + return 0 + } + return w32.DefWindowProc(hwnd, uint32(msg), wParam, lParam) +}) + +func framelessTestWindow(t *testing.T) uintptr { + t.Helper() + cls, _ := windows.UTF16PtrFromString("magpieFramelessTest") + wc := w32.WNDCLASSEX{WndProc: framelessTestProc, Instance: w32.GetModuleHandle(""), ClassName: cls} + wc.Size = uint32(unsafe.Sizeof(wc)) + w32.RegisterClassEx(&wc) // once a process; a second call fails harmlessly + title, _ := windows.UTF16PtrFromString("magpie frameless test") + hwnd := w32.CreateWindowEx(0, cls, title, w32.WS_OVERLAPPEDWINDOW, 100, 100, 800, 600, 0, 0, wc.Instance, nil) + if hwnd == 0 { + t.Fatalf("CreateWindowEx: %v", windows.GetLastError()) + } + t.Cleanup(func() { w32.DestroyWindow(hwnd) }) + return hwnd +} + +func reframe(hwnd uintptr) { + w32.SetWindowPos(hwnd, 0, 0, 0, 0, 0, w32.SWP_NOMOVE|w32.SWP_NOSIZE|w32.SWP_NOZORDER|w32.SWP_NOACTIVATE|w32.SWP_FRAMECHANGED) +} + +func hitAt(hwnd uintptr, x, y int) uintptr { + return w32.SendMessage(hwnd, w32.WM_NCHITTEST, 0, uintptr(uint32(uint16(int16(y)))<<16|uint32(uint16(int16(x))))) +} + +// Puremilk_chun on X: the frameless main window (0.1.4274 on) couldn't be +// resized from outside its edge. Its left, right and bottom are Windows' +// resize border again, while its top is still the page's (the header is +// the title bar); maximised it fills the window, and any other window is +// left as Wails made it. +func TestMainWindowKeepsResizeBorder(t *testing.T) { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + defer mainHwnd.Store(0) + + main := framelessTestWindow(t) + mainHwnd.Store(main) + reframe(main) + r := w32.GetWindowRect(main) + cx, cy := w32.ClientToScreen(main, 0, 0) + if cy != int(r.Top) { + t.Errorf("the page starts %dpx below the window's top, want 0: the header is the title bar", cy-int(r.Top)) + } + if cx <= int(r.Left) { + t.Errorf("the page starts at the window's left edge: no resize border is left there") + } + midX, midY := int(r.Left+r.Right)/2, int(r.Top+r.Bottom)/2 + for _, c := range []struct { + name string + x, y int + want uintptr + }{ + {"left", int(r.Left), midY, w32.HTLEFT}, + {"right", int(r.Right) - 1, midY, w32.HTRIGHT}, + {"bottom", midX, int(r.Bottom) - 1, w32.HTBOTTOM}, + {"bottom right", int(r.Right) - 1, int(r.Bottom) - 1, w32.HTBOTTOMRIGHT}, + {"top", midX, int(r.Top) + 1, w32.HTCLIENT}, + } { + if got := hitAt(main, c.x, c.y); got != c.want { + t.Errorf("%s edge of the main window hits %d, want %d", c.name, got, c.want) + } + } + + w32.ShowWindow(main, w32.SW_MAXIMIZE) + reframe(main) + mr, cr := w32.GetWindowRect(main), w32.GetClientRect(main) + if cr.Right-cr.Left != mr.Right-mr.Left { + t.Errorf("maximised, the page is %dpx narrower than the window: Wails fits a maximised window", (mr.Right-mr.Left)-(cr.Right-cr.Left)) + } + + other := framelessTestWindow(t) + reframe(other) + r = w32.GetWindowRect(other) + if got := hitAt(other, int(r.Right)-1, int(r.Top+r.Bottom)/2); got != w32.HTCLIENT { + t.Errorf("another window's right edge hits %d, want HTCLIENT as Wails made it", got) + } +} diff --git a/internal/gui/screenback_windows.go b/internal/gui/screenback_windows.go index f88c7fd2b..7c87fac61 100644 --- a/internal/gui/screenback_windows.go +++ b/internal/gui/screenback_windows.go @@ -122,8 +122,12 @@ func screenBackFrom(msg uint32, wParam, lParam uintptr) string { // appWndProc is the app's WndProcInterceptor (windowsOptions): a window // not being shown for the user isn't activated (hookNoActivate), the screen // coming back draws the windows again, and the screens are read -// (screensWndProc). None keeps a message from Wails but the screens'. +// (screensWndProc). None keeps a message from Wails but the screens' and +// the main window's frame (mainFrameCalc). var appWndProc = func(hwnd uintptr, msg uint32, wParam, lParam uintptr) (uintptr, bool) { + if r, ok := mainFrameCalc(hwnd, msg, wParam, lParam); ok { + return r, true + } if msg == w32.WM_DESTROY && hwnd == ownMainThreadWindow() { unhookNoActivate() } else { diff --git a/internal/gui/webviewmend_other.go b/internal/gui/webviewmend_other.go index cf62f3902..1f653f49d 100644 --- a/internal/gui/webviewmend_other.go +++ b/internal/gui/webviewmend_other.go @@ -17,4 +17,8 @@ func awaitBrowserGone() {} // The screen coming back is watched on Windows only (screenback_windows.go). func watchScreenBack() {} +// Only Windows' frameless main window needs its resize border kept +// (mainframe_windows.go). +func keepResizeFrame(*application.WebviewWindow) {} + var appWndProc func(hwnd uintptr, msg uint32, wParam, lParam uintptr) (uintptr, bool)