Better devtools handling

This commit is contained in:
Lea Anthony
2020-11-21 12:40:19 +11:00
parent b920f45f60
commit bc260b08b2
6 changed files with 10 additions and 11 deletions

View File

@@ -4,6 +4,9 @@ package app
// Init initialises the application for a debug environment
func (a *App) Init() error {
// Indicate debug mode
a.debug = true
// Enable dev tools
a.options.DevTools = true
return nil
}

View File

@@ -142,7 +142,7 @@ func (a *App) Run() error {
return err
}
result := a.window.Run(dispatcher, bindingDump)
result := a.window.Run(dispatcher, bindingDump, a.debug)
a.logger.Trace("Ffenestri.Run() exited")
a.servicebus.Stop()

View File

@@ -64,9 +64,7 @@ func CreateApp(options *Options) *App {
MaxWidth: options.MaxWidth,
MaxHeight: options.MaxHeight,
StartHidden: options.StartHidden,
// This should be controlled by the compile time flags...
DevTools: true,
DevTools: options.DevTools,
Resizable: !options.DisableResize,
Fullscreen: options.Fullscreen,

View File

@@ -25,10 +25,6 @@ import (
*/
import "C"
// DEBUG is the global Ffenestri debug flag.
// TODO: move to compile time.
var DEBUG bool = true
// Application is our main application object
type Application struct {
config *options.App
@@ -108,7 +104,7 @@ func intToColour(colour int) (C.int, C.int, C.int, C.int) {
}
// Run the application
func (a *Application) Run(incomingDispatcher Dispatcher, bindings string) error {
func (a *Application) Run(incomingDispatcher Dispatcher, bindings string, debug bool) error {
title := a.string2CString(a.config.Title)
width := C.int(a.config.Width)
height := C.int(a.config.Height)
@@ -117,6 +113,8 @@ func (a *Application) Run(incomingDispatcher Dispatcher, bindings string) error
fullscreen := a.bool2Cint(a.config.Fullscreen)
startHidden := a.bool2Cint(a.config.StartHidden)
logLevel := C.int(a.config.LogLevel)
println("debug = ", debug)
println("devtools = ", a.config.DevTools)
app := C.NewApplication(title, width, height, resizable, devtools, fullscreen, startHidden, logLevel)
// Save app reference
@@ -133,7 +131,7 @@ func (a *Application) Run(incomingDispatcher Dispatcher, bindings string) error
C.SetMaxWindowSize(a.app, maxWidth, maxHeight)
// Set debug if needed
C.SetDebug(app, a.bool2Cint(DEBUG))
C.SetDebug(app, a.bool2Cint(debug))
// TODO: Move frameless to Linux options
// if a.config.Frameless {

View File

@@ -10,7 +10,7 @@ var Default = &App{
Title: "My Wails App",
Width: 1024,
Height: 768,
DevTools: true,
DevTools: false,
RGBA: 0xFFFFFFFF,
Mac: &mac.Options{
TitleBar: mac.TitleBarDefault(),

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB