code-style changes

This commit is contained in:
Hiltjo Posthuma 2021-03-28 15:02:25 +02:00
parent 8f6a7b5e42
commit 7c06a0caf5
1 changed files with 17 additions and 8 deletions

17
svkbd.c
View File

@ -492,6 +492,7 @@ printkey(Key *k, KeySym mod)
printdbg("Printing key %ld (shift=%d)\n", k->keysym, shift); printdbg("Printing key %ld (shift=%d)\n", k->keysym, shift);
if (k->keysym == XK_Cancel) if (k->keysym == XK_Cancel)
return; return;
KeySym *keysym = &(k->keysym); KeySym *keysym = &(k->keysym);
XIM xim = XOpenIM(dpy, 0, 0, 0); XIM xim = XOpenIM(dpy, 0, 0, 0);
XIC xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, NULL); XIC xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, NULL);
@ -519,8 +520,12 @@ printkey(Key *k, KeySym mod)
void void
simulate_keypress(KeySym keysym) simulate_keypress(KeySym keysym)
{ {
if (!simulateoutput) return; KeyCode code;
KeyCode code = XKeysymToKeycode(dpy, keysym);
if (!simulateoutput)
return;
code = XKeysymToKeycode(dpy, keysym);
if (code == 0) if (code == 0)
code = tmp_remap(keysym); code = tmp_remap(keysym);
XTestFakeKeyEvent(dpy, code, True, 0); XTestFakeKeyEvent(dpy, code, True, 0);
@ -529,8 +534,12 @@ simulate_keypress(KeySym keysym)
void void
simulate_keyrelease(KeySym keysym) simulate_keyrelease(KeySym keysym)
{ {
if (!simulateoutput) return; KeyCode code;
KeyCode code = XKeysymToKeycode(dpy, keysym);
if (!simulateoutput)
return;
code = XKeysymToKeycode(dpy, keysym);
if (code == 0) if (code == 0)
code = tmp_remap(keysym); code = tmp_remap(keysym);
XTestFakeKeyEvent(dpy, code, False, 0); XTestFakeKeyEvent(dpy, code, False, 0);