diff -Naur Irrlicht/CIrrDeviceLinux.cpp Irrlicht.new/CIrrDeviceLinux.cpp --- Irrlicht/CIrrDeviceLinux.cpp 2005-07-10 00:19:06.786097113 +0200 +++ Irrlicht.new/CIrrDeviceLinux.cpp 2005-07-10 01:04:33.183719755 +0200 @@ -5,6 +5,8 @@ #include "CIrrDeviceLinux.h" #ifdef LINUX +#include +#include #include "IEventReceiver.h" #include "irrList.h" @@ -339,6 +341,27 @@ XMapRaised(display, window); } +#if 0 + xic=NULL; + if (XSupportsLocale()) + { + XIM xim = XOpenIM(display, NULL, NULL, NULL); + XIMStyles *supp_styles; + XGetIMValues(xim, XNQueryInputStyle, &supp_styles, NULL); + char **missing_charsets; + int num_missing_charsets=0; + char *default_string; + XFontSet fontset = XCreateFontSet(display,"-*-*-*-*-*-*-*-130-75-75-*-*-*-*",&missing_charsets, &num_missing_charsets,&default_string); + if (num_missing_charsets>0) + printf("Missing fonts\n"); + XVaNestedList list = XVaCreateNestedList(0, XNFontSet, fontset, NULL); + xic = XCreateIC(xim, XNInputStyle, *supp_styles, + XNClientWindow, window, + XNStatusAttributes, list, NULL); + XFree(list); + } +#endif + #ifdef _IRR_COMPILE_WITH_OPENGL_ if (DriverType == video::EDT_OPENGL) { @@ -489,36 +512,26 @@ case KeyRelease: case KeyPress: - { - SKeyMap mp; - //mp.X11Key = XLookupKeysym(&event.xkey, 0); - KeySym k; - char buf [4]; - int len = XLookupString (&event.xkey, buf, sizeof buf, &k, NULL) ; - mp.X11Key = k; - - s32 idx = KeyMap.binary_search(mp); - - if (idx != -1) - { - irrevent.EventType = irr::EET_KEY_INPUT_EVENT; - irrevent.KeyInput.Key = (EKEY_CODE)KeyMap[idx].Win32Key; - irrevent.KeyInput.PressedDown = (event.type == KeyPress); - - //irrevent.KeyInput.Char = mp.X11Key; - - irrevent.KeyInput.Char = (len>0 ? buf[0] : 0); - irrevent.KeyInput.Control = (event.xkey.state & ControlMask) != 0; - if (irrevent.KeyInput.Control) - irrevent.KeyInput.Char = (irrevent.KeyInput.Char & 0x1f) + '@'; - - postEventFromUser(irrevent); - } - else - os::Printer::log("Could not find win32 key for x11 key.", ELL_WARNING); - } + { + SKeyMap mp; + //mp.X11Key = XLookupKeysym(&event.xkey, 0); + char buf [5]="\0\0\0\0"; + int len = XLookupString(&event.xkey, buf, 4, &mp.X11Key, NULL); + + s32 idx = KeyMap.binary_search(mp); + + if (idx != -1) + irrevent.KeyInput.Key = (EKEY_CODE)KeyMap[idx].Win32Key; + else + os::Printer::log("Could not find win32 key for x11 key.", ELL_WARNING); + irrevent.EventType = irr::EET_KEY_INPUT_EVENT; + irrevent.KeyInput.PressedDown = (event.type == KeyPress); + mbtowc(&irrevent.KeyInput.Char,buf,4); + irrevent.KeyInput.Control = (event.xkey.state & ControlMask) != 0; + irrevent.KeyInput.Shift = (event.xkey.state & ShiftMask) != 0; + postEventFromUser(irrevent); + } break; - case ClientMessage: if (*XGetAtomName(display, event.xclient.message_type) == *wmDeleteWindow) @@ -820,7 +833,7 @@ KeyMap.push_back(SKeyMap(XK_Clear, KEY_CLEAR)); KeyMap.push_back(SKeyMap(XK_Return, KEY_RETURN)); KeyMap.push_back(SKeyMap(XK_Pause, KEY_PAUSE)); - KeyMap.push_back(SKeyMap(XK_Scroll_Lock, 0)); // ??? + KeyMap.push_back(SKeyMap(XK_Scroll_Lock, KEY_SCROLL)); KeyMap.push_back(SKeyMap(XK_Sys_Req, 0)); // ??? KeyMap.push_back(SKeyMap(XK_Escape, KEY_ESCAPE)); KeyMap.push_back(SKeyMap(XK_Delete, KEY_DELETE)); @@ -887,20 +900,30 @@ KeyMap.push_back(SKeyMap(XK_Shift_R, KEY_RSHIFT)); KeyMap.push_back(SKeyMap(XK_Control_L, KEY_LCONTROL)); KeyMap.push_back(SKeyMap(XK_Control_R, KEY_RCONTROL)); + KeyMap.push_back(SKeyMap(XK_Caps_Lock, KEY_CAPITAL)); + KeyMap.push_back(SKeyMap(XK_Shift_Lock, KEY_CAPITAL)); + KeyMap.push_back(SKeyMap(XK_Meta_L, KEY_LWIN)); + KeyMap.push_back(SKeyMap(XK_Meta_R, KEY_RWIN)); + KeyMap.push_back(SKeyMap(XK_Alt_L, KEY_LMENU)); + KeyMap.push_back(SKeyMap(XK_Alt_R, KEY_RMENU)); + KeyMap.push_back(SKeyMap(XK_ISO_Level3_Shift, KEY_RMENU)); + KeyMap.push_back(SKeyMap(XK_Menu, KEY_MENU)); KeyMap.push_back(SKeyMap(XK_space, KEY_SPACE)); KeyMap.push_back(SKeyMap(XK_exclam, 0)); //? KeyMap.push_back(SKeyMap(XK_quotedbl, 0)); //? + KeyMap.push_back(SKeyMap(XK_section, 0)); //? KeyMap.push_back(SKeyMap(XK_numbersign, 0)); //? KeyMap.push_back(SKeyMap(XK_dollar, 0)); //? KeyMap.push_back(SKeyMap(XK_percent, 0)); //? KeyMap.push_back(SKeyMap(XK_ampersand, 0)); //? KeyMap.push_back(SKeyMap(XK_apostrophe, 0)); //? KeyMap.push_back(SKeyMap(XK_parenleft, 0)); //? + KeyMap.push_back(SKeyMap(XK_parenright, 0)); //? KeyMap.push_back(SKeyMap(XK_asterisk, 0)); //? - KeyMap.push_back(SKeyMap(XK_plus, 0)); //? - KeyMap.push_back(SKeyMap(XK_comma, 0)); //? - KeyMap.push_back(SKeyMap(XK_minus, 0)); //? - KeyMap.push_back(SKeyMap(XK_period, 0)); //? + KeyMap.push_back(SKeyMap(XK_plus, KEY_PLUS)); + KeyMap.push_back(SKeyMap(XK_comma, KEY_COMMA)); + KeyMap.push_back(SKeyMap(XK_minus, KEY_MINUS)); + KeyMap.push_back(SKeyMap(XK_period, KEY_PERIOD)); KeyMap.push_back(SKeyMap(XK_slash, 0)); //? KeyMap.push_back(SKeyMap(XK_0, KEY_KEY_0)); KeyMap.push_back(SKeyMap(XK_1, KEY_KEY_1)); @@ -919,6 +942,8 @@ KeyMap.push_back(SKeyMap(XK_greater, 0)); //? KeyMap.push_back(SKeyMap(XK_question, 0)); //? KeyMap.push_back(SKeyMap(XK_at, 0)); //? + KeyMap.push_back(SKeyMap(XK_mu, 0)); //? + KeyMap.push_back(SKeyMap(XK_EuroSign, 0)); //? KeyMap.push_back(SKeyMap(XK_A, KEY_KEY_A)); KeyMap.push_back(SKeyMap(XK_B, KEY_KEY_B)); KeyMap.push_back(SKeyMap(XK_C, KEY_KEY_C)); @@ -945,12 +970,17 @@ KeyMap.push_back(SKeyMap(XK_X, KEY_KEY_X)); KeyMap.push_back(SKeyMap(XK_Y, KEY_KEY_Y)); KeyMap.push_back(SKeyMap(XK_Z, KEY_KEY_Z)); + KeyMap.push_back(SKeyMap(XK_Adiaeresis, 0)); //? + KeyMap.push_back(SKeyMap(XK_Odiaeresis, 0)); //? + KeyMap.push_back(SKeyMap(XK_Udiaeresis, 0)); //? KeyMap.push_back(SKeyMap(XK_bracketleft, 0)); //? KeyMap.push_back(SKeyMap(XK_backslash, 0)); //? KeyMap.push_back(SKeyMap(XK_bracketright, 0)); //? KeyMap.push_back(SKeyMap(XK_asciicircum, 0)); //? + KeyMap.push_back(SKeyMap(XK_degree, 0)); //? KeyMap.push_back(SKeyMap(XK_underscore, 0)); //? KeyMap.push_back(SKeyMap(XK_grave, 0)); //? + KeyMap.push_back(SKeyMap(XK_acute, 0)); //? KeyMap.push_back(SKeyMap(XK_quoteleft, 0)); //? KeyMap.push_back(SKeyMap(XK_a, KEY_KEY_A)); KeyMap.push_back(SKeyMap(XK_b, KEY_KEY_B)); @@ -978,6 +1008,10 @@ KeyMap.push_back(SKeyMap(XK_x, KEY_KEY_X)); KeyMap.push_back(SKeyMap(XK_y, KEY_KEY_Y)); KeyMap.push_back(SKeyMap(XK_z, KEY_KEY_Z)); + KeyMap.push_back(SKeyMap(XK_ssharp, 0)); //? + KeyMap.push_back(SKeyMap(XK_adiaeresis, 0)); //? + KeyMap.push_back(SKeyMap(XK_odiaeresis, 0)); //? + KeyMap.push_back(SKeyMap(XK_udiaeresis, 0)); //? KeyMap.sort(); } diff -Naur Irrlicht/CIrrDeviceLinux.h Irrlicht.new/CIrrDeviceLinux.h --- Irrlicht/CIrrDeviceLinux.h 2005-07-10 00:18:38.493077466 +0200 +++ Irrlicht.new/CIrrDeviceLinux.h 2005-07-10 01:01:18.065160339 +0200 @@ -222,6 +222,7 @@ unsigned int width, height, depth; bool close; + XIC xic; struct SKeyMap { SKeyMap() {} @@ -230,7 +231,7 @@ { } - s32 X11Key; + KeySym X11Key; s32 Win32Key; bool operator<(const SKeyMap& o) const