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

Can't type non-latin symbols from keyboard in game on linux #7296

Closed
Nik-mmzd opened this issue Feb 28, 2019 · 32 comments · Fixed by #7086

Comments

@Nik-mmzd
Copy link

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

Version of OpenTTD

Compiled from adb50ce
Also 1.8.0 from openttd.org ("Linux Generic Binaries (x86_64, 64bit)" package)

Expected result

Russian letters in textbox (e.g. vehicle name)

Actual result

Nothing in textbox, keys act as hotkeys

Steps to reproduce

Set keyboard layout to russian

Additional info

#  cat /etc/os-release 
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
...
#  uname -a
Linux Raxacoricofallapatorius 4.20.12-arch1-1-ARCH #1 SMP PREEMPT Sat Feb 23 15:11:34 UTC 2019 x86_64 GNU/Linux
#  echo $LC_CTYPE 
ru_RU.UTF-8
#  echo $LANG    
ru_RU.UTF-8
#  echo $XDG_SESSION_TYPE 
x11
#  echo $XDG_SESSION_DESKTOP 
gnome

libinput 1.12.6, gnome 3.30.2

Any workaround? If I need to provide more data, just ask

@PeterN

This comment has been minimized.

Copy link
Member

@PeterN PeterN commented Feb 28, 2019

I can type non-latin characters using the compose key. That doesn't give me cyrillic characters though.

@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

image
There should be only © symbol... 🤔

UPD tried to manually type a letter using char code...
image
It allows to write a letter, but also writes all keys I typed except ctrl + shift + u.

Maybe something works incorrectly on my side or all should be as on screenshots above?

@Nik-mmzd Nik-mmzd changed the title Can't type non-latin symbols in game on linux Can't type non-latin symbols from keyboard in game on linux Feb 28, 2019
@PeterN

This comment has been minimized.

Copy link
Member

@PeterN PeterN commented Feb 28, 2019

Hmm, the ctrl-shift-u input method doesn't work at all for me in OpenTTD.

@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

ctrl - shift - u (just press), keycode (424 on screenshot above), space. Works for me.

@Eddi-z

This comment has been minimized.

Copy link
Contributor

@Eddi-z Eddi-z commented Feb 28, 2019

ctrl+shift+u doesn't do anything here either. must be some external program intercepting your input? that might cause weird effects like this.

@nielsmh

This comment has been minimized.

Copy link
Contributor

@nielsmh nielsmh commented Feb 28, 2019

Can the game otherwise show these characters? E.g. via language pack or town names generated/in a scenario?

@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

...Xorg?... ctrl-shift-u and compose key are X features, AFAIK
But main question is "how to fix typing russian letters from keyboard", I don't think anybody really will write symbols using ctrl-shift-u/compose key/smth like it

Yes, game can show this characters.
image
image
image
...and https://github.com/OpenTTD/OpenTTD/blob/master/src/lang/russian.txt

@Eddi-z

This comment has been minimized.

Copy link
Contributor

@Eddi-z Eddi-z commented Feb 28, 2019

@PeterN

This comment has been minimized.

Copy link
Member

@PeterN PeterN commented Feb 28, 2019

No indeed, but it might be related. Not all Xorg keyboard layouts enable the compose-key the same way, but I'm pretty sure ctrl-shift-u is not handled by Xorg but elsewhere.

@Eddi-z

This comment has been minimized.

Copy link
Contributor

@Eddi-z Eddi-z commented Feb 28, 2019

In my setup (opensuse, german keyboard) i can input all kinds of characters using AltGr key. (although most of them display as ? with sprite font)

For example AltGr+Shift+C gives me ©

@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

But the problem is typing russian letters from physical keyboard with russian keyboard layout in system...
Why we are talking about compose keys? I'm really confused a bit

@PeterN

This comment has been minimized.

Copy link
Member

@PeterN PeterN commented Feb 28, 2019

Yeah, so maybe something else is intercepting it?

@Eddi-z

This comment has been minimized.

Copy link
Contributor

@Eddi-z Eddi-z commented Feb 28, 2019

Why we are talking about compose keys?

Because most of us won't have a physical russian keyboard lying around to test this.

@nielsmh

This comment has been minimized.

Copy link
Contributor

@nielsmh nielsmh commented Feb 28, 2019

As far as I know, Cyrillic keyboards typically work via a hardware Cyrillic Lock key similar to Caps Lock on Latin-only keyboards?

@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

IDK because russian keyboard layout works in entire system including TTYs...
OpenTTD is first program that is'n able to handle russian input
PS it may be caused by some software upgrade like gnome or libinput... I will try with older software version

@nielsmh no =)
It is usual keyboard, without any additional keys =)
image

