KWin
Loading...
Searching...
No Matches
textinput_v3_p.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2020 Bhushan Shah <bshah@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6#pragma once
7
8#include "clientconnection.h"
9#include "textinput_v3.h"
10
11#include <QHash>
12#include <QList>
13#include <QPointer>
14#include <QRect>
15
16#include <qwayland-server-text-input-unstable-v3.h>
17
18namespace KWin
19{
20class TextInputManagerV3InterfacePrivate : public QtWaylandServer::zwp_text_input_manager_v3
21{
22public:
24
26
27protected:
28 void zwp_text_input_manager_v3_destroy(Resource *resource) override;
29 void zwp_text_input_manager_v3_get_text_input(Resource *resource, uint32_t id, wl_resource *seat) override;
30};
31
32class TextInputV3InterfacePrivate : public QtWaylandServer::zwp_text_input_v3
33{
34public:
36
37 // events
40 void sendPreEdit(const QString &text, const quint32 cursorBegin, const quint32 cursorEnd);
41 void commitString(const QString &text);
42 void deleteSurroundingText(quint32 beforeLength, quint32 afterLength);
43 void done();
44
45 void updateEnabled();
46
47 QList<TextInputV3InterfacePrivate::Resource *> textInputsForClient(ClientConnection *client) const;
48 QList<TextInputV3InterfacePrivate::Resource *> enabledTextInputsForClient(ClientConnection *client) const;
49
51 {
52 return inputInterface->d.get();
53 }
54
58
59 SeatInterface *seat = nullptr;
60 QPointer<SurfaceInterface> surface;
61
66
67 QString preeditText;
68 quint32 preeditCursorBegin = 0;
69 quint32 preeditCursorEnd = 0;
70
71 struct
72 {
73 QRect cursorRectangle;
75 TextInputContentHints contentHints = TextInputContentHint::None;
77 bool enabled = false;
78 QString surroundingText;
81 QString preeditText;
82 quint32 preeditCursorBegin = 0;
83 quint32 preeditCursorEnd = 0;
85
86 QHash<Resource *, quint32> serialHash;
87 QHash<Resource *, bool> enabledHash;
88
89 void defaultPending();
91
93 bool isEnabled = false;
94
95protected:
96 void zwp_text_input_v3_bind_resource(Resource *resource) override;
97 void zwp_text_input_v3_destroy_resource(Resource *resource) override;
98 void zwp_text_input_v3_destroy(Resource *resource) override;
99 void zwp_text_input_v3_enable(Resource *resource) override;
100 void zwp_text_input_v3_disable(Resource *resource) override;
101 void zwp_text_input_v3_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) override;
102 void zwp_text_input_v3_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) override;
103 void zwp_text_input_v3_set_text_change_cause(Resource *resource, uint32_t cause) override;
104 void zwp_text_input_v3_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
105 void zwp_text_input_v3_commit(Resource *resource) override;
106};
107
108}
Convenient Class which represents a wl_client.
Class holding the Wayland server display loop.
Definition display.h:34
Represents a Seat on the Wayland Display.
Definition seat.h:134
Resource representing a wl_surface.
Definition surface.h:80
Represent the Global for the interface.
void zwp_text_input_manager_v3_get_text_input(Resource *resource, uint32_t id, wl_resource *seat) override
TextInputManagerV3Interface * q
TextInputManagerV3InterfacePrivate(TextInputManagerV3Interface *_q, Display *display)
void zwp_text_input_manager_v3_destroy(Resource *resource) override
Represents a generic Resource for a text input object.A TextInputV3Interface gets created by the Text...
QList< TextInputV3InterfacePrivate::Resource * > enabledTextInputsForClient(ClientConnection *client) const
QList< TextInputV3InterfacePrivate::Resource * > textInputsForClient(ClientConnection *client) const
void zwp_text_input_v3_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) override
void deleteSurroundingText(quint32 beforeLength, quint32 afterLength)
void zwp_text_input_v3_commit(Resource *resource) override
TextInputContentPurpose contentPurpose
QHash< Resource *, bool > enabledHash
void zwp_text_input_v3_disable(Resource *resource) override
void commitString(const QString &text)
void sendLeave(SurfaceInterface *surface)
TextInputV3InterfacePrivate(SeatInterface *seat, TextInputV3Interface *_q)
void zwp_text_input_v3_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) override
void zwp_text_input_v3_destroy_resource(Resource *resource) override
void sendPreEdit(const QString &text, const quint32 cursorBegin, const quint32 cursorEnd)
void sendEnter(SurfaceInterface *surface)
void zwp_text_input_v3_enable(Resource *resource) override
static TextInputV3InterfacePrivate * get(TextInputV3Interface *inputInterface)
QHash< Resource *, quint32 > serialHash
struct KWin::TextInputV3InterfacePrivate::@31 pending
void zwp_text_input_v3_destroy(Resource *resource) override
TextInputContentHints contentHints
void zwp_text_input_v3_set_text_change_cause(Resource *resource, uint32_t cause) override
QPointer< SurfaceInterface > surface
void zwp_text_input_v3_bind_resource(Resource *resource) override
void zwp_text_input_v3_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override
TextInputChangeCause surroundingTextChangeCause
TextInputChangeCause
Definition textinput.h:131
TextInputContentPurpose
Definition textinput.h:72