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

View file

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