static void domcreate_console_available(libxl__egc *egc, libxl__domain_create_state *dcs) { libxl__ao_progress_report(egc, dcs->ao, &dcs->aop_console_how, NEW_EVENT(egc, DOMAIN_CREATE_CONSOLE_AVAILABLE, dcs->guest_domid, dcs->aop_console_how.for_event)); }
void mouse_arbitrary_click_up2(CGEventMouseSubtype button, CGPoint point) { CGEventRef base_event = NEW_EVENT( kCGEventOtherMouseUp, point, button ); POSTRELEASE(base_event); }
void mouse_secondary_click_up2(CGPoint point) { CGEventRef base_event = NEW_EVENT( kCGEventRightMouseUp, point, kCGMouseButtonRight ); POSTRELEASE(base_event); }
void mouse_secondary_click_down3(CGPoint point, uint_t sleep_quanta) { CGEventRef base_event = NEW_EVENT( kCGEventRightMouseDown, point, kCGMouseButtonRight ); POSTRELEASE(base_event); mouse_sleep(sleep_quanta); }
void mouse_arbitrary_click_down3( CGEventMouseSubtype button, CGPoint point, uint_t sleep_quanta ) { CGEventRef base_event = NEW_EVENT( kCGEventOtherMouseDown, point, button ); POSTRELEASE(base_event); mouse_sleep(sleep_quanta); }
void mouse_drag_to2(CGPoint point, double duration) { POSTRELEASE(NEW_EVENT( kCGEventLeftMouseDown, mouse_current_position(), kCGMouseButtonLeft )); mouse_animate( kCGEventLeftMouseDragged, kCGMouseButtonLeft, mouse_current_position(), point, duration ); POSTRELEASE(NEW_EVENT( kCGEventLeftMouseUp, mouse_current_position(), kCGMouseButtonLeft )); }
void mouse_multi_click2(size_t num_clicks, CGPoint point) { CGEventRef base_event = NEW_EVENT( kCGEventLeftMouseDown, point, kCGMouseButtonLeft ); CGEventSetIntegerValueField(base_event, kCGMouseEventClickState, num_clicks); CHANGE(base_event, kCGEventLeftMouseDown); POST(base_event); CHANGE(base_event, kCGEventLeftMouseUp); POSTRELEASE(base_event); }
// Executes a linear mouse movement animation. It can be a simple cursor // move or a drag depending on what is passed to `type`. static void mouse_animate( CGEventType type, CGMouseButton button, CGPoint start_point, CGPoint end_point, double duration ) { CFDateRef current_time = NULL; CGPoint current_point = start_point; double xstep = (end_point.x - start_point.x) / (duration * FPS); double ystep = (end_point.y - start_point.y) / (duration * FPS); CFDateRef start = NOW; double remaining = 0.0; while (!CLOSE_ENOUGH(current_point, end_point)) { remaining = end_point.x - current_point.x; current_point.x += abs(xstep) > abs(remaining) ? remaining : xstep; remaining = end_point.y - current_point.y; current_point.y += abs(ystep) > abs(remaining) ? remaining : ystep; POSTRELEASE(NEW_EVENT(type, current_point, button)); mouse_sleep(1); current_time = NOW; // this is a safety if (CFDateGetTimeIntervalSinceDate(NOW, start) > (duration + 1)) break; RELEASE(current_time); current_time = NULL; current_point = mouse_current_position(); } RELEASE(start); if (current_time) RELEASE(current_time); }
void mouse_click_up2(CGPoint point) { POSTRELEASE(NEW_EVENT(kCGEventLeftMouseUp, point, kCGMouseButtonLeft)); }
void mouse_click_down3(CGPoint point, uint_t sleep_quanta) { POSTRELEASE(NEW_EVENT(kCGEventLeftMouseDown, point, kCGMouseButtonLeft)); mouse_sleep(sleep_quanta); }