diff --git a/v3/STATUS.md b/v3/STATUS.md index 5ed7c2db..0bdd58d3 100644 --- a/v3/STATUS.md +++ b/v3/STATUS.md @@ -52,7 +52,7 @@ Webview Window Interface Methods | setAlwaysOnTop(alwaysOnTop bool) | Y | | Y | | | setBackgroundColour(color RGBA) | Y | | Y | | | setFrameless(bool) | | | Y | | -| setFullscreenButtonEnabled(enabled bool) | X | | Y | There is no fullscreen button in Windows | +| setFullscreenButtonEnabled(enabled bool) | - | | Y | There is no fullscreen button in Windows | | setHTML(html string) | | | Y | | | setMaxSize(width, height int) | Y | | Y | | | setMinSize(width, height int) | Y | | Y | | @@ -148,6 +148,44 @@ Webview Window Interface Methods | SetZoom | | | Y | Set view scale | | Screen | | | Y | Get screen for window | + +### Window Options + +A 'Y' in the table below indicates that the option has been tested and is applied when the window is created. +An 'X' indicates that the option is not supported by the platform. + + +| Feature | Windows | Linux | Mac | Notes | +|---------------------------------|---------|-------|-----|--------------------------------------------| +| Name | | | | | +| Title | Y | | | | +| Width | Y | | | | +| Height | Y | | | | +| AlwaysOnTop | Y | | | | +| URL | | | | | +| DisableResize | Y | | | | +| Frameless | | | | | +| MinWidth | Y | | | | +| MinHeight | Y | | | | +| MaxWidth | Y | | | | +| MaxHeight | Y | | | | +| StartState | Y | | | | +| Mac | - | - | | | +| BackgroundType | | | | Acrylic seems to work but the others don't | +| BackgroundColour | Y | | | | +| HTML | | | | | +| JS | | | | | +| CSS | | | | | +| X | | | | | +| Y | | | | | +| HideOnClose | | | | | +| FullscreenButtonEnabled | | | | | +| Hidden | | | | | +| EnableFraudulentWebsiteWarnings | | | | | +| Zoom | | | | | +| EnableDragAndDrop | | | | | +| Windows | | - | - | | + ### Log To log or not to log? System logger vs custom logger. @@ -230,9 +268,9 @@ Built-in plugin support: | Icon Generation | | | Y | | | Icon Embedding | | | Y | | | Info.plist | | | Y | | -| NSIS Installer | | | | | +| NSIS Installer | | | - | | | Mac bundle | | | Y | | -| Windows exe | | | | | +| Windows exe | | | - | | ## Frameless Windows diff --git a/v3/pkg/application/options_webview_window.go b/v3/pkg/application/options_webview_window.go index 367ac2ce..be053794 100644 --- a/v3/pkg/application/options_webview_window.go +++ b/v3/pkg/application/options_webview_window.go @@ -12,7 +12,8 @@ const ( type WebviewWindowOptions struct { Name string Title string - Width, Height int + Width int + Height int AlwaysOnTop bool URL string DisableResize bool diff --git a/v3/pkg/application/webview_window_windows.go b/v3/pkg/application/webview_window_windows.go index 90a05014..6d51a3f7 100644 --- a/v3/pkg/application/webview_window_windows.go +++ b/v3/pkg/application/webview_window_windows.go @@ -662,6 +662,53 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp if w.framelessWithDecorations() { w32.ExtendFrameIntoClientArea(w.hwnd, true) } + case w32.WM_NCHITTEST: + // Get the cursor position + x := int32(w32.LOWORD(uint32(lparam))) + y := int32(w32.HIWORD(uint32(lparam))) + ptCursor := w32.POINT{X: x, Y: y} + + // Get the window rectangle + rcWindow := w32.GetWindowRect(w.hwnd) + + // Determine if the cursor is in a resize area + bOnResizeBorder := false + resizeBorderWidth := int32(5) // change this to adjust the resize border width + if ptCursor.X >= rcWindow.Right-resizeBorderWidth { + bOnResizeBorder = true // right edge + } + if ptCursor.Y >= rcWindow.Bottom-resizeBorderWidth { + bOnResizeBorder = true // bottom edge + } + if ptCursor.X <= rcWindow.Left+resizeBorderWidth { + bOnResizeBorder = true // left edge + } + if ptCursor.Y <= rcWindow.Top+resizeBorderWidth { + bOnResizeBorder = true // top edge + } + + // Return the appropriate value + if bOnResizeBorder { + if ptCursor.X >= rcWindow.Right-resizeBorderWidth && ptCursor.Y >= rcWindow.Bottom-resizeBorderWidth { + return w32.HTBOTTOMRIGHT + } else if ptCursor.X <= rcWindow.Left+resizeBorderWidth && ptCursor.Y >= rcWindow.Bottom-resizeBorderWidth { + return w32.HTBOTTOMLEFT + } else if ptCursor.X >= rcWindow.Right-resizeBorderWidth && ptCursor.Y <= rcWindow.Top+resizeBorderWidth { + return w32.HTTOPRIGHT + } else if ptCursor.X <= rcWindow.Left+resizeBorderWidth && ptCursor.Y <= rcWindow.Top+resizeBorderWidth { + return w32.HTTOPLEFT + } else if ptCursor.X >= rcWindow.Right-resizeBorderWidth { + return w32.HTRIGHT + } else if ptCursor.Y >= rcWindow.Bottom-resizeBorderWidth { + return w32.HTBOTTOM + } else if ptCursor.X <= rcWindow.Left+resizeBorderWidth { + return w32.HTLEFT + } else if ptCursor.Y <= rcWindow.Top+resizeBorderWidth { + return w32.HTTOP + } + } + return w32.HTCLIENT + case w32.WM_NCCALCSIZE: // Disable the standard frame by allowing the client area to take the full // window size.