From e4a8b1f8544c07bbe81644f76692ba0b1ff579ca Mon Sep 17 00:00:00 2001 From: vcaesar Date: Mon, 30 Jul 2018 00:57:31 +0800 Subject: [PATCH] simplified max and min window api --- robotgo.go | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/robotgo.go b/robotgo.go index c4fb2b0..8dcfe11 100644 --- a/robotgo.go +++ b/robotgo.go @@ -1287,20 +1287,34 @@ func GetActive() C.MData { } // MinWindow set the window min -func MinWindow(pid int32, state bool, args ...int) { - var hwnd int +func MinWindow(pid int32, args ...interface{}) { + var ( + state = true + hwnd int + ) + if len(args) > 0 { - hwnd = args[0] + state = args[0].(bool) + } + if len(args) > 1 { + hwnd = args[1].(int) } C.min_window(C.uintptr(pid), C.bool(state), C.uintptr(hwnd)) } // MaxWindow set the window max -func MaxWindow(pid int32, state bool, args ...int) { - var hwnd int +func MaxWindow(pid int32, args ...interface{}) { + var ( + state = true + hwnd int + ) + if len(args) > 0 { - hwnd = args[0] + state = args[0].(bool) + } + if len(args) > 1 { + hwnd = args[1].(int) } C.max_window(C.uintptr(pid), C.bool(state), C.uintptr(hwnd))