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

Update to v1.0.0 (funcs xkb_utf32_to_keysym, xkb_keymap_key_get_mods_for_level) #19

Closed
ldrahnik opened this issue Apr 9, 2024 · 9 comments

Comments

@ldrahnik
Copy link

ldrahnik commented Apr 9, 2024

Hello there!

do you think that would be possible add funcs xkb_utf32_to_keysym and xkb_keymap_key_get_mods_for_level which have been added into libxkbcommon by changelog in next v1.0.0? (I could offer to create a pull request eventually)

Link to a related project that would use both func in the same way as it uses how-to-type tool from libxkbcommon repository.

@ldrahnik ldrahnik changed the title Update to v1.0.0 (func xkb_keymap_key_get_mods_for_level) Update to v1.0.0 (funcs xkb_utf32_to_keysym, xkb_keymap_key_get_mods_for_level) Apr 9, 2024
@sde1000
Copy link
Owner

sde1000 commented Apr 9, 2024

Adding xkb_keymap_key_get_mods_for_level sounds reasonable, I'll have a look at that.

xkb_utf32_to_keysym sounds less useful; python doesn't deal in utf32 very often, I'm not sure how I would expose that in the python bindings. I could include it in the ffi module I suppose.

@sde1000
Copy link
Owner

sde1000 commented Apr 9, 2024

Can you let me know if #20 does what you need?

@ldrahnik
Copy link
Author

Exactly, what we need. The added code I did not test. Should I?

@sde1000
Copy link
Owner

sde1000 commented Apr 10, 2024

If you can check that it does what you expect, that would be good. I had a quick look while I was writing the test for it, and it appears to return plausible sets of modifiers for keys, but I don't use that call myself so I don't know if it's right.

@ldrahnik
Copy link
Author

ldrahnik commented Apr 10, 2024

Could you guide me how to initiate the project and run the test on local machine (Ubuntu 22.04 aswell) ? Because $ pytest in root gives me ModuleNotFoundError: No module named 'xkbcommob._ffi'

$ cd python-xkbcommon
# init?
$ pytest

@sde1000
Copy link
Owner

sde1000 commented Apr 10, 2024

These days see https://setuptools.pypa.io/en/latest/userguide/development_mode.html

$ cd python-xkbcommon
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install --editable .
$ pytest

@ldrahnik
Copy link
Author

ldrahnik commented Apr 10, 2024

AFAIK it can be merged. The while True: cycle sounds better than allocating entire space at start typedef uint32_t xkb_mod_mask_t (typedefs) with consideration the most used count of modifiers will not be far away from currently used 21.

About your idea of a helper: might be useful to have an equivalent for this function string_to_keycode (written in c already here) which returns:

*return_value = KeyCombination{
     .modifiers = mask,
     keycode = key,
};
return;

@sde1000
Copy link
Owner

sde1000 commented Apr 10, 2024

Ok, I'll make a release 1.0 which includes this, and upload it to pypi.

@sde1000 sde1000 closed this as completed Apr 10, 2024
@ldrahnik
Copy link
Author

Thank you!

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

No branches or pull requests

2 participants