https://bugs.kde.org/show_bug.cgi?id=524622

            Bug ID: 524622
           Summary: WindowStateSaver force-shows QML windows with visible:
                    false when restoring maximized state in KConfig 6.29
    Classification: Frameworks and Libraries
           Product: frameworks-kconfig
      Version First 6.29.0
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

Created attachment 195387
  --> https://bugs.kde.org/attachment.cgi?id=195387&action=edit
Minimal reproducer, frozen saved state, and KConfig 6.28/6.29 regression logs

I can reproduce a regression in KConfig 6.29 where KConfig.WindowStateSaver
makes a QML window visible even though the application explicitly declares
visible: false.

The trigger is a previously saved maximized state.


STEPS TO REPRODUCE

1. Create a QML window containing WindowStateSaver:

    import QtQuick
    import QtQuick.Window
    import org.kde.config as KConfig

    Window {
        id: root
        width: 480
        height: 320
        visible: false

        KConfig.WindowStateSaver {
            configGroupName: "VisibilityProbe"
        }

        onVisibleChanged: {
            console.log("VISIBLE_CHANGED", root.visible, root.visibility)
        }

        onVisibilityChanged: function(visibility) {
            console.log("VISIBILITY_CHANGED", visibility,
                        "visible=", root.visible)
        }

        Component.onCompleted: {
            console.log("COMPLETED", root.visible, root.visibility)
        }

        Timer {
            interval: 1500
            running: true
            onTriggered: {
                console.log("FINAL", root.visible, root.visibility)
                Qt.quit()
            }
        }
    }

2. Use a WindowStateSaver state containing:

    [VisibilityProbe]
    1280x800 screen: Window-Maximized=true

3. Run the QML file.


ACTUAL RESULT

With KConfig 6.29.0:

    VISIBLE_CHANGED true 0
    VISIBILITY_CHANGED 4 visible= true
    COMPLETED true 4
    FINAL true 4

The window is visible and maximized by Component.onCompleted even though it was
explicitly declared visible: false.

The transition back to visible=false only happens during application shutdown.


REGRESSION TEST

I restored the exact same saved-state file before every trial.

    KConfig 6.29.0-1: 5/5 force-shown
    KConfig 6.28.0-1: 0/5 force-shown
    KConfig 6.29.0-1 after reinstall: 3/3 force-shown

Frozen saved-state SHA-256:

    08428c4976b308ad6dd9bdaa15ced66ea2fb242f88710645fe5cce0423f7569d

With no saved maximized state, the hidden window remains hidden under KConfig
6.29.

I also built KConfig v6.29.0 from source and reproduced the same behavior, so
this does not appear to be specific to the Arch Linux package.


SUSPECTED REGRESSION

The behavior appears related to:

    31dd5c79f40af792387ee6ecfb613d2aa8055a67

which reverted:

    9c204933c6438395d8a34f61c69c932c4b94ff5b

The earlier commit changed:

    if (window->windowState() == Qt::WindowMaximized) {

to:

    if (window->windowState() == Qt::WindowMaximized && window->isVisible()) {

Its commit message states that this was intended to avoid overriding an
application's decision not to show a window.

The 6.29 revert restored maximized-state restoration for Bug 522205, but
appears to restore the force-show behavior demonstrated here as well.

As a source-level control, restoring only && window->isVisible() in v6.29
prevents the hidden-window failure (0/5), but also prevents an initially
visible QML window from restoring its maximized state.

So simply reverting the revert does not appear sufficient.

The two required behaviors seem to be:

    visible: false + saved maximized -> remain hidden
    visible: true  + saved maximized -> restore maximized


EXPECTED RESULT

A QML window explicitly declared visible: false should remain hidden unless the
application itself requests that it be shown.

Restoring a saved maximized state should not implicitly make a hidden window
visible.

A window declared visible: true should still restore its saved maximized state.


ENVIRONMENT

    Arch Linux
    KConfig 6.29.0-1
    Known-good control: KConfig 6.28.0-1
    Qt6 Base 6.11.2-2
    Qt6 Declarative 6.11.2-1
    Plasma Workspace 6.7.4-3
    Linux 7.1.8-arch1-3
    KDE Plasma Wayland
    Oracle VirtualBox guest


RELATED

Bug 522205

I can attach the minimal QML reproducer, frozen saved-state file, and the
6.28/6.29 comparison logs.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to