5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 23:20:51 +08:00

[mac] Fix webviewistransparent and debug flag

This commit is contained in:
Lea Anthony 2021-10-19 20:07:36 +11:00
parent 913cc56adf
commit 32c3721b1b
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
2 changed files with 15 additions and 9 deletions

View File

@ -90,18 +90,18 @@ func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.
}
result.assets = assets
go result.startMessageProcessor(ctx)
go result.startRequestProcessor(ctx)
go result.startMessageProcessor()
go result.startRequestProcessor()
return result
}
func (f *Frontend) startMessageProcessor(ctx context.Context) {
func (f *Frontend) startMessageProcessor() {
for message := range messageBuffer {
f.processMessage(message)
}
}
func (f *Frontend) startRequestProcessor(ctx context.Context) {
func (f *Frontend) startRequestProcessor() {
for request := range requestBuffer {
f.processRequest(request)
}
@ -115,7 +115,12 @@ func (f *Frontend) Run(ctx context.Context) error {
f.ctx = context.WithValue(ctx, "frontend", f)
mainWindow := NewWindow(f.frontendOptions)
var _debug = ctx.Value("debug")
if _debug != nil {
f.debug = _debug.(bool)
}
mainWindow := NewWindow(f.frontendOptions, f.debug)
f.mainWindow = mainWindow
f.mainWindow.Center()

View File

@ -35,21 +35,20 @@ func bool2Cint(value bool) C.int {
return C.int(0)
}
func NewWindow(frontendOptions *options.App) *Window {
func NewWindow(frontendOptions *options.App, debugMode bool) *Window {
frameless := bool2Cint(frontendOptions.Frameless)
resizable := bool2Cint(!frontendOptions.DisableResize)
fullscreen := bool2Cint(frontendOptions.Fullscreen)
alwaysOnTop := bool2Cint(frontendOptions.AlwaysOnTop)
webviewIsTransparent := bool2Cint(frontendOptions.AlwaysOnTop)
hideWindowOnClose := bool2Cint(frontendOptions.HideWindowOnClose)
debug := bool2Cint(true)
debug := bool2Cint(debugMode)
alpha := C.int(frontendOptions.RGBA.A)
red := C.int(frontendOptions.RGBA.R)
green := C.int(frontendOptions.RGBA.G)
blue := C.int(frontendOptions.RGBA.B)
var fullSizeContent, hideTitleBar, hideTitle, useToolbar C.int
var fullSizeContent, hideTitleBar, hideTitle, useToolbar, webviewIsTransparent C.int
var titlebarAppearsTransparent, hideToolbarSeparator, windowIsTranslucent C.int
var appearance, title *C.char
@ -69,6 +68,8 @@ func NewWindow(frontendOptions *options.App) *Window {
hideToolbarSeparator = bool2Cint(mac.TitleBar.HideToolbarSeparator)
}
windowIsTranslucent = bool2Cint(mac.WindowIsTranslucent)
webviewIsTransparent = bool2Cint(mac.WebviewIsTransparent)
appearance = C.CString(string(mac.Appearance))
}
var context *C.WailsContext = C.Create(title, width, height, frameless, resizable, fullscreen, fullSizeContent, hideTitleBar, titlebarAppearsTransparent, hideTitle, useToolbar, hideToolbarSeparator, webviewIsTransparent, alwaysOnTop, hideWindowOnClose, appearance, windowIsTranslucent, debug)