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

Improve interactive tools #352

Merged
merged 4 commits into from
Sep 18, 2023
Merged

Conversation

wismill
Copy link
Member

@wismill wismill commented Jun 29, 2023

I would like to revive #36 but I realize that I use a bunch of printf for debugging modifiers.

This MR add new options to interactive-evdev for debugging (see commits). Some options use the private API, so I added a non-installable version of the tool with this API.

I did not modify the other tools ATM, because interactive-evdev seem the most flexible one, being able to load whatever configuration without depending nor impacting the environment.

There is one commit that improve the display of control characters from key strokes translation.

@wismill wismill added enhancement Indicates new feature requests tools: interactive labels Jun 30, 2023
* any non-printable character in the string.
*/
if (strlen(s) == 1 && (*s <= 0x1F)) {
printf("unicode [ U+%04hX ] ", *s);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally the Unicode wouldn't tell me much as I don't really remember that e.g. newline is U+000A. In that case I'd prefer \n. But that would be more work, at least I don't know a stdlib function which does this escaping. So +1 from me, this is definitely an improvement.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a standard notation. I agree every developer prefers the \n escape sequence, but U+NNNN is a standard Unicode notation and gives good result in search engine. Anyway you will also have the keysym Return displayed: I think this is already a good hint.

tools/interactive-evdev.c Outdated Show resolved Hide resolved
tools/interactive-evdev.c Outdated Show resolved Hide resolved
tools/interactive-evdev.c Outdated Show resolved Hide resolved
@wismill wismill mentioned this pull request Jun 30, 2023
@wismill wismill added this to the 1.6.0 milestone Jul 3, 2023
@wismill
Copy link
Member Author

wismill commented Jul 12, 2023

Rebased. This PR requires squashing some commits. Will get to it later.

Currently the interactive tools print the string result of key strokes
as it is, without any escape. This is especially annoying for trivial
keysyms such as: Return, BackSpace and Escape.

Fix this by displaying the Unicode code point notation (e.g U+000D for
Return) for single control characters from the C0 set and DEL.

This is a hack: ideally we would like to escape any non-printable
character in the utf-8 string.
Display can be cluttered when too many fields are displayed.

Add options to hide some default fields
Add an option to print modmap and vmodmap of relevant keys, as well as
virtual modifiers mapping to real modifier. This is useful for debugging.
It uses private API, so we compile it separately in the fashion of
`xkbcli-compile-keymap/compile-keymap`.
@wismill wismill marked this pull request as ready for review September 18, 2023 10:42
@wismill
Copy link
Member Author

wismill commented Sep 18, 2023

Rebased & squashed.

@wismill
Copy link
Member Author

wismill commented Sep 18, 2023

I do not think this is controversial and it is very useful for debugging, so I am going to merge this.

@wismill wismill merged commit 0e3e2d1 into xkbcommon:master Sep 18, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests tools: interactive
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants