Page 1 of 1

Input under Linux

Posted: Thu Jul 05, 2007 09:52
by Durin
The problem is that Cegui´s Inputsystem works fine under Windows, but under Linux special letters as ö, ä and ü (german language) are not accepted as input in an editbox. The System just does nothing if this key is pressed. Under Windows it works fine so far.
Thx for help

Posted: Thu Jul 05, 2007 10:39
by Pompei2
If you are using SDL, I solved the same problem a few weeks ago. Do you use the SDL ?

Posted: Thu Jul 05, 2007 16:57
by Durin
I`m not using SDL. I use only the methods
CEGUI::System::getSingleton().injectKeyUp(evt.key),
CEGUI::System::getSingleton().injectKeyDown(evt.key) and
CEGUI::System::getSingleton().injectChar(evt.text);

Posted: Thu Jul 05, 2007 18:15
by Pompei2
Hmm, then it's probably your injectChar that is not called correctly. I guess the evt variable comes from the X-lib events ? I don't know much about this, but you need the X-lib to give you a unicode character. That means you need a function that:

if the hat sign ^ is pressed once, returns you 0 or NULL or whatever. so if this function returns that value, you skip the injectChar function call.

if after pressing the ^ key, the "e" key is pressed, the function has to return you the unicode (UTF8, i guess) value of "ê", so you pass it to injectChar.

Unfortunately I don't know X-lib very good. I think i saw such a function once, i'll go look for it this evening :)

Posted: Fri Jul 06, 2007 10:55
by Durin
I don't know X-lib at all. But if you could find this function to solve the problem and post it, it would make me happy ;-).

Posted: Fri Jul 06, 2007 11:17
by Pompei2
I'm really sorry, it is not the function. The function I had in my head (XKeysymToString) transforms it into a complete string, like "space".

Here is all I know, maybe it will help you in your search, maybe not:

Code: Select all

void eventCallback( XPointer /*priv*/, XRecordInterceptData *d )
{
   unsigned int detail = (((unsigned char *)d->data)[1]);

   // Gets you the keysym of the key that was pressed, I think
   // You will need the keysym to get the unicode keycode.
   XKeycodeToKeysym(pDisplay,detail,0);
}


But you are using the X-lib right ? I see you write your program for both windows and linux, so why don't you use the SDL ?

Posted: Fri Jul 06, 2007 22:08
by Durin
I solved the problem in another way. I added the functionality manually in my own inputhandler. It´s not very fine but i think it works. I have to test it (because i didn`t have a Linux system), but i hope it works.