Add RARCH_DISPLAY_CTL_IS_FOCUSED

This commit is contained in:
twinaphex 2015-11-20 15:24:24 +01:00
parent 7141210d15
commit 5cea9e5400
3 changed files with 9 additions and 18 deletions

View File

@ -727,14 +727,6 @@ bool video_driver_read_viewport(uint8_t *buffer)
return false;
}
bool video_driver_focus(void)
{
driver_t *driver = driver_get_ptr();
const video_driver_t *video = video_driver_ctx_get_ptr(driver);
return video->focus(driver->video_data);
}
#ifdef HAVE_OVERLAY
bool video_driver_overlay_interface(const video_overlay_interface_t **iface)
{
@ -1189,15 +1181,15 @@ void video_driver_set_pixel_format(enum retro_pixel_format fmt)
bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
{
driver_t *driver = driver_get_ptr();
const video_driver_t *video = video_driver_ctx_get_ptr(driver);
switch (state)
{
case RARCH_DISPLAY_CTL_IS_FOCUSED:
return video->focus(driver->video_data);
case RARCH_DISPLAY_CTL_HAS_WINDOWED:
{
driver_t *driver = driver_get_ptr();
const video_driver_t *video = video_driver_ctx_get_ptr(driver);
return video->has_windowed(driver->video_data);
}
return video->has_windowed(driver->video_data);
case RARCH_DISPLAY_CTL_GET_FRAME_COUNT:
{
uint64_t **ptr = (uint64_t**)data;

View File

@ -224,6 +224,7 @@ enum rarch_display_ctl_state
RARCH_DISPLAY_CTL_FRAME_FILTER_ALIVE,
RARCH_DISPLAY_CTL_FRAME_FILTER_IS_32BIT,
RARCH_DISPLAY_CTL_HAS_WINDOWED,
RARCH_DISPLAY_CTL_IS_FOCUSED,
RARCH_DISPLAY_CTL_GET_FRAME_COUNT
};
@ -317,8 +318,6 @@ bool video_driver_read_viewport(uint8_t *buffer);
bool video_driver_set_shader(enum rarch_shader_type type,
const char *path);
bool video_driver_focus(void);
#ifdef HAVE_OVERLAY
bool video_driver_overlay_interface(const video_overlay_interface_t **iface);
#endif

View File

@ -320,7 +320,7 @@ static void x_input_poll_mouse(x11_input_t *x11)
x11->mouse_r = mask & Button3Mask;
/* Somewhat hacky, but seem to do the job. */
if (x11->grab_mouse && video_driver_focus())
if (x11->grab_mouse && video_driver_ctl(RARCH_DISPLAY_CTL_IS_FOCUSED, NULL))
{
int mid_w, mid_h;
struct video_viewport vp = {0};
@ -363,7 +363,7 @@ static void x_input_poll(void *data)
{
x11_input_t *x11 = (x11_input_t*)data;
if (video_driver_focus())
if (video_driver_ctl(RARCH_DISPLAY_CTL_IS_FOCUSED, NULL))
XQueryKeymap(x11->display, x11->state);
else
memset(x11->state, 0, sizeof(x11->state));