Commit e90d275b by PLN (Algolia)

midiviz: t shows the window again — visibility is witnessed before the flag change

Qt hides the window the instant setWindowFlag runs; the re-show guard ran
after the call and always read False, so t dismissed the lens for good
(PLN: 'it does kill it, risky'). The check now happens before.
parent 89f158bb
......@@ -3029,16 +3029,18 @@ def build_widget(port_label: str, reader: "Reader | None", scale: float = 1.0,
def _set_on_top(self, on: bool):
self.on_top = on
self._sync_menu()
# Qt requires the window be re-shown after a flag change for the
# compositor to be told. It does not touch the KWin all-desktops
# rule, which is keyed on the app id and stays in force.
# PLN, 2026-09-24: "pressing t makes the win disappear and never
# reappear it does kill it". The cause is an ordering trap: Qt
# HIDES the window the instant setWindowFlag runs, so the old
# `if self.isVisible(): self.show()` — written after the call —
# always read False and the re-show never fired. Visibility must
# be captured BEFORE the flag change: it is the only witness of
# whether the window was on screen. Qt requires the re-show after
# a flag change for the compositor to be told; it does not touch
# the KWin all-desktops rule, which is keyed on the app id.
was_visible = self.isVisible()
self.setWindowFlag(Qt.WindowType.WindowStaysOnTopHint, on)
# Only re-show a window that was already on screen. Qt needs the
# re-show to tell the compositor about a flag change on a VISIBLE
# window; a hidden one picks the flag up on its next show() -- and
# toggling the pin from the tray must not be a way to un-hide the
# lens PLN just dismissed.
if self.isVisible():
if was_visible:
self.show()
self.update()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment