wayland: show cursor if stylus is in proximity
While a stylus is in proximity we want to show its cursor. In this commit it only gets shown on move because for a still unknown reason the position is out of date before the first move event. BUG: 443921
This commit is contained in:
parent
5f16757090
commit
33f3a13a1a
4 changed files with 21 additions and 10 deletions
|
@ -123,7 +123,7 @@ set(kwin_SRCS
|
|||
syncalarmx11filter.cpp
|
||||
tablet_input.cpp
|
||||
toplevel.cpp
|
||||
touch_hide_cursor_spy.cpp
|
||||
hide_cursor_spy.cpp
|
||||
touch_input.cpp
|
||||
udev.cpp
|
||||
unmanaged.cpp
|
||||
|
|
|
@ -6,26 +6,27 @@
|
|||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "touch_hide_cursor_spy.h"
|
||||
#include "hide_cursor_spy.h"
|
||||
#include "main.h"
|
||||
#include "platform.h"
|
||||
#include "input_event.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
void TouchHideCursorSpy::pointerEvent(MouseEvent *event)
|
||||
void HideCursorSpy::pointerEvent(MouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
showCursor();
|
||||
}
|
||||
|
||||
void TouchHideCursorSpy::wheelEvent(KWin::WheelEvent *event)
|
||||
void HideCursorSpy::wheelEvent(KWin::WheelEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
showCursor();
|
||||
}
|
||||
|
||||
void TouchHideCursorSpy::touchDown(qint32 id, const QPointF &pos, quint32 time)
|
||||
void HideCursorSpy::touchDown(qint32 id, const QPointF &pos, quint32 time)
|
||||
{
|
||||
Q_UNUSED(id)
|
||||
Q_UNUSED(pos)
|
||||
|
@ -33,7 +34,16 @@ void TouchHideCursorSpy::touchDown(qint32 id, const QPointF &pos, quint32 time)
|
|||
hideCursor();
|
||||
}
|
||||
|
||||
void TouchHideCursorSpy::showCursor()
|
||||
void HideCursorSpy::tabletToolEvent(TabletEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::Type::TabletLeaveProximity) {
|
||||
hideCursor();
|
||||
} else {
|
||||
showCursor();
|
||||
}
|
||||
}
|
||||
|
||||
void HideCursorSpy::showCursor()
|
||||
{
|
||||
if (!m_cursorHidden) {
|
||||
return;
|
||||
|
@ -42,7 +52,7 @@ void TouchHideCursorSpy::showCursor()
|
|||
kwinApp()->platform()->showCursor();
|
||||
}
|
||||
|
||||
void TouchHideCursorSpy::hideCursor()
|
||||
void HideCursorSpy::hideCursor()
|
||||
{
|
||||
if (m_cursorHidden) {
|
||||
return;
|
|
@ -12,12 +12,13 @@
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
class TouchHideCursorSpy : public InputEventSpy
|
||||
class HideCursorSpy : public InputEventSpy
|
||||
{
|
||||
public:
|
||||
void pointerEvent(KWin::MouseEvent *event) override;
|
||||
void wheelEvent(KWin::WheelEvent *event) override;
|
||||
void touchDown(qint32 id, const QPointF &pos, quint32 time) override;
|
||||
void tabletToolEvent(TabletEvent *event) override;
|
||||
|
||||
private:
|
||||
void showCursor();
|
|
@ -23,7 +23,7 @@
|
|||
#include "pointer_input.h"
|
||||
#include "session.h"
|
||||
#include "tablet_input.h"
|
||||
#include "touch_hide_cursor_spy.h"
|
||||
#include "hide_cursor_spy.h"
|
||||
#include "touch_input.h"
|
||||
#include "x11client.h"
|
||||
#ifdef KWIN_BUILD_TABBOX
|
||||
|
@ -2455,7 +2455,7 @@ void InputRedirection::setupInputFilters()
|
|||
installInputEventFilter(new VirtualTerminalFilter);
|
||||
}
|
||||
if (waylandServer()) {
|
||||
installInputEventSpy(new TouchHideCursorSpy);
|
||||
installInputEventSpy(new HideCursorSpy);
|
||||
installInputEventSpy(new UserActivitySpy);
|
||||
if (hasGlobalShortcutSupport) {
|
||||
installInputEventFilter(new TerminateServerFilter);
|
||||
|
|
Loading…
Reference in a new issue