mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
update and fmt code
This commit is contained in:
parent
816bfeaba9
commit
ac648bde74
@ -57,7 +57,7 @@ void dispatch_proc(iohook_event * const event) {
|
|||||||
// printf("atoi(str)---%d\n", atoi(cevent));
|
// printf("atoi(str)---%d\n", atoi(cevent));
|
||||||
if (akeycode == atoi(cevent)){
|
if (akeycode == atoi(cevent)){
|
||||||
int astop = aStop();
|
int astop = aStop();
|
||||||
// printf("%d\n",astop);
|
// printf("%d\n", astop);
|
||||||
cstatus = 0;
|
cstatus = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -82,7 +82,7 @@ void dispatch_proc(iohook_event * const event) {
|
|||||||
|
|
||||||
if (strcmp(buf, cevent) == 0){
|
if (strcmp(buf, cevent) == 0){
|
||||||
int astop = aStop();
|
int astop = aStop();
|
||||||
// printf("%d\n",astop);
|
// printf("%d\n", astop);
|
||||||
cstatus = 0;
|
cstatus = 0;
|
||||||
}
|
}
|
||||||
// return (char*) event->data.keyboard.keychar;
|
// return (char*) event->data.keyboard.keychar;
|
||||||
@ -221,7 +221,7 @@ int aEvent(char *aevent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// return status;
|
// return status;
|
||||||
// printf("%d\n",status);
|
// printf("%d\n", status);
|
||||||
return cstatus;
|
return cstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ int CheckKeyFlags(char* f, MMKeyFlags* flags)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetFlagsFromValue(char* value[], MMKeyFlags* flags,int num){
|
int GetFlagsFromValue(char* value[], MMKeyFlags* flags, int num){
|
||||||
if (!flags) {return -1;}
|
if (!flags) {return -1;}
|
||||||
int i;
|
int i;
|
||||||
for ( i= 0; i <num; i++){
|
for ( i= 0; i <num; i++){
|
||||||
@ -185,7 +185,7 @@ char* aKey_Tap(char *k, char* keyarr[], int num){
|
|||||||
MMKeyCode key;
|
MMKeyCode key;
|
||||||
|
|
||||||
switch(GetFlagsFromValue(keyarr, &flags, num)){
|
switch(GetFlagsFromValue(keyarr, &flags, num)){
|
||||||
// switch (CheckKeyFlags(akey,&flags)){
|
// switch (CheckKeyFlags(akey, &flags)){
|
||||||
case -1:
|
case -1:
|
||||||
return "Null pointer in key flag.";
|
return "Null pointer in key flag.";
|
||||||
break;
|
break;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "../base/types.h"
|
#include "../base/types.h"
|
||||||
#include "mouse_c.h"
|
#include "mouse_c.h"
|
||||||
|
|
||||||
//Global delays.
|
// Global delays.
|
||||||
int mouseDelay = 10;
|
int mouseDelay = 10;
|
||||||
// int keyboardDelay = 10;
|
// int keyboardDelay = 10;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ int aDragMouse(size_t x, size_t y){
|
|||||||
dragMouse(point, button);
|
dragMouse(point, button);
|
||||||
microsleep(mouseDelay);
|
microsleep(mouseDelay);
|
||||||
|
|
||||||
// printf("%s\n","gyp-----");
|
// printf("%s\n", "gyp-----");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ int aMoveMouseSmooth(size_t x, size_t y, double lowSpeed, double highSpeed){
|
|||||||
MMPoint aGetMousePos(){
|
MMPoint aGetMousePos(){
|
||||||
MMPoint pos = getMousePos();
|
MMPoint pos = getMousePos();
|
||||||
|
|
||||||
//Return object with .x and .y.
|
// Return object with .x and .y.
|
||||||
// printf("%zu\n%zu\n", pos.x, pos.y );
|
// printf("%zu\n%zu\n", pos.x, pos.y );
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ int aMouseToggle(char* d, MMMouseButton button){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int aSetMouseDelay(size_t val){
|
int aSetMouseDelay(size_t val){
|
||||||
// int val=10;
|
// int val = 10;
|
||||||
mouseDelay = val;
|
mouseDelay = val;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -322,8 +322,8 @@ bool IsValid (){
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
mData.XWin=actdata.XWin;
|
mData.XWin = actdata.XWin;
|
||||||
if (mData.XWin == 0)return false;
|
if (mData.XWin == 0) return false;
|
||||||
|
|
||||||
Display *rDisplay = XOpenDisplay(NULL);
|
Display *rDisplay = XOpenDisplay(NULL);
|
||||||
// Check for a valid X-Window display
|
// Check for a valid X-Window display
|
||||||
@ -732,8 +732,8 @@ MData GetActive (void){
|
|||||||
HWND handle;
|
HWND handle;
|
||||||
handle = GetForegroundWindow();
|
handle = GetForegroundWindow();
|
||||||
if (handle != NULL){
|
if (handle != NULL){
|
||||||
// mData.HWnd=(uintptr) handle;
|
// mData.HWnd = (uintptr) handle;
|
||||||
result.HWnd= (HWND)handle;
|
result.HWnd = (HWND)handle;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
Sleep (20);
|
Sleep (20);
|
||||||
@ -767,7 +767,7 @@ void SetTopMost (bool state){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//CloseWindow
|
// CloseWindow
|
||||||
void CloseWin(void){
|
void CloseWin(void){
|
||||||
// Check window validity
|
// Check window validity
|
||||||
if (!IsValid()) return;
|
if (!IsValid()) return;
|
||||||
@ -819,7 +819,7 @@ char *GetTitle(){
|
|||||||
CFStringGetCString (data, conv,
|
CFStringGetCString (data, conv,
|
||||||
512, kCFStringEncodingUTF8);
|
512, kCFStringEncodingUTF8);
|
||||||
CFRelease (data);
|
CFRelease (data);
|
||||||
char* s=(char*)calloc(100,sizeof(char*));
|
char* s = (char*)calloc(100,sizeof(char*));
|
||||||
if(s)strcpy(s,conv);
|
if(s)strcpy(s,conv);
|
||||||
// return (char *)&conv;
|
// return (char *)&conv;
|
||||||
return s;
|
return s;
|
||||||
@ -839,10 +839,10 @@ char *GetTitle(){
|
|||||||
// Check result value
|
// Check result value
|
||||||
if (result != NULL){
|
if (result != NULL){
|
||||||
// Convert result to a string
|
// Convert result to a string
|
||||||
char *name=(char*) result;
|
char *name = (char*) result;
|
||||||
XFree (result);
|
XFree (result);
|
||||||
|
|
||||||
if (name!=NULL)return name;
|
if (name != NULL) return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get window title (ASCII)
|
// Get window title (ASCII)
|
||||||
|
Loading…
Reference in New Issue
Block a user