From d3342c6897f369441068df53f599658f29b0b96a Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 29 Nov 2021 18:59:06 +0200 Subject: [PATCH] Append "pointer" to AbstractClient::{enterEvent,leaveEvent} KWin handles several types of pointing input devices, e.g. mice, tablets, etc. As is, enterEvent and leaveEvent are very ambiguous. This change prepends "pointer" to those methods to make it explicit that they handle pointer enter/leave events. --- src/abstract_client.cpp | 4 ++-- src/abstract_client.h | 4 ++-- src/events.cpp | 4 ++-- src/pointer_input.cpp | 6 +++--- src/touch_input.cpp | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp index d21612ab59..704764a7f3 100644 --- a/src/abstract_client.cpp +++ b/src/abstract_client.cpp @@ -2516,7 +2516,7 @@ void AbstractClient::setDecoratedClient(QPointer< Decoration::DecoratedClientImp m_decoration.client = client; } -void AbstractClient::enterEvent(const QPoint &globalPos) +void AbstractClient::pointerEnterEvent(const QPoint &globalPos) { if (options->isShadeHover()) { cancelShadeHoverTimer(); @@ -2544,7 +2544,7 @@ void AbstractClient::enterEvent(const QPoint &globalPos) } } -void AbstractClient::leaveEvent() +void AbstractClient::pointerLeaveEvent() { cancelAutoRaise(); workspace()->cancelDelayFocus(); diff --git a/src/abstract_client.h b/src/abstract_client.h index 56695dc806..67fb701060 100644 --- a/src/abstract_client.h +++ b/src/abstract_client.h @@ -598,8 +598,8 @@ public: void endInteractiveMoveResize(); void keyPressEvent(uint key_code); - void enterEvent(const QPoint &globalPos); - void leaveEvent(); + void pointerEnterEvent(const QPoint &globalPos); + void pointerLeaveEvent(); /** * These values represent positions inside an area diff --git a/src/events.cpp b/src/events.cpp index 9bfd0872ed..b15aa5734a 100644 --- a/src/events.cpp +++ b/src/events.cpp @@ -679,7 +679,7 @@ void X11Client::enterNotifyEvent(xcb_enter_notify_event_t *e) if (e->mode == XCB_NOTIFY_MODE_NORMAL || (e->mode == XCB_NOTIFY_MODE_UNGRAB && MOUSE_DRIVEN_FOCUS)) { #undef MOUSE_DRIVEN_FOCUS - enterEvent(QPoint(e->root_x, e->root_y)); + pointerEnterEvent(QPoint(e->root_x, e->root_y)); return; } } @@ -712,7 +712,7 @@ void X11Client::leaveNotifyEvent(xcb_leave_notify_event_t *e) } } if (lostMouse) { - leaveEvent(); + pointerLeaveEvent(); if (isDecorated()) { // sending a move instead of a leave. With leave we need to send proper coords, with move it's handled internally QHoverEvent leaveEvent(QEvent::HoverMove, QPointF(-1, -1), QPointF(-1, -1), Qt::NoModifier); diff --git a/src/pointer_input.cpp b/src/pointer_input.cpp index 657f6f6073..b7fbe4f350 100644 --- a/src/pointer_input.cpp +++ b/src/pointer_input.cpp @@ -198,7 +198,7 @@ void PointerInputRedirection::updateToReset() } if (focus()) { if (AbstractClient *c = qobject_cast(focus())) { - c->leaveEvent(); + c->pointerLeaveEvent(); } disconnect(m_focusGeometryConnection); m_focusGeometryConnection = QMetaObject::Connection(); @@ -568,7 +568,7 @@ static bool s_cursorUpdateBlocking = false; void PointerInputRedirection::focusUpdate(Toplevel *focusOld, Toplevel *focusNow) { if (AbstractClient *ac = qobject_cast(focusOld)) { - ac->leaveEvent(); + ac->pointerLeaveEvent(); breakPointerConstraints(ac->surface()); disconnectPointerConstraintsConnection(); } @@ -576,7 +576,7 @@ void PointerInputRedirection::focusUpdate(Toplevel *focusOld, Toplevel *focusNow m_focusGeometryConnection = QMetaObject::Connection(); if (AbstractClient *ac = qobject_cast(focusNow)) { - ac->enterEvent(m_pos.toPoint()); + ac->pointerEnterEvent(m_pos.toPoint()); } if (internalWindow()) { diff --git a/src/touch_input.cpp b/src/touch_input.cpp index 8331f4d31a..f00421958d 100644 --- a/src/touch_input.cpp +++ b/src/touch_input.cpp @@ -85,13 +85,13 @@ void TouchInputRedirection::focusUpdate(Toplevel *focusOld, Toplevel *focusNow) // TODO: handle pointer grab aka popups if (AbstractClient *ac = qobject_cast(focusOld)) { - ac->leaveEvent(); + ac->pointerLeaveEvent(); } disconnect(m_focusGeometryConnection); m_focusGeometryConnection = QMetaObject::Connection(); if (AbstractClient *ac = qobject_cast(focusNow)) { - ac->enterEvent(m_lastPosition.toPoint()); + ac->pointerEnterEvent(m_lastPosition.toPoint()); workspace()->updateFocusMousePosition(m_lastPosition.toPoint()); }