mouse shortcuts: allow override for all shortcuts (7729e7)

This commit is contained in:
bakkeby 2020-03-24 14:08:08 +01:00
parent 584f3928ad
commit ed7837a816
2 changed files with 13 additions and 13 deletions

View File

@ -262,6 +262,13 @@ ResourcePref resources[] = {
};
#endif // XRESOURCES_PATCH
/*
* 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.
@ -373,13 +380,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;
#if !FIXKEYBOARDINPUT_PATCH
/*
* This is the huge key array which defines all compatibility to the Linux

12
x.c
View File

@ -390,7 +390,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)) {
@ -476,7 +476,7 @@ bpress(XEvent *e)
#endif // SCROLLBACK_MOUSE_PATCH / SCROLLBACK_MOUSE_ALTSCREEN_PATCH
int snap;
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forcemousemod)) {
mousereport(e);
return;
}
@ -485,8 +485,8 @@ bpress(XEvent *e)
if (tisaltscr())
#endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH
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;
}
@ -720,7 +720,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;
}
@ -751,7 +751,7 @@ bmotion(XEvent *e)
}
#endif // HIDECURSOR_PATCH
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forcemousemod)) {
mousereport(e);
return;
}