I mean I can't write russian letters from physical keyboard using russian keyboard layout in system while latin layout works well

@PeterN

This comment has been minimized.

Copy link
Member

@PeterN PeterN commented Feb 28, 2019

I've tested with my keyboard set to "ru" in Gnome, and I am able to enter cyrillic characters into OpenTTD.

@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

@PeterN I tried with older system and all works too
Maybe it caused by some library update? I'll try to downgrade libinput, but if it'll not help... IDK what package update could do this thing

@Eddi-z

This comment has been minimized.

Copy link
Contributor

@Eddi-z Eddi-z commented Feb 28, 2019

Have you tried looking at the link i posted? it might help isolating the problem if you could try that out

@ldpl

This comment has been minimized.

Copy link
Contributor

@ldpl ldpl commented Feb 28, 2019

I also had this bug at some point (I don't atm). And I spent some trying to fix it and was even reading X11 code for reference. Sadly, I don't remember the details anymore but I came to a conclusion that it's an SDL 1.2 bug that was fixed in SDL2. I can't find that exact bug on sdl bugtracker right now but I recall it was described is some technical terms as it's something to do with X11 sending those symbols differently and SDL failing to handle them correctly.

P.S. I was using -v allegro as a workaround.

@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

P.S. I was using -v allegro as a workaround.

You mean launching OpenTTD with this argument?

@ldpl

This comment has been minimized.

Copy link
Contributor

@ldpl ldpl commented Feb 28, 2019

@Nik-mmzd yeah, you can select allegro video driver if your openttd is compiled with it.
Ofc allegro has it's own issues but at least non-lating symbols work.

@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

if your openttd is compiled with it.

How to compile oTTD with allegro support?

@ldpl

This comment has been minimized.

Copy link
Contributor

@ldpl ldpl commented Feb 28, 2019

@Nik-mmzd you need to install allegro dev libraries and re-run ./configure, which should pick them up automatically and say checking allegro... found

Btw, check openttd --help first in case you already have it. It should look like that:

List of video drivers:
               sdl: SDL Video Driver
           allegro: Allegro Video Driver
         dedicated: Dedicated Video Driver
              null: Null Video Driver
@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

Also. I found one thing. If I'll press a key really fast it will sometimes print russian letters in input fields O_o
image

Btw, check openttd --help first in case you already have it. It should look like that:

Already checked =(

@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

@ldpl yes, all works with allegro =)
Thanks, will use it as work-around

@nikolas

This comment has been minimized.

Copy link
Contributor

@nikolas nikolas commented Feb 28, 2019

@Nik-mmzd you can also try using my SDL 2 branch if you want to experiment: https://github.com/nikolas/OpenTTD/tree/sdl2

I don't have a Russian keyboard to test this, so I'm curious if it works for you, or breaks in a different way. Text input is handled differently in SDL 2.

SDL 2 text input: https://github.com/nikolas/OpenTTD/blob/sdl2/src/video/sdl_v.cpp#L617
SDL 1.2: https://github.com/OpenTTD/OpenTTD/blob/master/src/video/sdl_v.cpp#L592

@nikolas

This comment has been minimized.

Copy link
Contributor

@nikolas nikolas commented Feb 28, 2019

By the way, I can get "ctrl-shift-u-4-2-4-space" to display Ф here in my browser (on Linux/XFCE), but not in OpenTTD. I'll see if I can find a way to reproduce this in OpenTTD..

@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Feb 28, 2019

@nikolas your SDL2 branch just "freeses" at first "frame"
image
With empty ~/.openttd

image
With ~/.openttd contains files from "usual" version. Music is playing, but nothing moves in game window

Nothing interesting in logs (just some warnings about ALSA and JACK)... Nothing happens on screen...

@nikolas

This comment has been minimized.

Copy link
Contributor

@nikolas nikolas commented Mar 4, 2019

@Nik-mmzd wow.. I haven't seen that before. Thanks for giving this a try.

There have been some significant changes with video rendering on this branch, so if you're up to it, you could try again with the latest code.

@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented Mar 4, 2019

@nikolas nothing changed for me: stuck at first rendered frame
Still nothing in the logs except ALSA/JACK warnings
Compiled from your SDL2 branch, commit 20a7e0c
Git log shows 3c94bdd, ebc3934, 20a7e0c as three last commits

@stale

This comment has been minimized.

Copy link

@stale stale bot commented May 3, 2019

This issue has been automatically marked as stale because it has not had any activity in the last two months.
If you believe the issue is still relevant, please test on the latest nightly and report back.
It will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@stale stale bot added the stale label May 3, 2019
@Nik-mmzd

This comment has been minimized.

Copy link
Author

@Nik-mmzd Nik-mmzd commented May 3, 2019

No, bot, no!
It still not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.