10#if QT_CONFIG(draganddrop)
11#include <QtWaylandCompositor/QWaylandDrag>
13#include <QtWaylandCompositor/QWaylandTouch>
14#include <QtWaylandCompositor/QWaylandPointer>
15#include <QtWaylandCompositor/QWaylandKeymap>
16#include <QtWaylandCompositor/private/qwaylandseat_p.h>
17#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
18#include <QtWaylandCompositor/private/qwaylandkeyboard_p.h>
19#if QT_CONFIG(wayland_datadevice)
20#include <QtWaylandCompositor/private/qwldatadevice_p.h>
22#include <QtWaylandCompositor/private/qwaylandutils_p.h>
46 if (capabilities != caps) {
47 QWaylandSeat::CapabilityFlags changed = caps ^ capabilities;
62 QList<Resource *> resources = resourceMap().values();
63 for (
int i = 0;
i < resources.size();
i++) {
64 wl_seat::send_capabilities(resources.at(
i)->handle, (uint32_t)capabilities);
72#if QT_CONFIG(wayland_datadevice)
78 data_device->add(client,
id, 1);
90 wl_seat::send_capabilities(resource->handle, (uint32_t)capabilities);
155 d->capabilities = capabilityFlags;
181 d->init(
d->compositor->display(), 4);
190 d->isInitialized =
true;
201 return d->isInitialized;
210 d->pointer->sendMousePressEvent(
button);
219 d->pointer->sendMouseReleaseEvent(
button);
229 d->pointer->sendMouseMoveEvent(
view, localPos, outputSpacePos);
238 d->pointer->sendMouseWheelEvent(orientation, delta);
247 d->keyboard->sendKeyPressEvent(code);
256 d->keyboard->sendKeyReleaseEvent(code);
273 if (
d->touch.isNull())
276 return d->touch->sendTouchPointEvent(surface,
id, point,
state);
395 if (!
d->touch.isNull())
396 d->touch->sendFrameEvent(client);
411 if (!
d->touch.isNull())
412 d->touch->sendCancelEvent(client);
430 d->touch->sendFullTouchEvent(surface,
event);
446 qWarning(
"Cannot send key event, no keyboard focus, fix the compositor");
452 &&
event->nativeScanCode() == 0) {
463 if (textInputMethod) {
471 if (textInputV3 && !
event->text().isEmpty()) {
485 if (!
d->keyboard.isNull() && !
event->isAutoRepeat()) {
487 uint scanCode =
event->nativeScanCode();
489 scanCode =
d->keyboard->keyToScanCode(
event->key());
492 qWarning() <<
"Can't send Wayland key event: Unable to get a valid scan code";
498 d->keyboard->sendKeyPressEvent(scanCode);
500 d->keyboard->sendKeyReleaseEvent(scanCode);
526 qWarning(
"Cannot send Wayland key event, no keyboard focus, fix the compositor");
530 if (
auto scanCode =
d->keyboard->keyToScanCode(
qtKey)) {
532 d->keyboard->sendKeyPressEvent(scanCode);
534 d->keyboard->sendKeyReleaseEvent(scanCode);
560void QWaylandSeat::sendUnicodeKeyPressEvent(
uint unicode)
585void QWaylandSeat::sendUnicodeKeyReleaseEvent(
uint unicode)
598 qWarning(
"Can't send a unicode key event, no keyboard focus, fix the compositor");
603 text += QChar::fromUcs4(
static_cast<char32_t>(unicode));
616 if (textInputMethod) {
634 qWarning() <<
"Can't send a unicode key event: Unable to find a text-input protocol.";
644 return d->keyboard.data();
653 if (
d->keyboard.isNull() || !
d->keyboard->focus())
656 return d->keyboard->focus();
671 if (surface == oldSurface)
674 d->keyboardFocus = surface;
675 if (!
d->keyboard.isNull())
676 d->keyboard->setFocus(surface);
677#if QT_CONFIG(wayland_datadevice)
679 d->data_device->setFocus(surface ? surface->
client() :
nullptr);
693 return d->keymap.data();
702 return d->pointer.data();
711 return d->touch.data();
720 return d->mouseFocus;
729 if (
view ==
d->mouseFocus)
733 d->mouseFocus =
view;
749 return d->compositor;
755#if QT_CONFIG(draganddrop)
759 return d->drag_handle.data();
769 return d->capabilities;
787 if (
auto p = QtWayland::fromResource<QWaylandSeatPrivate *>(resource))
798void QWaylandSeat::handleMouseFocusDestroyed()
804 d->mouseFocus =
nullptr;
876#include "moc_qwaylandseat.cpp"
Type
This enum type defines the valid event types in Qt.
The QKeyEvent class describes a key event.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
\inmodule QtCore\reentrant
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
The QTouchEvent class contains parameters that describe a touch event.
\qmltype WaylandClient \instantiates QWaylandClient \inqmlmodule QtWayland.Compositor
static QWaylandClient * fromWlClient(QWaylandCompositor *compositor, wl_client *wlClient)
Returns the QWaylandClient corresponding to the Wayland client wlClient and compositor.
static QWaylandTextInput * findIn(QWaylandObject *container)
If any instance of the interface has been registered with container, this is returned.
static QWaylandCompositorPrivate * get(QWaylandCompositor *compositor)
\qmltype WaylandCompositor \instantiates QWaylandCompositor \inqmlmodule QtWayland....
static QWaylandKeyboardPrivate * get(QWaylandKeyboard *keyboard)
\inmodule QtWaylandCompositor
virtual void setFocus(QWaylandSurface *surface)
Sets the current focus to surface.
virtual void addClient(QWaylandClient *client, uint32_t id, uint32_t version)
\inmodule QtWaylandCompositor
\inmodule QtWaylandCompositor
void sendKeyEvent(QKeyEvent *event)
~QWaylandSeatPrivate() override
void seat_get_keyboard(wl_seat::Resource *resource, uint32_t id) override
void seat_get_pointer(wl_seat::Resource *resource, uint32_t id) override
QWaylandSeatPrivate(QWaylandSeat *seat)
void seat_destroy_resource(wl_seat::Resource *resource) override
void seat_get_touch(wl_seat::Resource *resource, uint32_t id) override
void seat_bind_resource(wl_seat::Resource *resource) override
void setCapabilities(QWaylandSeat::CapabilityFlags caps)
\qmltype WaylandSeat \instantiates QWaylandSeat \inqmlmodule QtWayland.Compositor
~QWaylandSeat() override
Destroys the QWaylandSeat.
QWaylandSeat::CapabilityFlags capabilities() const
Returns the drag object for this QWaylandSeat.
void keyboardFocusChanged(QWaylandSurface *newFocus, QWaylandSurface *oldFocus)
\qmlsignal void QtWayland.Compositor::WaylandSeat::keyboardFocusChanged(QWaylandSurface newFocus,...
QWaylandKeymap * keymap
Returns the keymap object for this QWaylandSeat.
QWaylandSeat(QWaylandCompositor *compositor, CapabilityFlags capabilityFlags=DefaultCapabilities)
Constructs a QWaylandSeat for the given compositor and capabilityFlags.
void sendMouseMoveEvent(QWaylandView *surface, const QPointF &localPos, const QPointF &outputSpacePos=QPointF())
Sets the mouse focus to view and sends a mouse move event to the pointer device with the local positi...
Q_INVOKABLE uint sendTouchPointReleased(QWaylandSurface *surface, int id, const QPointF &position)
\qmlmethod void QtWayland.Compositor::WaylandSeat::sendTouchPointReleased(WaylandSurface surface,...
void sendMouseReleaseEvent(Qt::MouseButton button)
Sends a mouse release event for button to the QWaylandSeat's pointer device.
void setMouseFocus(QWaylandView *view)
Sets the current mouse focus to view.
void sendFullTouchEvent(QWaylandSurface *surface, QTouchEvent *event)
Sends the event to the specified surface on the touch device.
void sendMousePressEvent(Qt::MouseButton button)
Sends a mouse press event for button to the QWaylandSeat's pointer device.
QWaylandKeyboard * keyboard() const
Returns the keyboard for this input device.
void sendKeyReleaseEvent(uint code)
Sends a key release event with the key code to the keyboard device.
Q_INVOKABLE void sendKeyEvent(int qtKey, bool pressed)
\qmlmethod void QtWayland.Compositor::WaylandSeat::sendKeyEvent(int qtKey, bool pressed)
bool isInitialized() const
Returns true if the QWaylandSeat is initialized; false otherwise.
void cursorSurfaceRequested(QWaylandSurface *surface, int hotspotX, int hotspotY, QWaylandClient *client)
QWaylandPointer * pointer() const
Returns the pointer device for this QWaylandSeat.
static QWaylandSeat * fromSeatResource(struct ::wl_resource *resource)
Returns the QWaylandSeat corresponding to the resource.
void sendFullKeyEvent(QKeyEvent *event)
Sends the event to the keyboard device.
QWaylandSurface * keyboardFocus() const
Returns the current focused surface for keyboard input.
QWaylandTouch * touch() const
Returns the touch device for this QWaylandSeat.
QWaylandView * mouseFocus() const
Returns the view that currently has mouse focus.
bool setKeyboardFocus(QWaylandSurface *surface)
Sets the current keyboard focus to surface.
void sendMouseWheelEvent(Qt::Orientation orientation, int delta)
Sends a mouse wheel event to the QWaylandSeat's pointer device with the given orientation and delta.
Q_INVOKABLE void sendTouchFrameEvent(QWaylandClient *client)
\qmlmethod void QtWayland.Compositor::WaylandSeat::sendTouchFrameEvent(WaylandClient client)
Q_INVOKABLE uint sendTouchPointPressed(QWaylandSurface *surface, int id, const QPointF &position)
\qmlmethod uint QtWayland.Compositor::WaylandSeat::sendTouchPointPressed(WaylandSurface surface,...
virtual void initialize()
Initializes parts of the seat corresponding to the capabilities set in the constructor,...
uint sendTouchPointEvent(QWaylandSurface *surface, int id, const QPointF &point, Qt::TouchPointState state)
Sends a touch point event to the surface on a touch device with the given id, point and state.
QWaylandCompositor * compositor() const
Returns the compositor for this QWaylandSeat.
virtual bool isOwner(QInputEvent *inputEvent) const
Q_INVOKABLE void sendTouchCancelEvent(QWaylandClient *client)
\qmlmethod void QtWayland.Compositor::WaylandSeat::sendTouchCancelEvent(WaylandClient client)
Q_INVOKABLE uint sendTouchPointMoved(QWaylandSurface *surface, int id, const QPointF &position)
\qmlmethod void QtWayland.Compositor::WaylandSeat::sendTouchPointMoved(WaylandSurface surface,...
void sendKeyPressEvent(uint code)
Sends a key press event with the key code to the keyboard device.
void mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus)
This signal is emitted when the mouse focus has changed from oldFocus to newFocus.
\qmltype WaylandSurface \instantiates QWaylandSurface \inqmlmodule QtWayland.Compositor
QWaylandClient * client
\qmlproperty WaylandClient QtWayland.Compositor::WaylandSurface::client
Q_INVOKABLE bool isDestroyed() const
\qmlmethod bool QtWayland.Compositor::WaylandSurface::isDestroyed()
void sendKeyEvent(QKeyEvent *event)
void sendKeyEvent(QKeyEvent *event)
\inmodule QtWaylandCompositor
virtual void addClient(QWaylandClient *client, uint32_t id, uint32_t version)
\qmltype WaylandView \instantiates QWaylandView \inqmlmodule QtWayland.Compositor
bool postQtKeyEvent(QKeyEvent *event, QWaylandSurface *surface)
Combined button and popup list for selecting options.
static QOpenGLCompositor * compositor
GLsizei const void * pointer
GLdouble GLdouble GLdouble GLdouble q
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static QString qtKey(CFStringRef cfkey)
#define QT_CONFIG(feature)
bool testFlag(MaskType mask, FlagType flag)
if(qFloatDistance(a, b)<(1<< 7))
[0]
myObject disconnect()
[26]