diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index b7734ff6e2..2e2208917b 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -185,7 +185,7 @@ static void udev_handle_keyboard(void *data, { case EV_KEY: keysym = input_unify_ev_key_code(event->code); - if (event->value && video_driver_cb_has_focus()) + if (event->value && video_driver_has_focus()) BIT_SET(udev_key_state, keysym); else BIT_CLEAR(udev_key_state, keysym); @@ -224,7 +224,7 @@ static udev_input_mouse_t *udev_get_mouse(struct udev_input *udev, unsigned port settings_t *settings = config_get_ptr(); udev_input_mouse_t *mouse = NULL; - if (port >= MAX_USERS || !video_driver_cb_has_focus()) + if (port >= MAX_USERS || !video_driver_has_focus()) return NULL; for (i = 0; i < udev->num_devices; ++i) diff --git a/input/drivers/x11_input.c b/input/drivers/x11_input.c index 13467d6ef2..62bc6e6e65 100644 --- a/input/drivers/x11_input.c +++ b/input/drivers/x11_input.c @@ -419,7 +419,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_cb_has_focus()) + if (x11->grab_mouse && video_driver_has_focus()) { int mid_w, mid_h; struct video_viewport vp; @@ -453,7 +453,7 @@ static void x_input_poll(void *data) { x11_input_t *x11 = (x11_input_t*)data; - if (video_driver_cb_has_focus()) + if (video_driver_has_focus()) XQueryKeymap(x11->display, x11->state); else memset(x11->state, 0, sizeof(x11->state)); diff --git a/retroarch.c b/retroarch.c index 1a036e55fa..cb9dc871c5 100644 --- a/retroarch.c +++ b/retroarch.c @@ -9659,6 +9659,11 @@ bool video_driver_translate_coord_viewport( #define video_has_focus() ((current_video_context.has_focus) ? (current_video_context.has_focus && current_video_context.has_focus(video_context_data)) : (current_video->focus) ? (current_video && current_video->focus && current_video->focus(video_driver_data)) : true) +bool video_driver_has_focus(void) +{ + return video_has_focus(); +} + void video_driver_get_window_title(char *buf, unsigned len) { if (buf && video_driver_window_title_update) diff --git a/retroarch.h b/retroarch.h index 1ab3a9b1ad..b88abd47d1 100644 --- a/retroarch.h +++ b/retroarch.h @@ -1632,6 +1632,8 @@ extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END]; bool video_driver_has_windowed(void); +bool video_driver_has_focus(void); + bool video_driver_cached_frame_has_valid_framebuffer(void); void video_driver_set_cached_frame_ptr(const void *data);