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

Key events can be buffered when compiling without Ibus support on an Ibus supported system #2940

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments


Copy link

@SDLBugzilla SDLBugzilla commented Feb 11, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.8
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2018-07-12 16:08:45 +0000, Marc Di Luzio wrote:

Created attachment 3271
Simple reproduction file

Tested on latest tip of default (1a1133e9c7d4).

On Linux, if SDL is compiled without ibus or fcitx support, but the system does support either - ie. XMODIFIERS="@im=ibus", then X key events for held keys will be buffered at low FPS.

See the example file to repro.

Compile and link with a SDL configured with --disable-ibus and --disable-fcitx, and run on a system with either supported (Ubuntu 18.04 will do).

This was originally introduced with, which wrapped the setting of new_xmods behind the HAVE_IBUS_IBUS_H or HAVE_FCITX_FRONTEND_H defines. Fixed a related issue, but the bug still remained.

A possible patch fix will be attached i a subsequent comment, though I'm unsure if it's exactly the correct fix.

On 2018-07-12 16:10:14 +0000, Marc Di Luzio wrote:

This patch fixes the issue locally. It simple ensures SDL still sets "@im=none" on systems that have ibus/fcitx support, regardless of whether SDL itself was configured with direct support.

HG changeset patch

User Marc Di Luzio

Date 1531410765 -3600

Thu Jul 12 16:52:45 2018 +0100

Node ID 44ebedcfe8bf4b244d0cedb83019cc65985b6e83

Parent 1a1133e9c7d40416af82e97711f91f5a857ffc54

Ensure we still clear the X locale modifiers even if not compiled with ibus or fcitx support

diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c
--- a/src/video/x11/SDL_x11keyboard.c
+++ b/src/video/x11/SDL_x11keyboard.c
@@ -292,9 +292,7 @@
char *prev_locale = setlocale(LC_ALL, NULL);
char *prev_xmods = X11_XSetLocaleModifiers(NULL);
const char *new_xmods = "";
-#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
const char *env_xmods = SDL_getenv("XMODIFIERS");
SDL_bool has_dbus_ime_support = SDL_FALSE;

     if (prev_locale) {

@@ -309,16 +307,12 @@
when it is used via XIM which causes issues. Prevent this by forcing
@im=none if XMODIFIERS contains @im=ibus. IBus can still be used via
the DBus implementation, which also has support for pre-editing. */
if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) {
has_dbus_ime_support = SDL_TRUE;
if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) {
has_dbus_ime_support = SDL_TRUE;
if (has_dbus_ime_support || !xkb_repeat) {
new_xmods = "@im=none";

On 2018-07-13 10:51:02 +0000, Marc Di Luzio wrote:

Just to add a little more info for the repro file - when running, hold a keyboard key for more than a second and see the output. Release the key, and see that the events keep repeating for an extended period of time. SDL_PollEvent should be returning true if it has events queued, but it doesn't, they're still buffered in X.

On 2018-07-17 15:56:20 +0000, Sam Lantinga wrote:

Patch added, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

1 participant