mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-20 01:38:12 +00:00
Create input_driver_grab_mouse
This commit is contained in:
parent
5f8407e16c
commit
0d164162fc
@ -258,3 +258,17 @@ uint64_t input_driver_get_capabilities(void)
|
||||
return driver->input->get_capabilities(driver->input_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool input_driver_grab_mouse(bool state)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (!driver)
|
||||
return false;
|
||||
if (!driver->input)
|
||||
return false;
|
||||
if (!driver->input->grab_mouse)
|
||||
return false;
|
||||
driver->input->grab_mouse(driver->input_data, state);
|
||||
return true;
|
||||
}
|
||||
|
@ -148,6 +148,8 @@ uint64_t input_driver_get_capabilities(void);
|
||||
|
||||
const rarch_joypad_driver_t * input_driver_get_joypad_driver(void);
|
||||
|
||||
bool input_driver_grab_mouse(bool state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -2930,13 +2930,13 @@ bool rarch_main_command(unsigned cmd)
|
||||
{
|
||||
static bool grab_mouse_state = false;
|
||||
|
||||
if (!driver->input || !driver->input->grab_mouse)
|
||||
grab_mouse_state = !grab_mouse_state;
|
||||
|
||||
if (!driver->input || !input_driver_grab_mouse(grab_mouse_state))
|
||||
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);
|
||||
|
||||
video_driver_show_mouse(!grab_mouse_state);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user