Added better support for kubuntu and fixed some issues with telemetry.

This commit is contained in:
2026-09-09 22:35:13 +02:00
parent 6e6219107e
commit 290d1a5383
8 changed files with 587 additions and 65 deletions

View File

@@ -479,6 +479,18 @@ class _X11:
return None
return values[0]
def restore_normal_window_state(self, window: int) -> bool:
"""Undo a nested game iconify without activating the outer host window."""
self._replace_long_property(
window,
b"WM_STATE",
b"WM_STATE",
(_X_WM_STATE_NORMAL, 0),
)
self.library.XSync(self.display, 0)
return self.window_state(window) == _X_WM_STATE_NORMAL
def window_is_borderless(self, window: int) -> bool | None:
"""Return whether the client currently requests no Motif decorations."""
@@ -1776,9 +1788,38 @@ def _resolve_gamescope_game_window(
wm_state=_wm_state_name(state),
)
if state == _X_WM_STATE_ICONIC:
# IconicState can be a real desktop minimize request. Monitoring must never
# turn that user-controlled state back into a visible window.
return None
# This mapper runs inside Gamescope's nested X server. The desktop owns a
# separate outer window, so restoring this game-driven login transition
# neither activates nor raises a minimized host window.
try:
restored = mapper.restore_normal_window_state(window)
except Exception as exc:
restored = False
if diagnostics is not None:
diagnostics.record(
"nested_iconify_recovery_failed",
window_id=window,
error_type=type(exc).__name__,
)
if restored:
if diagnostics is not None:
diagnostics.record(
"nested_iconify_recovered",
window_id=window,
**_sample_window_diagnostic_details(
diagnostics,
mapper,
window,
),
)
print(
"Game login window requested nested minimization; kept its "
"surface visible inside Gamescope.",
file=sys.stderr,
flush=True,
)
return window
state = None
if state is not None and state != _X_WM_STATE_WITHDRAWN:
return window