use xcb-keysyms to parse keycodes
fixes #1
Warning: I merged this into my fork and blezz stopped to react on keystrokes.
Hi @roomcays, can you test it again? Does the escape key exit the application when pressed?
Hello @alpheratz0 . I did test it again - with the same, unsuccessfull result. No key works. Keyboard is like "locked", I can not quit via escape key nor switch app with alt+tab combination. The only thing that works is clicking with mouse "on" the blezz (anywhere), and this quits blezz.
I can perform some debugging if you explain me how :)
@roomcays well, thats strange, the first thing that I would test is if you are receiving any keyboard events, to do so can you add this printf call (the highlighted text without the plus signs) to src/gui.c (line 214 if you have merged both pull requests) and test again, press some keys (Escape, etc) and send me back whats printed out.
diff --git a/src/gui.c b/src/gui.c
index 00ec99f..cbb3bb4 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -212,6 +212,14 @@ int handleKeyPress(xcb_generic_event_t* event) {
keycode = ((xcb_key_press_event_t *)event)->detail;
keysym = xcb_key_symbols_get_keysym(ksyms, keycode, state);
+ printf("\n"
+ "\tstate: %hu\n"
+ "\tkeycode: %hhu\n"
+ "\tkeysym: %u\n"
+ "\tESC keysym: %u\n"
+ "\tgetCharFromKeysym: %c\n",
+ state, keycode, keysym, XKB_KEY_Escape, getCharfromKeysym(keysym));
+
if (keysym == XKB_KEY_Escape) { //If the keycode represents escape
return 1;
}
@alpheratz0 sure! Below is the output you asked for. I pressed: a, b, c, d, D, Esc, Esc, Esc.
$ ./blezz
Loading config from: /home/user/.config/blezz/config
Loaded directoryUpKey as: .
Loaded actionIndicator as: ~
Loaded directoryIndicator as: /
Loaded startDirectory as: Main
Loaded windowWidth as: 800
Loaded showMenuNames as: 1
Loaded showMenuNamesNested as: 1
Loaded backgroundColor as: 0x313742
Loaded foregroundColor as: 0xf5f6f7
Loaded topIndentation as: 10
Loaded leftIndentation as: 20
Loaded bottomIndentation as: 10
Loaded windowXOffset as: 0
Loaded windowYOffset as: 0
Loaded windowXPosition as: 1
Loaded windowYPosition as: 1
Loading content from: /home/user/.config/blezz/content
Loaded 8 directories
Loaded 21 actions
state: 16
keycode: 38
keysym: 0
ESC keysym: 65307
getCharFromKeysym:
state: 16
keycode: 56
keysym: 0
ESC keysym: 65307
getCharFromKeysym:
state: 16
keycode: 54
keysym: 0
ESC keysym: 65307
getCharFromKeysym:
state: 16
keycode: 40
keysym: 0
ESC keysym: 65307
getCharFromKeysym:
state: 16
keycode: 50
keysym: 0
ESC keysym: 65307
getCharFromKeysym:
state: 17
keycode: 40
keysym: 0
ESC keysym: 65307
getCharFromKeysym:
state: 16
keycode: 9
keysym: 0
ESC keysym: 65307
getCharFromKeysym:
state: 16
keycode: 9
keysym: 0
ESC keysym: 65307
getCharFromKeysym:
state: 16
keycode: 9
keysym: 0
ESC keysym: 65307
getCharFromKeysym:
I thought this could be connected with hotkey manager I use (sxhkd), but with it turned off (killed) the behavior is the same.
@roomcays thanks, thats really nice, I think I found the problem, new commit going in the way, correct me if I am wrong, do you have NumLock turned on?
Yes, I do have NumLock on (permamently) :) I have merged the latest commit and it fixed the issue! Good job, thank you!
I'm so glad somebody besides me needs this kind of application (and can code in C ;-P). I was looking for alternatives over github.com and elsewhere and suprisingly find none.
Yes, I do have NumLock on (permamently) :) I have merged the latest commit and it fixed the issue! Good job, thank you!
@roomcays thank you for reporting the problem and help me fix it! I am happy that this PR is useful for someone, I thought it will never be merged/useful because this project (and the account) is abandoned but you proved me wrong.
I'm so glad somebody besides me needs this kind of application (and can code in C ;-P). I was looking for alternatives over github.com and elsewhere and suprisingly find none.
I really like minimalist applications, and this one is a very useful one ;)
Have a nice day