Compare commits

...

4 Commits

Author SHA1 Message Date
Lea Anthony
b18d4fbf41 v2.0.0-alpha.32 2021-02-22 09:00:47 +11:00
Lea Anthony
9ec5605e63 fix: loglevel duplication 2021-02-22 09:00:09 +11:00
Lea Anthony
98a4de8878 v2.0.0-alpha.31 2021-02-21 20:38:14 +11:00
Lea Anthony
5fe709f558 Trigger clean shutdown on Quit 2021-02-21 20:37:42 +11:00
3 changed files with 11 additions and 46 deletions

View File

@@ -1,3 +1,3 @@
package main
var version = "v2.0.0-alpha.30"
var version = "v2.0.0-alpha.32"

View File

@@ -4,14 +4,11 @@ package app
import (
"context"
"flag"
"strings"
"sync"
"github.com/wailsapp/wails/v2/internal/bridge"
"github.com/wailsapp/wails/v2/internal/menumanager"
clilogger "github.com/wailsapp/wails/v2/pkg/logger"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/internal/binding"
@@ -70,23 +67,6 @@ func CreateApp(appoptions *options.App) (*App, error) {
// Set up logger
myLogger := logger.New(appoptions.Logger)
loglevel := flag.String("loglevel", "debug", "Loglevel to use - Trace, Debug, Info, Warning, Error")
flag.Parse()
if len(*loglevel) > 0 {
switch strings.ToLower(*loglevel) {
case "trace":
myLogger.SetLogLevel(clilogger.TRACE)
case "info":
myLogger.SetLogLevel(clilogger.INFO)
case "warning":
myLogger.SetLogLevel(clilogger.WARNING)
case "error":
myLogger.SetLogLevel(clilogger.ERROR)
default:
myLogger.SetLogLevel(appoptions.LogLevel)
}
}
// Create the menu manager
menuManager := menumanager.NewManager()

View File

@@ -498,31 +498,6 @@ void DestroyApplication(struct Application *app) {
Debug(app, "Finished Destroying Application");
}
// Quit will stop the cocoa application and free up all the memory
// used by the application
void Quit(struct Application *app) {
Debug(app, "Quit Called");
ON_MAIN_THREAD (
// Terminate app
msg(app->application, s("stop:"), NULL);
id fakeevent = msg(c("NSEvent"),
s("otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:"),
15, // Type
msg(c("CGPoint"), s("init:x:y:"), 0, 0), // location
0, // flags
0, // timestamp
0, // window
NULL, // context
0, // subtype
0, // data1
0 // data2
);
msg(c("NSApp"), s("postEvent:atStart:"), fakeevent, true);
// msg(c(app->mainWindow), s("performClose:"))
);
}
// SetTitle sets the main window title to the given string
void SetTitle(struct Application *app, const char *title) {
// Guard against calling during shutdown
@@ -1837,6 +1812,16 @@ void Run(struct Application *app, int argc, char **argv) {
MEMFREE(internalCode);
}
// Quit will stop the cocoa application and free up all the memory
// used by the application
void Quit(struct Application *app) {
Debug(app, "Quit Called");
msg(app->application, s("stop:"), NULL);
ON_MAIN_THREAD (
// Terminate app by triggering a UI event
SetSize(app, 0, 0);
);
}
void* NewApplication(const char *title, int width, int height, int resizable, int devtools, int fullscreen, int startHidden, int logLevel, int hideWindowOnClose) {