mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
term: add term_mouse_grabbed()
When this returns true, it means we have keyboard focus and are grabbing the mouse (for e.g. selections), regardless of whether the client has enabled mouse tracking or not.
This commit is contained in:
parent
5d2b2dc8a7
commit
2208f4304b
3 changed files with 17 additions and 30 deletions
13
selection.c
13
selection.c
|
|
@ -21,23 +21,12 @@
|
|||
#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 ||
|
||||
selection_forced(term) ||
|
||||
term_mouse_grabbed(term) ||
|
||||
term->is_searching;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue