Any chanse to get Alt key with non-latin characters working with GTK backend?

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
unxed
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Dec 09, 2019 8:48 pm

Any chanse to get Alt key with non-latin characters working with GTK backend?

Post by unxed » Mon Dec 09, 2019 9:00 pm

There is long standing bug in wx (http://trac.wxwidgets.org/ticket/17643) with key events (EVT_KEY_DOWN/EVT_KEY_UP/EVT_CHAR) do not fireing if letter key is pressed together with Alt and non-latin keyboard layout is selected.

For example, you can not bind event listener to shortcuts like "alt+б" (russian letter, placed on "," key).

Okay, menu shortcuts are keyboard layout independent, so this can be used to workaround an issue (if you do not want menu, just an action on key combination, you can create hidden menu with shorcuts for all needed keys), but you can't bind menu shortcut to non-alphanumeric keys like ",".

The only solution I found is to check for next keypresses via wxGetKeyState() every 10000 usecs in a separate thread if Alt keypress was fired previously. But this is CPU consuming and looks like an ugly hack.

May be there are some better solutions? Thanks.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4374
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Any chanse to get Alt key with non-latin characters working with GTK backend?

Post by ONEEYEMAN » Mon Dec 09, 2019 10:47 pm

Hi,
What's your wx version?
Can you try Git master? I think Vadim fixed this problem recently...

Thank you.

unxed
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Dec 09, 2019 8:48 pm

Re: Any chanse to get Alt key with non-latin characters working with GTK backend?

Post by unxed » Tue Dec 10, 2019 7:56 am

ONEEYEMAN wrote:
Mon Dec 09, 2019 10:47 pm
Hi,
What's your wx version?
Can you try Git master? I think Vadim fixed this problem recently...

Thank you.
Thanks for quick reply! I am building with 3.0 which is default on Ubuntu 18.04.
I have never built wx by myself, will try to digg into it :)

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4374
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Any chanse to get Alt key with non-latin characters working with GTK backend?

Post by ONEEYEMAN » Tue Dec 10, 2019 6:13 pm

Hi,
This is very simple.

1. Install git client package
2. Clone wxWidgets repository (documentation at wxWidgets.org explains how to do that. See: http://www.wxwidgets.org/develop/code-repository/)
3. Do this:

cd wxWidgets && mkdir buildGTK && cd buildGTK && ../configure --enable-debug && make -j2

4. Do this after successful completion of the previous command(s):

cd samples/text && make -j2 && ./minimal

I presume the text sample is the one where you can easily see the problem.

Thank you.

unxed
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Dec 09, 2019 8:48 pm

Re: Any chanse to get Alt key with non-latin characters working with GTK backend?

Post by unxed » Wed Dec 11, 2019 9:34 am

ONEEYEMAN wrote:
Tue Dec 10, 2019 6:13 pm
1. Install git client package
2. Clone wxWidgets repository (documentation at wxWidgets.org explains how to do that. See: http://www.wxwidgets.org/develop/code-repository/)
3. Do this:
cd wxWidgets && mkdir buildGTK && cd buildGTK && ../configure --enable-debug && make -j2
cd samples/text && make -j2 && ./minimal
Successfully got Alt+"б" KeyUp event in text sample with wx from git, thanks again!

unxed
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Dec 09, 2019 8:48 pm

Re: Any chanse to get Alt key with non-latin characters working with GTK backend?

Post by unxed » Wed Dec 11, 2019 2:57 pm

ONEEYEMAN wrote:
Mon Dec 09, 2019 10:47 pm
I think Vadim fixed this problem recently...
Still there is a minor issue in this case: event.GetKeyCode() for such key combinations (like Alt+"б") always return zero. event.GetUnicodeKey() values are correct though, so still usable, but a bit annoying. Should I open a new bug report about this, or it is expected behavour?

Also EVT_CHAR events are fired for Alt+latin_letters and not fired for Alt+non_latin_letters.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4374
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Any chanse to get Alt key with non-latin characters working with GTK backend?

Post by ONEEYEMAN » Wed Dec 11, 2019 3:25 pm

Hi,
Try to send an e-mail to wx-users ML first. There you will catch core developers of the library (Vadim included) and you will get a responce whether it is a bug(s) or expected behavior.

Thank you.

unxed
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Dec 09, 2019 8:48 pm

Re: Any chanse to get Alt key with non-latin characters working with GTK backend?

Post by unxed » Sat Dec 21, 2019 12:35 pm

ONEEYEMAN wrote:
Wed Dec 11, 2019 3:25 pm
Hi,
Try to send an e-mail to wx-users ML first. There you will catch core developers of the library (Vadim included) and you will get a responce whether it is a bug(s) or expected behavior.

Thank you.
Hope I am doing it right :) https://groups.google.com/forum/#!topic ... H5qzP5mxtM

User avatar
doublemax
Moderator
Moderator
Posts: 15095
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Any chanse to get Alt key with non-latin characters working with GTK backend?

Post by doublemax » Sat Dec 21, 2019 12:50 pm

Yes, your message is visible. Thanks.

But don't expect responses as fast as here on the forum, especially around the holidays.
Use the source, Luke!

Post Reply