Page 1 of 1

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

Posted: Tue Mar 25, 2008 5:20 pm
by esp
Привет братцы.
Очень рад увидеть здесь раздел для русскоязычных.

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

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 - все вообщем то работает - но куча мелочей - типа этого.

Posted: Tue Mar 25, 2008 6:57 pm
by ONEEYEMAN
I'm guessing the default language is English?
What happen if you set Russian as default?

Thank you.

Posted: Wed Mar 26, 2008 9:06 am
by esp
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.

Posted: Wed Mar 26, 2008 3:11 pm
by ONEEYEMAN
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.

Posted: Wed Mar 26, 2008 9:54 pm
by esp
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.

Posted: Wed Mar 26, 2008 10:41 pm
by ONEEYEMAN
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.

Posted: Thu Mar 27, 2008 1:29 am
by esp
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!!!

Posted: Thu Mar 27, 2008 4:40 pm
by ONEEYEMAN
It's probably not just for Russian.
Check the trunk and post to [wx-dev] about it...

Thank you.

Posted: Wed Apr 02, 2008 3:57 pm
by esp
Как бы обратить внимание разработчиков на эту проблему? Help.

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

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

Posted: Wed Apr 02, 2008 4:19 pm
by ONEEYEMAN
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... :)