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

Invalid text in KeyEvent on Linux after recent change #3079

Closed
Riateche opened this issue Sep 2, 2023 · 5 comments · Fixed by #3087
Closed

Invalid text in KeyEvent on Linux after recent change #3079

Riateche opened this issue Sep 2, 2023 · 5 comments · Fixed by #3087
Assignees
Labels
B - bug Dang, that shouldn't have happened B - regression DS - x11

Comments

@Riateche
Copy link
Contributor

Riateche commented Sep 2, 2023

KeyEvent::text always contains a lowercase Latin letter, even if the current layout uses another language. Pressing Shift while typing still produces a lowercase letter. This issue first appeared in bb9b629.

@madsmtm madsmtm added B - bug Dang, that shouldn't have happened DS - x11 labels Sep 2, 2023
@madsmtm
Copy link
Member

madsmtm commented Sep 2, 2023

CC @notgull

@notgull
Copy link
Member

notgull commented Sep 4, 2023

Confirmed this issue on my end. Standby for a fix.

@notgull
Copy link
Member

notgull commented Sep 5, 2023

This code appears to be the issue, as it appears that reverting it to the old implementation of select_xkb_events fixes the issue.

pub fn select_xkb_events(
&self,
device_id: xkb::DeviceSpec,
mask: xkb::EventType,
) -> Result<bool, X11Error> {
let result = self
.xcb_connection()
.xkb_select_events(
device_id,
xkb::EventType::from(0u8),
mask,
xkb::MapPart::from(u16::from(mask)),
xkb::MapPart::EXPLICIT_COMPONENTS
| xkb::MapPart::KEY_ACTIONS
| xkb::MapPart::KEY_BEHAVIORS
| xkb::MapPart::VIRTUAL_MODS
| xkb::MapPart::MODIFIER_MAP
| xkb::MapPart::VIRTUAL_MOD_MAP,
&xkb::SelectEventsAux::new(),
)
.map_err(ReplyError::from)
.and_then(|x| x.check());
match result {
Ok(()) => Ok(true),
Err(ReplyError::ConnectionError(ConnectionError::UnsupportedExtension)) => {
error!("Could not select XKB events: The XKB extension is not initialized!");
Ok(false)
}
Err(e) => Err(e.into()),
}
}

@kchibisov
Copy link
Member

@notgull maybe the keymap stuff is not delivered?

notgull added a commit that referenced this issue Sep 5, 2023
The new implementation of select_xkb_events apparently misconfigures
the server. This commit does a temporary fix by just reverting it to its
previous implementation.

This is temporary until I can figure out what Xlib is doing behind the
scenes or until I read xkbproto.pdf.

Closes #3079 for now

Signed-off-by: John Nunley <dev@notgull.net>
@notgull
Copy link
Member

notgull commented Sep 7, 2023

@notgull maybe the keymap stuff is not delivered?

I tried putting an explicit synchronization between the server and client before/after the event call, but nothing changes. My current working theory is that the XkbUseExtension internal function is doing something else that I don't quite understand yet.

kchibisov pushed a commit that referenced this issue Sep 7, 2023
The new implementation of select_xkb_events apparently misconfigures
the server. This commit does a temporary fix by just reverting it to its
previous implementation.

This is temporary until I can figure out what Xlib is doing behind the
scenes or until I read xkbproto.pdf.

Fixes: #3079
Signed-off-by: John Nunley <dev@notgull.net>
kchibisov pushed a commit to kchibisov/winit that referenced this issue Oct 17, 2023
The new implementation of select_xkb_events apparently misconfigures
the server. This commit does a temporary fix by just reverting it to its
previous implementation.

This is temporary until I can figure out what Xlib is doing behind the
scenes or until I read xkbproto.pdf.

Fixes: rust-windowing#3079
Signed-off-by: John Nunley <dev@notgull.net>
kchibisov pushed a commit that referenced this issue Oct 21, 2023
The new implementation of select_xkb_events apparently misconfigures
the server. This commit does a temporary fix by just reverting it to its
previous implementation.

This is temporary until I can figure out what Xlib is doing behind the
scenes or until I read xkbproto.pdf.

Fixes: #3079
Signed-off-by: John Nunley <dev@notgull.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B - bug Dang, that shouldn't have happened B - regression DS - x11
Development

Successfully merging a pull request may close this issue.

4 participants