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

[linux] Fix fullscreen

This commit is contained in:
Lea Anthony 2022-02-08 05:29:26 +11:00
parent 3decd70319
commit 322aad166b
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -43,11 +43,11 @@ type Frontend struct {
startURL string startURL string
// main window handle // main window handle
mainWindow *Window mainWindow *Window
// minWidth, minHeight, maxWidth, maxHeight int minWidth, minHeight, maxWidth, maxHeight int
bindings *binding.Bindings bindings *binding.Bindings
dispatcher frontend.Dispatcher dispatcher frontend.Dispatcher
servingFromDisk bool servingFromDisk bool
} }
func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.Logger, appBindings *binding.Bindings, dispatcher frontend.Dispatcher) *Frontend { func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.Logger, appBindings *binding.Bindings, dispatcher frontend.Dispatcher) *Frontend {
@ -62,6 +62,10 @@ func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.
dispatcher: dispatcher, dispatcher: dispatcher,
ctx: ctx, ctx: ctx,
startURL: "file://wails/", startURL: "file://wails/",
minHeight: appoptions.MinHeight,
minWidth: appoptions.MinWidth,
maxHeight: appoptions.MaxHeight,
maxWidth: appoptions.MaxWidth,
} }
bindingsJSON, err := appBindings.ToJSON() bindingsJSON, err := appBindings.ToJSON()
@ -157,11 +161,15 @@ func (f *Frontend) WindowSetTitle(title string) {
} }
func (f *Frontend) WindowFullscreen() { func (f *Frontend) WindowFullscreen() {
f.mainWindow.SetMaxSize(0, 0)
f.mainWindow.SetMinSize(0, 0)
f.mainWindow.Fullscreen() f.mainWindow.Fullscreen()
} }
func (f *Frontend) WindowUnFullscreen() { func (f *Frontend) WindowUnFullscreen() {
f.mainWindow.UnFullscreen() f.mainWindow.UnFullscreen()
f.mainWindow.SetMaxSize(f.maxWidth, f.maxHeight)
f.mainWindow.SetMinSize(f.minWidth, f.minHeight)
} }
func (f *Frontend) WindowShow() { func (f *Frontend) WindowShow() {
@ -185,9 +193,13 @@ func (f *Frontend) WindowUnminimise() {
} }
func (f *Frontend) WindowSetMinSize(width int, height int) { func (f *Frontend) WindowSetMinSize(width int, height int) {
f.minWidth = width
f.minHeight = height
f.mainWindow.SetMinSize(width, height) f.mainWindow.SetMinSize(width, height)
} }
func (f *Frontend) WindowSetMaxSize(width int, height int) { func (f *Frontend) WindowSetMaxSize(width int, height int) {
f.maxWidth = width
f.maxHeight = height
f.mainWindow.SetMaxSize(width, height) f.mainWindow.SetMaxSize(width, height)
} }