aboutsummaryrefslogtreecommitdiff
path: root/wayland.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-03-02 17:42:49 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-03-02 17:42:49 +0000
commit22ce09eb44db887d32a5b3a88740939b7285c763 (patch)
tree5f661d5d890b09ae335b4e7b8548cd76b7f2d862 /wayland.c
parentinput: raise window 'move' timeout to 200ms (diff)
config: make CSD user configurable
The user can now configure the following: * Whether to prefer CSDs or SSDs. But note that this is only a hint to the compositor - it may deny our request. Furthermore, not all compositors implement the decoration manager protocol, meaning CSDs will be used regardless of the user configuration (GNOME/mutter being the most prominent one). * Title bar size and color, including transparency * Border size and color, including transparency Also drop support for rendering the CSDs inside the main surface.
Diffstat (limited to 'wayland.c')
-rw-r--r--wayland.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/wayland.c b/wayland.c
index 957f736e..c5272994 100644
--- a/wayland.c
+++ b/wayland.c
@@ -536,18 +536,14 @@ xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
* sub-surfaces. Thus, since our resize code assumes the size
* to resize to is the main window only, adjust the size here,
* to account for the CSDs.
- *
- * Of course this does *not* apply when we position the CSDs
- * *inside* the main surface.
*/
-#if FOOT_CSD_OUTSIDE
+ const struct config *conf = win->term->conf;
if (!is_maximized) {
- width -= 2 * csd_border_size;
- height -= 2 * csd_border_size + csd_title_size;
+ width -= 2 * conf->csd.border_width;
+ height -= 2 * conf->csd.border_width + conf->csd.title_height;
} else {
- height -= csd_title_size;
+ height -= conf->csd.title_height;
}
-#endif
}
win->configure.is_activated = is_activated;
@@ -670,18 +666,18 @@ xdg_toplevel_decoration_configure(void *data,
if (win->is_configured && win->use_csd == CSD_YES) {
struct terminal *term = win->term;
- int scale = term->scale;
+ const struct config *conf = term->conf;
+ int scale = term->scale;
int width = term->width / scale;
int height = term->height / scale;
-#if FOOT_CSD_OUTSIDE
if (!term->window->is_maximized) {
- width -= 2 * csd_border_size;
- height -= 2 * csd_border_size + csd_title_size;
+ width -= 2 * conf->csd.border_width;
+ height -= 2 * conf->csd.border_width + conf->csd.title_height;
} else
- height -= csd_title_size;
-#endif
+ height -= conf->csd.title_height;
+
render_resize_force(term, width, height);
}
}
@@ -1013,6 +1009,7 @@ struct wl_window *
wayl_win_init(struct terminal *term)
{
struct wayland *wayl = term->wl;
+ const struct config *conf = wayl->conf;
struct wl_window *win = calloc(1, sizeof(*win));
win->term = term;
@@ -1050,8 +1047,16 @@ wayl_win_init(struct terminal *term)
if (wayl->xdg_decoration_manager != NULL) {
win->xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(
wayl->xdg_decoration_manager, win->xdg_toplevel);
+
+ LOG_INFO("preferring %s decorations",
+ conf->csd.preferred == CONF_CSD_PREFER_SERVER ? "SSD" : "CSD");
+
zxdg_toplevel_decoration_v1_set_mode(
- win->xdg_toplevel_decoration, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
+ win->xdg_toplevel_decoration,
+ (conf->csd.preferred == CONF_CSD_PREFER_SERVER
+ ? ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE
+ : ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE));
+
zxdg_toplevel_decoration_v1_add_listener(
win->xdg_toplevel_decoration, &xdg_toplevel_decoration_listener, win);
} else {