Add RARCH_DISPLAY_CTL_SHOW_MOUSE

This commit is contained in:
twinaphex 2015-11-20 17:26:39 +01:00
parent 3e986f9562
commit d68401aa4d
3 changed files with 14 additions and 11 deletions

View File

@ -1760,6 +1760,7 @@ bool event_command(enum event_command cmd)
case EVENT_CMD_GRAB_MOUSE_TOGGLE:
{
static bool grab_mouse_state = false;
bool grab_mouse_state_tmp;
grab_mouse_state = !grab_mouse_state;
@ -1770,7 +1771,8 @@ bool event_command(enum event_command cmd)
msg_hash_to_str(MSG_GRAB_MOUSE_STATE),
grab_mouse_state ? "yes" : "no");
video_driver_show_mouse(!grab_mouse_state);
grab_mouse_state_tmp = !grab_mouse_state;
video_driver_ctl(RARCH_DISPLAY_CTL_SHOW_MOUSE, &grab_mouse_state_tmp);
}
break;
case EVENT_CMD_PERFCNT_REPORT_FRONTEND_LOG:

View File

@ -653,14 +653,6 @@ void video_driver_set_aspect_ratio(unsigned aspectratio_index)
poke->set_aspect_ratio(driver->video_data, aspectratio_index);
}
void video_driver_show_mouse(bool state)
{
driver_t *driver = driver_get_ptr();
const video_poke_interface_t *poke = video_driver_get_poke_ptr(driver);
if (poke && poke->show_mouse)
poke->show_mouse(driver->video_data, state);
}
void video_driver_set_osd_msg(const char *msg,
const struct font_params *params, void *font)
@ -1157,6 +1149,16 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
switch (state)
{
case RARCH_DISPLAY_CTL_SHOW_MOUSE:
{
driver_t *driver = driver_get_ptr();
const video_poke_interface_t *poke = video_driver_get_poke_ptr(driver);
bool *toggle = (bool*)data;
if (poke && poke->show_mouse)
poke->show_mouse(driver->video_data, *toggle);
}
return true;
case RARCH_DISPLAY_CTL_SET_NONBLOCK_STATE:
{
driver_t *driver = driver_get_ptr();

View File

@ -232,6 +232,7 @@ enum rarch_display_ctl_state
/* Renders the current video frame. */
RARCH_DISPLAY_CTL_CACHED_FRAME_RENDER,
RARCH_DISPLAY_CTL_CACHED_FRAME_HAS_VALID_FB,
RARCH_DISPLAY_CTL_SHOW_MOUSE,
RARCH_DISPLAY_CTL_GET_FRAME_COUNT
};
@ -304,8 +305,6 @@ bool video_driver_get_video_output_size(
void video_driver_set_aspect_ratio(unsigned aspectratio_index);
void video_driver_show_mouse(bool state);
void video_driver_set_osd_msg(const char *msg,
const struct font_params *params, void *font);