-
Notifications
You must be signed in to change notification settings - Fork 73
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
Enhance keySyms #113
Enhance keySyms #113
Conversation
@@ -0,0 +1,35 @@ | |||
#!/bin/bash | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add set -e
Thanks! The code looks good but it's a major version and I don't know that's desirable. To keep compatibility the description could be inserted as comments |
I mean a major version change |
Thanks! I will update it now. |
* Direct translate from X.Org's xproto/keysymdef.h * Adds the key description as JSON data * Update examples where the `x11.keySyms` API changes
Oh I see. I understand the reason to store the description for pedagogic reasons, but does it make sense from a logical/API POV? |
Well, i believe that information can be useful for other things, like sys testing, sys configuration... Imagine a keyboard config gui... You can set chars for each key and the description will help the user to be sure about what they are doing. Well... there is an information. We can easily provide to the user. Lets give it and open more possibilities to the public. For sure my ideas are a small set of the human mindshare. :-p Separate the data will use more memory and will make the translation a kind bizarre... The API change is simple as you can see on the example updates that i did, but that is true. That is why i try to push a new version on my first push. But you should decide about the numbering. :-) |
Hey, a cool usage: You have a game with configurable inputs. The config UI can show the key description when it is not a simple letter. |
Yes, I can see the usefulness now. Thanks :) Yes, I understand that trying to keep the current API might not be nice nor optimal but not breaking the API can be good for the users of the module. I'm not totally against it. Let's see what @sidorares think. |
I'm probably ok with major version bump ( it's very trivial to upgrade for those who depend on x11.keySyms ). At the same time I'm still thinking if backwards-compatible solution would be better, for example add "descriptions" hash alongside to keysyms: var keySyms = x11.keySyms;
for (codeName in x11.keySyms) {
code = keySyms[codeName];
chr2Data[code] = { codeName: codeName, description: keysSyms.description[codeName] };
} |
Guys, how about to make I still prefer the API change, while the world domination is not accomplished, because any solution to maintain backwards compatibility, will add some extra complexity to the code. However, i'm not here to decide. :-) |
getter is actually a good idea. |
Lazily load is a great idea! I will add this feature. |
I'm ok with api breakage, it's pretty minor ( but we'll bump major version as its major in semver sense ) |
✨ Done! ✨ |
white = display.screen[0].white_pixel; // Will paint the window. | ||
|
||
// Get the local key mapping to build key2Data. | ||
X.GetKeyboardMapping(min, max-min, function(err, list) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw on error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talking about if (err) throw err
, or other line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Sorry if it's not clear. I mean in the callback of X.GetKeyboardMapping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ow ok... I was worried, thinking there was a bug. As it is a simple example, if the main data provider fail, there is no why to continue. So throw it.
One comment and it looks good to me |
hey @aurium I started looking at what actually happens when you change language layout ( for example, en->ru ) Few problems/suggestions here:
|
Hi @sidorares, I'm auto writing portuguese text with keysyms.js. The "char table" let us to know the key combination for any char, so i can write " Anyway, the decision is yours. What you think about this proposal? |
That's because latin1 keysyms are the same as corresponding unicode code points:
unfortunately not the case for codes outside of 0-255 range, X11 keysyms were created long before Unicode table and are different, so there is a need for translation table keysym -> unicode code point |
some future read for me: http://www.x.org/releases/X11R7.7/doc/libX11/XIM/xim.txt |
x11.keySyms
API changes