Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use xcb-keysyms to parse keycodes #17

Closed
wants to merge 7 commits into from
Closed

use xcb-keysyms to parse keycodes #17

wants to merge 7 commits into from

Conversation

alpheratz0
Copy link

fixes #1

@roomcays
Copy link

Warning: I merged this into my fork and blezz stopped to react on keystrokes.

@alpheratz0
Copy link
Author

Hi @roomcays, can you test it again? Does the escape key exit the application when pressed?

@roomcays
Copy link

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 :)

@alpheratz0
Copy link
Author

@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;
     }

@roomcays
Copy link

@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.

@alpheratz0
Copy link
Author

@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?

NumLock and other modifiers alters the modifiers mask in an
unwanted way, just allowing the shift modifier should fix this problem
thank you @roomcays for reporting it!
@roomcays
Copy link

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.

@alpheratz0
Copy link
Author

alpheratz0 commented Oct 17, 2022

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

@alpheratz0 alpheratz0 closed this Aug 29, 2023
@alpheratz0 alpheratz0 deleted the patch-better-keypress-handling branch August 29, 2023 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Actual KeySyms
2 participants