Added support for X11 compose key (Multi_key). This change fixes

the handling of compose key sequences.  The key presses were
suppressed but not the corresponding releases, confusing the
clients.  It also adds support for generating keysyms via the
compose key if the necessary dead keys or Mode_switch are not
available.
This commit is contained in:
crs
2004-11-04 21:26:43 +00:00
parent 4be95841d2
commit bdd3635f4b
6 changed files with 285 additions and 58 deletions

View File

@@ -334,6 +334,7 @@ CXWindowsScreen::leave()
if (m_ic != NULL) {
XmbResetIC(m_ic);
XSetICFocus(m_ic);
m_filtered.clear();
}
// now off screen
@@ -876,6 +877,18 @@ CXWindowsScreen::handleSystemEvent(const CEvent& event, void*)
// now filter the event
if (XFilterEvent(xevent, None)) {
if (xevent->type == KeyPress) {
// add filtered presses to the filtered list
m_filtered.insert(m_lastKeycode);
}
return;
}
// discard matching key releases for key presses that were
// filtered and remove them from our filtered list.
else if (xevent->type == KeyRelease &&
m_filtered.count(xevent->xkey.keycode) > 0) {
m_filtered.erase(xevent->xkey.keycode);
return;
}
}
@@ -1030,14 +1043,26 @@ CXWindowsScreen::onKeyPress(XKeyEvent& xkey)
// get which button. see call to XFilterEvent() in onEvent()
// for more info.
bool isFake = false;
KeyButton keycode = static_cast<KeyButton>(xkey.keycode);
if (keycode == 0) {
isFake = true;
keycode = static_cast<KeyButton>(m_lastKeycode);
if (keycode == 0) {
// no keycode
return;
}
}
// handle key
m_keyState->sendKeyEvent(getEventTarget(),
true, false, key, mask, 1, keycode);
// do fake release if this is a fake press
if (isFake) {
m_keyState->sendKeyEvent(getEventTarget(),
false, false, key, mask, 1, keycode);
}
}
}