/* * Generate the down click part of an arbitrary click event * * This might be useful in concert with {Mouse.arbitrary_click_up} if * you want to inject some behaviour between the down and up click * events. * * You can optionally specify a point to click; the mouse cursor will * instantly jump to the given point; otherwise the click event happens * at the current cursor position. * * @overload arbitrary_click_down() * @return [CGPoint] * @overload arbitrary_click_down(point) * @param point [CGPoint] * @return [CGPoint] */ static VALUE rb_mouse_arbitrary_click_down(const int argc, VALUE* const argv, UNUSED const VALUE self) { if (argc == 0) rb_raise(rb_eArgError, "arbitrary_click_down requires at least one arg"); const uint_t button = NUM2UINT(argv[0]); switch (argc) { case 1: mouse_arbitrary_click_down(button); break; case 2: default: mouse_arbitrary_click_down2(button, rb_mouse_unwrap_point(argv[1])); } return CURRENT_POSITION; }
void mouse_arbitrary_click2(CGEventMouseSubtype button, CGPoint point) { mouse_arbitrary_click_down2(button, point); mouse_arbitrary_click_up2(button, point); }
void mouse_arbitrary_click_down(CGEventMouseSubtype button) { mouse_arbitrary_click_down2(button, mouse_current_position()); }