[kwin] Listen to mouse motion events in the screenedge windows

Problem description: if a window decoration is in the screenedge
(not really unlikely for maximized windows) we either did not get
mouse events to the decoration or the screenedge window. E.g. the
enter event didn't reach the approach window which means it doesn't
get unmapped and thus the motion events in that area are not passed
to the decoration below. The same happened for the screenedge window,
the enter event was just not delivered if there is a window decoration
in the edge.

To solve this problem we listen for motion events in the approach and
the edge window and pass them from the event filter to the screen edges.
If one of our windows contains that the position of the motion event
we trigger the edge just in the same way as we do with the enter event.
This commit is contained in:
Martin Gräßlin 2014-02-01 10:03:49 +01:00
parent 7c7f137832
commit 0b32e5e57d
2 changed files with 10 additions and 2 deletions

View file

@ -193,6 +193,8 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
#ifdef KWIN_BUILD_SCREENEDGES
if (QWidget::mouseGrabber()) {
ScreenEdges::self()->check(rootPos, QDateTime::fromMSecsSinceEpoch(xTime()), true);
} else {
ScreenEdges::self()->check(rootPos, QDateTime::fromMSecsSinceEpoch(mouseEvent->time));
}
#endif
break;

View file

@ -469,7 +469,7 @@ void WindowBasedEdge::createWindow()
const uint32_t mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
const uint32_t values[] = {
true,
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | XCB_EVENT_MASK_POINTER_MOTION
};
m_window.create(geometry(), XCB_WINDOW_CLASS_INPUT_ONLY, mask, values);
m_window.map();
@ -490,7 +490,7 @@ void WindowBasedEdge::createApproachWindow()
const uint32_t mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
const uint32_t values[] = {
true,
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | XCB_EVENT_MASK_POINTER_MOTION
};
m_approachWindow.create(approachGeometry(), XCB_WINDOW_CLASS_INPUT_ONLY, mask, values);
m_approachWindow.map();
@ -964,6 +964,12 @@ void ScreenEdges::unreserve(ElectricBorder border, QObject *object)
void ScreenEdges::check(const QPoint &pos, const QDateTime &now, bool forceNoPushBack)
{
for (QList<WindowBasedEdge*>::iterator it = m_edges.begin(); it != m_edges.end(); ++it) {
if (!(*it)->isReserved()) {
continue;
}
if ((*it)->approachGeometry().contains(pos)) {
(*it)->startApproaching();
}
(*it)->check(pos, now, forceNoPushBack);
}
}