GTK+UTF-8+UNICODE= Key event проблемка.

Это русская секция форума wxWidjets. В этой секции вы можете обсуждать любые вопросы, связанные с wxWidgets на вашем родном языке.
Post Reply
esp
Earned a small fee
Earned a small fee
Posts: 13
Joined: Thu May 24, 2007 9:50 am

GTK+UTF-8+UNICODE= Key event проблемка.

Post by esp » Tue Mar 25, 2008 5:20 pm

Привет братцы.
Очень рад увидеть здесь раздел для русскоязычных.

Повторю свой вопрос по-русски. По-английски никто не ответил.

wxWidgets 2.8.6 GTK сборка под ubuntu 7.10 юникод.
(вообще этот глюк везде в wxwidgets есть в линуксах)

Берем собираем sample "keyboard".
Переключаемся на русский. В ивент от нажатия русских букв приходит байда:


"Char event:NUL (flags = ----) (raw key code/flags: 3213029900 and 0x0)"

Key event-а вообще нет.

В английской раскладке естественно все ок. Оба ивента и как положено.


Вообще много вопросов под линуксом - много чего не работает.
В основном писали под вин32 - сейчас портанули проект под wxGTK - все вообщем то работает - но куча мелочей - типа этого.
Last edited by esp on Wed Mar 26, 2008 9:17 am, edited 1 time in total.

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

Post by ONEEYEMAN » Tue Mar 25, 2008 6:57 pm

I'm guessing the default language is English?
What happen if you set Russian as default?

Thank you.

esp
Earned a small fee
Earned a small fee
Posts: 13
Joined: Thu May 24, 2007 9:50 am

Post by esp » Wed Mar 26, 2008 9:06 am

ONEEYEMAN wrote:I'm guessing the default language is English?
What happen if you set Russian as default?
Default language is Russian.
LANG=ru_RU.UTF-8 is you meant it.


The same thing if I set default keyboard Russian instead of English.


What you mean "as default"?

WBW.

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

Post by ONEEYEMAN » Wed Mar 26, 2008 3:11 pm

In K (GNOME,FireFox,...) set the initial keyboard layout to Russian.
Start the program, test it then change the layout to English while the program runs.

Thank you.

esp
Earned a small fee
Earned a small fee
Posts: 13
Joined: Thu May 24, 2007 9:50 am

Post by esp » Wed Mar 26, 2008 9:54 pm

ONEEYEMAN wrote:In K (GNOME,FireFox,...) set the initial keyboard layout to Russian.
Start the program, test it then change the layout to English while the program runs.
The same.

In screenshot I pressed key '1' and then 'q' in Russian layout.

wxGTK complited with "configure --with-gtk --enable-unicode --with-gnome-print --with-gnomeprintui"

BTW, in sources wxGTK - how i can grab messages from wxLogTrace?
May be I'll fix it.

WBW.
Attachments
keyb.png

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

Post by ONEEYEMAN » Wed Mar 26, 2008 10:41 pm

OK,
2 questions:
1. What happen if you start the app with English keyboard?
2. What hapen if you change the layout from Russian to English during the app run?

Thank you.

esp
Earned a small fee
Earned a small fee
Posts: 13
Joined: Thu May 24, 2007 9:50 am

Post by esp » Thu Mar 27, 2008 1:29 am

ONEEYEMAN wrote:OK,
2 questions:
1. What happen if you start the app with English keyboard?
Everything ok. All events from all keys fine.
2. What hapen if you change the layout from Russian to English during the app run?
First of all, events from keys which switch layout (for example Ctrl-Shift) then digits and func keys works fine - keys with letters dont send key events at all and char NUL events.

If switch back in English layout - everything fine with keys.


Another words, key events does not work with russian layout from letters keys.



P.S.:

Finally I found why.

/wxGTK-2.8.7/src/gtk/window.cpp


static inline bool wxIsAsciiKeysym(KeySym ks)
{
return ks < 256;
}


This is incorrect for russian keys.


and

// These are used when transforming Ctrl-alpha to ascii values 1-26
inline bool wxIsLowerChar(int code)
{
return (code >= 'a' && code <= 'z' );
}

inline bool wxIsUpperChar(int code)
{
return (code >= 'A' && code <= 'Z' );
}



and in gtk_wxwindow_commit_cb


for( const wxChar* pstr = data; *pstr; pstr++ )
{
#if wxUSE_UNICODE
event.m_uniChar = *pstr;
// Backward compatible for ISO-8859-1
event.m_keyCode = *pstr < 256 ? event.m_uniChar : 0;
wxLogTrace(TRACE_KEYS, _T("IM sent character '%c'"), event.m_uniChar);
#else
event.m_keyCode = *pstr;
#endif // wxUSE_UNICODE



Why 256???



P.P.S:


I set to 10240 these two places and look at it!!!
Attachments
keyb1.png

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

Post by ONEEYEMAN » Thu Mar 27, 2008 4:40 pm

It's probably not just for Russian.
Check the trunk and post to [wx-dev] about it...

Thank you.

esp
Earned a small fee
Earned a small fee
Posts: 13
Joined: Thu May 24, 2007 9:50 am

Post by esp » Wed Apr 02, 2008 3:57 pm

Как бы обратить внимание разработчиков на эту проблему? Help.

EmulateKeyPress тоже криво работает. Игнорит русскую раскладку полностью.

Я у себя пофиксил - но как бы это в проект засунуть.

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

Post by ONEEYEMAN » Wed Apr 02, 2008 4:19 pm

All you need is either post to [email protected] or submit a bug at https://sourceforge.net/tracker/?group_ ... tid=109863 with the patch that resolves it.

Thank you.

P.S.: Also check the trunk. Maybe it's already fixed there... :)

Post Reply