Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_SystemX11.cpp
| Show First 20 Lines • Show All 672 Lines • ▼ Show 20 Lines | #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) | ||||
| if (m_xim) { | if (m_xim) { | ||||
| GHOST_WindowX11 * window = findGhostWindow(xevent.xany.window); | GHOST_WindowX11 * window = findGhostWindow(xevent.xany.window); | ||||
| if (window && !window->getX11_XIC() && window->createX11_XIC()) { | if (window && !window->getX11_XIC() && window->createX11_XIC()) { | ||||
| GHOST_PRINT("XIM input context created\n"); | GHOST_PRINT("XIM input context created\n"); | ||||
| if (xevent.type == KeyPress) | if (xevent.type == KeyPress) | ||||
| /* we can assume the window has input focus | /* we can assume the window has input focus | ||||
| * here, because key events are received only | * here, because key events are received only | ||||
| * when the window is focused. */ | * when the window is focused. */ | ||||
| XSetICFocus(window->getX11_XIC()); | window->setX11_ICFocus(true); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* dispatch event to XIM server */ | /* dispatch event to XIM server */ | ||||
| if ((XFilterEvent(&xevent, (Window)NULL) == True)) { | if ((XFilterEvent(&xevent, (Window)NULL) == True)) { | ||||
| /* do nothing now, the event is consumed by XIM. */ | /* do nothing now, the event is consumed by XIM. this triggers | ||||
| * setting spot location, may cause redrawing active region to calculate | |||||
| * its coordinates. */ | |||||
| GHOST_WindowX11 * window = findGhostWindow(xevent.xany.window); | |||||
| if (window) { | |||||
| pushEvent(new GHOST_EventKey( | |||||
| getMilliSeconds(), | |||||
| GHOST_kEventIMComposition, | |||||
| window, | |||||
| GHOST_kKeyUnknown, | |||||
| '\0', | |||||
| NULL)); | |||||
| anyProcessed = true; | |||||
| } | |||||
| continue; | continue; | ||||
| } | } | ||||
| #endif | #endif | ||||
| /* when using autorepeat, some keypress events can actually come *after* the | /* when using autorepeat, some keypress events can actually come *after* the | ||||
| * last keyrelease. The next code takes care of that */ | * last keyrelease. The next code takes care of that */ | ||||
| if (xevent.type == KeyRelease) { | if (xevent.type == KeyRelease) { | ||||
| m_last_release_keycode = xevent.xkey.keycode; | m_last_release_keycode = xevent.xkey.keycode; | ||||
| m_last_release_time = xevent.xkey.time; | m_last_release_time = xevent.xkey.time; | ||||
| ▲ Show 20 Lines • Show All 575 Lines • ▼ Show 20 Lines | case FocusOut: | ||||
| // printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window); | // printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window); | ||||
| /* May have to look at the type of event and filter some out. */ | /* May have to look at the type of event and filter some out. */ | ||||
| GHOST_TEventType gtype = (xfe.type == FocusIn) ? | GHOST_TEventType gtype = (xfe.type == FocusIn) ? | ||||
| GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate; | GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate; | ||||
| #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) | #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) | ||||
| XIC xic = window->getX11_XIC(); | window->setX11_ICFocus(xe->type == FocusIn ? true : false); | ||||
| if (xic) { | |||||
| if (xe->type == FocusIn) | |||||
| XSetICFocus(xic); | |||||
| else | |||||
| XUnsetICFocus(xic); | |||||
| } | |||||
| #endif | #endif | ||||
| g_event = new | g_event = new | ||||
| GHOST_Event( | GHOST_Event( | ||||
| getMilliSeconds(), | getMilliSeconds(), | ||||
| gtype, | gtype, | ||||
| window | window | ||||
| ); | ); | ||||
| ▲ Show 20 Lines • Show All 1,124 Lines • Show Last 20 Lines | |||||