summaryrefslogtreecommitdiff
path: root/sysdata_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'sysdata_windows.go')
-rw-r--r--sysdata_windows.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/sysdata_windows.go b/sysdata_windows.go
index 4a4f69f..76c068c 100644
--- a/sysdata_windows.go
+++ b/sysdata_windows.go
@@ -685,3 +685,15 @@ func (s *sysData) repaintAll() {
}
<-ret
}
+
+func (s *sysData) center() {
+ var ws _RECT
+ _getWindowRect.Call(uintptr(s.hwnd), uintptr(unsafe.Pointer(&ws)))
+ dw, _, _ := _getSystemMetrics.Call(_SM_CXFULLSCREEN)
+ dh, _, _ := _getSystemMetrics.Call(_SM_CYFULLSCREEN)
+ ww := ws.right - ws.left
+ wh := ws.bottom - ws.top
+ wx := (int32(dw) / 2) - (ww / 2)
+ wy := (int32(dh) / 2) - (wh / 2)
+ s.setRect(int(wx), int(wy), int(ww), int(wh), 0)
+}