Improve event handling for screen edge activation on XCB

It still doesn't trigger properly - might be fixed if KDE/4.11 gets
merged into this branch again.
This commit is contained in:
Martin Gräßlin 2013-08-01 11:36:38 +02:00
parent c16c0c3753
commit d90d0f5c8e
3 changed files with 13 additions and 28 deletions

View file

@ -341,7 +341,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
QWhatsThis::leaveWhatsThisMode();
}
#ifdef KWIN_BUILD_SCREENEDGES
if (ScreenEdges::self()->isEntered(e))
if (ScreenEdges::self()->isEntered(reinterpret_cast<xcb_enter_notify_event_t*>(e)))
return true;
#endif
break;
@ -401,7 +401,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
return true; // always eat these, they would tell Qt that KWin is the active app
case XCB_CLIENT_MESSAGE:
#ifdef KWIN_BUILD_SCREENEDGES
if (ScreenEdges::self()->isEntered(e))
if (ScreenEdges::self()->isEntered(reinterpret_cast<xcb_client_message_event_t*>(e)))
return true;
#endif
break;

View file

@ -966,36 +966,20 @@ void ScreenEdges::check(const QPoint &pos, const QDateTime &now, bool forceNoPus
}
}
bool ScreenEdges::isEntered(XEvent* e)
bool ScreenEdges::isEntered(xcb_enter_notify_event_t *event)
{
if (e->type == EnterNotify) {
return handleEnterNotifiy(e->xcrossing.window,
QPoint(e->xcrossing.x_root, e->xcrossing.y_root),
QDateTime::fromMSecsSinceEpoch(e->xcrossing.time));
}
if (e->type == ClientMessage) {
if (e->xclient.message_type == atoms->xdnd_position) {
return handleDndNotify(e->xclient.window,
QPoint(e->xclient.data.l[2] >> 16, e->xclient.data.l[2] & 0xffff));
}
}
return false;
return handleEnterNotifiy(event->event,
QPoint(event->root_x, event->root_y),
QDateTime::fromMSecsSinceEpoch(event->time));
}
bool ScreenEdges::isEntered(xcb_generic_event_t *e)
bool ScreenEdges::isEntered(xcb_client_message_event_t *event)
{
if (e->response_type == XCB_ENTER_NOTIFY) {
xcb_enter_notify_event_t *event = reinterpret_cast<xcb_enter_notify_event_t*>(e);
return handleEnterNotifiy(event->event,
QPoint(event->root_x, event->root_y),
QDateTime::fromMSecsSinceEpoch(event->time));
if (event->type != atoms->xdnd_position) {
return false;
}
if (e->response_type == XCB_CLIENT_MESSAGE) {
xcb_client_message_event_t *event = reinterpret_cast<xcb_client_message_event_t*>(e);
return handleDndNotify(event->window,
QPoint(event->data.data32[2] >> 16, event->data.data32[2] & 0xffff));
}
return false;
return handleDndNotify(event->window,
QPoint(event->data.data32[2] >> 16, event->data.data32[2] & 0xffff));
}
bool ScreenEdges::handleEnterNotifiy(xcb_window_t window, const QPoint &point, const QDateTime &timestamp)

View file

@ -257,8 +257,9 @@ public:
* It may switch to another virtual desktop.
* @param e the X event which is passed to this method.
*/
bool isEntered(XEvent * e);
bool isEntered(xcb_generic_event_t *e);
bool isEntered(xcb_enter_notify_event_t *e);
bool isEntered(xcb_client_message_event_t *e);
/**
* Returns a QVector of all existing screen edge windows