Add static SeatInterface *SeatInterface::get(wl_resource*)
No auto-test for it as we don't track the created resources which makes testing difficult. Implicit testing will be added through DataDeviceInterface.
This commit is contained in:
parent
a160876d05
commit
435c88f1e0
2 changed files with 16 additions and 1 deletions
|
@ -58,6 +58,11 @@ public:
|
||||||
PointerInterface *pointerInterface;
|
PointerInterface *pointerInterface;
|
||||||
KeyboardInterface *keyboardInterface;
|
KeyboardInterface *keyboardInterface;
|
||||||
|
|
||||||
|
static SeatInterface *get(wl_resource *native) {
|
||||||
|
auto s = cast(native);
|
||||||
|
return s ? s->q : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Private *cast(wl_resource *r);
|
static Private *cast(wl_resource *r);
|
||||||
static void bind(wl_client *client, void *data, uint32_t version, uint32_t id);
|
static void bind(wl_client *client, void *data, uint32_t version, uint32_t id);
|
||||||
|
@ -68,12 +73,15 @@ private:
|
||||||
static void getKeyboardCallback(wl_client *client, wl_resource *resource, uint32_t id);
|
static void getKeyboardCallback(wl_client *client, wl_resource *resource, uint32_t id);
|
||||||
static void getTouchCallback(wl_client *client, wl_resource *resource, uint32_t id);
|
static void getTouchCallback(wl_client *client, wl_resource *resource, uint32_t id);
|
||||||
static const struct wl_seat_interface s_interface;
|
static const struct wl_seat_interface s_interface;
|
||||||
|
|
||||||
|
SeatInterface *q;
|
||||||
};
|
};
|
||||||
|
|
||||||
SeatInterface::Private::Private(SeatInterface *q, Display *d)
|
SeatInterface::Private::Private(SeatInterface *q, Display *d)
|
||||||
: display(d)
|
: display(d)
|
||||||
, pointerInterface(new PointerInterface(d, q))
|
, pointerInterface(new PointerInterface(d, q))
|
||||||
, keyboardInterface(new KeyboardInterface(d, q))
|
, keyboardInterface(new KeyboardInterface(d, q))
|
||||||
|
, q(q)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +189,7 @@ void SeatInterface::Private::sendCapabilities(wl_resource *r)
|
||||||
|
|
||||||
SeatInterface::Private *SeatInterface::Private::cast(wl_resource *r)
|
SeatInterface::Private *SeatInterface::Private::cast(wl_resource *r)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<SeatInterface::Private*>(wl_resource_get_user_data(r));
|
return r ? reinterpret_cast<SeatInterface::Private*>(wl_resource_get_user_data(r)) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SeatInterface::setHasKeyboard(bool has)
|
void SeatInterface::setHasKeyboard(bool has)
|
||||||
|
@ -271,6 +279,11 @@ KeyboardInterface *SeatInterface::keyboard()
|
||||||
return d->keyboardInterface;
|
return d->keyboardInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SeatInterface *SeatInterface::get(wl_resource *native)
|
||||||
|
{
|
||||||
|
return Private::get(native);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************
|
/****************************************
|
||||||
* PointerInterface
|
* PointerInterface
|
||||||
***************************************/
|
***************************************/
|
||||||
|
|
|
@ -64,6 +64,8 @@ public:
|
||||||
void setHasKeyboard(bool has);
|
void setHasKeyboard(bool has);
|
||||||
void setHasTouch(bool has);
|
void setHasTouch(bool has);
|
||||||
|
|
||||||
|
static SeatInterface *get(wl_resource *native);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void nameChanged(const QString&);
|
void nameChanged(const QString&);
|
||||||
void hasPointerChanged(bool);
|
void hasPointerChanged(bool);
|
||||||
|
|
Loading…
Reference in a new issue