Merge with develop
This commit is contained in:
parent
83f8502b51
commit
2d2c79a2b3
1 changed files with 31 additions and 55 deletions
|
@ -37,10 +37,8 @@ static Atom XA_WM_DELETE_WINDOW = 0;
|
|||
|
||||
namespace NLMISC {
|
||||
|
||||
CUnixEventEmitter::CUnixEventEmitter ():_dpy(NULL), _win(0), _driver(NULL)
|
||||
CUnixEventEmitter::CUnixEventEmitter ():_dpy(NULL), _win(0), _im(NULL), _ic(NULL), _driver(NULL)
|
||||
{
|
||||
_im = 0;
|
||||
_ic = 0;
|
||||
_SelectionOwned = false;
|
||||
}
|
||||
|
||||
|
@ -84,26 +82,36 @@ void CUnixEventEmitter::createIM()
|
|||
|
||||
XModifierKeymap *g_mod_map = XGetModifierMapping(_dpy);
|
||||
|
||||
char *modifiers = XSetLocaleModifiers(getenv("XMODIFIERS"));
|
||||
_im = XOpenIM(_dpy, NULL, NULL, NULL);
|
||||
|
||||
if (_im == NULL)
|
||||
{
|
||||
XSetLocaleModifiers("@im=local");
|
||||
|
||||
_im = XOpenIM(_dpy, NULL, NULL, NULL);
|
||||
|
||||
if (_im == NULL)
|
||||
{
|
||||
XSetLocaleModifiers("@im=");
|
||||
|
||||
_im = XOpenIM(_dpy, NULL, NULL, NULL);
|
||||
|
||||
if (_im == NULL)
|
||||
{
|
||||
nlwarning("XOpenIM failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_im)
|
||||
{
|
||||
_ic = XCreateIC(_im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, _win, XNFocusWindow, _win, NULL);
|
||||
// XSetICFocus(_ic);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ic = 0;
|
||||
nlwarning("XCreateIM failed");
|
||||
}
|
||||
|
||||
if (!_ic)
|
||||
{
|
||||
nlwarning("XCreateIC failed");
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -159,12 +167,8 @@ static Bool isMouseMoveEvent(Display *display, XEvent *event, XPointer arg)
|
|||
}
|
||||
|
||||
#ifndef AltMask
|
||||
# ifdef NL_OS_MAC
|
||||
# define AltMask (8192)
|
||||
# else
|
||||
# define AltMask (Mod1Mask)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
TMouseButton getMouseButton (uint32 state)
|
||||
{
|
||||
|
@ -194,33 +198,6 @@ TKey getKeyFromKeycode (uint keycode)
|
|||
// keycodes are depending on system
|
||||
switch (keycode)
|
||||
{
|
||||
#ifdef NL_OS_MAC
|
||||
/*
|
||||
TODO use key mapping from driver/opengl/mac/cocoa_adapter.mm
|
||||
*/
|
||||
case 0x12: return Key1;
|
||||
case 0x13: return Key2;
|
||||
case 0x14: return Key3;
|
||||
case 0x15: return Key4;
|
||||
case 0x16: return Key6;
|
||||
case 0x17: return Key5;
|
||||
case 0x18: return KeyEQUALS;
|
||||
case 0x19: return Key9;
|
||||
case 0x1a: return Key7;
|
||||
case 0x1c: return Key8;
|
||||
case 0x1d: return Key0;
|
||||
case 0x1e: return KeyRBRACKET;
|
||||
case 0x21: return KeyLBRACKET;
|
||||
case 0x27: return KeyAPOSTROPHE;
|
||||
case 0x29: return KeySEMICOLON;
|
||||
case 0x2a: return KeyBACKSLASH;
|
||||
case 0x2b: return KeyCOMMA;
|
||||
case 0x2c: return KeySLASH;
|
||||
case 0x2f: return KeyPERIOD;
|
||||
// case 0x5e: return KeyOEM_102;
|
||||
// case 0x30: return KeyTILDE;
|
||||
// case 0x3d: return KeyPARAGRAPH;
|
||||
#else
|
||||
case 0x0a: return Key1;
|
||||
case 0x0b: return Key2;
|
||||
case 0x0c: return Key3;
|
||||
|
@ -271,7 +248,6 @@ TKey getKeyFromKeycode (uint keycode)
|
|||
case 0x38: return KeyB;
|
||||
case 0x39: return KeyN;
|
||||
case 0x3a: return KeyM;
|
||||
#endif
|
||||
default:
|
||||
// nlwarning("missing keycode 0x%x %d '%c'", keycode, keycode, keycode);
|
||||
break;
|
||||
|
@ -548,11 +524,11 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server)
|
|||
_PressedKeys[key] = true;
|
||||
|
||||
// don't send a control character when deleting
|
||||
if (key == KeyDELETE)
|
||||
c = 0;
|
||||
if (key == KeyDELETE) c = 0;
|
||||
}
|
||||
|
||||
Text[c] = '\0';
|
||||
|
||||
if (c > 0)
|
||||
{
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
|
|
Loading…
Reference in a new issue