Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Remove windows custom dpi code
Browse files Browse the repository at this point in the history
  • Loading branch information
achhabra2 committed Feb 10, 2022
1 parent 81d99f4 commit ac4d441
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 64 deletions.
2 changes: 1 addition & 1 deletion frontend/dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/dist/bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/wailsjs/go/bindings.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface go {
export interface go {
"main": {
"App": {
AppInstalledFromPackageManager():Promise<boolean>
Expand Down
55 changes: 28 additions & 27 deletions frontend/wailsjs/runtime/runtimedev.js

Large diffs are not rendered by default.

72 changes: 38 additions & 34 deletions internal/settings/dimensions_windows.go
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
package settings

import (
"syscall"
)

var (
user32 = syscall.NewLazyDLL("User32.dll")
getSystemMetrics = user32.NewProc("GetSystemMetrics")
getDpiForSystem = user32.NewProc("GetDpiForSystem")
)

func GetSystemMetrics(nIndex int) int {
index := uintptr(nIndex)
ret, _, _ := getSystemMetrics.Call(index)
return int(ret)
}
// import (
// "syscall"
// )

func GetDpiForSystem() int {
ret, _, _ := getDpiForSystem.Call()
return int(ret)
}
// var (
// user32 = syscall.NewLazyDLL("User32.dll")
// getSystemMetrics = user32.NewProc("GetSystemMetrics")
// getDpiForSystem = user32.NewProc("GetDpiForSystem")
// )

const (
SM_CXSCREEN = 0
SM_CYSCREEN = 1
)
// func GetSystemMetrics(nIndex int) int {
// index := uintptr(nIndex)
// ret, _, _ := getSystemMetrics.Call(index)
// return int(ret)
// }

func GetResolution() (int, int) {
return GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)
}
// func GetDpiForSystem() int {
// ret, _, _ := getDpiForSystem.Call()
// return int(ret)
// }

// const (
// SM_CXSCREEN = 0
// SM_CYSCREEN = 1
// )

// func GetResolution() (int, int) {
// return GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)
// }

// func GetAppDefaultDimensionsBackup() (int, int) {
// w := 528.0
// h := 440.0
// baseDpi := 96.0
// currentDpi := float64(GetDpiForSystem())
// scalingFactor := currentDpi / baseDpi
// w2 := int(w * scalingFactor)
// h2 := int(h * scalingFactor)
// return w2, h2
// }

func GetAppDefaultDimensions() (int, int) {
w := 528.0
h := 440.0
baseDpi := 96.0
currentDpi := float64(GetDpiForSystem())
scalingFactor := currentDpi / baseDpi
w2 := int(w * scalingFactor)
h2 := int(h * scalingFactor)
return w2, h2
return 528, 440
}

0 comments on commit ac4d441

Please sign in to comment.