static void pointer_event(VncState *vs, int button_mask, int x, int y)

{

    static uint32_t bmap[INPUT_BUTTON__MAX] = {

        [INPUT_BUTTON_LEFT]       = 0x01,

        [INPUT_BUTTON_MIDDLE]     = 0x02,

        [INPUT_BUTTON_RIGHT]      = 0x04,

        [INPUT_BUTTON_WHEEL_UP]   = 0x08,

        [INPUT_BUTTON_WHEEL_DOWN] = 0x10,

    };

    QemuConsole *con = vs->vd->dcl.con;

    int width = pixman_image_get_width(vs->vd->server);

    int height = pixman_image_get_height(vs->vd->server);



    if (vs->last_bmask != button_mask) {

        qemu_input_update_buttons(con, bmap, vs->last_bmask, button_mask);

        vs->last_bmask = button_mask;

    }



    if (vs->absolute) {

        qemu_input_queue_abs(con, INPUT_AXIS_X, x, width);

        qemu_input_queue_abs(con, INPUT_AXIS_Y, y, height);

    } else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {

        qemu_input_queue_rel(con, INPUT_AXIS_X, x - 0x7FFF);

        qemu_input_queue_rel(con, INPUT_AXIS_Y, y - 0x7FFF);

    } else {

        if (vs->last_x != -1) {

            qemu_input_queue_rel(con, INPUT_AXIS_X, x - vs->last_x);

            qemu_input_queue_rel(con, INPUT_AXIS_Y, y - vs->last_y);

        }

        vs->last_x = x;

        vs->last_y = y;

    }

    qemu_input_event_sync();

}

static void pointer_event(VncState *vs, int button_mask, int x, int y)

{

    static uint32_t bmap[INPUT_BUTTON__MAX] = {

        [INPUT_BUTTON_LEFT]       = 0x01,

        [INPUT_BUTTON_MIDDLE]     = 0x02,

        [INPUT_BUTTON_RIGHT]      = 0x04,

        [INPUT_BUTTON_WHEEL_UP]   = 0x08,

        [INPUT_BUTTON_WHEEL_DOWN] = 0x10,

    };

    QemuConsole *con = vs->vd->dcl.con;

    int width = pixman_image_get_width(vs->vd->server);

    int height = pixman_image_get_height(vs->vd->server);



    if (vs->last_bmask != button_mask) {

        qemu_input_update_buttons(con, bmap, vs->last_bmask, button_mask);

        vs->last_bmask = button_mask;

    }



    if (vs->absolute) {

        qemu_input_queue_abs(con, INPUT_AXIS_X, x, width);

        qemu_input_queue_abs(con, INPUT_AXIS_Y, y, height);

    } else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {

        qemu_input_queue_rel(con, INPUT_AXIS_X, x - 0x7FFF);

        qemu_input_queue_rel(con, INPUT_AXIS_Y, y - 0x7FFF);

    } else {

        if (vs->last_x != -1) {

            qemu_input_queue_rel(con, INPUT_AXIS_X, x - vs->last_x);

            qemu_input_queue_rel(con, INPUT_AXIS_Y, y - vs->last_y);

        }

        vs->last_x = x;

        vs->last_y = y;

    }

    qemu_input_event_sync();

}

static void FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3)

{

    static uint32_t VAR_4[INPUT_BUTTON__MAX] = {

        [INPUT_BUTTON_LEFT]       = 0x01,

        [INPUT_BUTTON_MIDDLE]     = 0x02,

        [INPUT_BUTTON_RIGHT]      = 0x04,

        [INPUT_BUTTON_WHEEL_UP]   = 0x08,

        [INPUT_BUTTON_WHEEL_DOWN] = 0x10,

    };

    QemuConsole *con = VAR_0->vd->dcl.con;

    int VAR_5 = pixman_image_get_width(VAR_0->vd->server);

    int VAR_6 = pixman_image_get_height(VAR_0->vd->server);



    if (VAR_0->last_bmask != VAR_1) {

        qemu_input_update_buttons(con, VAR_4, VAR_0->last_bmask, VAR_1);

        VAR_0->last_bmask = VAR_1;

    }



    if (VAR_0->absolute) {

        qemu_input_queue_abs(con, INPUT_AXIS_X, VAR_2, VAR_5);

        qemu_input_queue_abs(con, INPUT_AXIS_Y, VAR_3, VAR_6);

    } else if (vnc_has_feature(VAR_0, VNC_FEATURE_POINTER_TYPE_CHANGE)) {

        qemu_input_queue_rel(con, INPUT_AXIS_X, VAR_2 - 0x7FFF);

        qemu_input_queue_rel(con, INPUT_AXIS_Y, VAR_3 - 0x7FFF);

    } else {

        if (VAR_0->last_x != -1) {

            qemu_input_queue_rel(con, INPUT_AXIS_X, VAR_2 - VAR_0->last_x);

            qemu_input_queue_rel(con, INPUT_AXIS_Y, VAR_3 - VAR_0->last_y);

        }

        VAR_0->last_x = VAR_2;

        VAR_0->last_y = VAR_3;

    }

    qemu_input_event_sync();

}

static void FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3)
{ static uint32_t VAR_4[INPUT_BUTTON__MAX] = { [INPUT_BUTTON_LEFT]       = 0x01,
[INPUT_BUTTON_MIDDLE]     = 0x02,
[INPUT_BUTTON_RIGHT]      = 0x04,
[INPUT_BUTTON_WHEEL_UP]   = 0x08,
[INPUT_BUTTON_WHEEL_DOWN] = 0x10,
}; QemuConsole *con = VAR_0->vd->dcl.con; int VAR_5 = pixman_image_get_width(VAR_0->vd->server); int VAR_6 = pixman_image_get_height(VAR_0->vd->server); if (VAR_0->last_bmask != VAR_1) { qemu_input_update_buttons(con, VAR_4, VAR_0->last_bmask, VAR_1); VAR_0->last_bmask = VAR_1; } if (VAR_0->absolute) { qemu_input_queue_abs(con, INPUT_AXIS_X, VAR_2, VAR_5); qemu_input_queue_abs(con, INPUT_AXIS_Y, VAR_3, VAR_6); } else if (vnc_has_feature(VAR_0, VNC_FEATURE_POINTER_TYPE_CHANGE)) { qemu_input_queue_rel(con, INPUT_AXIS_X, VAR_2 - 0x7FFF); qemu_input_queue_rel(con, INPUT_AXIS_Y, VAR_3 - 0x7FFF); } else { if (VAR_0->last_x != -1) { qemu_input_queue_rel(con, INPUT_AXIS_X, VAR_2 - VAR_0->last_x); qemu_input_queue_rel(con, INPUT_AXIS_Y, VAR_3 - VAR_0->last_y); } VAR_0->last_x = VAR_2; VAR_0->last_y = VAR_3; } qemu_input_event_sync(); }