static void xenfb_mouse_event(void *opaque,

			      int dx, int dy, int dz, int button_state)

{

    struct XenInput *xenfb = opaque;

    DisplaySurface *surface = qemu_console_surface(xenfb->c.con);

    int dw = surface_width(surface);

    int dh = surface_height(surface);

    int i;



    trace_xenfb_mouse_event(opaque, dx, dy, dz, button_state,

                            xenfb->abs_pointer_wanted);

    if (xenfb->abs_pointer_wanted)

	xenfb_send_position(xenfb,

			    dx * (dw - 1) / 0x7fff,

			    dy * (dh - 1) / 0x7fff,

			    dz);

    else

	xenfb_send_motion(xenfb, dx, dy, dz);



    for (i = 0 ; i < 8 ; i++) {

	int lastDown = xenfb->button_state & (1 << i);

	int down = button_state & (1 << i);

	if (down == lastDown)

	    continue;



	if (xenfb_send_key(xenfb, down, BTN_LEFT+i) < 0)

	    return;

    }

    xenfb->button_state = button_state;

}

static void xenfb_mouse_event(void *opaque,

			      int dx, int dy, int dz, int button_state)

{

    struct XenInput *xenfb = opaque;

    DisplaySurface *surface = qemu_console_surface(xenfb->c.con);

    int dw = surface_width(surface);

    int dh = surface_height(surface);

    int i;



    trace_xenfb_mouse_event(opaque, dx, dy, dz, button_state,

                            xenfb->abs_pointer_wanted);

    if (xenfb->abs_pointer_wanted)

	xenfb_send_position(xenfb,

			    dx * (dw - 1) / 0x7fff,

			    dy * (dh - 1) / 0x7fff,

			    dz);

    else

	xenfb_send_motion(xenfb, dx, dy, dz);



    for (i = 0 ; i < 8 ; i++) {

	int lastDown = xenfb->button_state & (1 << i);

	int down = button_state & (1 << i);

	if (down == lastDown)

	    continue;



	if (xenfb_send_key(xenfb, down, BTN_LEFT+i) < 0)

	    return;

    }

    xenfb->button_state = button_state;

}

static void FUNC_0(void *VAR_0,

			      int VAR_1, int VAR_2, int VAR_3, int VAR_4)

{

    struct XenInput *VAR_5 = VAR_0;

    DisplaySurface *surface = qemu_console_surface(VAR_5->c.con);

    int VAR_6 = surface_width(surface);

    int VAR_7 = surface_height(surface);

    int VAR_8;



    trace_xenfb_mouse_event(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4,

                            VAR_5->abs_pointer_wanted);

    if (VAR_5->abs_pointer_wanted)

	xenfb_send_position(VAR_5,

			    VAR_1 * (VAR_6 - 1) / 0x7fff,

			    VAR_2 * (VAR_7 - 1) / 0x7fff,

			    VAR_3);

    else

	xenfb_send_motion(VAR_5, VAR_1, VAR_2, VAR_3);



    for (VAR_8 = 0 ; VAR_8 < 8 ; VAR_8++) {

	int VAR_9 = VAR_5->VAR_4 & (1 << VAR_8);

	int VAR_10 = VAR_4 & (1 << VAR_8);

	if (VAR_10 == VAR_9)

	    continue;



	if (xenfb_send_key(VAR_5, VAR_10, BTN_LEFT+VAR_8) < 0)

	    return;

    }

    VAR_5->VAR_4 = VAR_4;

}

static void FUNC_0(void *VAR_0,
int VAR_1, int VAR_2, int VAR_3, int VAR_4)
{ struct XenInput *VAR_5 = VAR_0; DisplaySurface *surface = qemu_console_surface(VAR_5->c.con); int VAR_6 = surface_width(surface); int VAR_7 = surface_height(surface); int VAR_8; trace_xenfb_mouse_event(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4,
VAR_5->abs_pointer_wanted); if (VAR_5->abs_pointer_wanted)
xenfb_send_position(VAR_5,
VAR_1 * (VAR_6 - 1) / 0x7fff,
VAR_2 * (VAR_7 - 1) / 0x7fff,
VAR_3); else
xenfb_send_motion(VAR_5, VAR_1, VAR_2, VAR_3); for (VAR_8 = 0 ; VAR_8 < 8 ; VAR_8++) { int VAR_9 = VAR_5->VAR_4 & (1 << VAR_8); int VAR_10 = VAR_4 & (1 << VAR_8); if (VAR_10 == VAR_9)
continue; if (xenfb_send_key(VAR_5, VAR_10, BTN_LEFT+VAR_8) < 0)
return; } VAR_5->VAR_4 = VAR_4; }