x11_show_mouse and win32_get_video_output_size - get rid of duplicate

code
This commit is contained in:
libretroadmin 2023-06-20 11:46:00 +02:00
parent 08ba0b53c6
commit 5e2bfcbe09
14 changed files with 19 additions and 71 deletions

View File

@ -2688,10 +2688,9 @@ bool win32_get_video_output(DEVMODE *dm, int mode, size_t len)
return true;
}
void win32_get_video_output_size(unsigned *width, unsigned *height, char *desc, size_t desc_len)
void win32_get_video_output_size(void *data, unsigned *width, unsigned *height, char *desc, size_t desc_len)
{
DEVMODE dm;
if (win32_get_video_output(&dm, -1, sizeof(dm)))
{
*width = dm.dmPelsWidth;

View File

@ -137,7 +137,7 @@ void win32_check_window(void *data,
void win32_set_window(unsigned *width, unsigned *height,
bool fullscreen, bool windowed_full, void *rect_data);
void win32_get_video_output_size(
void win32_get_video_output_size(void *data,
unsigned *width, unsigned *height, char *desc, size_t desc_len);
void win32_get_video_output_prev(

View File

@ -111,8 +111,10 @@ static void x11_hide_mouse(Display *dpy, Window win)
XFreeColors(dpy, colormap, &black.pixel, 1, 0);
}
void x11_show_mouse(Display *dpy, Window win, bool state)
void x11_show_mouse(void *data, bool state)
{
Display *dpy = g_x11_dpy;
Window win = g_x11_win;
if (state)
XUndefineCursor(dpy, win);
else

View File

@ -28,7 +28,7 @@ extern Display *g_x11_dpy;
extern Colormap g_x11_cmap;
extern unsigned g_x11_screen;
void x11_show_mouse(Display *dpy, Window win, bool state);
void x11_show_mouse(void *data, bool state);
void x11_set_net_wm_fullscreen(Display *dpy, Window win);
void x11_suspend_screensaver(void *data, bool enable);

View File

@ -2771,12 +2771,6 @@ static uint32_t d3d10_get_flags(void *data)
}
#ifndef __WINRT__
static void d3d10_get_video_output_size(void *data,
unsigned *width, unsigned *height, char *desc, size_t desc_len)
{
win32_get_video_output_size(width, height, desc, desc_len);
}
static void d3d10_get_video_output_prev(void *data)
{
unsigned width = 0;
@ -2809,7 +2803,7 @@ static const video_poke_interface_t d3d10_poke_interface = {
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
#else
d3d10_get_video_output_size,
win32_get_video_output_size,
d3d10_get_video_output_prev,
d3d10_get_video_output_next,
#endif

View File

@ -3585,12 +3585,6 @@ static bool d3d11_get_hw_render_interface(
}
#ifndef __WINRT__
static void d3d11_get_video_output_size(void *data,
unsigned *width, unsigned *height, char *desc, size_t desc_len)
{
win32_get_video_output_size(width, height, desc, desc_len);
}
static void d3d11_get_video_output_prev(void *data)
{
unsigned width = 0;
@ -3623,7 +3617,7 @@ static const video_poke_interface_t d3d11_poke_interface = {
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
#else
d3d11_get_video_output_size,
win32_get_video_output_size,
d3d11_get_video_output_prev,
d3d11_get_video_output_next,
#endif

View File

@ -4124,12 +4124,6 @@ static bool d3d12_get_hw_render_interface(
}
#ifndef __WINRT__
static void d3d12_get_video_output_size(void *data,
unsigned *width, unsigned *height, char *desc, size_t desc_len)
{
win32_get_video_output_size(width, height, desc, desc_len);
}
static void d3d12_get_video_output_prev(void *data)
{
unsigned width = 0;
@ -4162,7 +4156,7 @@ static const video_poke_interface_t d3d12_poke_interface = {
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
#else
d3d12_get_video_output_size,
win32_get_video_output_size,
d3d12_get_video_output_prev,
d3d12_get_video_output_next,
#endif

View File

@ -967,12 +967,6 @@ static void gdi_unload_texture(void *data,
static uint32_t gdi_get_flags(void *data) { return 0; }
static void gdi_get_video_output_size(void *data,
unsigned *width, unsigned *height, char *desc, size_t desc_len)
{
win32_get_video_output_size(width, height, desc, desc_len);
}
static void gdi_get_video_output_prev(void *data)
{
unsigned width = 0;
@ -994,7 +988,7 @@ static const video_poke_interface_t gdi_poke_interface = {
gdi_set_video_mode,
win32_get_refresh_rate,
NULL, /* set_filtering */
gdi_get_video_output_size,
win32_get_video_output_size,
gdi_get_video_output_prev,
gdi_get_video_output_next,
NULL, /* get_current_framebuffer */

View File

@ -812,7 +812,7 @@ static void *xv_init(const video_info_t *video,
if (video->fullscreen)
{
x11_set_net_wm_fullscreen(g_x11_dpy, g_x11_win);
x11_show_mouse(g_x11_dpy, g_x11_win, false);
x11_show_mouse(xv, false);
}
xv->gc = XCreateGC(g_x11_dpy, g_x11_win, 0, 0);

View File

@ -295,15 +295,7 @@ static uint32_t gfx_ctx_w_vk_get_flags(void *data)
}
static void gfx_ctx_w_vk_set_flags(void *data, uint32_t flags) { }
static void gfx_ctx_w_vk_get_video_output_size(void *data,
unsigned *width, unsigned *height, char *desc, size_t desc_len)
{
win32_get_video_output_size(width, height, desc, desc_len);
}
static void gfx_ctx_w_vk_get_video_output_prev(void *data) { }
static void gfx_ctx_w_vk_get_video_output_next(void *data) { }
const gfx_ctx_driver_t gfx_ctx_w_vk = {
@ -315,7 +307,7 @@ const gfx_ctx_driver_t gfx_ctx_w_vk = {
gfx_ctx_w_vk_set_video_mode,
win32_get_video_size,
win32_get_refresh_rate,
gfx_ctx_w_vk_get_video_output_size,
win32_get_video_output_size,
gfx_ctx_w_vk_get_video_output_prev,
gfx_ctx_w_vk_get_video_output_next,
win32_get_metrics,

View File

@ -777,12 +777,6 @@ static void gfx_ctx_wgl_set_flags(void *data, uint32_t flags)
}
static void gfx_ctx_wgl_get_video_output_size(void *data,
unsigned *width, unsigned *height, char *desc, size_t desc_len)
{
win32_get_video_output_size(width, height, desc, desc_len);
}
static void gfx_ctx_wgl_get_video_output_prev(void *data) { }
static void gfx_ctx_wgl_get_video_output_next(void *data) { }
@ -795,7 +789,7 @@ const gfx_ctx_driver_t gfx_ctx_wgl = {
gfx_ctx_wgl_set_video_mode,
win32_get_video_size,
win32_get_refresh_rate,
gfx_ctx_wgl_get_video_output_size,
win32_get_video_output_size,
gfx_ctx_wgl_get_video_output_prev,
gfx_ctx_wgl_get_video_output_next,
win32_get_metrics,

View File

@ -623,7 +623,7 @@ static bool gfx_ctx_x_set_video_mode(void *data,
x11_update_title(NULL);
if (fullscreen)
x11_show_mouse(g_x11_dpy, g_x11_win, false);
x11_show_mouse(data, false);
#ifdef HAVE_XF86VM
if (true_full)
@ -1031,11 +1031,6 @@ static bool gfx_ctx_x_bind_api(void *data, enum gfx_ctx_api api,
return false;
}
static void gfx_ctx_x_show_mouse(void *data, bool state)
{
x11_show_mouse(g_x11_dpy, g_x11_win, state);
}
static void gfx_ctx_x_bind_hw_render(void *data, bool enable)
{
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;
@ -1181,7 +1176,7 @@ const gfx_ctx_driver_t gfx_ctx_x = {
gfx_ctx_x_get_proc_address,
NULL,
NULL,
gfx_ctx_x_show_mouse,
x11_show_mouse,
"x",
gfx_ctx_x_get_flags,
gfx_ctx_x_set_flags,

View File

@ -390,7 +390,7 @@ static bool gfx_ctx_x_vk_set_video_mode(void *data,
x11_update_title(NULL);
if (fullscreen)
x11_show_mouse(g_x11_dpy, g_x11_win, false);
x11_show_mouse(data, false);
#ifdef HAVE_XF86VM
if (true_full)
@ -516,11 +516,6 @@ static enum gfx_ctx_api gfx_ctx_x_vk_get_api(void *data)
static bool gfx_ctx_x_vk_bind_api(void *data, enum gfx_ctx_api api,
unsigned major, unsigned minor) { return (api == GFX_CTX_VULKAN_API); }
static void gfx_ctx_x_vk_show_mouse(void *data, bool state)
{
x11_show_mouse(g_x11_dpy, g_x11_win, state);
}
static void gfx_ctx_x_vk_bind_hw_render(void *data, bool enable) { }
static void *gfx_ctx_x_vk_get_context_data(void *data)
@ -572,7 +567,7 @@ const gfx_ctx_driver_t gfx_ctx_vk_x = {
NULL, /* get_proc_address */
NULL,
NULL,
gfx_ctx_x_vk_show_mouse,
x11_show_mouse,
"vk_x",
gfx_ctx_x_vk_get_flags,
gfx_ctx_x_vk_set_flags,

View File

@ -398,7 +398,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
x11_update_title(NULL);
if (fullscreen)
x11_show_mouse(g_x11_dpy, g_x11_win, false);
x11_show_mouse(data, false);
#ifdef HAVE_XF86VM
if (true_full)
@ -517,11 +517,6 @@ static bool gfx_ctx_xegl_bind_api(void *video_driver,
return false;
}
static void gfx_ctx_xegl_show_mouse(void *data, bool state)
{
x11_show_mouse(g_x11_dpy, g_x11_win, state);
}
static void gfx_ctx_xegl_swap_buffers(void *data)
{
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
@ -618,7 +613,7 @@ const gfx_ctx_driver_t gfx_ctx_x_egl =
gfx_ctx_xegl_get_proc_address,
NULL,
NULL,
gfx_ctx_xegl_show_mouse,
x11_show_mouse,
"egl_x",
gfx_ctx_xegl_get_flags,
gfx_ctx_xegl_set_flags,