From 65ad7ffb27f37afb576f5e1fb14e4a8c549fd1b8 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 19 Feb 2021 14:59:01 +0100 Subject: [PATCH] inputmethod: do not cover panels with the input method (e.g. virtual keyboard) This way we can adapt the panels themselves to show useful UX like hiding the keyboard or switching. --- src/inputpanelv1client.cpp | 6 +++--- src/workspace.cpp | 4 ++++ src/workspace.h | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/inputpanelv1client.cpp b/src/inputpanelv1client.cpp index f9ddc937f1..0eec81fe0b 100644 --- a/src/inputpanelv1client.cpp +++ b/src/inputpanelv1client.cpp @@ -69,9 +69,9 @@ void KWin::InputPanelV1Client::reposition() return; } - const auto outputGeometry = m_output->geometry(); - QRect geo(outputGeometry.topLeft(), panelSize); - geo.translate((outputGeometry.width() - panelSize.width())/2, outputGeometry.height() - panelSize.height()); + const QRect availableArea = workspace()->clientArea(MaximizeArea, m_output, desktop()); + QRect geo(availableArea.topLeft(), panelSize); + geo.translate((availableArea.width() - panelSize.width())/2, availableArea.height() - panelSize.height()); updateGeometry(geo); } } break; diff --git a/src/workspace.cpp b/src/workspace.cpp index 26237f5688..aa544e6858 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -2299,6 +2299,10 @@ QRect Workspace::clientArea(clientAreaOption opt, int screen, int desktop) const abort(); } +QRect Workspace::clientArea(clientAreaOption opt, const AbstractOutput *output, int desktop) const +{ + return clientArea(opt, kwinApp()->platform()->enabledOutputs().indexOf(output), desktop); +} QRect Workspace::clientArea(clientAreaOption opt, const QPoint& p, int desktop) const { diff --git a/src/workspace.h b/src/workspace.h index ffd06a3e3c..e46fd91d9d 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -41,6 +41,7 @@ class Window; } class AbstractClient; +class AbstractOutput; class ColorMapper; class Compositor; class Deleted; @@ -154,6 +155,7 @@ public: QRect clientArea(clientAreaOption, const QPoint& p, int desktop) const; QRect clientArea(clientAreaOption, const AbstractClient* c) const; QRect clientArea(clientAreaOption, int screen, int desktop) const; + QRect clientArea(clientAreaOption, const AbstractOutput *output, int desktop) const; QRegion restrictedMoveArea(int desktop, StrutAreas areas = StrutAreaAll) const; -- GitLab