From 22ce09eb44db887d32a5b3a88740939b7285c763 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 2 Mar 2020 18:42:49 +0100 Subject: 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. --- input.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index 2fde9ca4..dbb8ec33 100644 --- a/input.c +++ b/input.c @@ -21,6 +21,7 @@ #define LOG_MODULE "input" #define LOG_ENABLE_DBG 0 #include "log.h" +#include "config.h" #include "commands.h" #include "keymap.h" #include "render.h" @@ -616,6 +617,7 @@ input_repeat(struct wayland *wayl, uint32_t key) static bool is_top_left(const struct terminal *term, int x, int y) { + int csd_border_size = term->conf->csd.border_width; return ( (term->active_surface == TERM_SURF_BORDER_LEFT && y < 10 * term->scale) || (term->active_surface == TERM_SURF_BORDER_TOP && x < (10 + csd_border_size) * term->scale)); @@ -624,6 +626,7 @@ is_top_left(const struct terminal *term, int x, int y) static bool is_top_right(const struct terminal *term, int x, int y) { + int csd_border_size = term->conf->csd.border_width; return ( (term->active_surface == TERM_SURF_BORDER_RIGHT && y < 10 * term->scale) || (term->active_surface == TERM_SURF_BORDER_TOP && x > term->width + 1 * csd_border_size * term->scale - 10 * term->scale)); @@ -632,6 +635,8 @@ is_top_right(const struct terminal *term, int x, int y) static bool is_bottom_left(const struct terminal *term, int x, int y) { + int csd_title_size = term->conf->csd.title_height; + int csd_border_size = term->conf->csd.border_width; return ( (term->active_surface == TERM_SURF_BORDER_LEFT && y > csd_title_size * term->scale + term->height) || (term->active_surface == TERM_SURF_BORDER_BOTTOM && x < (10 + csd_border_size) * term->scale)); @@ -640,6 +645,8 @@ is_bottom_left(const struct terminal *term, int x, int y) static bool is_bottom_right(const struct terminal *term, int x, int y) { + int csd_title_size = term->conf->csd.title_height; + int csd_border_size = term->conf->csd.border_width; return ( (term->active_surface == TERM_SURF_BORDER_RIGHT && y > csd_title_size * term->scale + term->height) || (term->active_surface == TERM_SURF_BORDER_BOTTOM && x > term->width + 1 * csd_border_size * term->scale - 10 * term->scale)); @@ -648,22 +655,14 @@ is_bottom_right(const struct terminal *term, int x, int y) static const char * xcursor_for_csd_border(struct terminal *term, int x, int y) { - if (is_top_left(term, x, y)) - return "top_left_corner"; - else if (is_top_right(term, x, y)) - return "top_right_corner"; - else if (is_bottom_left(term, x, y)) - return "bottom_left_corner"; - else if (is_bottom_right(term, x, y)) - return "bottom_right_corner"; - else if (term->active_surface == TERM_SURF_BORDER_LEFT) - return "left_side"; - else if (term->active_surface == TERM_SURF_BORDER_RIGHT) - return "right_side"; - else if (term->active_surface == TERM_SURF_BORDER_TOP) - return "top_side"; - else if (term->active_surface == TERM_SURF_BORDER_BOTTOM) - return"bottom_side"; + if (is_top_left(term, x, y)) return "top_left_corner"; + else if (is_top_right(term, x, y)) return "top_right_corner"; + else if (is_bottom_left(term, x, y)) return "bottom_left_corner"; + else if (is_bottom_right(term, x, y)) return "bottom_right_corner"; + else if (term->active_surface == TERM_SURF_BORDER_LEFT) return "left_side"; + else if (term->active_surface == TERM_SURF_BORDER_RIGHT) return "right_side"; + else if (term->active_surface == TERM_SURF_BORDER_TOP) return "top_side"; + else if (term->active_surface == TERM_SURF_BORDER_BOTTOM) return"bottom_side"; else { assert(false); return NULL; -- cgit v1.3