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>
26#if QT_WAYLAND_TEXT_INPUT_V4_WIP
48 if (capabilities != caps) {
49 QWaylandSeat::CapabilityFlags changed = caps ^ capabilities;
65 for (
int i = 0;
i < resources.
size();
i++) {
66 wl_seat::send_capabilities(resources.
at(
i)->handle, (uint32_t)capabilities);
74#if QT_CONFIG(wayland_datadevice)
80 data_device->add(client,
id, 1);
92 wl_seat::send_capabilities(resource->handle, (uint32_t)capabilities);
157 d->capabilities = capabilityFlags;
183 d->init(
d->compositor->display(), 4);
192 d->isInitialized =
true;
203 return d->isInitialized;
212 d->pointer->sendMousePressEvent(
button);
221 d->pointer->sendMouseReleaseEvent(
button);
231 d->pointer->sendMouseMoveEvent(
view, localPos, outputSpacePos);
240 d->pointer->sendMouseWheelEvent(orientation, delta);
249 d->keyboard->sendKeyPressEvent(code);
258 d->keyboard->sendKeyReleaseEvent(code);
275 if (
d->touch.isNull())
278 return d->touch->sendTouchPointEvent(surface,
id, point,
state);
397 if (!
d->touch.isNull())
398 d->touch->sendFrameEvent(client);
413 if (!
d->touch.isNull())
414 d->touch->sendCancelEvent(client);
432 d->touch->sendFullTouchEvent(surface,
event);
448 qWarning(
"Cannot send key event, no keyboard focus, fix the compositor");
454 &&
event->nativeScanCode() == 0) {
465 if (textInputMethod) {
471#if QT_WAYLAND_TEXT_INPUT_V4_WIP
474 if (textInputV4 && !
event->text().isEmpty()) {
489 if (!
d->keyboard.isNull() && !
event->isAutoRepeat()) {
491 uint scanCode =
event->nativeScanCode();
493 scanCode =
d->keyboard->keyToScanCode(
event->key());
496 qWarning() <<
"Can't send Wayland key event: Unable to get a valid scan code";
502 d->keyboard->sendKeyPressEvent(scanCode);
504 d->keyboard->sendKeyReleaseEvent(scanCode);
530 qWarning(
"Cannot send Wayland key event, no keyboard focus, fix the compositor");
534 if (
auto scanCode =
d->keyboard->keyToScanCode(
qtKey)) {
536 d->keyboard->sendKeyPressEvent(scanCode);
538 d->keyboard->sendKeyReleaseEvent(scanCode);
566void QWaylandSeat::sendUnicodeKeyEvent(
uint unicode,
bool pressed)
569 qWarning(
"Can't send a unicode key event, no keyboard focus, fix the compositor");
576 const uint keysym = 0x01000000 | unicode;
589 if (textInputMethod) {
595#if QT_WAYLAND_TEXT_INPUT_V4_WIP
609 qWarning() <<
"Can't send a unicode key event: Unable to find a text-input protocol.";
619 return d->keyboard.data();
628 if (
d->keyboard.isNull() || !
d->keyboard->focus())
631 return d->keyboard->focus();
646 if (surface == oldSurface)
649 d->keyboardFocus = surface;
650 if (!
d->keyboard.isNull())
651 d->keyboard->setFocus(surface);
652#if QT_CONFIG(wayland_datadevice)
654 d->data_device->setFocus(surface ? surface->
client() :
nullptr);
668 return d->keymap.data();
677 return d->pointer.data();
686 return d->touch.data();
695 return d->mouseFocus;
704 if (
view ==
d->mouseFocus)
708 d->mouseFocus =
view;
724 return d->compositor;
730#if QT_CONFIG(draganddrop)
734 return d->drag_handle.data();
744 return d->capabilities;
762 if (
auto p = QtWayland::fromResource<QWaylandSeatPrivate *>(resource))
773void QWaylandSeat::handleMouseFocusDestroyed()
779 d->mouseFocus =
nullptr;
851#include "moc_qwaylandseat.cpp"
The QKeyEvent class describes a key event.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
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.
bool isEmpty() const
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.
QWaylandKeyboard * callCreateKeyboardDevice(QWaylandSeat *seat)
QWaylandPointer * callCreatePointerDevice(QWaylandSeat *seat)
static QWaylandCompositorPrivate * get(QWaylandCompositor *compositor)
QWaylandTouch * callCreateTouchDevice(QWaylandSeat *seat)
\qmltype WaylandCompositor \instantiates QWaylandCompositor \inqmlmodule QtWayland....
void checkAndRepairModifierState(QKeyEvent *ke)
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
static QString lookupStringNoKeysymTransformations(xkb_keysym_t keysym)
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]