inputmethod: Don't move the clients around when the input panel is an overlay

It's meant to be floating around the cursor, if we do this we just get a
weird tiny screen.
This commit is contained in:
Aleix Pol 2021-06-05 03:15:12 +02:00 committed by Aleix Pol Gonzalez
parent 8fc3b024be
commit 34bfc25759
3 changed files with 14 additions and 4 deletions

View file

@ -10,6 +10,7 @@
#include "abstract_client.h"
#include "virtualkeyboard_dbus.h"
#include "input.h"
#include "inputpanelv1client.h"
#include "keyboard_input.h"
#include "utils.h"
#include "screens.h"
@ -135,11 +136,13 @@ void InputMethod::setActive(bool active)
}
}
void InputMethod::clientAdded(AbstractClient* client)
void InputMethod::clientAdded(AbstractClient *_client)
{
if (!client->isInputMethod()) {
if (!_client->isInputMethod()) {
return;
}
const auto client = dynamic_cast<InputPanelV1Client *>(_client);
m_inputClient = client;
connect(client->surface(), &SurfaceInterface::inputChanged, this, &InputMethod::updateInputPanelState);
connect(client, &QObject::destroyed, this, [this] {
@ -545,7 +548,8 @@ void InputMethod::updateInputPanelState()
QRect overlap = QRect(0, 0, 0, 0);
if (m_trackedClient) {
m_trackedClient->setVirtualKeyboardGeometry(m_inputClient ? m_inputClient->inputGeometry() : QRect());
const bool bottomKeyboard = m_inputClient && m_inputClient->mode() != InputPanelV1Client::Overlay;
m_trackedClient->setVirtualKeyboardGeometry(bottomKeyboard ? m_inputClient->inputGeometry() : QRect());
if (m_inputClient) {
overlap = m_trackedClient->frameGeometry() & m_inputClient->inputGeometry();

View file

@ -30,6 +30,7 @@ namespace KWin
{
class AbstractClient;
class InputPanelV1Client;
/**
* This class implements the zwp_input_method_unstable_v1, which is currently used to provide
@ -99,7 +100,7 @@ private:
bool m_enabled = true;
quint32 m_serial = 0;
QScopedPointer<KStatusNotifierItem> m_sni;
QPointer<AbstractClient> m_inputClient;
QPointer<InputPanelV1Client> m_inputClient;
QPointer<AbstractClient> m_trackedClient;
QProcess *m_inputMethodProcess = nullptr;

View file

@ -43,6 +43,11 @@ public:
NET::WindowType windowType(bool /*direct*/, int /*supported_types*/) const override;
QRect inputGeometry() const override;
Mode mode() const
{
return m_mode;
}
protected:
void moveResizeInternal(const QRect &rect, MoveResizeMode mode) override;