Enable Key Press/Release events

Requires review 373d812a636da898a0f1cc017fa2c9dd4ff50381 on
kdelibs frameworks.
This commit is contained in:
Martin Gräßlin 2013-07-26 10:04:53 +02:00
parent 485f0a3e06
commit 334cf10d7d
3 changed files with 11 additions and 11 deletions

View file

@ -136,11 +136,10 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
#endif
break;
}
#if KWIN_QT5_PORTING
case KeyPress: {
case XCB_KEY_PRESS: {
was_user_interaction = true;
int keyQt;
KKeyServer::xEventToQt(e, &keyQt);
KKeyServer::xcbKeyPressEventToQt(reinterpret_cast<xcb_key_press_event_t*>(e), &keyQt);
// kDebug(125) << "Workspace::keyPress( " << keyQt << " )";
if (movingClient) {
movingClient->keyPressEvent(keyQt);
@ -154,15 +153,16 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
#endif
break;
}
case KeyRelease:
case XCB_KEY_RELEASE:
was_user_interaction = true;
#ifdef KWIN_BUILD_TABBOX
if (TabBox::TabBox::self()->isGrabbed()) {
TabBox::TabBox::self()->keyRelease(e->xkey);
TabBox::TabBox::self()->keyRelease(reinterpret_cast<xcb_key_release_event_t*>(e));
return true;
}
#endif
break;
#if KWIN_QT5_PORTING
case ConfigureNotify:
if (e->xconfigure.event == rootWindow())
x_stacking_dirty = true;

View file

@ -1489,12 +1489,12 @@ void TabBox::reject()
/*!
Handles alt-tab / control-tab releasing
*/
void TabBox::keyRelease(const XKeyEvent& ev)
void TabBox::keyRelease(const xcb_key_release_event_t *ev)
{
if (m_noModifierGrab) {
return;
}
unsigned int mk = ev.state &
unsigned int mk = ev->state &
(KKeyServer::modXShift() |
KKeyServer::modXCtrl() |
KKeyServer::modXAlt() |
@ -1504,8 +1504,8 @@ void TabBox::keyRelease(const XKeyEvent& ev)
// modifiers are released: only one modifier is active and the currently released
// key is this modifier - if yes, release the grab
int mod_index = -1;
for (int i = ShiftMapIndex;
i <= Mod5MapIndex;
for (int i = XCB_MAP_INDEX_SHIFT;
i <= XCB_MAP_INDEX_5;
++i)
if ((mk & (1 << i)) != 0) {
if (mod_index >= 0)
@ -1519,7 +1519,7 @@ void TabBox::keyRelease(const XKeyEvent& ev)
XModifierKeymap* xmk = XGetModifierMapping(display());
for (int i = 0; i < xmk->max_keypermod; i++)
if (xmk->modifiermap[xmk->max_keypermod * mod_index + i]
== ev.keycode)
== ev->detail)
release = true;
XFreeModifiermap(xmk);
}

View file

@ -174,7 +174,7 @@ public:
int nextDesktopStatic(int iDesktop) const;
int previousDesktopStatic(int iDesktop) const;
void keyPress(int key);
void keyRelease(const XKeyEvent& ev);
void keyRelease(const xcb_key_release_event_t *ev);
static TabBox *self();
static TabBox *create(QObject *parent);