Skip to content

Fix for X11 keypad release behavior. - #114

Closed
nowl wants to merge 1 commit into
rust-windowing:masterfrom
nowl:master
Closed

nowl wants to merge 1 commit into
rust-windowing:masterfrom
nowl:master

Conversation

@nowl

@nowl nowl commented Jan 19, 2017

Copy link
Copy Markdown

Two changes:

  1. Xutf8LookupString is only defined for KeyPress not KeyRelease
  2. Uncommented the necessary keypad events in events.rs to map to the relevant VirtualKeyCode for a Release

Two changes:
  1. Xutf8LookupString is only defined for KeyPress not KeyRelease
  2. Uncommented the necessary keypad events in events.rs to map to the relevant VirtualKeyCode for a Release
jrmuizel pushed a commit to jrmuizel/winit that referenced this pull request Mar 29, 2017
Update cocoa to 0.7

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/glutin/114)
<!-- Reviewable:end -->
@Ralith

Ralith commented Apr 22, 2017 •

Copy link
Copy Markdown
Contributor

The new event mapping don't make much sense. If an X keysym doesn't exist in the winit keycode table, add it, don't map it to something else.

I've included a fix for 1 in #164.

@nowl

nowl commented Apr 22, 2017

Copy link
Copy Markdown
Author

Thanks for the comment. When I made this commit, keypad events weren't working in X11, so my intention was just to get those to work for a dependent project I was working on. My goal was just to make those events work with a minimal amount of effort and I was happy with the results. I'm sure there are better or more correct ways to do it, but I thought it would be valuable upstream to at least have keypad events working. If you have a better way to do this or it's already been fixed, then by all means ignore this pull request.

@Ralith

Ralith commented May 31, 2017

Copy link
Copy Markdown
Contributor

I now better understand the relationship between X11 KeySyms and winit's VirtualKeyCode. My criticism of your change was unfounded, because the VirtualKeyCode of a key probably should not vary according to modifier state. I'm not totally confident in a static mapping as proposed here working in all cases, but it would definitely be an improvement over the current state of affairs. A more robust fix might involve looking up keycodes against the active keymap while ignoring modifiers.

@elinorbgr

Copy link
Copy Markdown
Contributor

Is this still relevant? It looks like this PR has been dormant for a while now.

@francesca64

Copy link
Copy Markdown
Member

I'd say this is no longer relevant. The only part of it that's still applicable is the change to have numpad keys always produce the same VirtualKeyCode regardless of numlock state, which is really an API concern.

While I agree with @Ralith about modifiers not influencing VirtualKeyCode, winit's API doesn't provide a way to check whether or not numlock is active, and I'd say it's conceptually distinct from shift/ctrl/etc. Without numlock on, the meaning of the numpad keys is completely different.

The docs say VirtualKeyCode is for the semantic meaning of the key, and I'd argue that it's incorrect to treat the numpad keys as having the same meaning regardless of numlock state. For people who want to use the numpad for something akin to Blender's camera controls, using the scancode is more appropriate.

@francesca64

Copy link
Copy Markdown
Member

Closed via #396

tmfink pushed a commit to tmfink/winit that referenced this pull request Jan 5, 2022
tmfink pushed a commit to tmfink/winit that referenced this pull request Jan 5, 2022
madsmtm pushed a commit to madsmtm/winit that referenced this pull request Jun 11, 2022
…wing#114)

Co-authored-by: David Lemarier <david@lemarier.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants