Ensure pointer position is updated before screen locker enforcement

We need to update the pointer position, also if the screen is locked.
Otherwise the pointer doesn't move on the locked screen with libinput.

In addition we need to use the m_globalPointer for finding the correct
lock screen window as updatePointerWindow also does sanity checking on
the coordinates.

Also we need to introduce security checks where we use the signal.

REVIEW: 126103
This commit is contained in:
Martin Gräßlin 2015-11-18 14:30:32 +01:00
parent 3be016fba4
commit 4d883a9cda
2 changed files with 14 additions and 6 deletions

View file

@ -702,22 +702,22 @@ void InputRedirection::processPointerMotion(const QPointF &pos, uint32_t time)
return;
}
// first update to new mouse position
// const QPointF oldPos = m_globalPointer;
updatePointerPosition(pos);
if (waylandServer()->isScreenLocked()) {
Toplevel *t = findToplevel(pos.toPoint());
Toplevel *t = findToplevel(m_globalPointer.toPoint());
if (t && t->surface()) {
if (auto seat = findSeat()) {
seat->setFocusedPointerSurface(t->surface(), t->pos());
seat->setTimestamp(time);
seat->setPointerPos(pos);
seat->setPointerPos(m_globalPointer);
}
}
return;
}
// first update to new mouse position
// const QPointF oldPos = m_globalPointer;
updatePointerPosition(pos);
// TODO: check which part of KWin would like to intercept the event
QMouseEvent event(QEvent::MouseMove, m_globalPointer.toPoint(), m_globalPointer.toPoint(),
Qt::NoButton, qtButtonStates(), keyboardModifiers());

View file

@ -39,6 +39,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "utils.h"
#include <workspace.h>
#include "virtualdesktops.h"
#ifndef KWIN_UNIT_TEST
#include "wayland_server.h"
#endif
// DBus generated
#include "screenlocker_interface.h"
// frameworks
@ -599,6 +602,11 @@ AreaBasedEdge::~AreaBasedEdge()
void AreaBasedEdge::pointerPosChanged(const QPointF &pos)
{
#ifndef KWIN_UNIT_TEST
if (waylandServer() && waylandServer()->isScreenLocked()) {
return;
}
#endif
if (!isReserved()) {
return;
}