redox-os / orbtk

The Rust UI-Toolkit.
MIT License
3.78k stars 188 forks source link

TextBox doesn't allow upper-case nor shift+digit (eg !, @, #, ...) #162

Closed shadiakiki1986 closed 4 years ago

shadiakiki1986 commented 4 years ago

Describe the bug Entering upper-case characters or shift+digit (eg !, @, #, ...) doesn't work

To Reproduce Steps to reproduce the behavior:

  1. cargo run --example widgets
  2. Type "ABCdef!@#" in the text box
  3. See "abcdef123" show up instead

Expected behavior Should see "ABC!@#"

Desktop (please complete the following information):

Additional info: From the issue Text box doesn't filter numbers, I would guess that there is a feature somewhere to filter the input text. Not sure how to disable it or how it gets enabled in the first place. Just guessing though.

Kaiden42 commented 4 years ago

I noticed the same bug using the german Neo2 as a keyboard layout. It's not possible to type the characters of layer 2 to 6, which need a combination of Shift, Mod3 (Capslock), and Mod4 (Alt Gr) to be typed.

Desktop: Linux Mint 19.3 Cinnamon Edition

Keyboard layout: https://neo-layout.org/

Update: I traced the problem towards line 70 of crates/shell/src/minifb/mod.rs where the InputCallBack of minifb is used.

impl minifb::InputCallback for KeyInputCallBack {
    fn add_char(&mut self, uni_char: u32) {
        if let Some(key_event) = unicode_to_key_event(uni_char) {
            self.key_events.borrow_mut().push(key_event);
        }
    }
}

Minifb only gives the key as an unicode value of the key pressed. Regardless of modifying keys like shift.

FloVanGH commented 4 years ago

!, @, # should work now.

mpolosak commented 4 years ago

it still happens to me

mpolosak commented 4 years ago

and it doesn't support typing number using numpad

kivimango commented 4 years ago

numpad and some other keys missing from the keyboard map, the PR is coming to address this.

FloVanGH commented 4 years ago

@kivimango ', /, \, [, ], {, } will be added after my branch is merged. I think this will be done in the next days.