aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-09-18 14:36:39 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-09-18 14:36:39 +0000
commitfe7aa25ad82f5551f0a84bb98df8ccbac39a8f79 (patch)
treecbc4ec4992bb2a49b27b92b9d992e63e61099d38 /config.c
parentinput: improve touch handling on pointer presense (diff)
input: make wheel events mappable
Un-grabbed wheel events are now passed through the mouse binding matching logic, instead of being hardcoded to scrolling the terminal contents. They are mappable through the BTN_BACK and BTN_FORWARD buttons. Since they're not actually button *presses*, they never generate a click count other than 1. This limitation is documented, but not checked in the config. This means it's possible to create bindings like "BTN_BACK+3" (i.e. triple "click"). They will however never trigger. The old, hardcoded logic is now accessible through the new scrollback-up-mouse and scrollback-down-mouse mouse bindings. They (obiously) default to BTN_BACK and BTN_FORWARD, respectively. Example usage: keep the default of scrolling terminal contents with the wheel, when used without modifiers, but map Control+wheel to font zoom in/out: [mouse-bindings] font-increase=Control+BTN_FORWARD font-decrease=Control+BTN_BACK (this also keeps the default key bindings to zoom in/out; ctrl-+ and ctrl+-) Closes #1077
Diffstat (limited to 'config.c')
-rw-r--r--config.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/config.c b/config.c
index 129fe99a..aeea0b32 100644
--- a/config.c
+++ b/config.c
@@ -120,6 +120,8 @@ static const char *const binding_action_map[] = {
[BIND_ACTION_UNICODE_INPUT] = "unicode-input",
/* Mouse-specific actions */
+ [BIND_ACTION_SCROLLBACK_UP_MOUSE] = "scrollback-up-mouse",
+ [BIND_ACTION_SCROLLBACK_DOWN_MOUSE] = "scrollback-down-mouse",
[BIND_ACTION_SELECT_BEGIN] = "select-begin",
[BIND_ACTION_SELECT_BEGIN_BLOCK] = "select-begin-block",
[BIND_ACTION_SELECT_EXTEND] = "select-extend",
@@ -2871,6 +2873,8 @@ static void
add_default_mouse_bindings(struct config *conf)
{
static const struct config_key_binding bindings[] = {
+ {BIND_ACTION_SCROLLBACK_UP_MOUSE, m_none, {.m = {BTN_BACK, 1}}},
+ {BIND_ACTION_SCROLLBACK_DOWN_MOUSE, m_none, {.m = {BTN_FORWARD, 1}}},
{BIND_ACTION_PRIMARY_PASTE, m_none, {.m = {BTN_MIDDLE, 1}}},
{BIND_ACTION_SELECT_BEGIN, m_none, {.m = {BTN_LEFT, 1}}},
{BIND_ACTION_SELECT_BEGIN_BLOCK, m_ctrl, {.m = {BTN_LEFT, 1}}},