KWin
Loading...
Searching...
No Matches
textinput_v1.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2022 Xuetian Weng <wengxt@gmail.com>
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 "kwin_export.h"
9
10#include <QObject>
11#include <memory>
12
13#include "textinput.h"
14
15struct wl_resource;
16namespace KWin
17{
18class ClientConnection;
19class Display;
20class SeatInterface;
21class SurfaceInterface;
22class TextInputV1Interface;
23class TextInputV1InterfacePrivate;
24class TextInputManagerV1InterfacePrivate;
25
34class KWIN_EXPORT TextInputManagerV1Interface : public QObject
35{
36 Q_OBJECT
37public:
38 explicit TextInputManagerV1Interface(Display *display, QObject *parent = nullptr);
40
41private:
42 std::unique_ptr<TextInputManagerV1InterfacePrivate> d;
43};
44
62class KWIN_EXPORT TextInputV1Interface : public QObject
63{
64 Q_OBJECT
65public:
66 explicit TextInputV1Interface(SeatInterface *seat);
67 ~TextInputV1Interface() override;
68
75 QString preferredLanguage() const;
76
80 QRect cursorRectangle() const;
81
85 TextInputContentPurpose contentPurpose() const;
86
90 TextInputContentHints contentHints() const;
91
98 QString surroundingText() const;
104 qint32 surroundingTextCursorPosition() const;
113 qint32 surroundingTextSelectionAnchor() const;
114
120 QPointer<SurfaceInterface> surface() const;
121
125 bool clientSupportsTextInput(ClientConnection *client) const;
126
132 bool isEnabled() const;
133
147 void preEdit(const QString &text, const QString &commitText);
148
161 void commitString(const QString &text);
162
171 void setPreEditCursor(qint32 index);
172
182 void preEditStyling(uint32_t index, uint32_t length, uint32_t style);
183
193 void deleteSurroundingText(quint32 beforeLength, quint32 afterLength);
194
200 void setCursorPosition(qint32 index, qint32 anchor);
201
205 void setTextDirection(Qt::LayoutDirection direction);
206
207 void keysymPressed(quint32 time, quint32 keysym, quint32 modifiers = 0);
208 void keysymReleased(quint32 time, quint32 keysym, quint32 modifiers = 0);
209
219 void setInputPanelState(bool visible);
220
224 void setLanguage(const QString &languageTag);
225
229 void setModifiersMap(const QByteArray &modifiersMap);
230
231Q_SIGNALS:
246 void preferredLanguageChanged(const QString &language);
250 void cursorRectangleChanged(const QRect &rect);
274 void stateUpdated(quint32 serial);
278 void reset();
282 void invokeAction(quint32 button, quint32 index);
283
284private:
286 friend class SeatInterface;
289
290 std::unique_ptr<TextInputV1InterfacePrivate> d;
291};
292
293}
294
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
Represent the Global for the interface.
Represents a generic Resource for a text input object.
void stateUpdated(quint32 serial)
void cursorRectangleChanged(const QRect &rect)
void preferredLanguageChanged(const QString &language)
void invokeAction(quint32 button, quint32 index)
Q_DECLARE_METATYPE(KWin::SwitchEvent::State)
TextInputContentPurpose
Definition textinput.h:72
struct _XDisplay Display