mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Add RARCH_CMD_GRAB_MOUSE_TOGGLE
This commit is contained in:
parent
b3309d2132
commit
4bd018257e
@ -163,6 +163,7 @@ enum basic_event
|
||||
RARCH_CMD_DISK_NEXT,
|
||||
RARCH_CMD_DISK_PREV,
|
||||
RARCH_CMD_RUMBLE_STOP,
|
||||
RARCH_CMD_GRAB_MOUSE_TOGGLE,
|
||||
};
|
||||
|
||||
enum action_state
|
||||
|
17
retroarch.c
17
retroarch.c
@ -2680,6 +2680,23 @@ bool rarch_main_command(unsigned cmd)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RARCH_CMD_GRAB_MOUSE_TOGGLE:
|
||||
{
|
||||
static bool grab_mouse_state = false;
|
||||
|
||||
if (!driver.input || !driver.input->grab_mouse)
|
||||
return false;
|
||||
|
||||
grab_mouse_state = !grab_mouse_state;
|
||||
RARCH_LOG("Grab mouse state: %s.\n",
|
||||
grab_mouse_state ? "yes" : "no");
|
||||
driver.input->grab_mouse(driver.input_data, grab_mouse_state);
|
||||
|
||||
if (driver.video_poke && driver.video_poke->show_mouse)
|
||||
driver.video_poke->show_mouse(
|
||||
driver.video_data, !grab_mouse_state);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
17
runloop.c
17
runloop.c
@ -40,21 +40,6 @@ static void set_volume(float gain)
|
||||
g_extern.audio_data.volume_gain = db_to_gain(g_settings.audio.volume);
|
||||
}
|
||||
|
||||
static void check_grab_mouse_toggle(void)
|
||||
{
|
||||
static bool grab_mouse_state = false;
|
||||
|
||||
if (!driver.input->grab_mouse)
|
||||
return;
|
||||
|
||||
grab_mouse_state = !grab_mouse_state;
|
||||
RARCH_LOG("Grab mouse state: %s.\n", grab_mouse_state ? "yes" : "no");
|
||||
driver.input->grab_mouse(driver.input_data, grab_mouse_state);
|
||||
|
||||
if (driver.video_poke && driver.video_poke->show_mouse)
|
||||
driver.video_poke->show_mouse(driver.video_data, !grab_mouse_state);
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
static void check_netplay_flip(bool pressed, bool fullscreen_toggle_pressed)
|
||||
{
|
||||
@ -397,7 +382,7 @@ static int do_state_checks(
|
||||
set_volume(-0.5f);
|
||||
|
||||
if (BIT64_GET(trigger_input, RARCH_GRAB_MOUSE_TOGGLE))
|
||||
check_grab_mouse_toggle();
|
||||
rarch_main_command(RARCH_CMD_GRAB_MOUSE_TOGGLE);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (BIT64_GET(trigger_input, RARCH_OVERLAY_NEXT))
|
||||
|
Loading…
x
Reference in New Issue
Block a user