From d68401aa4d39b2cbc3f21b3461e789bfe285e1ad Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 20 Nov 2015 17:26:39 +0100 Subject: [PATCH] Add RARCH_DISPLAY_CTL_SHOW_MOUSE --- command_event.c | 4 +++- gfx/video_driver.c | 18 ++++++++++-------- gfx/video_driver.h | 3 +-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/command_event.c b/command_event.c index 887a97fdef..ecf656020c 100644 --- a/command_event.c +++ b/command_event.c @@ -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: diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 26c79aba19..f634f9ba68 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -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(); diff --git a/gfx/video_driver.h b/gfx/video_driver.h index f14556b367..5a7a0df39f 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -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);