19 lines
486 B
Go
19 lines
486 B
Go
//go:build windows
|
|||
|
|
|
||
|
|
package ui
|
||
|
|
|
||
|
|
// SM_CXSCREEN / SM_CYSCREEN return the primary display size in pixels.
|
||
|
|
const (
|
||
|
|
smCXScreen = 0
|
||
|
|
smCYScreen = 1
|
||
|
|
)
|
||
|
|
|
||
|
|
var procGetSystemMetrics = user32.NewProc("GetSystemMetrics")
|
||
|
|
|
||
|
|
// screenSize returns the primary display size in pixels, or (0, 0) if unavailable.
|
||
|
|
func screenSize() (int, int) {
|
||
|
|
width, _, _ := procGetSystemMetrics.Call(uintptr(smCXScreen))
|
||
|
|
height, _, _ := procGetSystemMetrics.Call(uintptr(smCYScreen))
|
||
|
|
return int(width), int(height)
|
||
|
|
}
|