add menu setting to toggle window decorations
This commit is contained in:
parent
a8af4ee8c6
commit
43aa977a91
|
@ -125,6 +125,9 @@ static const unsigned fullscreen_y = 0;
|
||||||
*/
|
*/
|
||||||
static const unsigned window_opacity = 100;
|
static const unsigned window_opacity = 100;
|
||||||
|
|
||||||
|
/* Whether to show the usual window decorations like border, titlebar etc. */
|
||||||
|
static const bool window_decorations = true;
|
||||||
|
|
||||||
#if defined(RARCH_CONSOLE) || defined(__APPLE__)
|
#if defined(RARCH_CONSOLE) || defined(__APPLE__)
|
||||||
static const bool load_dummy_on_core_shutdown = false;
|
static const bool load_dummy_on_core_shutdown = false;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1379,6 +1379,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||||
SETTING_BOOL("screenshots_in_content_dir", &settings->bools.screenshots_in_content_dir, true, default_screenshots_in_content_dir, false);
|
SETTING_BOOL("screenshots_in_content_dir", &settings->bools.screenshots_in_content_dir, true, default_screenshots_in_content_dir, false);
|
||||||
|
|
||||||
SETTING_BOOL("video_msg_bgcolor_enable", &settings->bools.video_msg_bgcolor_enable, true, message_bgcolor_enable, false);
|
SETTING_BOOL("video_msg_bgcolor_enable", &settings->bools.video_msg_bgcolor_enable, true, message_bgcolor_enable, false);
|
||||||
|
SETTING_BOOL("video_window_show_decorations", &settings->bools.video_window_show_decorations, true, window_decorations, false);
|
||||||
|
|
||||||
*size = count;
|
*size = count;
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,7 @@ typedef struct settings
|
||||||
bool bluetooth_enable;
|
bool bluetooth_enable;
|
||||||
|
|
||||||
bool automatically_add_content_to_playlist;
|
bool automatically_add_content_to_playlist;
|
||||||
|
bool video_window_show_decorations;
|
||||||
} bools;
|
} bools;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
|
|
@ -817,8 +817,11 @@ bool win32_window_create(void *data, unsigned style,
|
||||||
video_driver_window_set((uintptr_t)main_window.hwnd);
|
video_driver_window_set((uintptr_t)main_window.hwnd);
|
||||||
|
|
||||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500 /* 2K */
|
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500 /* 2K */
|
||||||
|
if (!settings->bools.video_window_show_decorations)
|
||||||
|
SetWindowLongPtr(main_window.hwnd, GWL_STYLE, WS_POPUP);
|
||||||
|
|
||||||
/* Windows 2000 and above use layered windows to enable transparency */
|
/* Windows 2000 and above use layered windows to enable transparency */
|
||||||
if(settings->uints.video_window_opacity < 100)
|
if (settings->uints.video_window_opacity < 100)
|
||||||
{
|
{
|
||||||
SetWindowLongPtr(main_window.hwnd,
|
SetWindowLongPtr(main_window.hwnd,
|
||||||
GWL_EXSTYLE,
|
GWL_EXSTYLE,
|
||||||
|
|
|
@ -48,6 +48,7 @@ const video_display_server_t dispserv_null = {
|
||||||
null_display_server_destroy,
|
null_display_server_destroy,
|
||||||
null_set_window_opacity,
|
null_set_window_opacity,
|
||||||
null_set_window_progress,
|
null_set_window_progress,
|
||||||
|
NULL,
|
||||||
"null"
|
"null"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
unsigned opacity;
|
unsigned opacity;
|
||||||
int progress;
|
int progress;
|
||||||
|
bool decorations;
|
||||||
} dispserv_win32_t;
|
} dispserv_win32_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -180,11 +181,23 @@ static bool win32_set_window_progress(void *data, int progress, bool finished)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool win32_set_window_decorations(void *data, bool on)
|
||||||
|
{
|
||||||
|
dispserv_win32_t *serv = (dispserv_win32_t*)data;
|
||||||
|
|
||||||
|
serv->decorations = on;
|
||||||
|
|
||||||
|
/* menu_setting performs a reinit instead to properly apply decoration changes */
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const video_display_server_t dispserv_win32 = {
|
const video_display_server_t dispserv_win32 = {
|
||||||
win32_display_server_init,
|
win32_display_server_init,
|
||||||
win32_display_server_destroy,
|
win32_display_server_destroy,
|
||||||
win32_set_window_opacity,
|
win32_set_window_opacity,
|
||||||
win32_set_window_progress,
|
win32_set_window_progress,
|
||||||
|
win32_set_window_decorations,
|
||||||
"win32"
|
"win32"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned opacity;
|
unsigned opacity;
|
||||||
|
bool decorations;
|
||||||
} dispserv_x11_t;
|
} dispserv_x11_t;
|
||||||
|
|
||||||
static void* x11_display_server_init(void)
|
static void* x11_display_server_init(void)
|
||||||
|
@ -47,7 +48,6 @@ static bool x11_set_window_opacity(void *data, unsigned opacity)
|
||||||
dispserv_x11_t *serv = (dispserv_x11_t*)data;
|
dispserv_x11_t *serv = (dispserv_x11_t*)data;
|
||||||
Atom net_wm_opacity = XInternAtom(g_x11_dpy, "_NET_WM_WINDOW_OPACITY", False);
|
Atom net_wm_opacity = XInternAtom(g_x11_dpy, "_NET_WM_WINDOW_OPACITY", False);
|
||||||
Atom cardinal = XInternAtom(g_x11_dpy, "CARDINAL", False);
|
Atom cardinal = XInternAtom(g_x11_dpy, "CARDINAL", False);
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
|
|
||||||
serv->opacity = opacity;
|
serv->opacity = opacity;
|
||||||
|
|
||||||
|
@ -61,11 +61,23 @@ static bool x11_set_window_opacity(void *data, unsigned opacity)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool x11_set_window_decorations(void *data, bool on)
|
||||||
|
{
|
||||||
|
dispserv_x11_t *serv = (dispserv_x11_t*)data;
|
||||||
|
|
||||||
|
serv->decorations = on;
|
||||||
|
|
||||||
|
/* menu_setting performs a reinit instead to properly apply decoration changes */
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const video_display_server_t dispserv_x11 = {
|
const video_display_server_t dispserv_x11 = {
|
||||||
x11_display_server_init,
|
x11_display_server_init,
|
||||||
x11_display_server_destroy,
|
x11_display_server_destroy,
|
||||||
x11_set_window_opacity,
|
x11_set_window_opacity,
|
||||||
NULL,
|
NULL,
|
||||||
|
x11_set_window_decorations,
|
||||||
"x11"
|
"x11"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,16 @@ static enum gfx_ctx_api x_api = GFX_CTX_NONE;
|
||||||
|
|
||||||
static gfx_ctx_x_data_t *current_context_data = NULL;
|
static gfx_ctx_x_data_t *current_context_data = NULL;
|
||||||
|
|
||||||
|
typedef struct Hints
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
unsigned long functions;
|
||||||
|
unsigned long decorations;
|
||||||
|
long inputMode;
|
||||||
|
unsigned long status;
|
||||||
|
} Hints;
|
||||||
|
|
||||||
|
/* We use long because X11 wants 32-bit pixels for 32-bit systems and 64 for 64... */
|
||||||
const unsigned long retroarch_icon_data[] = {
|
const unsigned long retroarch_icon_data[] = {
|
||||||
16, 16,
|
16, 16,
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||||
|
@ -623,7 +633,6 @@ static bool gfx_ctx_x_set_video_mode(void *data,
|
||||||
int (*old_handler)(Display*, XErrorEvent*) = NULL;
|
int (*old_handler)(Display*, XErrorEvent*) = NULL;
|
||||||
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;
|
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;
|
||||||
Atom net_wm_icon = XInternAtom(g_x11_dpy, "_NET_WM_ICON", False);
|
Atom net_wm_icon = XInternAtom(g_x11_dpy, "_NET_WM_ICON", False);
|
||||||
Atom net_wm_opacity = XInternAtom(g_x11_dpy, "_NET_WM_WINDOW_OPACITY", False);
|
|
||||||
Atom cardinal = XInternAtom(g_x11_dpy, "CARDINAL", False);
|
Atom cardinal = XInternAtom(g_x11_dpy, "CARDINAL", False);
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
unsigned opacity = settings->uints.video_window_opacity * ((unsigned)-1 / 100.0);
|
unsigned opacity = settings->uints.video_window_opacity * ((unsigned)-1 / 100.0);
|
||||||
|
@ -717,7 +726,23 @@ static bool gfx_ctx_x_set_video_mode(void *data,
|
||||||
XChangeProperty(g_x11_dpy, g_x11_win, net_wm_icon, cardinal, 32, PropModeReplace, (const unsigned char*)retroarch_icon_data, sizeof(retroarch_icon_data) / sizeof(*retroarch_icon_data));
|
XChangeProperty(g_x11_dpy, g_x11_win, net_wm_icon, cardinal, 32, PropModeReplace, (const unsigned char*)retroarch_icon_data, sizeof(retroarch_icon_data) / sizeof(*retroarch_icon_data));
|
||||||
|
|
||||||
if (opacity < (unsigned)-1)
|
if (opacity < (unsigned)-1)
|
||||||
|
{
|
||||||
|
Atom net_wm_opacity = XInternAtom(g_x11_dpy, "_NET_WM_WINDOW_OPACITY", False);
|
||||||
XChangeProperty(g_x11_dpy, g_x11_win, net_wm_opacity, cardinal, 32, PropModeReplace, (const unsigned char*)&opacity, 1);
|
XChangeProperty(g_x11_dpy, g_x11_win, net_wm_opacity, cardinal, 32, PropModeReplace, (const unsigned char*)&opacity, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!settings->bools.video_window_show_decorations)
|
||||||
|
{
|
||||||
|
/* We could have just set _NET_WM_WINDOW_TYPE_DOCK instead, but that removes the window from any taskbar/panel,
|
||||||
|
* so we are forced to use the old motif hints method. */
|
||||||
|
Hints hints;
|
||||||
|
Atom property = XInternAtom(g_x11_dpy, "_MOTIF_WM_HINTS", False);
|
||||||
|
|
||||||
|
hints.flags = 2;
|
||||||
|
hints.decorations = 0;
|
||||||
|
|
||||||
|
XChangeProperty(g_x11_dpy, g_x11_win, property, property, 32, PropModeReplace, (const unsigned char*)&hints, 5);
|
||||||
|
}
|
||||||
|
|
||||||
switch (x_api)
|
switch (x_api)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,3 +74,10 @@ bool video_display_server_set_window_progress(int progress, bool finished)
|
||||||
return current_display_server->set_window_progress(current_display_server_data, progress, finished);
|
return current_display_server->set_window_progress(current_display_server_data, progress, finished);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool video_display_server_set_window_decorations(bool on)
|
||||||
|
{
|
||||||
|
if (current_display_server && current_display_server->set_window_decorations)
|
||||||
|
return current_display_server->set_window_decorations(current_display_server_data, on);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ typedef struct video_display_server
|
||||||
void (*destroy)(void *data);
|
void (*destroy)(void *data);
|
||||||
bool (*set_window_opacity)(void *data, unsigned opacity);
|
bool (*set_window_opacity)(void *data, unsigned opacity);
|
||||||
bool (*set_window_progress)(void *data, int progress, bool finished);
|
bool (*set_window_progress)(void *data, int progress, bool finished);
|
||||||
|
bool (*set_window_decorations)(void *data, bool on);
|
||||||
const char *ident;
|
const char *ident;
|
||||||
} video_display_server_t;
|
} video_display_server_t;
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ void* video_display_server_init(void);
|
||||||
void video_display_server_destroy(void);
|
void video_display_server_destroy(void);
|
||||||
bool video_display_server_set_window_opacity(unsigned opacity);
|
bool video_display_server_set_window_opacity(unsigned opacity);
|
||||||
bool video_display_server_set_window_progress(int progress, bool finished);
|
bool video_display_server_set_window_progress(int progress, bool finished);
|
||||||
|
bool video_display_server_set_window_decorations(bool on);
|
||||||
|
|
||||||
extern const video_display_server_t dispserv_win32;
|
extern const video_display_server_t dispserv_win32;
|
||||||
extern const video_display_server_t dispserv_x11;
|
extern const video_display_server_t dispserv_x11;
|
||||||
|
|
|
@ -3311,3 +3311,5 @@ MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY,
|
||||||
"Lower this value to favor performance/lower latency over audio quality, increase if you want better audio quality at the expense of performance/lower latency.")
|
"Lower this value to favor performance/lower latency over audio quality, increase if you want better audio quality at the expense of performance/lower latency.")
|
||||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES,
|
MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES,
|
||||||
"シェーダーファイルの変更を監視")
|
"シェーダーファイルの変更を監視")
|
||||||
|
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS,
|
||||||
|
"ウィンドウ枠を表示")
|
||||||
|
|
|
@ -1437,3 +1437,5 @@ MSG_HASH(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV,
|
||||||
"udev")
|
"udev")
|
||||||
MSG_HASH(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW,
|
MSG_HASH(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW,
|
||||||
"linuxraw")
|
"linuxraw")
|
||||||
|
MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS,
|
||||||
|
"video_window_show_decorations")
|
||||||
|
|
|
@ -3415,3 +3415,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES,
|
||||||
"Watch shader files for changes")
|
"Watch shader files for changes")
|
||||||
MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES,
|
MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES,
|
||||||
"Auto-apply changes made to shader files on disk.")
|
"Auto-apply changes made to shader files on disk.")
|
||||||
|
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS,
|
||||||
|
"Show Window Decorations")
|
||||||
|
|
|
@ -5829,6 +5829,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||||
menu_displaylist_parse_settings_enum(menu, info,
|
menu_displaylist_parse_settings_enum(menu, info,
|
||||||
MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY,
|
MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY,
|
||||||
PARSE_ONLY_UINT, false);
|
PARSE_ONLY_UINT, false);
|
||||||
|
menu_displaylist_parse_settings_enum(menu, info,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS,
|
||||||
|
PARSE_ONLY_BOOL, false);
|
||||||
menu_displaylist_parse_settings_enum(menu, info,
|
menu_displaylist_parse_settings_enum(menu, info,
|
||||||
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER,
|
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER,
|
||||||
PARSE_ONLY_BOOL, false);
|
PARSE_ONLY_BOOL, false);
|
||||||
|
|
|
@ -1854,6 +1854,9 @@ void general_write_handler(void *data)
|
||||||
case MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY:
|
case MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY:
|
||||||
video_display_server_set_window_opacity(settings->uints.video_window_opacity);
|
video_display_server_set_window_opacity(settings->uints.video_window_opacity);
|
||||||
break;
|
break;
|
||||||
|
case MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS:
|
||||||
|
video_display_server_set_window_decorations(settings->bools.video_window_show_decorations);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3663,6 +3666,22 @@ static bool setting_append_list(
|
||||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CONFIG_BOOL(
|
||||||
|
list, list_info,
|
||||||
|
&settings->bools.video_window_show_decorations,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS,
|
||||||
|
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS,
|
||||||
|
window_decorations,
|
||||||
|
MENU_ENUM_LABEL_VALUE_OFF,
|
||||||
|
MENU_ENUM_LABEL_VALUE_ON,
|
||||||
|
&group_info,
|
||||||
|
&subgroup_info,
|
||||||
|
parent_group,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler,
|
||||||
|
SD_FLAG_NONE);
|
||||||
|
menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_REINIT);
|
||||||
|
|
||||||
CONFIG_BOOL(
|
CONFIG_BOOL(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
&settings->bools.video_scale_integer,
|
&settings->bools.video_scale_integer,
|
||||||
|
|
|
@ -1734,6 +1734,7 @@ enum msg_hash_enums
|
||||||
|
|
||||||
MENU_LABEL(NETPLAY_USE_MITM_SERVER),
|
MENU_LABEL(NETPLAY_USE_MITM_SERVER),
|
||||||
MENU_LABEL(NETPLAY_MITM_SERVER),
|
MENU_LABEL(NETPLAY_MITM_SERVER),
|
||||||
|
MENU_LABEL(VIDEO_WINDOW_SHOW_DECORATIONS),
|
||||||
|
|
||||||
MSG_LAST
|
MSG_LAST
|
||||||
};
|
};
|
||||||
|
|
|
@ -152,6 +152,12 @@
|
||||||
# If fullscreen, prefer using a windowed fullscreen mode.
|
# If fullscreen, prefer using a windowed fullscreen mode.
|
||||||
# video_windowed_fullscreen = true
|
# video_windowed_fullscreen = true
|
||||||
|
|
||||||
|
# Percentage of opacity to use for the window (100 is completely opaque).
|
||||||
|
# video_window_opacity = 100
|
||||||
|
|
||||||
|
# Whether to enable the default window decorations like border, titlebar etc.
|
||||||
|
# video_window_show_decorations = true
|
||||||
|
|
||||||
# Which monitor to prefer. 0 (default) means no particular monitor is preferred, 1 and up (1 being first monitor),
|
# Which monitor to prefer. 0 (default) means no particular monitor is preferred, 1 and up (1 being first monitor),
|
||||||
# suggests RetroArch to use that particular monitor.
|
# suggests RetroArch to use that particular monitor.
|
||||||
# video_monitor_index = 0
|
# video_monitor_index = 0
|
||||||
|
|
Loading…
Reference in New Issue