Client: Expose default input device through integration
Expose the whole default input device to clients. [ChangeLog][QPA plugin] Expose default input device to clients through the QPA API. Change-Id: I2608178f8b0ac09f766434588a280bcc2b30627d Reviewed-by: Johan Helsing <johan.helsing@qt.io>
This commit is contained in:
parent
4da93aa94f
commit
43a13f3d97
@ -442,6 +442,21 @@ QWaylandInputDevice::Touch *QWaylandInputDevice::createTouch(QWaylandInputDevice
|
||||
return new Touch(device);
|
||||
}
|
||||
|
||||
QWaylandInputDevice::Keyboard *QWaylandInputDevice::keyboard() const
|
||||
{
|
||||
return mKeyboard;
|
||||
}
|
||||
|
||||
QWaylandInputDevice::Pointer *QWaylandInputDevice::pointer() const
|
||||
{
|
||||
return mPointer;
|
||||
}
|
||||
|
||||
QWaylandInputDevice::Touch *QWaylandInputDevice::touch() const
|
||||
{
|
||||
return mTouch;
|
||||
}
|
||||
|
||||
void QWaylandInputDevice::handleEndDrag()
|
||||
{
|
||||
if (mTouch)
|
||||
|
@ -148,6 +148,10 @@ public:
|
||||
virtual Pointer *createPointer(QWaylandInputDevice *device);
|
||||
virtual Touch *createTouch(QWaylandInputDevice *device);
|
||||
|
||||
Keyboard *keyboard() const;
|
||||
Pointer *pointer() const;
|
||||
Touch *touch() const;
|
||||
|
||||
private:
|
||||
QWaylandDisplay *mQDisplay = nullptr;
|
||||
struct wl_display *mDisplay = nullptr;
|
||||
@ -248,6 +252,8 @@ public:
|
||||
|
||||
Qt::KeyboardModifiers modifiers() const;
|
||||
|
||||
struct ::wl_keyboard *wl_keyboard() { return QtWayland::wl_keyboard::object(); }
|
||||
|
||||
private slots:
|
||||
void handleFocusDestroyed();
|
||||
void handleFocusLost();
|
||||
@ -284,6 +290,8 @@ public:
|
||||
#endif
|
||||
QWaylandInputDevice *seat() const { return mParent; }
|
||||
|
||||
struct ::wl_pointer *wl_pointer() { return QtWayland::wl_pointer::object(); }
|
||||
|
||||
protected:
|
||||
void pointer_enter(uint32_t serial, struct wl_surface *surface,
|
||||
wl_fixed_t sx, wl_fixed_t sy) override;
|
||||
@ -377,6 +385,8 @@ public:
|
||||
bool allTouchPointsReleased();
|
||||
void releasePoints();
|
||||
|
||||
struct ::wl_touch *wl_touch() { return QtWayland::wl_touch::object(); }
|
||||
|
||||
QWaylandInputDevice *mParent = nullptr;
|
||||
QPointer<QWaylandWindow> mFocus;
|
||||
QList<QWindowSystemInterface::TouchPoint> mTouchPoints;
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "qwaylanddisplay_p.h"
|
||||
#include "qwaylandwindowmanagerintegration_p.h"
|
||||
#include "qwaylandscreen_p.h"
|
||||
#include "qwaylandinputdevice_p.h"
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include <QtGui/QScreen>
|
||||
#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
|
||||
@ -76,6 +77,27 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re
|
||||
if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration())
|
||||
return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay);
|
||||
|
||||
if (lowerCaseResource == "wl_seat")
|
||||
return m_integration->display()->defaultInputDevice()->wl_seat();
|
||||
if (lowerCaseResource == "wl_keyboard") {
|
||||
auto *keyboard = m_integration->display()->defaultInputDevice()->keyboard();
|
||||
if (keyboard)
|
||||
return keyboard->wl_keyboard();
|
||||
return nullptr;
|
||||
}
|
||||
if (lowerCaseResource == "wl_pointer") {
|
||||
auto *pointer = m_integration->display()->defaultInputDevice()->pointer();
|
||||
if (pointer)
|
||||
return pointer->wl_pointer();
|
||||
return nullptr;
|
||||
}
|
||||
if (lowerCaseResource == "wl_touch") {
|
||||
auto *touch = m_integration->display()->defaultInputDevice()->touch();
|
||||
if (touch)
|
||||
return touch->wl_touch();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user