5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-07 03:00:52 +08:00

[v3] Change WebviewWindow options to be a value, not a pointer. Support Un/Fullscreen. Remove main thread switching. Use parent options instead of local variables.

This commit is contained in:
Lea Anthony 2023-05-01 18:20:28 +10:00 committed by Misite Bao
parent d56bb59b72
commit 4c04991d4d
20 changed files with 127 additions and 76 deletions

View File

@ -17,8 +17,8 @@ Application interface methods
| setIcon(icon []byte) | | | Y | | | setIcon(icon []byte) | | | Y | |
| on(id uint) | | | Y | | | on(id uint) | | | Y | |
| dispatchOnMainThread(fn func()) | Y | | Y | | | dispatchOnMainThread(fn func()) | Y | | Y | |
| hide() | | | Y | | | hide() | Y | | Y | |
| show() | | | Y | | | show() | Y | | Y | |
| getPrimaryScreen() (*Screen, error) | | | Y | | | getPrimaryScreen() (*Screen, error) | | | Y | |
| getScreens() ([]*Screen, error) | | | Y | | | getScreens() ([]*Screen, error) | | | Y | |

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -20,7 +20,7 @@ func main() {
}, },
}) })
// Create window // Create window
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Plain Bundle", Title: "Plain Bundle",
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`, CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
Mac: application.MacWindow{ Mac: application.MacWindow{

View File

@ -242,7 +242,7 @@ func (a *App) On(eventType events.ApplicationEventType, callback func()) func()
} }
} }
func (a *App) NewWebviewWindow() *WebviewWindow { func (a *App) NewWebviewWindow() *WebviewWindow {
return a.NewWebviewWindowWithOptions(&WebviewWindowOptions{}) return a.NewWebviewWindowWithOptions(WebviewWindowOptions{})
} }
func (a *App) GetPID() int { func (a *App) GetPID() int {
@ -283,11 +283,7 @@ func (a *App) error(message string, args ...any) {
}) })
} }
func (a *App) NewWebviewWindowWithOptions(windowOptions *WebviewWindowOptions) *WebviewWindow { func (a *App) NewWebviewWindowWithOptions(windowOptions WebviewWindowOptions) *WebviewWindow {
// Ensure we have sane defaults
if windowOptions == nil {
windowOptions = WebviewWindowDefaults
}
newWindow := NewWindow(windowOptions) newWindow := NewWindow(windowOptions)
id := newWindow.id id := newWindow.id
if a.windows == nil { if a.windows == nil {

View File

@ -27,6 +27,10 @@ type WindowsWindow struct {
Theme Theme Theme Theme
// Custom colours for dark/light mode // Custom colours for dark/light mode
CustomTheme *ThemeSettings CustomTheme *ThemeSettings
// Disable all window decorations in Frameless mode, which means no "Aero Shadow" and no "Rounded Corner" will be shown.
// "Rounded Corners" are only available on Windows 11.
DisableFramelessWindowDecorations bool
} }
type Theme int type Theme int

View File

@ -69,7 +69,7 @@ type WindowEventListener struct {
} }
type WebviewWindow struct { type WebviewWindow struct {
options *WebviewWindowOptions options WebviewWindowOptions
impl webviewWindowImpl impl webviewWindowImpl
implLock sync.RWMutex implLock sync.RWMutex
id uint id uint
@ -103,7 +103,7 @@ func (w *WebviewWindow) onApplicationEvent(eventType events.ApplicationEventType
} }
// NewWindow creates a new window with the given options // NewWindow creates a new window with the given options
func NewWindow(options *WebviewWindowOptions) *WebviewWindow { func NewWindow(options WebviewWindowOptions) *WebviewWindow {
if options.Width == 0 { if options.Width == 0 {
options.Width = 800 options.Width = 800
} }

View File

@ -17,9 +17,11 @@ type windowsWebviewWindow struct {
parent *WebviewWindow parent *WebviewWindow
hwnd w32.HWND hwnd w32.HWND
// Size Restrictions // Fullscreen flags
minWidth, minHeight int isCurrentlyFullscreen bool
maxWidth, maxHeight int previousWindowStyle uint32
previousWindowExStyle uint32
previousWindowPlacement w32.WINDOWPLACEMENT
} }
func (w *windowsWebviewWindow) nativeWindowHandle() uintptr { func (w *windowsWebviewWindow) nativeWindowHandle() uintptr {
@ -37,13 +39,11 @@ func (w *windowsWebviewWindow) setSize(width, height int) {
} }
func (w *windowsWebviewWindow) setAlwaysOnTop(alwaysOnTop bool) { func (w *windowsWebviewWindow) setAlwaysOnTop(alwaysOnTop bool) {
globalApplication.dispatchOnMainThread(func() { position := w32.HWND_NOTOPMOST
position := w32.HWND_NOTOPMOST if alwaysOnTop {
if alwaysOnTop { position = w32.HWND_TOPMOST
position = w32.HWND_TOPMOST }
} w32.SetWindowPos(w.hwnd, position, 0, 0, 0, 0, uint(w32.SWP_NOMOVE|w32.SWP_NOSIZE))
w32.SetWindowPos(w.hwnd, position, 0, 0, 0, 0, uint(w32.SWP_NOMOVE|w32.SWP_NOSIZE))
})
} }
func (w *windowsWebviewWindow) setURL(url string) { func (w *windowsWebviewWindow) setURL(url string) {
@ -52,19 +52,17 @@ func (w *windowsWebviewWindow) setURL(url string) {
} }
func (w *windowsWebviewWindow) setResizable(resizable bool) { func (w *windowsWebviewWindow) setResizable(resizable bool) {
globalApplication.dispatchOnMainThread(func() { w.setStyle(resizable, w32.WS_THICKFRAME)
w.setStyle(resizable, w32.WS_THICKFRAME)
})
} }
func (w *windowsWebviewWindow) setMinSize(width, height int) { func (w *windowsWebviewWindow) setMinSize(width, height int) {
w.minWidth = width w.parent.options.MinWidth = width
w.minHeight = height w.parent.options.MinHeight = height
} }
func (w *windowsWebviewWindow) setMaxSize(width, height int) { func (w *windowsWebviewWindow) setMaxSize(width, height int) {
w.maxWidth = width w.parent.options.MaxWidth = width
w.maxHeight = height w.parent.options.MaxHeight = height
} }
func (w *windowsWebviewWindow) execJS(js string) { func (w *windowsWebviewWindow) execJS(js string) {
@ -80,14 +78,13 @@ func (w *windowsWebviewWindow) run() {
globalApplication.dispatchOnMainThread(w._run) globalApplication.dispatchOnMainThread(w._run)
} }
func (w *windowsWebviewWindow) framelessWithDecorations() bool {
return w.parent.options.Frameless && !w.parent.options.Windows.DisableFramelessWindowDecorations
}
func (w *windowsWebviewWindow) _run() { func (w *windowsWebviewWindow) _run() {
// Copy options
options := w.parent.options options := w.parent.options
w.minWidth = options.MinWidth
w.minHeight = options.MinHeight
w.maxWidth = options.MaxWidth
w.maxHeight = options.MaxHeight
var exStyle uint var exStyle uint
exStyle = w32.WS_EX_CONTROLPARENT | w32.WS_EX_APPWINDOW exStyle = w32.WS_EX_CONTROLPARENT | w32.WS_EX_APPWINDOW
@ -119,9 +116,7 @@ func (w *windowsWebviewWindow) _run() {
windowsApp := globalApplication.impl.(*windowsApp) windowsApp := globalApplication.impl.(*windowsApp)
windowsApp.registerWindow(w) windowsApp.registerWindow(w)
if options.DisableResize { w.setResizable(!options.DisableResize)
w.setResizable(false)
}
// Icon // Icon
if !options.Windows.DisableIcon { if !options.Windows.DisableIcon {
@ -141,7 +136,6 @@ func (w *windowsWebviewWindow) _run() {
case BackgroundTypeTranslucent: case BackgroundTypeTranslucent:
w.setBackdropType(options.Windows.BackdropType) w.setBackdropType(options.Windows.BackdropType)
} }
w.setForeground()
// Process the theme // Process the theme
switch options.Windows.Theme { switch options.Windows.Theme {
@ -156,6 +150,20 @@ func (w *windowsWebviewWindow) _run() {
w.updateTheme(true) w.updateTheme(true)
} }
// Process StartState
switch options.StartState {
case WindowStateMaximised:
if w.parent.Resizable() {
w.maximise()
}
case WindowStateMinimised:
w.minimise()
case WindowStateFullscreen:
w.fullscreen()
}
w.setForeground()
if !options.Hidden { if !options.Hidden {
w.show() w.show()
w.update() w.update()
@ -166,6 +174,21 @@ func (w *windowsWebviewWindow) center() {
w32.CenterWindow(w.hwnd) w32.CenterWindow(w.hwnd)
} }
func (w *windowsWebviewWindow) disableSizeConstraints() {
w.setMaxSize(0, 0)
w.setMinSize(0, 0)
}
func (w *windowsWebviewWindow) enableSizeConstraints() {
options := w.parent.options
if options.MinWidth > 0 || options.MinHeight > 0 {
w.setMinSize(options.MinWidth, options.MinHeight)
}
if options.MaxWidth > 0 || options.MaxHeight > 0 {
w.setMaxSize(options.MaxWidth, options.MaxHeight)
}
}
func (w *windowsWebviewWindow) size() (int, int) { func (w *windowsWebviewWindow) size() (int, int) {
//TODO implement me //TODO implement me
panic("implement me") panic("implement me")
@ -267,9 +290,7 @@ func (w *windowsWebviewWindow) on(eventID uint) {
} }
func (w *windowsWebviewWindow) minimise() { func (w *windowsWebviewWindow) minimise() {
globalApplication.dispatchOnMainThread(func() { w32.ShowWindow(w.hwnd, w32.SW_MINIMIZE)
w32.ShowWindow(w.hwnd, w32.SW_MINIMIZE)
})
} }
func (w *windowsWebviewWindow) unminimise() { func (w *windowsWebviewWindow) unminimise() {
@ -277,9 +298,7 @@ func (w *windowsWebviewWindow) unminimise() {
} }
func (w *windowsWebviewWindow) maximise() { func (w *windowsWebviewWindow) maximise() {
globalApplication.dispatchOnMainThread(func() { w32.ShowWindow(w.hwnd, w32.SW_MAXIMIZE)
w32.ShowWindow(w.hwnd, w32.SW_MAXIMIZE)
})
} }
func (w *windowsWebviewWindow) unmaximise() { func (w *windowsWebviewWindow) unmaximise() {
@ -287,19 +306,54 @@ func (w *windowsWebviewWindow) unmaximise() {
} }
func (w *windowsWebviewWindow) restore() { func (w *windowsWebviewWindow) restore() {
globalApplication.dispatchOnMainThread(func() { w32.ShowWindow(w.hwnd, w32.SW_RESTORE)
w32.ShowWindow(w.hwnd, w32.SW_RESTORE)
})
} }
func (w *windowsWebviewWindow) fullscreen() { func (w *windowsWebviewWindow) fullscreen() {
//TODO implement me if w.isFullscreen() {
panic("implement me") return
}
if w.framelessWithDecorations() {
w32.ExtendFrameIntoClientArea(w.hwnd, false)
}
w.disableSizeConstraints()
w.previousWindowStyle = uint32(w32.GetWindowLongPtr(w.hwnd, w32.GWL_STYLE))
w.previousWindowExStyle = uint32(w32.GetWindowLong(w.hwnd, w32.GWL_EXSTYLE))
monitor := w32.MonitorFromWindow(w.hwnd, w32.MONITOR_DEFAULTTOPRIMARY)
var monitorInfo w32.MONITORINFO
monitorInfo.CbSize = uint32(unsafe.Sizeof(monitorInfo))
if !w32.GetMonitorInfo(monitor, &monitorInfo) {
return
}
if !w32.GetWindowPlacement(w.hwnd, &w.previousWindowPlacement) {
return
}
// According to https://devblogs.microsoft.com/oldnewthing/20050505-04/?p=35703 one should use w32.WS_POPUP | w32.WS_VISIBLE
w32.SetWindowLong(w.hwnd, w32.GWL_STYLE, w.previousWindowStyle & ^uint32(w32.WS_OVERLAPPEDWINDOW) | (w32.WS_POPUP|w32.WS_VISIBLE))
w32.SetWindowLong(w.hwnd, w32.GWL_EXSTYLE, w.previousWindowExStyle & ^uint32(w32.WS_EX_DLGMODALFRAME))
w32.SetWindowPos(w.hwnd, w32.HWND_TOP,
int(monitorInfo.RcMonitor.Left),
int(monitorInfo.RcMonitor.Top),
int(monitorInfo.RcMonitor.Right-monitorInfo.RcMonitor.Left),
int(monitorInfo.RcMonitor.Bottom-monitorInfo.RcMonitor.Top),
w32.SWP_NOOWNERZORDER|w32.SWP_FRAMECHANGED)
w.isCurrentlyFullscreen = true
} }
func (w *windowsWebviewWindow) unfullscreen() { func (w *windowsWebviewWindow) unfullscreen() {
//TODO implement me if !w.isFullscreen() {
panic("implement me") return
}
if w.framelessWithDecorations() {
w32.ExtendFrameIntoClientArea(w.hwnd, true)
}
w32.SetWindowLong(w.hwnd, w32.GWL_STYLE, w.previousWindowStyle)
w32.SetWindowLong(w.hwnd, w32.GWL_EXSTYLE, w.previousWindowExStyle)
w32.SetWindowPlacement(w.hwnd, &w.previousWindowPlacement)
w32.SetWindowPos(w.hwnd, 0, 0, 0, 0, 0,
w32.SWP_NOMOVE|w32.SWP_NOSIZE|w32.SWP_NOZORDER|w32.SWP_NOOWNERZORDER|w32.SWP_FRAMECHANGED)
w.enableSizeConstraints()
w.isCurrentlyFullscreen = false
} }
func (w *windowsWebviewWindow) isMinimised() bool { func (w *windowsWebviewWindow) isMinimised() bool {
@ -313,8 +367,8 @@ func (w *windowsWebviewWindow) isMaximised() bool {
} }
func (w *windowsWebviewWindow) isFullscreen() bool { func (w *windowsWebviewWindow) isFullscreen() bool {
//TODO implement me // TODO: Actually calculate this based on size of window against screen size
panic("implement me") return w.isCurrentlyFullscreen
} }
func (w *windowsWebviewWindow) isNormal() bool { func (w *windowsWebviewWindow) isNormal() bool {
@ -331,15 +385,11 @@ func (w *windowsWebviewWindow) setFullscreenButtonEnabled(_ bool) {
} }
func (w *windowsWebviewWindow) show() { func (w *windowsWebviewWindow) show() {
globalApplication.dispatchOnMainThread(func() { w32.ShowWindow(w.hwnd, w32.SW_SHOW)
w32.ShowWindow(w.hwnd, w32.SW_SHOW)
})
} }
func (w *windowsWebviewWindow) hide() { func (w *windowsWebviewWindow) hide() {
globalApplication.dispatchOnMainThread(func() { w32.ShowWindow(w.hwnd, w32.SW_HIDE)
w32.ShowWindow(w.hwnd, w32.SW_HIDE)
})
} }
func (w *windowsWebviewWindow) getScreen() (*Screen, error) { func (w *windowsWebviewWindow) getScreen() (*Screen, error) {
@ -487,10 +537,11 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp
case w32.WM_GETMINMAXINFO: case w32.WM_GETMINMAXINFO:
mmi := (*w32.MINMAXINFO)(unsafe.Pointer(lparam)) mmi := (*w32.MINMAXINFO)(unsafe.Pointer(lparam))
hasConstraints := false hasConstraints := false
if w.minWidth > 0 || w.minHeight > 0 { options := w.parent.options
if options.MinWidth > 0 || options.MinHeight > 0 {
hasConstraints = true hasConstraints = true
width, height := w.scaleWithWindowDPI(w.minWidth, w.minHeight) width, height := w.scaleWithWindowDPI(options.MinWidth, options.MinHeight)
if width > 0 { if width > 0 {
mmi.PtMinTrackSize.X = int32(width) mmi.PtMinTrackSize.X = int32(width)
} }
@ -498,10 +549,10 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp
mmi.PtMinTrackSize.Y = int32(height) mmi.PtMinTrackSize.Y = int32(height)
} }
} }
if w.maxWidth > 0 || w.maxHeight > 0 { if options.MaxWidth > 0 || options.MaxHeight > 0 {
hasConstraints = true hasConstraints = true
width, height := w.scaleWithWindowDPI(w.maxWidth, w.maxHeight) width, height := w.scaleWithWindowDPI(options.MaxWidth, options.MaxHeight)
if width > 0 { if width > 0 {
mmi.PtMaxTrackSize.X = int32(width) mmi.PtMaxTrackSize.X = int32(width)
} }