Merge pull request #83 from go-vgo/dep-pr

update and fmt code
This commit is contained in:
vz 2017-11-20 22:14:17 +08:00 committed by GitHub
commit f5574b6253
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 18 deletions

View File

@ -24,15 +24,19 @@ 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
#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 -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
//#include <AppKit/NSEvent.h>
// #include <AppKit/NSEvent.h>
#include "../screen/goScreen.h"
#include "../mouse/goMouse.h"
#include "../key/goKey.h"

View File

@ -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

View File

@ -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";