From 402a4dd637fd6cee7a1b76ca8ac895659b400032 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 1 May 2018 09:44:44 -0700 Subject: Release capture of mouse and keyboard when entering UI --- io.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'io.c') diff --git a/io.c b/io.c index 76bd8a0..9ad6fb1 100644 --- a/io.c +++ b/io.c @@ -674,6 +674,21 @@ void handle_mouse_moved(int mouse, uint16_t x, uint16_t y, int16_t deltax, int16 } } +void io_release_capture(sega_io *io) +{ + if (io->mouse_mode == MOUSE_RELATIVE || (io->mouse_mode == MOUSE_CAPTURE && io->mouse_captured)) { + render_relative_mouse(0); + } + current_io->keyboard_captured = 0; +} + +void io_reacquire_capture(sega_io *io) +{ + if (io->mouse_mode == MOUSE_RELATIVE || (io->mouse_mode == MOUSE_CAPTURE && io->mouse_captured)) { + render_relative_mouse(1); + } +} + int parse_binding_target(char * target, tern_node * padbuttons, tern_node *mousebuttons, int * ui_out, int * padnum_out, int * padbutton_out) { const int gpadslen = strlen("gamepads."); -- cgit v1.2.3