diff --git a/robotgo.go b/robotgo.go index 4599ab9..c60374c 100644 --- a/robotgo.go +++ b/robotgo.go @@ -422,13 +422,6 @@ func ScaleX() int { return int(C.scale_x()) } -// Deprecated: use the ScaledF(), -// -// ScaleY get primary display vertical DPI scale factor, drop -func ScaleY() int { - return int(C.scale_y()) -} - // Deprecated: use the ScaledF(), // // Scale get the screen scale (only windows old), drop @@ -1254,7 +1247,6 @@ func showAlert(title, msg string, args ...string) bool { func IsValid() bool { abool := C.is_valid() gbool := bool(abool) - // fmt.Println("bool---------", gbool) return gbool } diff --git a/robotgo_x11.go b/robotgo_x11.go index 8ef4eae..558567f 100644 --- a/robotgo_x11.go +++ b/robotgo_x11.go @@ -183,7 +183,12 @@ func DisplaysNum() int { func Alert(title, msg string, args ...string) bool { defaultBtn, cancelBtn := alertArgs(args...) c := `xmessage -center ` + msg + - ` -title ` + title + ` -buttons ` + defaultBtn + ":0," + cancelBtn + ":1" + ` -default Ok` + ` -title ` + title + ` -buttons ` + defaultBtn + ":0," + if cancleBtn != "" { + c += cancelBtn + ":1" + } + c += ` -default ` + defaultBtn + out, err := Run(c) if err != nil { fmt.Println("Alert: ", err, ". ", string(out)) diff --git a/window/goWindow.h b/window/goWindow.h index fd8a794..9bdcd25 100644 --- a/window/goWindow.h +++ b/window/goWindow.h @@ -14,29 +14,18 @@ int show_alert(const char *title, const char *msg, const char *defaultButton, const char *cancelButton){ - - int alert = showAlert(title, msg, defaultButton, cancelButton); - return alert; + + return showAlert(title, msg, defaultButton, cancelButton); } intptr scale_x(){ return scaleX(); } -intptr scale_y(){ - return scaleY(); -} - bool is_valid(){ - bool abool = IsValid(); - return abool; + return IsValid(); } -// int find_window(char* name){ -// int z = findwindow(name); -// return z; -// } - void min_window(uintptr pid, bool state, uintptr isHwnd){ #if defined(IS_MACOSX) // return 0; @@ -80,8 +69,7 @@ void close_window(uintptr pid, uintptr isHwnd){ } bool set_handle(uintptr handle){ - bool hwnd = setHandle(handle); - return hwnd; + return setHandle(handle); } uintptr get_handle(){ @@ -96,9 +84,19 @@ uintptr get_handle(){ #endif } +// uint32 uintptr +uintptr getHandle() { + #if defined(IS_MACOSX) + return (uintptr)mData.CgID; + #elif defined(USE_X11) + return (uintptr)mData.XWin; + #elif defined(IS_WINDOWS) + return (uintptr)mData.HWnd; + #endif +} + uintptr bget_handle(){ - uintptr hwnd = getHandle(); - return hwnd; + return getHandle(); } void set_active(const MData win){ diff --git a/window/win_sys.h b/window/win_sys.h index 236d3ae..1d64d62 100644 --- a/window/win_sys.h +++ b/window/win_sys.h @@ -76,18 +76,6 @@ intptr scaleX(){ #endif } -intptr scaleY(){ - #if defined(IS_MACOSX) - return 0; - #elif defined(USE_X11) - return 0; - #elif defined(IS_WINDOWS) - HDC desktopDc = GetDC(NULL); - intptr verticalDPI = GetDeviceCaps(desktopDc, LOGPIXELSY); - return verticalDPI; - #endif -} - Bounds get_bounds(uintptr pid, uintptr isHwnd){ // Check if the window is valid Bounds bounds; diff --git a/window/window.h b/window/window.h index 6ff4935..a8cc058 100644 --- a/window/window.h +++ b/window/window.h @@ -74,7 +74,7 @@ void set_handle_pid_mData(uintptr pid, uintptr isHwnd){ mData = win; } -bool IsValid(){ +bool IsValid() { initWindow(initHandle); if (!IsAxEnabled(true)) { printf("%s\n", "Window: Accessibility API is disabled!\n" @@ -232,17 +232,6 @@ bool setHandle(uintptr handle){ #endif } -// uint32 uintptr -uintptr getHandle() { - #if defined(IS_MACOSX) - return (uintptr)mData.CgID; - #elif defined(USE_X11) - return (uintptr)mData.XWin; - #elif defined(IS_WINDOWS) - return (uintptr)mData.HWnd; - #endif -} - bool IsTopMost(void){ // Check the window validity if (!IsValid()) {return false;}