This should hide the CRT SwitchRes option on systems

where it's not supported
This commit is contained in:
twinaphex 2019-05-05 16:32:28 +02:00
parent 5d018db08d
commit 0b426b2022
9 changed files with 68 additions and 8 deletions

View File

@ -56,6 +56,13 @@ static void android_display_server_set_screen_orientation(enum rotation rotation
g_android->setScreenOrientation, rotation);
}
static uint32_t android_display_server_get_flags(void *data)
{
uint32_t flags = 0;
return flags;
}
const video_display_server_t dispserv_android = {
android_display_server_init,
android_display_server_destroy,
@ -67,5 +74,6 @@ const video_display_server_t dispserv_android = {
NULL, /* get_output_options */
android_display_server_set_screen_orientation,
NULL, /* get_screen_orientation */
android_display_server_get_flags,
"android"
};

View File

@ -54,5 +54,6 @@ const video_display_server_t dispserv_null = {
NULL, /* get_output_options */
NULL, /* set_screen_orientation */
NULL, /* get_screen_orientation */
NULL, /* get_flags */
"null"
};

View File

@ -449,6 +449,15 @@ void win32_display_server_set_screen_orientation(enum rotation rotation)
}
#endif
static uint32_t win32_display_server_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, DISPSERV_CTX_CRT_SWITCHRES);
return flags;
}
const video_display_server_t dispserv_win32 = {
win32_display_server_init,
win32_display_server_destroy,
@ -465,5 +474,6 @@ const video_display_server_t dispserv_win32 = {
NULL,
NULL,
#endif
win32_display_server_get_flags,
"win32"
};

View File

@ -552,6 +552,17 @@ static enum rotation x11_display_server_get_screen_orientation(void)
}
#endif
static uint32_t x11_display_server_get_flags(void *data)
{
uint32_t flags = 0;
#ifdef HAVE_XRANDR
BIT32_SET(flags, DISPSERV_CTX_CRT_SWITCHRES);
#endif
return flags;
}
const video_display_server_t dispserv_x11 = {
x11_display_server_init,
x11_display_server_destroy,
@ -572,5 +583,6 @@ const video_display_server_t dispserv_x11 = {
NULL, /* set_screen_orientation */
NULL, /* get_screen_orientation */
#endif
x11_display_server_get_flags,
"x11"
};

View File

@ -147,6 +147,11 @@ typedef struct video_viewport
unsigned full_height;
} video_viewport_t;
typedef struct gfx_ctx_flags
{
uint32_t flags;
} gfx_ctx_flags_t;
RETRO_END_DECLS
#endif

View File

@ -145,3 +145,15 @@ enum rotation video_display_server_get_screen_orientation(void)
return current_display_server->get_screen_orientation();
return ORIENTATION_NORMAL;
}
bool video_display_server_get_flags(gfx_ctx_flags_t *flags)
{
if (!current_display_server && current_display_server->get_flags)
return false;
if (!flags)
return false;
flags->flags = current_display_server->get_flags(
current_display_server_data);
return true;
}

View File

@ -25,6 +25,12 @@
RETRO_BEGIN_DECLS
enum display_server_flags
{
DISPSERV_CTX_FLAGS_NONE = 0,
DISPSERV_CTX_CRT_SWITCHRES
};
typedef struct video_display_config
{
unsigned width;
@ -49,6 +55,7 @@ typedef struct video_display_server
const char *(*get_output_options)(void *data);
void (*set_screen_orientation)(enum rotation rotation);
enum rotation (*get_screen_orientation)(void);
uint32_t (*get_flags)(void *data);
const char *ident;
} video_display_server_t;
@ -56,6 +63,8 @@ void* video_display_server_init(void);
void video_display_server_destroy(void);
bool video_display_server_get_flags(gfx_ctx_flags_t *flags);
bool video_display_server_set_window_opacity(unsigned opacity);
bool video_display_server_set_window_progress(int progress, bool finished);

View File

@ -613,11 +613,6 @@ typedef struct gfx_ctx_driver
void (*make_current)(bool release);
} gfx_ctx_driver_t;
typedef struct gfx_ctx_flags
{
uint32_t flags;
} gfx_ctx_flags_t;
typedef struct gfx_ctx_size
{
bool *quit;

View File

@ -5631,10 +5631,18 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
break;
case DISPLAYLIST_VIDEO_SETTINGS_LIST:
{
gfx_ctx_flags_t flags;
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
if (video_display_server_get_flags(&flags))
{
if (BIT32_GET(flags.flags, DISPSERV_CTX_CRT_SWITCHRES))
menu_displaylist_parse_settings_enum(info->list,
MENU_ENUM_LABEL_CRT_SWITCHRES_SETTINGS,
PARSE_ACTION, false);
}
menu_displaylist_parse_settings_enum(info->list,
MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE,
PARSE_ONLY_BOOL, false);