Skip to content

Conversation

@belug23
Copy link

@belug23 belug23 commented Jan 29, 2026

While using a modded keyboard with macros on the characters pressing the keys affected by the ctrl modifier without ctrl down, would still trigger it, it was the same issue using the Android virtual keyboard.

Here's an example of what was happening, pressing a would erase all text and write the letter a instead, pressing b would write the letter b at the start of the text area and set the cursor in between the first and second character, pressing e would add the letter e at the end of the text area.

After some code investigation, I found out that calling nk_input_key would always increase ctx->input.keyboard.keys[key].clicked even if ctrl wasn't push, then if it was released while the clicked counter was still equals to 1, it would increase it to 2 triggering the nk_input_key_pressed due to the validation of if ((k->down && k->clicked) || (!k->down && k->clicked >= 2)).

Only calling nk_input_key when ctrl is down fixes the problem.

sleeptightAnsiC

This comment was marked as outdated.

@sleeptightAnsiC

This comment was marked as outdated.

@sleeptightAnsiC
Copy link
Contributor

sleeptightAnsiC commented Jan 30, 2026

(Our conversation moved to #882 I'm only responding here because of the referenced comment)

I might be missing a bigger picture here, but after taking a look at how Nuklear deals with this thing internally, it seems that nk_textedit_key should be handling all MOD/SHIFT/CTRL states on its own. The backend should passthrough all those "special keys" without checking weather or not the MOD/SHIFT/CTRL is being held.

Just want to add that my understanding wasn't really correct. That function handles the state of SHIFT, but nothing else. It's just a confusing design of Nuklear, that it implements all SHIFT-related behavior, but forces the backend to implement everything else. Strange...

@belug23
Copy link
Author

belug23 commented Jan 31, 2026

As discussed in #882 I've updated the code to handle the release of the special functions.

Copy link
Contributor

@sleeptightAnsiC sleeptightAnsiC left a comment

Choose a reason for hiding this comment

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

(Just note that I still don't consider this to be exactly correct, and it should NOT be merged yet. There are many nuances mentioned about this issue in #882 We decided to update this PR in order to have something to work with.)

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.

2 participants