-
Notifications
You must be signed in to change notification settings - Fork 946
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
Add an example of activating XIM #204
Conversation
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.
Looks good, but I think this raises the question though of whether XIM should just work out of the box without the user having to set locale manually. Could use more feedback on that aspect.
examples/xim.rs
Outdated
fn main() { | ||
let mut events_loop = winit::EventsLoop::new(); | ||
unsafe { | ||
libc::setlocale(libc::LC_CTYPE, b"\0".as_ptr() as *const _); |
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.
Might be nice to have a comment that passing an empty string will cause the locale to be set from environment variables. Ditto for XSetLocaleModifiers
.
User usually don't have to set |
The build test failed due to missing x11-dl crate. But x11-dl is in deps, could anybody explain why? (BTW, it passed cargo test on my machine). |
Because this only works on |
I think work out of the box is good, SDL2 also do so. |
@quininer adding it at the beginning of the file does not help because it will create an empty file so test will fail on non-linux platform. Is there any way of preventing it from running the test? I'm new to Rust, so not familiar with such options. |
Maybe you can create a new crate under |
I don't think an example should be added for such an obscure thing, especially considering that the example is both unsafe and platform-specific. |
It may be obscure to you, but IME support is an often requested feature for CJK users. Suggesting that it's obscure seems disrespectful for those that rely on it.
Those seem like reasons to open a new issue about having a safe, cross-platform API for achieving this and not a reason for closing a PR about XIM example. |
That's probably just ignorance by myself, as I thought this example was supposed to demonstrate some sort of way of overwriting the default key mapping. IME is supposed to work out of the box. |
It would be nice if it did, but it currently does not, and something along these lines is necessary. Unfortunately working out of the box would require calling |
This follows up and closes #195.
To make this example work, one should ensure he/she configures
LC_CTYPE
andXMODIFIERS
correctly in environment. An example isLC_CTYPE=zh_CN.utf8
andXMODIFIERS='@im=fcitx'
for fcitx-base IMEs.