(X11) Code de-duplication

This commit is contained in:
twinaphex 2015-11-19 12:05:32 +01:00
parent 50cd3bc185
commit e3aba24e42
5 changed files with 12 additions and 21 deletions

View File

@ -38,7 +38,7 @@ Window g_x11_win;
static XIM g_x11_xim;
static XIC g_x11_xic;
Display *g_x11_dpy;
bool g_x11_true_full;
static bool g_x11_true_full;
#define XA_INIT(x) XA##x = XInternAtom(dpy, #x, False)
#define _NET_WM_STATE_ADD 1
@ -538,10 +538,16 @@ void x11_update_window_title(void *data)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}
bool x11_input_ctx_new(void)
bool x11_input_ctx_new(bool true_full)
{
driver_t *driver = driver_get_ptr();
if (!x11_create_input_context(g_x11_dpy, g_x11_win, &g_x11_xim, &g_x11_xic))
return false;
driver->display_type = RARCH_DISPLAY_X11;
driver->video_display = (uintptr_t)g_x11_dpy;
driver->video_window = (uintptr_t)g_x11_win;
g_x11_true_full = true_full;
return true;
}

View File

@ -39,7 +39,6 @@ extern Atom g_x11_quit_atom;
extern bool g_x11_has_focus;
extern Window g_x11_win;
extern Display *g_x11_dpy;
extern bool g_x11_true_full;
extern Colormap g_x11_cmap;
void x11_show_mouse(Display *dpy, Window win, bool state);
@ -82,7 +81,7 @@ bool x11_connect(void);
void x11_update_window_title(void *data);
bool x11_input_ctx_new(void);
bool x11_input_ctx_new(bool true_full);
void x11_input_ctx_destroy(void);

View File

@ -556,10 +556,6 @@ static void *xv_init(const video_info_t *video,
xv_set_nonblock_state(xv, !video->vsync);
driver->display_type = RARCH_DISPLAY_X11;
driver->video_display = (uintptr_t)g_x11_dpy;
driver->video_window = (Window)g_x11_win;
if (input && input_data)
{
xinput = input_x.init();
@ -575,7 +571,7 @@ static void *xv_init(const video_info_t *video,
init_yuv_tables(xv);
xv_init_font(xv, settings->video.font_path, settings->video.font_size);
if (!x11_input_ctx_new())
if (!x11_input_ctx_new(true))
goto error;
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);

View File

@ -511,14 +511,9 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
XFree(vi);
if (!x11_input_ctx_new())
if (!x11_input_ctx_new(true_full))
goto error;
driver->display_type = RARCH_DISPLAY_X11;
driver->video_display = (uintptr_t)g_x11_dpy;
driver->video_window = (uintptr_t)g_x11_win;
g_x11_true_full = true_full;
return true;
error:

View File

@ -467,14 +467,9 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
XFree(vi);
g_inited = true;
if (!x11_input_ctx_new())
if (!x11_input_ctx_new(true_full))
goto error;
driver->display_type = RARCH_DISPLAY_X11;
driver->video_display = (uintptr_t)g_x11_dpy;
driver->video_window = (uintptr_t)g_x11_win;
g_x11_true_full = true_full;
return true;
error: