sde1000 / python-xkbcommon

Python bindings for libxkbcommon using cffi
MIT License
19 stars 5 forks source link

Update (partially) to 1.3.1 version of xkbcommon.h #13

Closed dydyamotya closed 6 months ago

dydyamotya commented 2 years ago

Hello. Thought, I've needed to upgrade code to latest version with keymap funcs: key_by_name, key_get_name. Also wrote utf32 functions. My first pull request, please, help me to figure out, if i've done something wrong.

sde1000 commented 2 years ago

Looks reasonably sensible so far!

You've added functions keysym_to_utf32 and utf32_to_keysym. Would it be better for these to work with Python strings? I.e. call chr() and ord() as appropriate, and give them different names?

Have you written tests for all the functions and methods you've added? (When checking this I noticed I didn't write tests for the keysym functions. Oops! I will have to add those.)

dydyamotya commented 2 years ago

Looks reasonably sensible so far!

You've added functions keysym_to_utf32 and utf32_to_keysym. Would it be better for these to work with Python strings? I.e. call chr() and ord() as appropriate, and give them different names?

Have you written tests for all the functions and methods you've added? (When checking this I noticed I didn't write tests for the keysym functions. Oops! I will have to add those.)

Thanks for responce. I've just make some research about how ord and chr works. It seems like on linux typical unicode symbol holds 32 bits, and it's really utf32. Though on Windows, it is UTF-16. And UTF-32 != UTF-16. What do you think?

Tests will be soon.

sde1000 commented 1 year ago

I've added support for key_by_name() and key_get_name() to the master branch now. Did you ever work out how the utf32 keysym functions related to Python strings?