Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
umu_run: perform window setup in thread
Browse files Browse the repository at this point in the history
R1kaB3rN committed Oct 18, 2024
1 parent 9982b40 commit e5e481b
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions umu/umu_run.py
Original file line number Diff line number Diff line change
@@ -521,14 +521,16 @@ def monitor_baselayer(
def monitor_windows(
d_secondary: display.Display,
gamescope_baselayer_sequence: list[int],
game_window_ids: set[str],
) -> None:
"""Monitor for new windows and assign them Steam's layer ID."""
window_ids: set[str] = game_window_ids.copy()
window_ids: set[str] | None = None
steam_assigned_layer_id: int = get_steam_layer_id(
gamescope_baselayer_sequence
)

while not window_ids:
window_ids = get_window_client_ids(d_secondary)

log.debug("Monitoring windows")

# Check if the window sequence has changed
@@ -555,10 +557,6 @@ def run_in_steammode(proc: Popen) -> int:
"""
# GAMESCOPECTRL_BASELAYER_APPID value on the primary's window
gamescope_baselayer_sequence: list[int] | None = None
# Windows that will be assigned Steam's layer ID
window_client_list: set[str] | None = None
is_createpfx: bool = os.environ.get("EXE") == ""
is_winetricks: bool = os.environ.get("EXE", "").endswith("winetricks")

# Currently, steamos creates two xwayland servers at :0 and :1
# Despite the socket for display :0 being hidden at /tmp/.x11-unix in
@@ -576,34 +574,17 @@ def run_in_steammode(proc: Popen) -> int:
# Note: If the executable is one that exists in the WINE prefix
# or container it is possible that umu wil hang when running a
# game within a gamescope session
if (
gamescope_baselayer_sequence
and not is_createpfx
and not is_winetricks
):
if gamescope_baselayer_sequence:
d_secondary.screen().root.change_attributes(
event_mask=X.SubstructureNotifyMask
)

# Get new windows under the client display's window
while not window_client_list:
window_client_list = get_window_client_ids(d_secondary)

# Setup the windows
window_setup(
d_primary,
d_secondary,
gamescope_baselayer_sequence,
window_client_list,
)

# Monitor for new windows
window_thread = threading.Thread(
target=monitor_windows,
args=(
d_secondary,
gamescope_baselayer_sequence,
window_client_list,
),
)
window_thread.daemon = True

0 comments on commit e5e481b

Please sign in to comment.