mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-04 07:15:29 -04:00
wayland: don’t instantiate a decoration object when user disabled decorations
An application opts *in* for being compositor-decorated by instantiating a decoration object. This means, even if we request e.g. CSDs, the compositor can choose to use SSDs. By *not* instantiating a decorator object, the compositor *must* not decorate the window for us. So, when the user has set csd.preferred=none, we absolute do not want the compositor to decorate us. Thus, we refrain from instantiating a decoration object.
This commit is contained in:
parent
17761dce63
commit
6afe64b7f4
1 changed files with 19 additions and 25 deletions
44
wayland.c
44
wayland.c
|
|
@ -635,29 +635,23 @@ xdg_toplevel_decoration_configure(void *data,
|
||||||
{
|
{
|
||||||
struct wl_window *win = data;
|
struct wl_window *win = data;
|
||||||
|
|
||||||
if (win->term->conf->csd.preferred == CONF_CSD_PREFER_NONE) {
|
assert(win->term->conf->csd.preferred != CONF_CSD_PREFER_NONE);
|
||||||
/* User explicitly disabled window decorations */
|
switch (mode) {
|
||||||
LOG_INFO("window decorations disabled");
|
case ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE:
|
||||||
|
LOG_INFO("using CSD decorations");
|
||||||
|
win->use_csd = CSD_YES;
|
||||||
|
csd_instantiate(win);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE:
|
||||||
|
LOG_INFO("using SSD decorations");
|
||||||
win->use_csd = CSD_NO;
|
win->use_csd = CSD_NO;
|
||||||
csd_destroy(win);
|
csd_destroy(win);
|
||||||
} else {
|
break;
|
||||||
switch (mode) {
|
|
||||||
case ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE:
|
|
||||||
LOG_INFO("using CSD decorations");
|
|
||||||
win->use_csd = CSD_YES;
|
|
||||||
csd_instantiate(win);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE:
|
default:
|
||||||
LOG_INFO("using SSD decorations");
|
LOG_ERR("unimplemented: unknown XDG toplevel decoration mode: %u", mode);
|
||||||
win->use_csd = CSD_NO;
|
break;
|
||||||
csd_destroy(win);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
LOG_ERR("unimplemented: unknown XDG toplevel decoration mode: %u", mode);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (win->is_configured && win->use_csd == CSD_YES) {
|
if (win->is_configured && win->use_csd == CSD_YES) {
|
||||||
|
|
@ -1191,7 +1185,11 @@ wayl_win_init(struct terminal *term)
|
||||||
|
|
||||||
xdg_toplevel_set_app_id(win->xdg_toplevel, conf->app_id);
|
xdg_toplevel_set_app_id(win->xdg_toplevel, conf->app_id);
|
||||||
|
|
||||||
if (wayl->xdg_decoration_manager != NULL) {
|
if (conf->csd.preferred == CONF_CSD_PREFER_NONE) {
|
||||||
|
/* User specifically do *not* want decorations */
|
||||||
|
win->use_csd = CSD_NO;
|
||||||
|
LOG_INFO("window decorations disabled by user");
|
||||||
|
} else if (wayl->xdg_decoration_manager != NULL) {
|
||||||
win->xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(
|
win->xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(
|
||||||
wayl->xdg_decoration_manager, win->xdg_toplevel);
|
wayl->xdg_decoration_manager, win->xdg_toplevel);
|
||||||
|
|
||||||
|
|
@ -1206,10 +1204,6 @@ wayl_win_init(struct terminal *term)
|
||||||
|
|
||||||
zxdg_toplevel_decoration_v1_add_listener(
|
zxdg_toplevel_decoration_v1_add_listener(
|
||||||
win->xdg_toplevel_decoration, &xdg_toplevel_decoration_listener, win);
|
win->xdg_toplevel_decoration, &xdg_toplevel_decoration_listener, win);
|
||||||
} else if (conf->csd.preferred == CONF_CSD_PREFER_NONE) {
|
|
||||||
/* No decoration manager - and user specifically do *not* want CSDs */
|
|
||||||
win->use_csd = CSD_NO;
|
|
||||||
LOG_INFO("no decoration manager available - user has disabled CSDs");
|
|
||||||
} else {
|
} else {
|
||||||
/* No decoration manager - thus we *must* draw our own decorations */
|
/* No decoration manager - thus we *must* draw our own decorations */
|
||||||
win->use_csd = CSD_YES;
|
win->use_csd = CSD_YES;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue