mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
Merge branch 'develop' of https://github.com/wailsapp/wails into develop
This commit is contained in:
21
app.go
21
app.go
@@ -1,7 +1,9 @@
|
||||
package wails
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"syscall"
|
||||
|
||||
"github.com/syossan27/tebata"
|
||||
@@ -65,9 +67,28 @@ func CreateApp(optionalConfig ...*AppConfig) *App {
|
||||
result.config.DisableInspector = true
|
||||
}
|
||||
|
||||
// If running windows, do a hidpi fix
|
||||
if runtime.GOOS == "windows" {
|
||||
err := SetProcessDPIAware()
|
||||
if err != nil {
|
||||
result.log.Fatalf(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// SetProcessDPIAware via user32.dll
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setprocessdpiaware
|
||||
// Also, thanks Jack Mordaynt! https://github.com/wailsapp/wails/issues/293
|
||||
func SetProcessDPIAware() error {
|
||||
status, r, err := syscall.NewLazyDLL("user32.dll").NewProc("SetProcessDPIAware").Call()
|
||||
if status == 0 {
|
||||
return fmt.Errorf("exit status %d: %v %v", status, r, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Run the app
|
||||
func (a *App) Run() error {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user