mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-19 22:33:55 +00:00
Drop c11 to c99
This commit is contained in:
parent
7f44a34f89
commit
d5c553b760
@ -417,8 +417,8 @@ static inline void process_key_pressed(uint64_t timestamp, CGEventRef event_ref)
|
|||||||
else {
|
else {
|
||||||
keycode_to_lookup(tis_message);
|
keycode_to_lookup(tis_message);
|
||||||
}
|
}
|
||||||
|
unsigned int i;
|
||||||
for (unsigned int i = 0; i < tis_message->length; i++) {
|
for (i= 0; i < tis_message->length; i++) {
|
||||||
// Populate key typed event.
|
// Populate key typed event.
|
||||||
event.time = timestamp;
|
event.time = timestamp;
|
||||||
event.reserved = 0x00;
|
event.reserved = 0x00;
|
||||||
|
@ -44,7 +44,8 @@ IOHOOK_API screen_data* hook_create_screen_info(unsigned char *count) {
|
|||||||
// Allocate memory for the number of screens found.
|
// Allocate memory for the number of screens found.
|
||||||
screens = malloc(sizeof(screen_data) * (*count));
|
screens = malloc(sizeof(screen_data) * (*count));
|
||||||
if (screens != NULL) {
|
if (screens != NULL) {
|
||||||
for (uint8_t i = 0; i < *count; i++) {
|
uint8_t i;
|
||||||
|
for (i = 0; i < *count; i++) {
|
||||||
//size_t width = CGDisplayPixelsWide(display_ids[i]);
|
//size_t width = CGDisplayPixelsWide(display_ids[i]);
|
||||||
//size_t height = CGDisplayPixelsHigh(display_ids[i]);
|
//size_t height = CGDisplayPixelsHigh(display_ids[i]);
|
||||||
CGRect boundsDisp = CGDisplayBounds(display_ids[i]);
|
CGRect boundsDisp = CGDisplayBounds(display_ids[i]);
|
||||||
|
@ -319,13 +319,15 @@ IOHOOK_API void hook_post_event(iohook_event * const event) {
|
|||||||
#ifdef USE_XTEST
|
#ifdef USE_XTEST
|
||||||
// XTest does not have modifier support, so we fake it by depressing the
|
// XTest does not have modifier support, so we fake it by depressing the
|
||||||
// appropriate modifier keys.
|
// appropriate modifier keys.
|
||||||
for (unsigned int i = 0; i < sizeof(keymask_lookup) / sizeof(KeySym); i++) {
|
unsigned int i;
|
||||||
|
for (i = 0; i < sizeof(keymask_lookup) / sizeof(KeySym); i++) {
|
||||||
if (event->mask & 1 << i) {
|
if (event->mask & 1 << i) {
|
||||||
XTestFakeKeyEvent(properties_disp, XKeysymToKeycode(properties_disp, keymask_lookup[i]), True, 0);
|
XTestFakeKeyEvent(properties_disp, XKeysymToKeycode(properties_disp, keymask_lookup[i]), True, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < sizeof(btnmask_lookup) / sizeof(unsigned int); i++) {
|
unsigned int i;
|
||||||
|
for (i = 0; i < sizeof(btnmask_lookup) / sizeof(unsigned int); i++) {
|
||||||
if (event->mask & btnmask_lookup[i]) {
|
if (event->mask & btnmask_lookup[i]) {
|
||||||
XTestFakeButtonEvent(properties_disp, i + 1, True, 0);
|
XTestFakeButtonEvent(properties_disp, i + 1, True, 0);
|
||||||
}
|
}
|
||||||
@ -364,13 +366,14 @@ IOHOOK_API void hook_post_event(iohook_event * const event) {
|
|||||||
|
|
||||||
#ifdef USE_XTEST
|
#ifdef USE_XTEST
|
||||||
// Release the previously held modifier keys used to fake the event mask.
|
// Release the previously held modifier keys used to fake the event mask.
|
||||||
for (unsigned int i = 0; i < sizeof(keymask_lookup) / sizeof(KeySym); i++) {
|
unsigned int i ;
|
||||||
|
for (i= 0; i < sizeof(keymask_lookup) / sizeof(KeySym); i++) {
|
||||||
if (event->mask & 1 << i) {
|
if (event->mask & 1 << i) {
|
||||||
XTestFakeKeyEvent(properties_disp, XKeysymToKeycode(properties_disp, keymask_lookup[i]), False, 0);
|
XTestFakeKeyEvent(properties_disp, XKeysymToKeycode(properties_disp, keymask_lookup[i]), False, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unsigned int i;
|
||||||
for (unsigned int i = 0; i < sizeof(btnmask_lookup) / sizeof(unsigned int); i++) {
|
for (i = 0; i < sizeof(btnmask_lookup) / sizeof(unsigned int); i++) {
|
||||||
if (event->mask & btnmask_lookup[i]) {
|
if (event->mask & btnmask_lookup[i]) {
|
||||||
XTestFakeButtonEvent(properties_disp, i + 1, False, 0);
|
XTestFakeButtonEvent(properties_disp, i + 1, False, 0);
|
||||||
}
|
}
|
||||||
|
@ -354,7 +354,8 @@ void hook_event_proc(XPointer closeure, XRecordInterceptData *recorded_data) {
|
|||||||
count = keysym_to_unicode(keysym, buffer, sizeof(buffer) / sizeof(uint16_t));
|
count = keysym_to_unicode(keysym, buffer, sizeof(buffer) / sizeof(uint16_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (unsigned int i = 0; i < count; i++) {
|
unsigned int i;
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
// Populate key typed event.
|
// Populate key typed event.
|
||||||
event.time = timestamp;
|
event.time = timestamp;
|
||||||
event.reserved = 0x00;
|
event.reserved = 0x00;
|
||||||
|
@ -1927,7 +1927,8 @@ void load_input_helper(Display *disp) {
|
|||||||
keysym_per_keycode--;
|
keysym_per_keycode--;
|
||||||
|
|
||||||
// Loop over the modifier map to find out if/where shift and caps locks are set.
|
// Loop over the modifier map to find out if/where shift and caps locks are set.
|
||||||
for (int i = LockMapIndex; i < LockMapIndex + modifierMap->max_keypermod && !is_caps_lock; i++) {
|
int i;
|
||||||
|
for (i = LockMapIndex; i < LockMapIndex + modifierMap->max_keypermod && !is_caps_lock; i++) {
|
||||||
if (capsLock != 0 && modifierMap->modifiermap[i] == capsLock) {
|
if (capsLock != 0 && modifierMap->modifiermap[i] == capsLock) {
|
||||||
is_caps_lock = true;
|
is_caps_lock = true;
|
||||||
is_shift_lock = false;
|
is_shift_lock = false;
|
||||||
|
@ -132,7 +132,8 @@ IOHOOK_API screen_data* hook_create_screen_info(unsigned char *count) {
|
|||||||
screens = malloc(sizeof(screen_data) * xine_count);
|
screens = malloc(sizeof(screen_data) * xine_count);
|
||||||
|
|
||||||
if (screens != NULL) {
|
if (screens != NULL) {
|
||||||
for (int i = 0; i < xine_count; i++) {
|
int i;
|
||||||
|
for (i = 0; i < xine_count; i++) {
|
||||||
screens[i] = (screen_data) {
|
screens[i] = (screen_data) {
|
||||||
.number = xine_info[i].screen_number,
|
.number = xine_info[i].screen_number,
|
||||||
.x = xine_info[i].x_org,
|
.x = xine_info[i].x_org,
|
||||||
@ -163,7 +164,8 @@ IOHOOK_API screen_data* hook_create_screen_info(unsigned char *count) {
|
|||||||
screens = malloc(sizeof(screen_data) * xrandr_count);
|
screens = malloc(sizeof(screen_data) * xrandr_count);
|
||||||
|
|
||||||
if (screens != NULL) {
|
if (screens != NULL) {
|
||||||
for (int i = 0; i < xrandr_count; i++) {
|
int i;
|
||||||
|
for (i = 0; i < xrandr_count; i++) {
|
||||||
XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(properties_disp, xrandr_resources, xrandr_resources->crtcs[i]);
|
XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(properties_disp, xrandr_resources, xrandr_resources->crtcs[i]);
|
||||||
|
|
||||||
if (crtc_info != NULL) {
|
if (crtc_info != NULL) {
|
||||||
|
@ -15,7 +15,8 @@ package robotgo
|
|||||||
#cgo darwin CFLAGS: -x objective-c -Wno-deprecated-declarations -I/usr/local/opt/libpng/include -I/usr/local/opt/zlib/include
|
#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 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
|
||||||
//#elif defined(USE_X11)
|
//#elif defined(USE_X11)
|
||||||
#cgo linux CFLAGS:-std=c11 -I/usr/src
|
//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 LDFLAGS:-L/usr/src -lpng -lz -lX11 -lXtst -lX11-xcb -lxcb -lxcb-xkb -lxkbcommon -lxkbcommon-x11 -lm
|
||||||
//#endif
|
//#endif
|
||||||
#cgo windows LDFLAGS: -lgdi32 -luser32 -lpng -lz
|
#cgo windows LDFLAGS: -lgdi32 -luser32 -lpng -lz
|
||||||
|
Loading…
Reference in New Issue
Block a user