mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-08 18:36:28 +00:00
Create x11_get_video_size
This commit is contained in:
parent
5283c4c13c
commit
cbaca1bfe1
@ -429,3 +429,29 @@ void x11_check_window(bool *quit)
|
||||
|
||||
*quit = g_x11_quit;
|
||||
}
|
||||
|
||||
void x11_get_video_size(unsigned *width, unsigned *height)
|
||||
{
|
||||
if (!g_x11_dpy || g_x11_win == None)
|
||||
{
|
||||
Display *dpy = (Display*)XOpenDisplay(NULL);
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
|
||||
if (dpy)
|
||||
{
|
||||
int screen = DefaultScreen(dpy);
|
||||
*width = DisplayWidth(dpy, screen);
|
||||
*height = DisplayHeight(dpy, screen);
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XWindowAttributes target;
|
||||
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);
|
||||
|
||||
*width = target.width;
|
||||
*height = target.height;
|
||||
}
|
||||
}
|
||||
|
@ -69,5 +69,7 @@ bool x11_get_metrics(void *data,
|
||||
|
||||
void x11_check_window(bool *quit);
|
||||
|
||||
void x11_get_video_size(unsigned *width, unsigned *height);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -86,39 +86,11 @@ static int glx_nul_handler(Display *dpy, XErrorEvent *event)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void gfx_ctx_glx_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
|
||||
|
||||
if (!glx)
|
||||
return;
|
||||
|
||||
(void)data;
|
||||
|
||||
if (!g_x11_dpy || g_x11_win == None)
|
||||
{
|
||||
Display *dpy = (Display*)XOpenDisplay(NULL);
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
|
||||
if (dpy)
|
||||
{
|
||||
int screen = DefaultScreen(dpy);
|
||||
*width = DisplayWidth(dpy, screen);
|
||||
*height = DisplayHeight(dpy, screen);
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XWindowAttributes target;
|
||||
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);
|
||||
|
||||
*width = target.width;
|
||||
*height = target.height;
|
||||
}
|
||||
x11_get_video_size(width, height);
|
||||
}
|
||||
|
||||
static void ctx_glx_destroy_resources(gfx_ctx_glx_data_t *glx)
|
||||
|
@ -76,9 +76,6 @@ static int egl_nul_handler(Display *dpy, XErrorEvent *event)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gfx_ctx_xegl_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height);
|
||||
|
||||
static void gfx_ctx_xegl_destroy(void *data);
|
||||
|
||||
static void egl_report_error(void)
|
||||
@ -129,6 +126,12 @@ static void gfx_ctx_xegl_swap_interval(void *data, unsigned interval)
|
||||
}
|
||||
}
|
||||
|
||||
static void gfx_ctx_xegl_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
x11_get_video_size(width, height);
|
||||
}
|
||||
|
||||
static void gfx_ctx_xegl_check_window(void *data, bool *quit,
|
||||
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
|
||||
{
|
||||
@ -176,36 +179,6 @@ static void gfx_ctx_xegl_update_window_title(void *data)
|
||||
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
|
||||
}
|
||||
|
||||
static void gfx_ctx_xegl_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
if (!g_x11_dpy || g_x11_win == None)
|
||||
{
|
||||
Display *dpy = XOpenDisplay(NULL);
|
||||
if (dpy)
|
||||
{
|
||||
int screen = DefaultScreen(dpy);
|
||||
*width = DisplayWidth(dpy, screen);
|
||||
*height = DisplayHeight(dpy, screen);
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
else
|
||||
{
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XWindowAttributes target;
|
||||
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);
|
||||
|
||||
*width = target.width;
|
||||
*height = target.height;
|
||||
}
|
||||
}
|
||||
|
||||
#define XEGL_ATTRIBS_BASE \
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT, \
|
||||
|
Loading…
x
Reference in New Issue
Block a user