Skip to content

Duplicated keyboard events with dead keys in X11 #107

Closed

Description

@siiptuo

When using dead keys, for instance ´ and a to write á, in some keyboard layouts under X11, ReceivedCharacter event is fired twice:

KeyboardInput(Pressed, 21, None)
KeyboardInput(Released, 21, None)
ReceivedCharacter('á')
KeyboardInput(Pressed, 0, None)
ReceivedCharacter('á')
KeyboardInput(Pressed, 0, None)
KeyboardInput(Released, 38, Some(A))

This issue seems to be related to XFilterEvent which is called in the code but doesn't really do anything. Checking the return value and returning early if it's non-zero seems to fix this issue.

Other software simply skip those events altogether or do something more or less complicated. In these examples filtering is also done for all events, not only in key events.

Activity

  1. added
    DS - x11
    B - bug
    on Jan 11, 2017
  2. added a commit that references this issue on Mar 29, 2017
  3. wengxt commented on Apr 5, 2017

    @wengxt
    Contributor

    Not checking the return value XFilterEvent is one issue, but the timing is also wrong.

    To support input method and compose correctly, the XFilterEvent should be called immediately after XNextEvent, and check the return value there.

    https://github.com/tomaka/winit/blob/master/src/platform/linux/x11/window.rs#L176

    XFilterEvent should be called right here.

    I used to fix input method bug in some other Xlib app, for more details just check the comment I added in following links.

    http://git.suckless.org/st/commit/?id=5f48e89716a74e75b6040fdb067372180626b699

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDS - x11

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions