This commit is contained in:
twinaphex 2020-09-20 17:50:06 +02:00
parent 240a2fee63
commit 8eeb612493
5 changed files with 22 additions and 26 deletions

View File

@ -25,7 +25,8 @@ static bool android_display_server_set_window_opacity(void *data, unsigned opaci
static bool android_display_server_set_window_progress(void *data, int progress, bool finished) { return true; }
static uint32_t android_display_server_get_flags(void *data) { return 0; }
static void android_display_server_set_screen_orientation(enum rotation rotation)
static void android_display_server_set_screen_orientation(void *data,
enum rotation rotation)
{
JNIEnv *env = jni_thread_getenv();

View File

@ -383,7 +383,7 @@ static void *win32_display_server_get_resolution_list(
}
#if _WIN32_WINNT >= 0x0500
enum rotation win32_display_server_get_screen_orientation(void)
enum rotation win32_display_server_get_screen_orientation(void *data)
{
DEVMODE dm = {0};
enum rotation rotation;
@ -410,7 +410,8 @@ enum rotation win32_display_server_get_screen_orientation(void)
return rotation;
}
void win32_display_server_set_screen_orientation(enum rotation rotation)
void win32_display_server_set_screen_orientation(void *data,
enum rotation rotation)
{
DEVMODE dm = {0};

View File

@ -65,16 +65,12 @@ typedef struct
#ifdef HAVE_XRANDR
static Display* x11_display_server_open_display(void)
{
Display *dpy = g_x11_dpy;
Display *dpy = g_x11_dpy;
x11_display_server_using_global_dpy = (dpy != NULL);
if (dpy)
x11_display_server_using_global_dpy = true;
else
{
/* SDL might use X11 but doesn't use g_x11_dpy, so open it manually */
dpy = XOpenDisplay(0);
x11_display_server_using_global_dpy = false;
}
/* SDL might use X11 but doesn't use g_x11_dpy, so open it manually */
if (!dpy)
dpy = XOpenDisplay(0);
return dpy;
}
@ -88,7 +84,8 @@ static void x11_display_server_close_display(Display *dpy)
}
static bool x11_display_server_set_resolution(void *data,
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index, int xoffset, int padjust)
unsigned width, unsigned height, int int_hz, float hz,
int center, int monitor_index, int xoffset, int padjust)
{
int m;
int screen;
@ -312,7 +309,8 @@ static bool x11_display_server_set_resolution(void *data,
return true;
}
static void x11_display_server_set_screen_orientation(enum rotation rotation)
static void x11_display_server_set_screen_orientation(void *data,
enum rotation rotation)
{
int i, j;
XRRScreenResources *screen = NULL;
@ -403,7 +401,7 @@ static void x11_display_server_set_screen_orientation(enum rotation rotation)
XCloseDisplay(dpy);
}
static enum rotation x11_display_server_get_screen_orientation(void)
static enum rotation x11_display_server_get_screen_orientation(void *data)
{
int i, j;
XRRScreenConfiguration *config = NULL;

View File

@ -53,8 +53,8 @@ typedef struct video_display_server
void *(*get_resolution_list)(void *data,
unsigned *size);
const char *(*get_output_options)(void *data);
void (*set_screen_orientation)(enum rotation rotation);
enum rotation (*get_screen_orientation)(void);
void (*set_screen_orientation)(void *data, enum rotation rotation);
enum rotation (*get_screen_orientation)(void *data);
uint32_t (*get_flags)(void *data);
const char *ident;
} video_display_server_t;

View File

@ -31518,32 +31518,28 @@ void video_display_server_set_screen_orientation(enum rotation rotation)
RARCH_LOG("[Video]: Setting screen orientation to %d.\n", rotation);
p_rarch->current_screen_orientation = rotation;
current_display_server->set_screen_orientation(rotation);
current_display_server->set_screen_orientation(p_rarch->current_display_server_data, rotation);
}
}
bool video_display_server_can_set_screen_orientation(void)
{
if (current_display_server && current_display_server->set_screen_orientation)
return true;
return false;
return (current_display_server && current_display_server->set_screen_orientation);
}
enum rotation video_display_server_get_screen_orientation(void)
{
struct rarch_state *p_rarch = &rarch_st;
if (current_display_server && current_display_server->get_screen_orientation)
return current_display_server->get_screen_orientation();
return current_display_server->get_screen_orientation(p_rarch->current_display_server_data);
return ORIENTATION_NORMAL;
}
bool video_display_server_get_flags(gfx_ctx_flags_t *flags)
{
struct rarch_state *p_rarch = &rarch_st;
if (!current_display_server || !current_display_server->get_flags)
if (!flags || !current_display_server || !current_display_server->get_flags)
return false;
if (!flags)
return false;
flags->flags = current_display_server->get_flags(
p_rarch->current_display_server_data);
return true;