Client: Update last input device on tablet tool tap
When user uses tablet exclusively to navigate in an app, the last tracked input device will be null. As the result, any popup that requires a popup grab will be backed by an xdg-toplevel rather than an xdg-popup. Fixes: QTBUG-111130 Change-Id: Ib87e732603bbe111c584361357727171825f8c68 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
c2cd7eb609
commit
8a6ef48e39
@ -84,6 +84,7 @@ public:
|
||||
|
||||
uint32_t capabilities() const { return mCaps; }
|
||||
|
||||
QWaylandDisplay *display() const { return mQDisplay; }
|
||||
struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); }
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
|
@ -27,6 +27,7 @@ QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDev
|
||||
|
||||
QWaylandTabletSeatV2::QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat)
|
||||
: QtWayland::zwp_tablet_seat_v2(manager->get_tablet_seat(seat->wl_seat()))
|
||||
, m_seat(seat)
|
||||
{
|
||||
}
|
||||
|
||||
@ -53,7 +54,7 @@ void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tablet_added(zwp_tablet_v2 *id)
|
||||
|
||||
void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tool_added(zwp_tablet_tool_v2 *id)
|
||||
{
|
||||
auto *tool = new QWaylandTabletToolV2(id);
|
||||
auto *tool = new QWaylandTabletToolV2(this, id);
|
||||
m_tools.push_back(tool);
|
||||
connect(tool, &QWaylandTabletToolV2::destroyed, this, [this, tool] { m_tools.removeOne(tool); });
|
||||
}
|
||||
@ -76,8 +77,9 @@ void QWaylandTabletV2::zwp_tablet_v2_removed()
|
||||
delete this;
|
||||
}
|
||||
|
||||
QWaylandTabletToolV2::QWaylandTabletToolV2(::zwp_tablet_tool_v2 *tool)
|
||||
QWaylandTabletToolV2::QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool)
|
||||
: QtWayland::zwp_tablet_tool_v2(tool)
|
||||
, m_tabletSeat(tabletSeat)
|
||||
{
|
||||
}
|
||||
|
||||
@ -163,8 +165,14 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_out()
|
||||
|
||||
void QWaylandTabletToolV2::zwp_tablet_tool_v2_down(uint32_t serial)
|
||||
{
|
||||
Q_UNUSED(serial);
|
||||
m_pending.down = true;
|
||||
|
||||
if (m_pending.proximitySurface) {
|
||||
if (QWaylandWindow *window = m_pending.proximitySurface->waylandWindow()) {
|
||||
QWaylandInputDevice *seat = m_tabletSeat->seat();
|
||||
seat->display()->setLastInputDevice(seat, serial, window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QWaylandTabletToolV2::zwp_tablet_tool_v2_up()
|
||||
|
@ -52,12 +52,15 @@ public:
|
||||
explicit QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat);
|
||||
~QWaylandTabletSeatV2() override;
|
||||
|
||||
QWaylandInputDevice *seat() const { return m_seat; }
|
||||
|
||||
protected:
|
||||
void zwp_tablet_seat_v2_tablet_added(struct ::zwp_tablet_v2 *id) override;
|
||||
void zwp_tablet_seat_v2_tool_added(struct ::zwp_tablet_tool_v2 *id) override;
|
||||
void zwp_tablet_seat_v2_pad_added(struct ::zwp_tablet_pad_v2 *id) override;
|
||||
|
||||
private:
|
||||
QWaylandInputDevice *m_seat;
|
||||
QList<QWaylandTabletV2 *> m_tablets;
|
||||
QList<QWaylandTabletToolV2 *> m_tools;
|
||||
QList<QWaylandTabletPadV2 *> m_pads;
|
||||
@ -81,7 +84,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QObject, public QtWay
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QWaylandTabletToolV2(::zwp_tablet_tool_v2 *tool);
|
||||
QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool);
|
||||
|
||||
protected:
|
||||
void zwp_tablet_tool_v2_type(uint32_t tool_type) override;
|
||||
@ -105,6 +108,7 @@ protected:
|
||||
void zwp_tablet_tool_v2_frame(uint32_t time) override;
|
||||
|
||||
private:
|
||||
QWaylandTabletSeatV2 *m_tabletSeat;
|
||||
|
||||
// Static state (sent before done event)
|
||||
QPointingDevice::PointerType m_pointerType = QPointingDevice::PointerType::Unknown;
|
||||
|
Loading…
x
Reference in New Issue
Block a user