Create video_driver_focus

This commit is contained in:
twinaphex 2015-03-22 23:40:22 +01:00
parent 344ebe3b73
commit 7243c43cda
3 changed files with 18 additions and 6 deletions

View File

@ -772,3 +772,15 @@ bool video_driver_read_viewport(uint8_t *buffer)
buffer);
}
bool video_driver_focus(void)
{
driver_t *driver = driver_get_ptr();
if (!driver)
return false;
if (!driver->video)
return false;
if (!driver->video->focus)
return false;
return driver->video->focus(driver->video_data);
}

View File

@ -303,6 +303,8 @@ 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 __cplusplus
}
#endif

View File

@ -271,10 +271,9 @@ static void x_input_free(void *data)
static void x_input_poll_mouse(x11_input_t *x11)
{
Window root_win, child_win;
int root_x, root_y, win_x, win_y;
unsigned mask;
driver_t *driver = driver_get_ptr();
int root_x, root_y, win_x, win_y;
Window root_win, child_win;
x11->mouse_last_x = x11->mouse_x;
x11->mouse_last_y = x11->mouse_y;
@ -293,7 +292,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 && driver->video->focus(driver->video_data))
if (x11->grab_mouse && video_driver_focus())
{
int mid_w, mid_h;
struct video_viewport vp = {0};
@ -335,9 +334,8 @@ void x_input_poll_wheel(void *data, XButtonEvent *event, bool latch)
static void x_input_poll(void *data)
{
x11_input_t *x11 = (x11_input_t*)data;
driver_t *driver = driver_get_ptr();
if (driver->video->focus(driver->video_data))
if (video_driver_focus())
XQueryKeymap(x11->display, x11->state);
else
memset(x11->state, 0, sizeof(x11->state));