aboutsummaryrefslogtreecommitdiff
path: root/wayland.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-10-10 09:04:17 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-10-10 11:07:29 +0000
commit6ff97128fc55573274fb21b6e56821db02cf162b (patch)
tree875c6b8c6d96b861ff14fee2c5cb3c23e3b308dd /wayland.c
parentMerge branch 'bind-shift+insert-to-primary-paste' into master (diff)
conf: csd.preferred can now be set to ‘none’
When csd.preferred == none, we will request CSDs from the compositor, but internally render as if we are using SSDs. That is, we don’t render any window decorations at all. Note that some compositors may ignore our request to use CSDs, and still render SSDs for us. Closes #163
Diffstat (limited to 'wayland.c')
-rw-r--r--wayland.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/wayland.c b/wayland.c
index dce240d3..2088ac87 100644
--- a/wayland.c
+++ b/wayland.c
@@ -635,22 +635,29 @@ xdg_toplevel_decoration_configure(void *data,
{
struct wl_window *win = data;
- 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:
- LOG_INFO("using SSD decorations");
+ if (win->term->conf->csd.preferred == CONF_CSD_PREFER_NONE) {
+ /* User explicitly disabled window decorations */
+ LOG_INFO("window decorations disabled");
win->use_csd = CSD_NO;
csd_destroy(win);
- break;
+ } else {
+ switch (mode) {
+ case ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE:
+ LOG_INFO("using CSD decorations");
+ win->use_csd = CSD_YES;
+ csd_instantiate(win);
+ break;
- default:
- LOG_ERR("unimplemented: unknown XDG toplevel decoration mode: %u", mode);
- break;
+ case ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE:
+ LOG_INFO("using SSD decorations");
+ win->use_csd = CSD_NO;
+ 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) {
@@ -1184,7 +1191,6 @@ wayl_win_init(struct terminal *term)
xdg_toplevel_set_app_id(win->xdg_toplevel, conf->app_id);
- /* Request server-side decorations */
if (wayl->xdg_decoration_manager != NULL) {
win->xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(
wayl->xdg_decoration_manager, win->xdg_toplevel);
@@ -1200,6 +1206,10 @@ wayl_win_init(struct terminal *term)
zxdg_toplevel_decoration_v1_add_listener(
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 {
/* No decoration manager - thus we *must* draw our own decorations */
win->use_csd = CSD_YES;