[server] Put some text-input v0 exclusive callbacks in v0 class
Summary: Requests * reset * commit_state * invoke_action are used in text-input v0 only and neither in v2 and upcoming v3 of the unstable text-input protocol. To increase readability put their callbacks in v0 interface class only. Test Plan: Compiles Reviewers: #kwin, #frameworks, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D16673
This commit is contained in:
parent
f552ba47dc
commit
c27932ea07
3 changed files with 29 additions and 28 deletions
|
@ -77,13 +77,6 @@ void TextInputInterface::Private::hideInputPanelCallback(wl_client *client, wl_r
|
|||
emit p->q_func()->requestHideInputPanel();
|
||||
}
|
||||
|
||||
void TextInputInterface::Private::resetCallback(wl_client *client, wl_resource *resource)
|
||||
{
|
||||
auto p = cast<Private>(resource);
|
||||
Q_ASSERT(*p->client == client);
|
||||
emit p->q_func()->requestReset();
|
||||
}
|
||||
|
||||
void TextInputInterface::Private::setSurroundingTextCallback(wl_client *client, wl_resource *resource, const char * text, uint32_t cursor, uint32_t anchor)
|
||||
{
|
||||
setSurroundingText2Callback(client, resource, text, cursor, anchor);
|
||||
|
@ -210,22 +203,6 @@ void TextInputInterface::Private::setPreferredLanguageCallback(wl_client *client
|
|||
}
|
||||
}
|
||||
|
||||
void TextInputInterface::Private::commitStateCallback(wl_client *client, wl_resource *resource, uint32_t serial)
|
||||
{
|
||||
auto p = cast<Private>(resource);
|
||||
Q_ASSERT(*p->client == client);
|
||||
p->latestState = serial;
|
||||
}
|
||||
|
||||
void TextInputInterface::Private::invokeActionCallback(wl_client *client, wl_resource *resource, uint32_t button, uint32_t index)
|
||||
{
|
||||
Q_UNUSED(button)
|
||||
Q_UNUSED(index)
|
||||
// TODO: implement
|
||||
auto p = cast<Private>(resource);
|
||||
Q_ASSERT(*p->client == client);
|
||||
}
|
||||
|
||||
TextInputInterface::Private::Private(TextInputInterface *q, Global *c, wl_resource *parentResource, const wl_interface *interface, const void *implementation)
|
||||
: Resource::Private(q, c, parentResource, interface, implementation)
|
||||
{
|
||||
|
|
|
@ -72,7 +72,6 @@ public:
|
|||
QRect cursorRectangle;
|
||||
TextInputInterface::ContentHints contentHints = TextInputInterface::ContentHint::None;
|
||||
TextInputInterface::ContentPurpose contentPurpose = TextInputInterface::ContentPurpose::Normal;
|
||||
quint32 latestState = 0;
|
||||
SeatInterface *seat = nullptr;
|
||||
QPointer<SurfaceInterface> surface;
|
||||
bool enabled = false;
|
||||
|
@ -92,14 +91,11 @@ protected:
|
|||
static void disableCallback(wl_client *client, wl_resource *resource, wl_resource * surface);
|
||||
static void showInputPanelCallback(wl_client *client, wl_resource *resource);
|
||||
static void hideInputPanelCallback(wl_client *client, wl_resource *resource);
|
||||
static void resetCallback(wl_client *client, wl_resource *resource);
|
||||
static void setSurroundingTextCallback(wl_client *client, wl_resource *resource, const char * text, uint32_t cursor, uint32_t anchor);
|
||||
static void setSurroundingText2Callback(wl_client *client, wl_resource *resource, const char * text, int32_t cursor, int32_t anchor);
|
||||
static void setContentTypeCallback(wl_client *client, wl_resource *resource, uint32_t hint, uint32_t purpose);
|
||||
static void setCursorRectangleCallback(wl_client *client, wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
|
||||
static void setPreferredLanguageCallback(wl_client *client, wl_resource *resource, const char * language);
|
||||
static void commitStateCallback(wl_client *client, wl_resource *resource, uint32_t serial);
|
||||
static void invokeActionCallback(wl_client *client, wl_resource *resource, uint32_t button, uint32_t index);
|
||||
|
||||
private:
|
||||
TextInputInterface *q_func() {
|
||||
|
|
|
@ -56,10 +56,15 @@ public:
|
|||
|
||||
private:
|
||||
static const struct wl_text_input_interface s_interface;
|
||||
|
||||
TextInputUnstableV0Interface *q_func() {
|
||||
return reinterpret_cast<TextInputUnstableV0Interface *>(q);
|
||||
}
|
||||
|
||||
static void resetCallback(wl_client *client, wl_resource *resource);
|
||||
static void commitStateCallback(wl_client *client, wl_resource *resource, uint32_t serial);
|
||||
static void invokeActionCallback(wl_client *client, wl_resource *resource, uint32_t button, uint32_t index);
|
||||
|
||||
quint32 latestState = 0;
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
@ -217,6 +222,29 @@ TextInputUnstableV0Interface::Private::Private(TextInputInterface *q, TextInputM
|
|||
|
||||
TextInputUnstableV0Interface::Private::~Private() = default;
|
||||
|
||||
void TextInputUnstableV0Interface::Private::resetCallback(wl_client *client, wl_resource *resource)
|
||||
{
|
||||
auto p = cast<Private>(resource);
|
||||
Q_ASSERT(*p->client == client);
|
||||
emit p->q_func()->requestReset();
|
||||
}
|
||||
|
||||
void TextInputUnstableV0Interface::Private::commitStateCallback(wl_client *client, wl_resource *resource, uint32_t serial)
|
||||
{
|
||||
auto p = cast<Private>(resource);
|
||||
Q_ASSERT(*p->client == client);
|
||||
p->latestState = serial;
|
||||
}
|
||||
|
||||
void TextInputUnstableV0Interface::Private::invokeActionCallback(wl_client *client, wl_resource *resource, uint32_t button, uint32_t index)
|
||||
{
|
||||
Q_UNUSED(button)
|
||||
Q_UNUSED(index)
|
||||
// TODO: implement
|
||||
auto p = cast<Private>(resource);
|
||||
Q_ASSERT(*p->client == client);
|
||||
}
|
||||
|
||||
TextInputUnstableV0Interface::TextInputUnstableV0Interface(TextInputManagerUnstableV0Interface *parent, wl_resource *parentResource)
|
||||
: TextInputInterface(new Private(this, parent, parentResource))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue