inputpanel: ignore requested output

While there's specific hardware where the IM could benefit from requesting to
be shown on a specific output, it effectively never has enough information to
choose a useful output - and the protocol doesn't allow setting a null output
to indicate that the compositor should do the choice.
To avoid showing the OSK on the wrong output, always put it on the active
output and ignore what the IM client requests.
This commit is contained in:
Xaver Hugl 2023-01-04 12:22:31 +01:00
parent cc5b917de1
commit 7cb4b51d5e
2 changed files with 7 additions and 27 deletions

View file

@ -41,12 +41,13 @@ InputPanelV1Window::InputPanelV1Window(InputPanelSurfaceV1Interface *panelSurfac
connect(panelSurface, &InputPanelSurfaceV1Interface::overlayPanel, this, &InputPanelV1Window::showOverlayPanel);
connect(panelSurface, &InputPanelSurfaceV1Interface::destroyed, this, &InputPanelV1Window::destroyWindow);
connect(workspace(), &Workspace::outputsChanged, this, &InputPanelV1Window::reposition);
kwinApp()->inputMethod()->setPanel(this);
}
void InputPanelV1Window::showOverlayPanel()
{
setOutput(nullptr);
m_mode = Mode::Overlay;
maybeShow();
}
@ -54,7 +55,6 @@ void InputPanelV1Window::showOverlayPanel()
void InputPanelV1Window::showTopLevel(OutputInterface *output, InputPanelSurfaceV1Interface::Position position)
{
m_mode = Mode::VirtualKeyboard;
setOutput(output);
maybeShow();
}
@ -94,18 +94,13 @@ void KWin::InputPanelV1Window::reposition()
return;
}
const auto activeOutput = workspace()->activeOutput();
const QRectF outputArea = activeOutput->geometry();
QRectF availableArea;
QRectF outputArea;
if (m_output) {
outputArea = m_output->geometry();
if (waylandServer()->isScreenLocked()) {
availableArea = outputArea;
} else {
availableArea = workspace()->clientArea(MaximizeArea, this, m_output);
}
if (waylandServer()->isScreenLocked()) {
availableArea = outputArea;
} else {
availableArea = workspace()->clientArea(MaximizeArea, this);
outputArea = workspace()->clientArea(FullScreenArea, this);
availableArea = workspace()->clientArea(MaximizeArea, this, activeOutput);
}
panelSize = panelSize.boundedTo(availableArea.size());
@ -180,19 +175,6 @@ QRectF InputPanelV1Window::inputGeometry() const
return readyForPainting() ? QRectF(surface()->input().boundingRect()).translated(pos()) : QRectF();
}
void InputPanelV1Window::setOutput(OutputInterface *outputIface)
{
if (m_output) {
disconnect(m_output, &Output::geometryChanged, this, &InputPanelV1Window::reposition);
}
m_output = outputIface ? outputIface->handle() : nullptr;
if (m_output) {
connect(m_output, &Output::geometryChanged, this, &InputPanelV1Window::reposition);
}
}
void InputPanelV1Window::moveResizeInternal(const QRectF &rect, MoveResizeMode mode)
{
updateGeometry(rect);

View file

@ -88,11 +88,9 @@ private:
void showTopLevel(KWaylandServer::OutputInterface *output, KWaylandServer::InputPanelSurfaceV1Interface::Position position);
void showOverlayPanel();
void reposition();
void setOutput(KWaylandServer::OutputInterface *output);
void handleMapped();
void maybeShow();
QPointer<Output> m_output;
Mode m_mode = Mode::None;
bool m_allowed = false;
bool m_virtualKeyboardShouldBeShown = false;