kwin/plugins/platforms/x11/standalone/edge.h
Martin Flöser 4e9456a857 [platforms/x11] Fix incorrect screen edge approaching with switch desktop on window move
Summary:
There is a regression in WindowBasedEdge::soStopApproaching. Due to
only operate when the edge activates for pointer it is possible that
the cursor polling stays active. Explaining the situation:

1. Activate switch desktop when moving window
2. Start moving a window
3. Move mouse into the approach geometry
-> doStartApproaching activates as we are moving a window
4. stop moving window
-> doStopApproaching early exits as the position does not activate for
   pointer any more - we are not moving a window
-> cursor polling is still connected and whenever mouse enters edge
   approaching is started

The analysis shows that the check whether activates for pointer is wrong
in the case of stop approaching. If the edge started to approach, we also
need to stop approaching.

This change addresses the problem by turning the check into whether the
connection for cursor position update is set.

This is the third bug fix to the X11 screen edge handling after
introducing touch screen edges. This needs more manual testing by
everybody in the Plasma team who is still using X11.

BUG: 381849
FIXED-IN: 5.10.4

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6467
2017-07-06 19:12:28 +02:00

79 lines
2.3 KiB
C++

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2011 Arthur Arlt <a.arlt@stud.uni-heidelberg.de>
Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
Since the functionality provided in this class has been moved from
class Workspace, it is not clear who exactly has written the code.
The list below contains the copyright holders of the class Workspace.
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_EDGE_H
#define KWIN_EDGE_H
#include "screenedge.h"
#include "xcbutils.h"
namespace KWin
{
class WindowBasedEdge : public Edge
{
Q_OBJECT
public:
explicit WindowBasedEdge(ScreenEdges *parent);
virtual ~WindowBasedEdge();
quint32 window() const override;
/**
* The approach window is a special window to notice when get close to the screen border but
* not yet triggering the border.
**/
quint32 approachWindow() const override;
protected:
virtual void doGeometryUpdate();
virtual void doActivate() override;
virtual void doDeactivate() override;
virtual void doStartApproaching();
virtual void doStopApproaching();
virtual void doUpdateBlocking();
private:
void createWindow();
void createApproachWindow();
Xcb::Window m_window;
Xcb::Window m_approachWindow;
QMetaObject::Connection m_cursorPollingConnection;
};
inline quint32 WindowBasedEdge::window() const
{
return m_window;
}
inline quint32 WindowBasedEdge::approachWindow() const
{
return m_approachWindow;
}
}
#endif