We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2844 - X11+IBus: SDL2 should post SDL_TEXTEDITING when preedit is cancelled by hitting Backspaces
Summary: X11+IBus: SDL2 should post SDL_TEXTEDITING when preedit is cancelled by hitti...
Status: REOPENED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.3
Hardware: x86 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.4, triage-2.0.4
Depends on:
Blocks:
 
Reported: 2015-01-14 11:00 UTC by Kengo Ide
Modified: 2018-02-14 09:22 UTC (History)
4 users (show)

See Also:


Attachments
Correctly send TEXTEDITING events. (1.21 KB, patch)
2015-02-01 21:17 UTC, Alex Baines
Details | Diff
Fix empty SDL_TEXTEDITING spam + only register interest in messages for ourselves. (3.09 KB, patch)
2015-02-27 21:26 UTC, Alex Baines
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kengo Ide 2015-01-14 11:00:14 UTC
Shown below are SDL_TEXTEDITING events while typing i-ro-ha in Japanese, then deleting it by Backspace key.

Windows:
SDL_TEXTEDITING {timestamp=2982, "い", start=1, length=0}
SDL_TEXTEDITING {timestamp=3247, "いr", start=2, length=0}
SDL_TEXTEDITING {timestamp=3341, "いろ", start=2, length=0}
SDL_TEXTEDITING {timestamp=3497, "いろh", start=3, length=0}
SDL_TEXTEDITING {timestamp=3592, "いろは", start=3, length=0}
SDL_TEXTEDITING {timestamp=4121, "いろ", start=2, length=0}
SDL_TEXTEDITING {timestamp=4355, "い", start=1, length=0}
SDL_TEXTEDITING {timestamp=4618, "", start=0, length=0}

X11+IBus:
SDL_TEXTEDITING {timestamp=4725, "い", start=0, length=1}
SDL_TEXTEDITING {timestamp=5394, "いr", start=0, length=2}
SDL_TEXTEDITING {timestamp=5726, "いろ", start=0, length=2}
SDL_TEXTEDITING {timestamp=6059, "いろh", start=0, length=3}
SDL_TEXTEDITING {timestamp=6318, "いろは", start=0, length=3}
SDL_TEXTEDITING {timestamp=9246, "いろ", start=0, length=2}
SDL_TEXTEDITING {timestamp=9805, "い", start=0, length=1}
# NOTE: No SDL_TEXTEDITING here.

When a user deletes all of the preedit text by repeatedly hitting Backspace key, since it doesn't insert any character, SDL_TEXTINPUT will not be sent. In this case, the last empty SDL_TEXTEDITING will be a only means of informing the application that the preedit process has ended. X11 backend should send it, as well as Windows backend.
Comment 1 Alex Baines 2015-02-01 21:17:27 UTC
Created attachment 2012 [details]
Correctly send TEXTEDITING events.

Here is a patch that should fix the bug. 

It also causes IBus to send multiple empty TEXTEDITING events when window focus changes - not sure if that is intended behaviour but it probably shouldn't hurt.
Comment 2 Ryan C. Gordon 2015-02-19 06:32:14 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry
if you got a lot of email from this. This is to help me sort through some bugs
in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4,
though!
Comment 3 Alex Baines 2015-02-27 21:26:54 UTC
Created attachment 2053 [details]
Fix empty SDL_TEXTEDITING spam + only register interest in messages for ourselves.

I fixed the empty SDL_TEXTEDITING event spam that was occuring with the other patch here. This also fixes recieving IBus events not aimed at us, and should definitely be included in 2.0.4 if the other IBus stuff is.
Comment 4 Ryan C. Gordon 2015-05-27 01:06:14 UTC
(In reply to Alex Baines from comment #1)
> Here is a patch that should fix the bug. 

This patch is now https://hg.libsdl.org/SDL/rev/b1e7169d1dcb.

--ryan.
Comment 5 Ryan C. Gordon 2015-05-27 01:06:52 UTC
(In reply to Alex Baines from comment #3)
> I fixed the empty SDL_TEXTEDITING event spam that was occuring with the
> other patch here. This also fixes recieving IBus events not aimed at us, and
> should definitely be included in 2.0.4 if the other IBus stuff is.

This patch is now https://hg.libsdl.org/SDL/rev/9d4917e2d909, thanks!

Resolving the bug...

--ryan.
Comment 6 Kengo Ide 2015-05-27 07:30:57 UTC
I verified that the bug is now fixed at r9652. Thank you.
Comment 7 Gajo Petrovic 2018-01-23 06:53:54 UTC
I have this exact same issue with fcitx in r11826. Reopening.