inputpanelv1window: polish window states

Do not markAsMapped an unpositioned panel, it would confuse the sliding
popups effect and force it to figure out its state in creative ways.
Mark the panel window as hidden as it gets destroyed.
This commit is contained in:
Aleix Pol 2024-06-21 17:23:57 +02:00 committed by Aleix Pol Gonzalez
parent 1dbef2d5ed
commit b1bd3ff630
2 changed files with 12 additions and 6 deletions

View file

@ -78,13 +78,9 @@ void InputPanelV1Window::hide()
}
}
void InputPanelV1Window::reposition()
void InputPanelV1Window::resetPosition()
{
Q_ASSERT(!isDeleted());
if (!readyForPainting()) {
return;
}
switch (m_mode) {
case Mode::None: {
// should never happen
@ -163,6 +159,15 @@ void InputPanelV1Window::reposition()
}
}
void InputPanelV1Window::reposition()
{
if (!readyForPainting()) {
return;
}
resetPosition();
}
void InputPanelV1Window::destroyWindow()
{
m_panelSurface->disconnect(this);
@ -226,8 +231,8 @@ void InputPanelV1Window::maybeShow()
{
const bool shouldShow = m_mode == Mode::Overlay || (m_mode == Mode::VirtualKeyboard && m_allowed && m_virtualKeyboardShouldBeShown);
if (shouldShow && !isDeleted() && surface()->isMapped()) {
resetPosition();
markAsMapped();
reposition();
setHidden(false);
}
}

View file

@ -90,6 +90,7 @@ protected:
private:
void showTopLevel(OutputInterface *output, InputPanelSurfaceV1Interface::Position position);
void showOverlayPanel();
void resetPosition();
void reposition();
void handleMapped();
void maybeShow();