diff io.c @ 1576:2b132d894d76

Release capture of mouse and keyboard when entering UI
author Michael Pavone <pavone@retrodev.com>
date Tue, 01 May 2018 09:44:44 -0700
parents 577253765192
children 430dd12e4010
line wrap: on
line diff
--- a/io.c	Mon Apr 30 23:58:24 2018 -0700
+++ b/io.c	Tue May 01 09:44:44 2018 -0700
@@ -674,6 +674,21 @@
 	}
 }
 
+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.");