From 334cf10d7d75e5d067c953e058d8e44fc2ffabbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 26 Jul 2013 10:04:53 +0200 Subject: [PATCH] Enable Key Press/Release events Requires review 373d812a636da898a0f1cc017fa2c9dd4ff50381 on kdelibs frameworks. --- events.cpp | 10 +++++----- tabbox/tabbox.cpp | 10 +++++----- tabbox/tabbox.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/events.cpp b/events.cpp index c1b22a4801..1cd1517d07 100644 --- a/events.cpp +++ b/events.cpp @@ -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(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(e)); return true; } #endif break; +#if KWIN_QT5_PORTING case ConfigureNotify: if (e->xconfigure.event == rootWindow()) x_stacking_dirty = true; diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index 62b0b9e284..ad4f524cbf 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -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); } diff --git a/tabbox/tabbox.h b/tabbox/tabbox.h index bfcf031c2e..d8860068c6 100644 --- a/tabbox/tabbox.h +++ b/tabbox/tabbox.h @@ -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);