006ee8b87a
This makes it possible to show the input method when using a client that doesn't support Wayland input methods (e.g. Xwayland). This adds 2 dbus API entry points: - activeClientSupported property: That tells us if the current client doesn't support text-input-v* - forceActivate method: forces the activation of the input method. This configures the input method in a state that we can use to forward the input method's keystrokes to the client, emulating a hardware keyboard. BUG: 4399911
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
/*
|
|
KWin - the KDE window manager
|
|
This file is part of the KDE project.
|
|
|
|
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
#include "virtualkeyboard_dbus.h"
|
|
#include <QDBusConnection>
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
VirtualKeyboardDBus::VirtualKeyboardDBus(InputMethod *parent)
|
|
: QObject(parent)
|
|
, m_inputMethod(parent)
|
|
{
|
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/VirtualKeyboard"), this,
|
|
QDBusConnection::ExportAllProperties | QDBusConnection::ExportScriptableContents | // qdbuscpp2xml doesn't support yet properties with NOTIFY
|
|
QDBusConnection::ExportAllSlots);
|
|
connect(parent, &InputMethod::activeChanged, this, &VirtualKeyboardDBus::activeChanged);
|
|
connect(parent, &InputMethod::enabledChanged, this, &VirtualKeyboardDBus::enabledChanged);
|
|
connect(parent, &InputMethod::visibleChanged, this, &VirtualKeyboardDBus::visibleChanged);
|
|
connect(parent, &InputMethod::availableChanged, this, &VirtualKeyboardDBus::availableChanged);
|
|
connect(parent, &InputMethod::activeClientSupportsTextInputChanged, this, &VirtualKeyboardDBus::activeClientSupportsTextInputChanged);
|
|
}
|
|
|
|
VirtualKeyboardDBus::~VirtualKeyboardDBus() = default;
|
|
|
|
bool VirtualKeyboardDBus::isActive() const
|
|
{
|
|
return m_inputMethod->isActive();
|
|
}
|
|
|
|
void VirtualKeyboardDBus::setEnabled(bool enabled)
|
|
{
|
|
m_inputMethod->setEnabled(enabled);
|
|
}
|
|
|
|
void VirtualKeyboardDBus::setActive(bool active)
|
|
{
|
|
m_inputMethod->setActive(active);
|
|
}
|
|
|
|
bool VirtualKeyboardDBus::isEnabled() const
|
|
{
|
|
return m_inputMethod->isEnabled();
|
|
}
|
|
|
|
bool VirtualKeyboardDBus::isVisible() const
|
|
{
|
|
return m_inputMethod->isVisible();
|
|
}
|
|
|
|
bool VirtualKeyboardDBus::isAvailable() const
|
|
{
|
|
return m_inputMethod->isAvailable();
|
|
}
|
|
|
|
bool VirtualKeyboardDBus::activeClientSupportsTextInput() const
|
|
{
|
|
return m_inputMethod->activeClientSupportsTextInput();
|
|
}
|
|
|
|
bool VirtualKeyboardDBus::willShowOnActive() const
|
|
{
|
|
return isAvailable() && isEnabled() && m_inputMethod->shouldShowOnActive();
|
|
}
|
|
|
|
void VirtualKeyboardDBus::forceActivate()
|
|
{
|
|
m_inputMethod->forceActivate();
|
|
}
|
|
}
|