Fix some bugs which had been previous undiscovered with the keysym

handling
This commit is contained in:
speedie 2023-06-08 22:42:25 +02:00
parent 148c219ec5
commit e6b2c0d9c9
2 changed files with 9 additions and 7 deletions

View file

@ -422,21 +422,21 @@ spmenu = {
// Shift+=: Increase image size by 100 // Shift+=: Increase image size by 100
{ mode = 0; { mode = 0;
modifier = "Shift"; modifier = "Shift";
key = "="; key = "+"; // Note that + is used instead of = because Shift is held down.
function = "setimgsize"; function = "setimgsize";
argument = "+100"; argument = "+100";
}, },
// Shift+-: Decrease image size by 100 // Shift+-: Decrease image size by 100
{ mode = 0; { mode = 0;
modifier = "Shift"; modifier = "Shift";
key = "-"; key = "_"; // Note that _ is used instead of - because Shift is held down.
function = "setimgsize"; function = "setimgsize";
argument = "-100"; argument = "-100";
}, },
// Shift+0: Set image size to the default // Shift+0: Set image size to the default
{ mode = 0; { mode = 0;
modifier = "Shift"; modifier = "Shift";
key = "0"; key = ")"; // Note that ) is used instead of 0 because Shift is held down.
function = "defaultimg"; function = "defaultimg";
argument = "0"; argument = "0";
}, },
@ -485,14 +485,14 @@ spmenu = {
// Shift+1: Decrease image gaps by 100 // Shift+1: Decrease image gaps by 100
{ mode = 0; { mode = 0;
modifier = "Shift"; modifier = "Shift";
key = "1"; key = "!"; // Note that ! is used instead of 1 because Shift is held down.
function = "setimggaps"; function = "setimggaps";
argument = "-100"; argument = "-100";
}, },
// Shift+2: Increase image gaps by 100 // Shift+2: Increase image gaps by 100
{ mode = 0; { mode = 0;
modifier = "Shift"; modifier = "Shift";
key = "2"; key = "@"; // Note that @ is used instead of 2 because Shift is held down.
function = "setimggaps"; function = "setimggaps";
argument = "+100"; argument = "+100";
}, },

View file

@ -18,7 +18,8 @@ void keypress_x11(XEvent *e) {
updatenumlockmask(); updatenumlockmask();
{ {
unsigned int i; unsigned int i;
KeySym keysym; KeySym keysym = NoSymbol;
KeySym keysym_case = NoSymbol;
XKeyEvent *ev; XKeyEvent *ev;
char buf[64]; char buf[64];
KeySym ksym = NoSymbol; KeySym ksym = NoSymbol;
@ -28,7 +29,8 @@ void keypress_x11(XEvent *e) {
ev = &e->xkey; ev = &e->xkey;
len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status); len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
keysym = XkbKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0, 0); // keysym = XkbKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0, 0);
XConvertCase(ksym, &keysym, &keysym_case);
// this makes sure we always have a way to exit if we unbind our quit key // this makes sure we always have a way to exit if we unbind our quit key
if (keysym == hkeys[0].keysym && CLEANMASK(hkeys[0].mod) == CLEANMASK(ev->state) && hkeys[0].func) hkeys[0].func(&(hkeys[0].arg)); if (keysym == hkeys[0].keysym && CLEANMASK(hkeys[0].mod) == CLEANMASK(ev->state) && hkeys[0].func) hkeys[0].func(&(hkeys[0].arg));