static void handle_mousemotion(SDL_Event *ev)

{

    int max_x, max_y;

    struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);



    if (qemu_input_is_absolute() || absolute_enabled) {

        int scr_w, scr_h;

        SDL_GetWindowSize(scon->real_window, &scr_w, &scr_h);

        max_x = scr_w - 1;

        max_y = scr_h - 1;

        if (gui_grab && (ev->motion.x == 0 || ev->motion.y == 0 ||

                         ev->motion.x == max_x || ev->motion.y == max_y)) {

            sdl_grab_end(scon);

        }

        if (!gui_grab &&

            (ev->motion.x > 0 && ev->motion.x < max_x &&

             ev->motion.y > 0 && ev->motion.y < max_y)) {

            sdl_grab_start(scon);

        }

    }

    if (gui_grab || qemu_input_is_absolute() || absolute_enabled) {

        sdl_send_mouse_event(scon, ev->motion.xrel, ev->motion.yrel,

                             ev->motion.x, ev->motion.y, ev->motion.state);

    }

}

static void handle_mousemotion(SDL_Event *ev)

{

    int max_x, max_y;

    struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);



    if (qemu_input_is_absolute() || absolute_enabled) {

        int scr_w, scr_h;

        SDL_GetWindowSize(scon->real_window, &scr_w, &scr_h);

        max_x = scr_w - 1;

        max_y = scr_h - 1;

        if (gui_grab && (ev->motion.x == 0 || ev->motion.y == 0 ||

                         ev->motion.x == max_x || ev->motion.y == max_y)) {

            sdl_grab_end(scon);

        }

        if (!gui_grab &&

            (ev->motion.x > 0 && ev->motion.x < max_x &&

             ev->motion.y > 0 && ev->motion.y < max_y)) {

            sdl_grab_start(scon);

        }

    }

    if (gui_grab || qemu_input_is_absolute() || absolute_enabled) {

        sdl_send_mouse_event(scon, ev->motion.xrel, ev->motion.yrel,

                             ev->motion.x, ev->motion.y, ev->motion.state);

    }

}

static void FUNC_0(SDL_Event *VAR_0)

{

    int VAR_1, VAR_2;

    struct sdl2_console *VAR_3 = get_scon_from_window(VAR_0->key.windowID);



    if (qemu_input_is_absolute() || absolute_enabled) {

        int VAR_4, VAR_5;

        SDL_GetWindowSize(VAR_3->real_window, &VAR_4, &VAR_5);

        VAR_1 = VAR_4 - 1;

        VAR_2 = VAR_5 - 1;

        if (gui_grab && (VAR_0->motion.x == 0 || VAR_0->motion.y == 0 ||

                         VAR_0->motion.x == VAR_1 || VAR_0->motion.y == VAR_2)) {

            sdl_grab_end(VAR_3);

        }

        if (!gui_grab &&

            (VAR_0->motion.x > 0 && VAR_0->motion.x < VAR_1 &&

             VAR_0->motion.y > 0 && VAR_0->motion.y < VAR_2)) {

            sdl_grab_start(VAR_3);

        }

    }

    if (gui_grab || qemu_input_is_absolute() || absolute_enabled) {

        sdl_send_mouse_event(VAR_3, VAR_0->motion.xrel, VAR_0->motion.yrel,

                             VAR_0->motion.x, VAR_0->motion.y, VAR_0->motion.state);

    }

}

static void FUNC_0(SDL_Event *VAR_0)
{ int VAR_1, VAR_2; struct sdl2_console *VAR_3 = get_scon_from_window(VAR_0->key.windowID); if (qemu_input_is_absolute() || absolute_enabled) { int VAR_4, VAR_5; SDL_GetWindowSize(VAR_3->real_window, &VAR_4, &VAR_5); VAR_1 = VAR_4 - 1; VAR_2 = VAR_5 - 1; if (gui_grab && (VAR_0->motion.x == 0 || VAR_0->motion.y == 0 ||
VAR_0->motion.x == VAR_1 || VAR_0->motion.y == VAR_2)) { sdl_grab_end(VAR_3); } if (!gui_grab &&
(VAR_0->motion.x > 0 && VAR_0->motion.x < VAR_1 &&
VAR_0->motion.y > 0 && VAR_0->motion.y < VAR_2)) { sdl_grab_start(VAR_3); } } if (gui_grab || qemu_input_is_absolute() || absolute_enabled) { sdl_send_mouse_event(VAR_3, VAR_0->motion.xrel, VAR_0->motion.yrel,
VAR_0->motion.x, VAR_0->motion.y, VAR_0->motion.state); } }