mirror of
https://github.com/libretro/RetroArch
synced 2025-02-25 21:41:03 +00:00
(X11) Code de-duplication
This commit is contained in:
parent
50cd3bc185
commit
e3aba24e42
@ -38,7 +38,7 @@ Window g_x11_win;
|
|||||||
static XIM g_x11_xim;
|
static XIM g_x11_xim;
|
||||||
static XIC g_x11_xic;
|
static XIC g_x11_xic;
|
||||||
Display *g_x11_dpy;
|
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 XA_INIT(x) XA##x = XInternAtom(dpy, #x, False)
|
||||||
#define _NET_WM_STATE_ADD 1
|
#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);
|
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))
|
if (!x11_create_input_context(g_x11_dpy, g_x11_win, &g_x11_xim, &g_x11_xic))
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ extern Atom g_x11_quit_atom;
|
|||||||
extern bool g_x11_has_focus;
|
extern bool g_x11_has_focus;
|
||||||
extern Window g_x11_win;
|
extern Window g_x11_win;
|
||||||
extern Display *g_x11_dpy;
|
extern Display *g_x11_dpy;
|
||||||
extern bool g_x11_true_full;
|
|
||||||
extern Colormap g_x11_cmap;
|
extern Colormap g_x11_cmap;
|
||||||
|
|
||||||
void x11_show_mouse(Display *dpy, Window win, bool state);
|
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);
|
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);
|
void x11_input_ctx_destroy(void);
|
||||||
|
|
||||||
|
@ -556,10 +556,6 @@ static void *xv_init(const video_info_t *video,
|
|||||||
|
|
||||||
xv_set_nonblock_state(xv, !video->vsync);
|
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)
|
if (input && input_data)
|
||||||
{
|
{
|
||||||
xinput = input_x.init();
|
xinput = input_x.init();
|
||||||
@ -575,7 +571,7 @@ static void *xv_init(const video_info_t *video,
|
|||||||
init_yuv_tables(xv);
|
init_yuv_tables(xv);
|
||||||
xv_init_font(xv, settings->video.font_path, settings->video.font_size);
|
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;
|
goto error;
|
||||||
|
|
||||||
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);
|
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);
|
||||||
|
@ -511,14 +511,9 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
|
|||||||
|
|
||||||
XFree(vi);
|
XFree(vi);
|
||||||
|
|
||||||
if (!x11_input_ctx_new())
|
if (!x11_input_ctx_new(true_full))
|
||||||
goto error;
|
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;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -467,14 +467,9 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
|||||||
XFree(vi);
|
XFree(vi);
|
||||||
g_inited = true;
|
g_inited = true;
|
||||||
|
|
||||||
if (!x11_input_ctx_new())
|
if (!x11_input_ctx_new(true_full))
|
||||||
goto error;
|
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;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user