kwin/inputmethod.h
Bhushan Shah 222b558b04 virtualkeyboard: rename class to InputMethod
VirtualKeyboard class does not implement the relevant VirtualKeyboard
protocol but rather implements the InputMethod protcol and can in theory
be used by other input method like e.g. ibus.

Make class name consistent with what it does to avoid confusion in
future.

For now only rename of main class is done and dbus service is kept as-is
to provide retro-compatibility, when input method protocol is
implemented fully, we can think of what to do wrt the dbus interface
later when we fully implement zwp_input_method_unstable_v1 protocol.
2020-09-29 20:55:24 +05:30

79 lines
1.7 KiB
C++

/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef KWIN_VIRTUAL_KEYBOARD_H
#define KWIN_VIRTUAL_KEYBOARD_H
#include <QObject>
#include <kwinglobals.h>
#include <kwin_export.h>
#include <abstract_client.h>
class KStatusNotifierItem;
namespace KWin
{
/**
* This class implements the zwp_input_method_unstable_v1, which is currently used to provide
* the Virtual Keyboard using supported input method client (maliit-keyboard e.g.)
**/
class KWIN_EXPORT InputMethod : public QObject
{
Q_OBJECT
public:
~InputMethod() override;
void init();
void hide();
void show();
Q_SIGNALS:
void enabledChanged(bool enabled);
private Q_SLOTS:
void clientAdded(AbstractClient* client);
// textinput interface slots
void handleFocusedSurfaceChanged();
void surroundingTextChanged();
void contentTypeChanged();
void requestReset();
void textInputInterfaceV2EnabledChanged();
void textInputInterfaceV3EnabledChanged();
void stateCommitted(uint32_t serial);
// inputcontext slots
void setPreeditString(uint32_t serial, const QString &text, const QString &commit);
void setPreeditCursor(qint32 index);
private:
void setEnabled(bool enable);
void updateSni();
void updateInputPanelState();
void adoptInputMethodContext();
struct {
QString text = QString();
quint32 begin = 0;
quint32 end = 0;
} preedit;
bool m_enabled = false;
KStatusNotifierItem *m_sni = nullptr;
QPointer<AbstractClient> m_inputClient;
QPointer<AbstractClient> m_trackedClient;
KWIN_SINGLETON(InputMethod)
};
}
#endif