Introduction
Introduction Statistics Contact Development Disclaimer Help
Extended key definition to allow setting explicit symbol for shift modifier. - …
git clone git://git.suckless.org/svkbd
Log
Files
Refs
README
LICENSE
---
commit d10af923a31df4cca4206fbf4f839716482fd1ba
parent 3be1e21c9f7174f7cca2b8a099990a745f657a92
Author: Reed Wade <[email protected]>
Date: Sat, 6 Mar 2021 15:09:08 +0100
Extended key definition to allow setting explicit symbol for shift modifier.
This allow key definitions as :
{ "?", XK_slash, 1, XK_Shift_L },
Which will press <S-/> wich output `?`
Signed-off-by: Reed Wade <[email protected]>
Signed-off-by: Maarten van Gompel <[email protected]>
Diffstat:
M svkbd.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/svkbd.c b/svkbd.c
@@ -41,6 +41,7 @@ typedef struct {
char *label;
KeySym keysym;
unsigned int width;
+ KeySym modifier;
int x, y, w, h;
Bool pressed;
Bool highlighted;
@@ -183,14 +184,20 @@ buttonpress(XEvent *e)
ispressing = True;
- for (i = 0; i < LENGTH(buttonmods); i++) {
- if (ev->button == buttonmods[i].button) {
- mod = buttonmods[i].mod;
- break;
+ if (!(k = findkey(ev->x, ev->y)))
+ return;
+
+ if (k->modifier)
+ mod = k->modifier;
+ else
+ for (i = 0; i < LENGTH(buttonmods); i++) {
+ if (ev->button == buttonmods[i].button) {
+ mod = buttonmods[i].mod;
+ break;
+ }
}
- }
- if ((k = findkey(ev->x, ev->y)))
- press(k, mod);
+
+ press(k, mod);
}
void
@@ -212,8 +219,10 @@ buttonrelease(XEvent *e)
if (ev->x < 0 || ev->y < 0) {
unpress(NULL, mod);
- } else {
- if ((k = findkey(ev->x, ev->y)))
+ } else if ((k = findkey(ev->x, ev->y))) {
+ if (k->modifier)
+ unpress(k, k->modifier);
+ else
unpress(k, mod);
}
}
@@ -872,6 +881,7 @@ showoverlay(int idx)
j++;
keys[j].label = overlay[i].label;
keys[j].keysym = overlay[i].keysym;
+ keys[j].modifier = overlay[i].modifier;
}
currentoverlay = idx;
overlaykeysym = ispressingkeysym;
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.