Add video_driver_has_focus

This commit is contained in:
twinaphex 2019-06-20 06:26:29 +02:00
parent d865c5e4a6
commit d50a6b6bd2
4 changed files with 11 additions and 4 deletions

View File

@ -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)

View File

@ -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));

View File

@ -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)

View File

@ -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);