Create x11_input_ctx_new/x11_input_ctx_destroy

This commit is contained in:
twinaphex 2015-11-19 11:27:41 +01:00
parent 56e5d0bf3e
commit ce2b973beb
5 changed files with 23 additions and 6 deletions

View File

@ -536,3 +536,15 @@ void x11_update_window_title(void *data)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}
bool x11_input_ctx_new(void)
{
if (!x11_create_input_context(g_x11_dpy, g_x11_win, &g_x11_xim, &g_x11_xic))
return false;
return true;
}
void x11_input_ctx_destroy(void)
{
x11_destroy_input_context(&g_x11_xim, &g_x11_xic);
}

View File

@ -83,5 +83,9 @@ bool x11_connect(void);
void x11_update_window_title(void *data);
bool x11_input_ctx_new(void);
void x11_input_ctx_destroy(void);
#endif

View File

@ -576,7 +576,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_create_input_context(g_x11_dpy, g_x11_win, &g_x11_xim, &g_x11_xic))
if (!x11_input_ctx_new())
goto error;
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);
@ -819,7 +819,8 @@ static void xv_free(void *data)
if (!xv)
return;
x11_destroy_input_context(&g_x11_xim, &g_x11_xic);
x11_input_ctx_destroy();
XShmDetach(g_x11_dpy, &xv->shminfo);
shmdt(xv->shminfo.shmaddr);
shmctl(xv->shminfo.shmid, IPC_RMID, NULL);

View File

@ -83,7 +83,7 @@ static void ctx_glx_destroy_resources(gfx_ctx_glx_data_t *glx)
if (!glx)
return;
x11_destroy_input_context(&g_x11_xim, &g_x11_xic);
x11_input_ctx_destroy();
if (g_x11_dpy && glx->g_ctx)
{
@ -518,7 +518,7 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
XFree(vi);
if (!x11_create_input_context(g_x11_dpy, g_x11_win, &g_x11_xim, &g_x11_xic))
if (!x11_input_ctx_new())
goto error;
driver->display_type = RARCH_DISPLAY_X11;

View File

@ -468,7 +468,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
XFree(vi);
g_inited = true;
if (!x11_create_input_context(g_x11_dpy, g_x11_win, &g_x11_xim, &g_x11_xic))
if (!x11_input_ctx_new())
goto error;
driver->display_type = RARCH_DISPLAY_X11;
@ -490,7 +490,7 @@ static void gfx_ctx_xegl_destroy(void *data)
{
(void)data;
x11_destroy_input_context(&g_x11_xim, &g_x11_xic);
x11_input_ctx_destroy();
if (g_egl_dpy)
{