aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-10-20 19:00:19 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-11-06 19:08:07 +0000
commit90544ef391f0c546e831255036a939ac5314f6a9 (patch)
tree69a9918f58fc9d7274052b01da4713c431324002 /input.c
parentwayland: properly restore window size when being un-tiled (diff)
input: don’t allow diagonal resize when tiled
Diffstat (limited to 'input.c')
-rw-r--r--input.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/input.c b/input.c
index 7042f645..0ade6db0 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 *