Example #1
0
/*
 * Generate the up click part of an arbitrary click event
 *
 * This might be useful in concert with {Mouse.arbitrary_click_down} 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_up()
 *   @return [CGPoint]
 * @overload arbitrary_click_up(point)
 *   @param point [CGPoint]
 *   @return [CGPoint]
 */
static
VALUE
rb_mouse_arbitrary_click_up(const int argc,
                            VALUE* const argv,
                            UNUSED const VALUE self)
{
    if (argc == 0)
        rb_raise(rb_eArgError,
                 "arbitrary_click_up requires at least one arg");

    const uint_t button = NUM2UINT(argv[0]);

    switch (argc) {
    case 1:
        mouse_arbitrary_click_up(button);
        break;
    case 2:
    default:
        mouse_arbitrary_click_up2(button, rb_mouse_unwrap_point(argv[1]));
    }

    return CURRENT_POSITION;
}
Example #2
0
void
mouse_arbitrary_click2(CGEventMouseSubtype button, CGPoint point)
{
  mouse_arbitrary_click_down2(button, point);
  mouse_arbitrary_click_up2(button, point);
}
Example #3
0
void
mouse_arbitrary_click3(CGEventMouseSubtype button, CGPoint point, uint_t sleep_quanta)
{
  mouse_arbitrary_click_down3(button, point, sleep_quanta);
  mouse_arbitrary_click_up2(button, point);
}
Example #4
0
void mouse_arbitrary_click_up(CGEventMouseSubtype button)
{
  mouse_arbitrary_click_up2(button, mouse_current_position());
}