mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 06:33:56 +00:00
update and fmt code
This commit is contained in:
parent
3454d35f35
commit
453375cb59
12
robotgo.go
12
robotgo.go
@ -24,12 +24,16 @@ package robotgo
|
||||
|
||||
/*
|
||||
//#if defined(IS_MACOSX)
|
||||
#cgo darwin CFLAGS: -x objective-c -Wno-deprecated-declarations -I/usr/local/opt/libpng/include -I/usr/local/opt/zlib/include
|
||||
#cgo darwin LDFLAGS: -framework Cocoa -framework OpenGL -framework IOKit -framework Carbon -framework CoreFoundation -L/usr/local/opt/libpng/lib -lpng -L/usr/local/opt/zlib/lib -lz
|
||||
#cgo darwin CFLAGS: -x objective-c -Wno-deprecated-declarations
|
||||
#cgo darwin CFLAGS: -I/usr/local/opt/libpng/include -I/usr/local/opt/zlib/include
|
||||
#cgo darwin LDFLAGS: -framework Cocoa -framework OpenGL -framework IOKit
|
||||
#cgo darwin LDFLAGS: -framework Carbon -framework CoreFoundation
|
||||
#cgo darwin LDFLAGS: -L/usr/local/opt/libpng/lib -lpng -L/usr/local/opt/zlib/lib -lz
|
||||
//#elif defined(USE_X11)
|
||||
// drop -std=c11
|
||||
#cgo linux CFLAGS:-I/usr/src
|
||||
#cgo linux LDFLAGS:-L/usr/src -lpng -lz -lX11 -lXtst -lX11-xcb -lxcb -lxcb-xkb -lxkbcommon -lxkbcommon-x11 -lm
|
||||
#cgo linux CFLAGS: -I/usr/src
|
||||
#cgo linux LDFLAGS: -L/usr/src -lpng -lz -lX11 -lXtst -lX11-xcb -lxcb
|
||||
#cgo linux LDFLAGS: -lxcb-xkb -lxkbcommon -lxkbcommon-x11 -lm
|
||||
//#endif
|
||||
// #cgo windows LDFLAGS: -lgdi32 -luser32 -lpng -lz
|
||||
#cgo windows LDFLAGS: -lgdi32 -luser32
|
||||
|
@ -45,7 +45,7 @@ void aWindow();
|
||||
|
||||
static AXUIElementRef GetUIElement (CGWindowID win){
|
||||
intptr pid = 0;
|
||||
// double_t pid=0;
|
||||
// double_t pid = 0;
|
||||
|
||||
// Create array storing window
|
||||
CGWindowID window[1] = { win };
|
||||
@ -301,12 +301,12 @@ void aWindow(uintptr handle){
|
||||
bool IsValid (){
|
||||
aWindow(ahandle);
|
||||
if(!IsAxEnabled(true))printf("%s\n", "Window:Accessibility API is disabled!\nFailed to enable access for assistive devices.");
|
||||
MData actdata=GetActive();
|
||||
MData actdata = GetActive();
|
||||
|
||||
#if defined(IS_MACOSX)
|
||||
|
||||
mData.CgID=actdata.CgID;
|
||||
mData.AxID=actdata.AxID;
|
||||
mData.CgID = actdata.CgID;
|
||||
mData.AxID = actdata.AxID;
|
||||
|
||||
if (mData.CgID == 0 || mData.AxID == 0)return false;
|
||||
|
||||
@ -340,7 +340,7 @@ bool IsValid (){
|
||||
XFree (result); return true;
|
||||
|
||||
#elif defined(IS_WINDOWS)
|
||||
mData.HWnd=actdata.HWnd;
|
||||
mData.HWnd = actdata.HWnd;
|
||||
|
||||
if (mData.HWnd == 0)
|
||||
return false;
|
||||
@ -825,7 +825,7 @@ char *GetTitle(){
|
||||
return s;
|
||||
}
|
||||
|
||||
return "null";
|
||||
return "";
|
||||
|
||||
#elif defined(USE_X11)
|
||||
|
||||
@ -851,15 +851,16 @@ char *GetTitle(){
|
||||
// Check result value
|
||||
if (result != NULL){
|
||||
// Convert result to a string
|
||||
char *name =(char*) result;
|
||||
char *name = (char*) result;
|
||||
XFree (result); return name;
|
||||
}
|
||||
|
||||
return "null";
|
||||
return "";
|
||||
|
||||
#elif defined(IS_WINDOWS)
|
||||
|
||||
return GetWindowText(mData.HWnd, mData.Title, 512) > 0 ? mData.Title : "null";
|
||||
return GetWindowText
|
||||
(mData.HWnd, mData.Title, 512) > 0 ? mData.Title : "";
|
||||
// return GetWindowText
|
||||
// (mData.HWnd, name, 512) > 0 ?
|
||||
// _UTF8Encode (name) : "null";
|
||||
|
Loading…
Reference in New Issue
Block a user