KWin
Loading...
Searching...
No Matches
textinput_v2.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@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 "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 TextInputV2Interface;
23class TextInputV2InterfacePrivate;
24class TextInputManagerV2InterfacePrivate;
25
34class KWIN_EXPORT TextInputManagerV2Interface : public QObject
35{
36 Q_OBJECT
37public:
38 explicit TextInputManagerV2Interface(Display *display, QObject *parent = nullptr);
40
41private:
42 std::unique_ptr<TextInputManagerV2InterfacePrivate> d;
43};
44
62class KWIN_EXPORT TextInputV2Interface : public QObject
63{
64 Q_OBJECT
65public:
67
68 enum class UpdateReason : uint32_t {
69 StateChange = 0, // updated state because it changed
70 StateFull = 1, // full state after enter or input_method_changed event
71 StateReset = 2, // full state after reset
72 StateEnter = 3, // full state after switching focus to a different widget on client side
73 };
74 Q_ENUM(UpdateReason)
81 QString preferredLanguage() const;
82
86 QRect cursorRectangle() const;
87
91 TextInputContentPurpose contentPurpose() const;
92
96 TextInputContentHints contentHints() const;
97
104 QString surroundingText() const;
110 qint32 surroundingTextCursorPosition() const;
119 qint32 surroundingTextSelectionAnchor() const;
120
126 QPointer<SurfaceInterface> surface() const;
127
131 bool clientSupportsTextInput(ClientConnection *client) const;
132
138 bool isEnabled() const;
139
153 void preEdit(const QString &text, const QString &commitText);
154
167 void commitString(const QString &text);
168
177 void setPreEditCursor(qint32 index);
178
188 void preEditStyling(uint32_t index, uint32_t length, uint32_t style);
189
199 void deleteSurroundingText(quint32 beforeLength, quint32 afterLength);
200
206 void setCursorPosition(qint32 index, qint32 anchor);
207
211 void setTextDirection(Qt::LayoutDirection direction);
212
213 void keysymPressed(quint32 keysym, quint32 modifiers = 0);
214 void keysymReleased(quint32 keysym, quint32 modifiers = 0);
215
225 void setInputPanelState(bool visible, const QRect &overlappedSurfaceArea);
226
230 void setLanguage(const QString &languageTag);
231
235 void setModifiersMap(const QByteArray &modifiersMap);
236
237Q_SIGNALS:
252 void preferredLanguageChanged(const QString &language);
256 void cursorRectangleChanged(const QRect &rect);
280 void stateUpdated(uint32_t serial, UpdateReason reason);
281
282private:
284 friend class SeatInterface;
287 explicit TextInputV2Interface(SeatInterface *seat);
288
289 std::unique_ptr<TextInputV2InterfacePrivate> d;
290};
291
292}
293
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(uint32_t serial, UpdateReason reason)
void preferredLanguageChanged(const QString &language)
void cursorRectangleChanged(const QRect &rect)
Q_DECLARE_METATYPE(KWin::SwitchEvent::State)
TextInputContentPurpose
Definition textinput.h:72
struct _XDisplay Display