mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
Move display_type / display_window etc all to gfx/video_driver.c -
no more dependencies on driver_t
This commit is contained in:
parent
6c4b6310aa
commit
0044d853f8
8
driver.h
8
driver.h
@ -271,14 +271,6 @@ typedef struct driver
|
||||
bool flushing_input;
|
||||
bool nonblock_state;
|
||||
|
||||
/* Opaque handles to currently running window.
|
||||
* Used by e.g. input drivers which bind to a window.
|
||||
* Drivers are responsible for setting these if an input driver
|
||||
* could potentially make use of this. */
|
||||
uintptr_t video_display;
|
||||
uintptr_t video_window;
|
||||
enum rarch_display_type display_type;
|
||||
|
||||
/* Last message given to the video driver */
|
||||
char current_msg[PATH_MAX_LENGTH];
|
||||
} driver_t;
|
||||
|
@ -279,7 +279,6 @@ bool win32_window_create(void *data, unsigned style,
|
||||
unsigned height, bool fullscreen)
|
||||
{
|
||||
#ifndef _XBOX
|
||||
driver_t *driver = driver_get_ptr();
|
||||
g_hwnd = CreateWindowEx(0, "RetroArch", "RetroArch",
|
||||
style,
|
||||
fullscreen ? mon_rect->left : g_pos_x,
|
||||
@ -289,9 +288,9 @@ bool win32_window_create(void *data, unsigned style,
|
||||
if (!g_hwnd)
|
||||
return false;
|
||||
|
||||
driver->display_type = RARCH_DISPLAY_WIN32;
|
||||
driver->video_display = 0;
|
||||
driver->video_window = (uintptr_t)g_hwnd;
|
||||
video_driver_display_type_set(RARCH_DISPLAY_WIN32);
|
||||
video_driver_display_set(0);
|
||||
video_driver_window_set((uintptr_t)g_hwnd);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -547,13 +547,12 @@ void x11_update_window_title(void *data)
|
||||
|
||||
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;
|
||||
video_driver_display_type_set(RARCH_DISPLAY_X11);
|
||||
video_driver_display_set((uintptr_t)g_x11_dpy);
|
||||
video_driver_window_set((uintptr_t)g_x11_win);
|
||||
g_x11_true_full = true_full;
|
||||
return true;
|
||||
}
|
||||
|
@ -210,8 +210,6 @@ static void sdl2_gfx_set_handles(sdl2_video_t *vid)
|
||||
{
|
||||
/* SysWMinfo headers are broken on OSX. */
|
||||
#if defined(_WIN32) || defined(HAVE_X11)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION(&info.version);
|
||||
|
||||
@ -219,13 +217,13 @@ static void sdl2_gfx_set_handles(sdl2_video_t *vid)
|
||||
return;
|
||||
|
||||
#if defined(_WIN32)
|
||||
driver->display_type = RARCH_DISPLAY_WIN32;
|
||||
driver->video_display = 0;
|
||||
driver->video_window = (uintptr_t)info.info.win.window;
|
||||
video_driver_display_type_set(RARCH_DISPLAY_WIN32);
|
||||
video_driver_display_set(0);
|
||||
video_driver_window_set((uintptr_t)info.info.win.window);
|
||||
#elif defined(HAVE_X11)
|
||||
driver->display_type = RARCH_DISPLAY_X11;
|
||||
driver->video_display = (uintptr_t)info.info.x11.display;
|
||||
driver->video_window = (uintptr_t)info.info.x11.window;
|
||||
video_driver_display_type_set(RARCH_DISPLAY_X11);
|
||||
video_driver_display_set((uintptr_t)info.info.x11.display);
|
||||
video_driver_window_set((uintptr_t)info.info.x11.window);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@ -560,15 +558,13 @@ static bool sdl2_gfx_focus(void *data)
|
||||
|
||||
static bool sdl2_gfx_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
(void)data;
|
||||
(void)enable;
|
||||
|
||||
if (driver->display_type == RARCH_DISPLAY_X11)
|
||||
if (video_driver_display_type_get() == RARCH_DISPLAY_X11)
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
x11_suspend_screensaver(driver->video_window);
|
||||
x11_suspend_screensaver(video_driver_window_get());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -221,7 +221,6 @@ static void sdl_gfx_set_handles(void)
|
||||
{
|
||||
/* SysWMinfo headers are broken on OSX. */
|
||||
#if defined(_WIN32) || defined(HAVE_X11)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION(&info.version);
|
||||
|
||||
@ -229,13 +228,13 @@ static void sdl_gfx_set_handles(void)
|
||||
return;
|
||||
|
||||
#if defined(_WIN32)
|
||||
driver->display_type = RARCH_DISPLAY_WIN32;
|
||||
driver->video_display = 0;
|
||||
driver->video_window = (uintptr_t)info.window;
|
||||
video_driver_display_type_set(RARCH_DISPLAY_WIN32);
|
||||
video_driver_display_set(0);
|
||||
video_driver_window_set((uintptr_t)info.window);
|
||||
#elif defined(HAVE_X11)
|
||||
driver->display_type = RARCH_DISPLAY_X11;
|
||||
driver->video_display = (uintptr_t)info.info.x11.display;
|
||||
driver->video_window = (uintptr_t)info.info.x11.window;
|
||||
video_driver_display_type_set(RARCH_DISPLAY_X11);
|
||||
video_driver_display_set((uintptr_t)info.info.x11.display);
|
||||
video_driver_window_set((uintptr_t)info.info.x11.window);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@ -404,19 +403,16 @@ static bool sdl_gfx_focus(void *data)
|
||||
|
||||
static bool sdl_gfx_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
(void)enable;
|
||||
#ifdef HAVE_X11
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (driver->display_type == RARCH_DISPLAY_X11)
|
||||
if (video_driver_display_type_get() == RARCH_DISPLAY_X11)
|
||||
{
|
||||
x11_suspend_screensaver(driver->video_window);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
(void)data;
|
||||
(void)enable;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -775,12 +775,10 @@ static bool xv_frame(void *data, const void *frame, unsigned width,
|
||||
|
||||
static bool xv_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (driver->display_type != RARCH_DISPLAY_X11)
|
||||
if (video_driver_display_type_get() != RARCH_DISPLAY_X11)
|
||||
return false;
|
||||
|
||||
x11_suspend_screensaver(driver->video_window);
|
||||
x11_suspend_screensaver(video_driver_window_get());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -522,11 +522,10 @@ static void gfx_ctx_glx_input_driver(void *data,
|
||||
|
||||
static bool gfx_ctx_glx_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (driver->display_type != RARCH_DISPLAY_X11)
|
||||
if (video_driver_display_type_get() != RARCH_DISPLAY_X11)
|
||||
return false;
|
||||
|
||||
x11_suspend_screensaver(driver->video_window);
|
||||
x11_suspend_screensaver(video_driver_window_get());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -423,15 +423,13 @@ static bool gfx_ctx_xegl_has_focus(void *data)
|
||||
|
||||
static bool gfx_ctx_xegl_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
(void)data;
|
||||
(void)enable;
|
||||
|
||||
if (driver->display_type != RARCH_DISPLAY_X11)
|
||||
if (video_driver_display_type_get() != RARCH_DISPLAY_X11)
|
||||
return false;
|
||||
|
||||
x11_suspend_screensaver(driver->video_window);
|
||||
x11_suspend_screensaver(video_driver_window_get());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -69,6 +69,14 @@ typedef struct video_driver_state
|
||||
} filter;
|
||||
} video_driver_state_t;
|
||||
|
||||
/* Opaque handles to currently running window.
|
||||
* Used by e.g. input drivers which bind to a window.
|
||||
* Drivers are responsible for setting these if an input driver
|
||||
* could potentially make use of this. */
|
||||
static uintptr_t video_display;
|
||||
static uintptr_t video_window;
|
||||
static enum rarch_display_type display_type;
|
||||
|
||||
/* Graphics driver requires RGBA byte order data (ABGR on little-endian)
|
||||
* for 32-bit.
|
||||
* This takes effect for overlay and shader cores that wants to load
|
||||
@ -671,9 +679,9 @@ static bool init_video(void)
|
||||
else
|
||||
RARCH_LOG("Video @ fullscreen\n");
|
||||
|
||||
driver->display_type = RARCH_DISPLAY_NONE;
|
||||
driver->video_display = 0;
|
||||
driver->video_window = 0;
|
||||
video_driver_display_type_set(RARCH_DISPLAY_NONE);
|
||||
video_driver_display_set(0);
|
||||
video_driver_window_set(0);
|
||||
|
||||
if (!init_video_pixel_converter(RARCH_SCALE_BASE * scale))
|
||||
{
|
||||
@ -1816,3 +1824,33 @@ void video_frame(const void *data, unsigned width,
|
||||
|
||||
*frame_count = *frame_count + 1;
|
||||
}
|
||||
|
||||
void video_driver_display_type_set(enum rarch_display_type type)
|
||||
{
|
||||
display_type = type;
|
||||
}
|
||||
|
||||
uintptr_t video_driver_display_get(void)
|
||||
{
|
||||
return video_display;
|
||||
}
|
||||
|
||||
void video_driver_display_set(uintptr_t idx)
|
||||
{
|
||||
video_display = idx;
|
||||
}
|
||||
|
||||
enum rarch_display_type video_driver_display_type_get(void)
|
||||
{
|
||||
return display_type;
|
||||
}
|
||||
|
||||
void video_driver_window_set(uintptr_t idx)
|
||||
{
|
||||
video_window = idx;
|
||||
}
|
||||
|
||||
uintptr_t video_driver_window_get(void)
|
||||
{
|
||||
return video_window;
|
||||
}
|
||||
|
@ -270,7 +270,6 @@ struct aspect_ratio_elem
|
||||
|
||||
extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
|
||||
|
||||
|
||||
enum rarch_display_type
|
||||
{
|
||||
/* Non-bindable types like consoles, KMS, VideoCore, etc. */
|
||||
@ -531,6 +530,19 @@ const video_poke_interface_t *video_driver_get_poke(void);
|
||||
void video_frame(const void *data, unsigned width,
|
||||
unsigned height, size_t pitch);
|
||||
|
||||
uintptr_t video_driver_display_get(void);
|
||||
|
||||
enum rarch_display_type video_driver_display_type_get(void);
|
||||
|
||||
uintptr_t video_driver_window_get(void);
|
||||
|
||||
void video_driver_display_type_set(enum rarch_display_type type);
|
||||
|
||||
void video_driver_display_set(uintptr_t idx);
|
||||
|
||||
void video_driver_window_set(uintptr_t idx);
|
||||
|
||||
|
||||
extern video_driver_t video_gl;
|
||||
extern video_driver_t video_psp1;
|
||||
extern video_driver_t video_vita2d;
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "../input_joypad_driver.h"
|
||||
#include "../input_keymaps.h"
|
||||
|
||||
#include "../../gfx/video_driver.h"
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include "../../verbosity.h"
|
||||
@ -49,11 +51,10 @@ typedef struct x11_input
|
||||
|
||||
static void *x_input_init(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
x11_input_t *x11;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (driver->display_type != RARCH_DISPLAY_X11)
|
||||
if (video_driver_display_type_get() != RARCH_DISPLAY_X11)
|
||||
{
|
||||
RARCH_ERR("Currently active window is not an X11 window. Cannot use this driver.\n");
|
||||
return NULL;
|
||||
@ -64,8 +65,8 @@ static void *x_input_init(void)
|
||||
return NULL;
|
||||
|
||||
/* Borrow the active X window ... */
|
||||
x11->display = (Display*)driver->video_display;
|
||||
x11->win = (Window)driver->video_window;
|
||||
x11->display = (Display*)video_driver_display_get();
|
||||
x11->win = (Window)video_driver_window_get();
|
||||
|
||||
x11->joypad = input_joypad_init_driver(settings->input.joypad_driver, x11);
|
||||
input_keymaps_init_keyboard_lut(rarch_key_map_x11);
|
||||
|
Loading…
Reference in New Issue
Block a user