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

x/exp/shiny: key repeats reported as release + press #18566

barnex opened this issue Jan 8, 2017 · 3 comments

x/exp/shiny: key repeats reported as release + press #18566

barnex opened this issue Jan 8, 2017 · 3 comments


Copy link

@barnex barnex commented Jan 8, 2017

What did you do?

This program opens an x/exp/shiny window and reports key presses:

package main

import (

func main() {
    driver.Main(func(s screen.Screen) {
        w, _ := s.NewWindow(nil)
        for {
            e := w.NextEvent()
            if e, ok := e.(key.Event); ok {

What did you expect to see?

According to, key repeats should report key.DirNone. So when pressing and holding down a key for a while, I expect to see:

11:59:49.544507 Press
11:59:50.045002 None
11:59:50.076717 None
11:59:50.107537 None
11:59:50.137585 Release

What did you see instead?

Holding down a key results in repeated Release/Press events:

11:59:49.544507 Press
11:59:50.045002 Release
11:59:50.045110 Press
11:59:50.076717 Release
11:59:50.076807 Press
11:59:50.107537 Release
11:59:50.107578 Press
11:59:50.137585 Release

What version of Go are you using (go version)?

go version go1.7.1 linux/amd64

What operating system and processor architecture are you using (go env)?

GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build871086202=/tmp/go-build -gno-record-gcc-switches"
Copy link

@as as commented Jan 8, 2017

I wasn't able to reproduce this on NT, so I looked to Linux as the culprit.

According to xorg

The X server usually generates both press and release events whenever an autorepeating key is held down. If an XKB-aware client enables the DetectableAutorepeat per-client option for a keyboard, the server sends that client a key release event only when the key is physically released. For example, holding down a key to generate three characters without detectable autorepeat yields:

Press -> Release -> Press -> Release -> Press -> Release
If detectable autorepeat is enabled, the client instead receives:

Press-> Press -> Press -> Release
Note that only clients that request detectable autorepeat are affected; other clients continue to receive both press and release events for autorepeating keys. Also note that support for detectable autorepeat is optional; servers are not required to support detectable autorepeat, but they must correctly report whether or not it is supported.

@titanous titanous changed the title exp/shiny: key repeats reported as release + press x/exp/shiny: key repeats reported as release + press Jan 9, 2017
@titanous titanous added this to the Unreleased milestone Jan 9, 2017
Copy link

@titanous titanous commented Jan 9, 2017

/cc @nigeltao

Copy link

@nigeltao nigeltao commented Jan 12, 2017

Yeah, it's a bug in the x11driver, although if fixing this involves XKB's DetectableAutorepeat, as @as suggested, then it's not going to be trivial. The xgb library that we use says, in "XKB is the only extension that intentionally does not work... due to its complexity and my current mental incapacity to test it."

@nigeltao nigeltao self-assigned this Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants