Use the minimum of workspace area size and panel size for input method placement

Rather than assuming the input panel to always be less than or equal to
the maximized area, ensure it is. This ensures that the input panel gets
placed correctly when there maximized area is smaller, like when there's
a panel on the side.

Additionally, don't skip the entire positioning code when "m_output" is
empty, to avoid the placement not happening when Kickoff is open.
This commit is contained in:
Arjen Hiemstra 2022-02-14 16:18:14 +01:00
parent aab395f07b
commit 03a3ae666c

View file

@ -75,22 +75,28 @@ void KWin::InputPanelV1Client::reposition()
switch (m_mode) {
case Toplevel: {
if (m_output) {
const QSize panelSize = surface()->size();
if (!panelSize.isValid() || panelSize.isEmpty()) {
return;
}
QSize panelSize = surface()->size();
if (!panelSize.isValid() || panelSize.isEmpty()) {
return;
}
QRect availableArea;
QRect availableArea;
if (m_output) {
if (waylandServer()->isScreenLocked()) {
availableArea = m_output->geometry();
} else {
availableArea = workspace()->clientArea(MaximizeArea, this, m_output);
}
QRect geo(availableArea.topLeft(), panelSize);
geo.translate((availableArea.width() - panelSize.width())/2, availableArea.height() - panelSize.height());
moveResize(geo);
} else {
availableArea = workspace()->clientArea(MaximizeArea, this);
}
panelSize = panelSize.boundedTo(availableArea.size());
QRect geo(availableArea.topLeft(), panelSize);
geo.translate((availableArea.width() - panelSize.width())/2, availableArea.height() - panelSize.height());
moveResize(geo);
} break;
case Overlay: {
auto textInputSurface = waylandServer()->seat()->focusedTextInputSurface();