-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
callback set withkinc_keyboard_set_key_up_callback
not being called for Ctrl
key
#720
Comments
I tracked this down to this if statement: Kinc/Backends/System/Linux/Sources/kinc/backend/x11/system.c.h Lines 514 to 516 in 8b34e14
When I release a key like
Since others who have tested this under similar setups couldn't replicate my problem I suspect that this could be unrelated to Kinc, but I still would like to investigate this odd behavior further to get to the root cause of it. |
Found the problem.. I tried different keyboards on a hunch that it could maybe related to my fancy keyboard and plugged in the other keyboards on different USB ports on my PC and it suddenly worked just fine. Ultimately it isn't even related to my keyboard at all but somehow related to either the specific port I had it plugged in or the USB extension cable I use to reach from the PC to my desk.. Completely Kinc unrelated |
I encountered that problem again using entirely different setups (HW and SW) and have written a little sample with which I can reproduce the issue on several different machines: #include <kinc/graphics4/graphics.h>
#include <kinc/input/keyboard.h>
#include <kinc/input/mouse.h>
#include <kinc/log.h>
#include <kinc/system.h>
void update(void) { kinc_g4_swap_buffers(); }
void keydowncb(int code) { kinc_log(KINC_LOG_LEVEL_INFO, "Key %d down", code); }
void keyupcb(int code) { kinc_log(KINC_LOG_LEVEL_INFO, "Key %d up", code); }
void mousedowncb(int w, int button, int x, int y) {
kinc_log(KINC_LOG_LEVEL_INFO, "Mouse button %d down", button);
}
void mouseupcb(int w, int button, int x, int y) {
kinc_log(KINC_LOG_LEVEL_INFO, "Mouse button %d up", button);
}
int kickstart(int argc, char **argv) {
kinc_init("ctrlbug", 1280, 720, NULL, NULL);
kinc_set_update_callback(update);
kinc_mouse_set_press_callback(mousedowncb);
kinc_mouse_set_release_callback(mouseupcb);
kinc_keyboard_set_key_down_callback(keydowncb);
kinc_keyboard_set_key_up_callback(keyupcb);
kinc_start();
return 0;
} The mouse callback code is only there because I suspected the combination of Ctrl and multiple clicks could potentially be the cause, which wasn't the case When running this code on Linux and then pressing the Ctrl key, I get a I can force the release event when I repeatedly press both Ctrl keys at the same time, several times. Not sure what causes this, but at least on these combinations I can reproduce the issue:
NOTE: I can resolve the wrong behavior by unplugging the keyboard and plugging it back in, but the wrong behavior is restored upon reboot. This is ofc not easily possible with the integrated keyboard of a laptop... |
To update my findings: Arch based x64 laptop with i3-gaps (X11)When I change the keyboard layout at least once using Manjaro based x64 workstation with i3-gaps (X11)No amount of changing the keyboard layout fixes anything ManjaroARM based aarch64 laptop with sway (Wayland)using WaylandThe key going down registers as code adding
|
Testing with
The first event is the key press event, the second one the key release. Note how the |
Relevant part to make this reproducible is having the option
|
Describe the bug
Pressing the
Ctrl
key does not trigger consistently. In fact I only manage to get it to trigger when I press bothCtrl
keys on my keyboard. The callback forkinc_keyboard_set_key_down_callback
gets triggered as expected.From a little bit of testing, this only affects the
Ctrl
key, while it behaves normally with other keys.To Reproduce
Steps to reproduce the behavior:
kinc_keyboard_set_key_[down/up]_callback
Ctrl
Expected behavior
Same as with other keys (maybe differentiating them into Ctrl-Left/Right, because pressing both, releasing one might create a whole other possibility to fail)
Execution Environment:
Additional context
None
The text was updated successfully, but these errors were encountered: