aboutsummaryrefslogtreecommitdiff
path: root/selection.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-30 10:59:47 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-30 10:59:47 +0000
commitedb78575c7a7193e60d0f226143f75a29360290b (patch)
tree8ef855d644aad6f8344dcf8ee584d171de1d0cdd /selection.c
parentvt: don't try to move cursor outside the terminal (diff)
selection: forced selection requires keyboard focus
Up the requirements for enabling "forced" selection (that is, allowing selections even though mouse tracking has been disabled). * Require keyboard focus (if we don't have it, then the shift-key isn't is for us) * Don't just require shift being pressed, but that all other modifiers are *not* pressed.
Diffstat (limited to 'selection.c')
-rw-r--r--selection.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/selection.c b/selection.c
index 2839636a..8aa97e13 100644
--- a/selection.c
+++ b/selection.c
@@ -21,12 +21,23 @@
#define min(x, y) ((x) < (y) ? (x) : (y))
#define max(x, y) ((x) > (y) ? (x) : (y))
+static bool
+selection_forced(const struct terminal *term)
+{
+ const struct wayland *wayl = term->wl;
+ return wayl->focused == term &&
+ wayl->kbd.shift &&
+ !wayl->kbd.alt &&
+ !wayl->kbd.ctrl &&
+ !wayl->kbd.meta;
+}
+
bool
selection_enabled(const struct terminal *term)
{
return
term->mouse_tracking == MOUSE_NONE ||
- term->wl->kbd.shift ||
+ selection_forced(term) ||
term->is_searching;
}