mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 03:29:03 +08:00
[mac] Fix webviewistransparent and debug flag
This commit is contained in:
parent
913cc56adf
commit
32c3721b1b
@ -90,18 +90,18 @@ func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.
|
|||||||
}
|
}
|
||||||
result.assets = assets
|
result.assets = assets
|
||||||
|
|
||||||
go result.startMessageProcessor(ctx)
|
go result.startMessageProcessor()
|
||||||
go result.startRequestProcessor(ctx)
|
go result.startRequestProcessor()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Frontend) startMessageProcessor(ctx context.Context) {
|
func (f *Frontend) startMessageProcessor() {
|
||||||
for message := range messageBuffer {
|
for message := range messageBuffer {
|
||||||
f.processMessage(message)
|
f.processMessage(message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (f *Frontend) startRequestProcessor(ctx context.Context) {
|
func (f *Frontend) startRequestProcessor() {
|
||||||
for request := range requestBuffer {
|
for request := range requestBuffer {
|
||||||
f.processRequest(request)
|
f.processRequest(request)
|
||||||
}
|
}
|
||||||
@ -115,7 +115,12 @@ func (f *Frontend) Run(ctx context.Context) error {
|
|||||||
|
|
||||||
f.ctx = context.WithValue(ctx, "frontend", f)
|
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 = mainWindow
|
||||||
f.mainWindow.Center()
|
f.mainWindow.Center()
|
||||||
|
|
||||||
|
@ -35,21 +35,20 @@ func bool2Cint(value bool) C.int {
|
|||||||
return C.int(0)
|
return C.int(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWindow(frontendOptions *options.App) *Window {
|
func NewWindow(frontendOptions *options.App, debugMode bool) *Window {
|
||||||
|
|
||||||
frameless := bool2Cint(frontendOptions.Frameless)
|
frameless := bool2Cint(frontendOptions.Frameless)
|
||||||
resizable := bool2Cint(!frontendOptions.DisableResize)
|
resizable := bool2Cint(!frontendOptions.DisableResize)
|
||||||
fullscreen := bool2Cint(frontendOptions.Fullscreen)
|
fullscreen := bool2Cint(frontendOptions.Fullscreen)
|
||||||
alwaysOnTop := bool2Cint(frontendOptions.AlwaysOnTop)
|
alwaysOnTop := bool2Cint(frontendOptions.AlwaysOnTop)
|
||||||
webviewIsTransparent := bool2Cint(frontendOptions.AlwaysOnTop)
|
|
||||||
hideWindowOnClose := bool2Cint(frontendOptions.HideWindowOnClose)
|
hideWindowOnClose := bool2Cint(frontendOptions.HideWindowOnClose)
|
||||||
debug := bool2Cint(true)
|
debug := bool2Cint(debugMode)
|
||||||
alpha := C.int(frontendOptions.RGBA.A)
|
alpha := C.int(frontendOptions.RGBA.A)
|
||||||
red := C.int(frontendOptions.RGBA.R)
|
red := C.int(frontendOptions.RGBA.R)
|
||||||
green := C.int(frontendOptions.RGBA.G)
|
green := C.int(frontendOptions.RGBA.G)
|
||||||
blue := C.int(frontendOptions.RGBA.B)
|
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 titlebarAppearsTransparent, hideToolbarSeparator, windowIsTranslucent C.int
|
||||||
var appearance, title *C.char
|
var appearance, title *C.char
|
||||||
|
|
||||||
@ -69,6 +68,8 @@ func NewWindow(frontendOptions *options.App) *Window {
|
|||||||
hideToolbarSeparator = bool2Cint(mac.TitleBar.HideToolbarSeparator)
|
hideToolbarSeparator = bool2Cint(mac.TitleBar.HideToolbarSeparator)
|
||||||
}
|
}
|
||||||
windowIsTranslucent = bool2Cint(mac.WindowIsTranslucent)
|
windowIsTranslucent = bool2Cint(mac.WindowIsTranslucent)
|
||||||
|
webviewIsTransparent = bool2Cint(mac.WebviewIsTransparent)
|
||||||
|
|
||||||
appearance = C.CString(string(mac.Appearance))
|
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)
|
var context *C.WailsContext = C.Create(title, width, height, frameless, resizable, fullscreen, fullSizeContent, hideTitleBar, titlebarAppearsTransparent, hideTitle, useToolbar, hideToolbarSeparator, webviewIsTransparent, alwaysOnTop, hideWindowOnClose, appearance, windowIsTranslucent, debug)
|
||||||
|
Loading…
Reference in New Issue
Block a user