mirror of
https://github.com/taigrr/wails.git
synced 2026-04-14 02:48:21 -07:00
Compare commits
5 Commits
v0.20.0-pr
...
windows-co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d29d8a902 | ||
|
|
d3b6040b6b | ||
|
|
51bd1c7bc0 | ||
|
|
859d8e0ebb | ||
|
|
241f10188b |
21
app.go
21
app.go
@@ -1,6 +1,7 @@
|
|||||||
package wails
|
package wails
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
@@ -66,12 +67,28 @@ func CreateApp(optionalConfig ...*AppConfig) *App {
|
|||||||
result.config.DisableInspector = true
|
result.config.DisableInspector = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Platform specific init
|
// If running windows, do a hidpi fix
|
||||||
platformInit()
|
if runtime.GOOS == "windows" {
|
||||||
|
err := SetProcessDPIAware()
|
||||||
|
if err != nil {
|
||||||
|
result.log.Fatalf(err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetProcessDPIAware via user32.dll
|
||||||
|
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setprocessdpiaware
|
||||||
|
// Also, thanks Jack Mordaunt! 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
|
// Run the app
|
||||||
func (a *App) Run() error {
|
func (a *App) Run() error {
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
// +build +linux +darwin !windows
|
|
||||||
|
|
||||||
package wails
|
|
||||||
|
|
||||||
func platformInit() {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
// +build windows !linux !darwin
|
|
||||||
|
|
||||||
package wails
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"syscall"
|
|
||||||
)
|
|
||||||
|
|
||||||
func platformInit() {
|
|
||||||
err := SetProcessDPIAware()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf(err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetProcessDPIAware via user32.dll
|
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setprocessdpiaware
|
|
||||||
// Also, thanks Jack Mordaunt! 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
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
// Version - Wails version
|
// Version - Wails version
|
||||||
const Version = "v0.20.0-pre2"
|
const Version = "v0.19.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user