tmouse shortcuts: allow override for all shortcuts - st - [fork] customized bui… | |
git clone git://src.adamsgaard.dk/st | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit b6d280de6df30167ce9cf30fadefc362e77729e7 | |
parent ba7f4d69af62d20e13fea78a408095e017410651 | |
Author: Avi Halachmi (:avih) <[email protected]> | |
Date: Thu, 10 Oct 2019 23:42:30 +0300 | |
mouse shortcuts: allow override for all shortcuts | |
Allow forceselmod to override all mouse shortcuts rather than only | |
selection, and rename it to forcemousemod as it's now more appropriate. | |
This will affect mouse shortcuts which use mask other than XK_ANY_MOD. | |
This does not affect the default behavior because the default mouse | |
shortcuts (wheel) use XK_ANY_MOD, where forceselmod already activated | |
tthe override also before this change. | |
Previously, if a mouse shortcut was configured with a specific mod and | |
forceselmod was held, then the shortcut did not execute unless the | |
configured mod included forceselmod. | |
Diffstat: | |
M config.def.h | 14 +++++++------- | |
M x.c | 12 ++++++------ | |
2 files changed, 13 insertions(+), 13 deletions(-) | |
--- | |
diff --git a/config.def.h b/config.def.h | |
t@@ -151,6 +151,13 @@ static unsigned int mousebg = 0; | |
static unsigned int defaultattr = 11; | |
/* | |
+ * Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set). | |
+ * Note that if you want to use ShiftMask with selmasks, set this to an other | |
+ * modifier, set to 0 to not use it. | |
+ */ | |
+static uint forcemousemod = ShiftMask; | |
+ | |
+/* | |
* Internal mouse shortcuts. | |
* Beware that overloading Button1 will disable the selection. | |
*/ | |
t@@ -214,13 +221,6 @@ static KeySym mappedkeys[] = { -1 }; | |
static uint ignoremod = Mod2Mask|XK_SWITCH_MOD; | |
/* | |
- * Override mouse-select while mask is active (when MODE_MOUSE is set). | |
- * Note that if you want to use ShiftMask with selmasks, set this to an other | |
- * modifier, set to 0 to not use it. | |
- */ | |
-static uint forceselmod = ShiftMask; | |
- | |
-/* | |
* This is the huge key array which defines all compatibility to the Linux | |
* world. Please decide about changes wisely. | |
*/ | |
diff --git a/x.c b/x.c | |
t@@ -340,7 +340,7 @@ void | |
mousesel(XEvent *e, int done) | |
{ | |
int type, seltype = SEL_REGULAR; | |
- uint state = e->xbutton.state & ~(Button1Mask | forceselmod); | |
+ uint state = e->xbutton.state & ~(Button1Mask | forcemousemod); | |
for (type = 1; type < LEN(selmasks); ++type) { | |
if (match(selmasks[type], state)) { | |
t@@ -423,14 +423,14 @@ bpress(XEvent *e) | |
MouseShortcut *ms; | |
int snap; | |
- if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { | |
+ if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forcemousemod)) { | |
mousereport(e); | |
return; | |
} | |
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { | |
- if (e->xbutton.button == ms->button | |
- && match(ms->mod, e->xbutton.state)) { | |
+ if (e->xbutton.button == ms->button && | |
+ match(ms->mod, e->xbutton.state & ~forcemousemod)) { | |
ms->func(&(ms->arg)); | |
return; | |
} | |
t@@ -650,7 +650,7 @@ xsetsel(char *str) | |
void | |
brelease(XEvent *e) | |
{ | |
- if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { | |
+ if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forcemousemod)) { | |
mousereport(e); | |
return; | |
} | |
t@@ -664,7 +664,7 @@ brelease(XEvent *e) | |
void | |
bmotion(XEvent *e) | |
{ | |
- if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { | |
+ if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forcemousemod)) { | |
mousereport(e); | |
return; | |
} |