mouse shortcuts: allow same functions as kb shortcuts (410651)
This commit is contained in:
parent
4aa6989993
commit
584f3928ad
3 changed files with 20 additions and 16 deletions
24
x.c
24
x.c
|
|
@ -33,9 +33,10 @@ typedef struct {
|
|||
} Shortcut;
|
||||
|
||||
typedef struct {
|
||||
uint b;
|
||||
uint mask;
|
||||
char *s;
|
||||
uint mod;
|
||||
uint button;
|
||||
void (*func)(const Arg *);
|
||||
const Arg arg;
|
||||
} MouseShortcut;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -57,6 +58,7 @@ static void clipcopy(const Arg *);
|
|||
static void clippaste(const Arg *);
|
||||
static void numlock(const Arg *);
|
||||
static void selpaste(const Arg *);
|
||||
static void ttysend(const Arg *);
|
||||
static void zoom(const Arg *);
|
||||
static void zoomabs(const Arg *);
|
||||
static void zoomreset(const Arg *);
|
||||
|
|
@ -308,6 +310,12 @@ clippaste(const Arg *dummy)
|
|||
xw.win, CurrentTime);
|
||||
}
|
||||
|
||||
void
|
||||
numlock(const Arg *dummy)
|
||||
{
|
||||
win.mode ^= MODE_NUMLOCK;
|
||||
}
|
||||
|
||||
void
|
||||
selpaste(const Arg *dummy)
|
||||
{
|
||||
|
|
@ -316,9 +324,9 @@ selpaste(const Arg *dummy)
|
|||
}
|
||||
|
||||
void
|
||||
numlock(const Arg *dummy)
|
||||
ttysend(const Arg *arg)
|
||||
{
|
||||
win.mode ^= MODE_NUMLOCK;
|
||||
ttywrite(arg->s, strlen(arg->s), 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -477,9 +485,9 @@ bpress(XEvent *e)
|
|||
if (tisaltscr())
|
||||
#endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
|
||||
if (e->xbutton.button == ms->b
|
||||
&& match(ms->mask, e->xbutton.state)) {
|
||||
ttywrite(ms->s, strlen(ms->s), 1);
|
||||
if (e->xbutton.button == ms->button
|
||||
&& match(ms->mod, e->xbutton.state)) {
|
||||
ms->func(&(ms->arg));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue