From 4c3d2cfc7d14daada6614d5b301afa61633fcc5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 20 Oct 2020 21:00:19 +0200 Subject: [PATCH] =?UTF-8?q?input:=20don=E2=80=99t=20allow=20diagonal=20res?= =?UTF-8?q?ize=20when=20tiled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + input.c | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36ef5ba8..bf83285c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ file. Note that foot will run, but without support for dead keys. (https://codeberg.org/dnkl/foot/issues/170). * Restored window size when window is un-tiled. +* XCursor shape in CSD corners when window is tiled. ### Security diff --git a/input.c b/input.c index a16ac7b5..99a2a7ad 100644 --- a/input.c +++ b/input.c @@ -1049,8 +1049,9 @@ 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)); + (!term->window->is_tiled_top && !term->window->is_tiled_left) && + ((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))); } static bool @@ -1058,8 +1059,9 @@ 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)); + (!term->window->is_tiled_top && !term->window->is_tiled_right) && + ((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))); } static bool @@ -1068,8 +1070,9 @@ 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)); + (!term->window->is_tiled_bottom && !term->window->is_tiled_left) && + ((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))); } static bool @@ -1078,8 +1081,9 @@ 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)); + (!term->window->is_tiled_bottom && !term->window->is_tiled_right) && + ((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))); } static const char *