diff --git a/src/hhd/controller/base.py b/src/hhd/controller/base.py index ec2c29be..9ee5d0f7 100644 --- a/src/hhd/controller/base.py +++ b/src/hhd/controller/base.py @@ -94,7 +94,7 @@ def __init__(self, ctx=None) -> None: self._controller_cb = None self._qam_cb = None self.ctx = ctx - self.use_legacy_qam = bool(os.environ.get("HHD_QAM_LEGACY", None)) + self.use_legacy_qam = not bool(os.environ.get("HHD_QAM_GAMESCOPE", None)) def send_qam(self): with self.intercept_lock: diff --git a/src/hhd/plugins/overlay/x11.py b/src/hhd/plugins/overlay/x11.py index 58b53262..05a741f7 100644 --- a/src/hhd/plugins/overlay/x11.py +++ b/src/hhd/plugins/overlay/x11.py @@ -24,6 +24,9 @@ class CachedValues(NamedTuple): touch: int | None +QAM_DELAY = 0.35 + + class QamHandler: def __init__( @@ -73,6 +76,7 @@ def _send_qam(self, expanded=False): fake_input(disp, X.KeyPress, KCTRL) # , root=steam) fake_input(disp, X.KeyPress, KEY) # , root=steam) disp.sync() + time.sleep(QAM_DELAY) fake_input(disp, X.KeyRelease, KCTRL) # , root=steam) fake_input(disp, X.KeyRelease, KEY) # , root=steam) disp.sync() @@ -150,10 +154,11 @@ def get_overlay_display(displays: Sequence[str], ctx=None): restore_priviledge(old) -def find_win(display: display.Display, win: list[str], atoms: list[str] = []): +def find_wins(display: display.Display, win: list[str], atoms: list[str] = []): n = display.get_atom("WM_CLASS") a_ids = [display.get_atom(a, only_if_exists=True) for a in atoms] + wins = [] for w in display.screen().root.query_tree().children: # Check the window has the proper class v = w.get_property(n, Xatom.STRING, 0, 50) @@ -174,7 +179,13 @@ def find_win(display: display.Display, win: list[str], atoms: list[str] = []): found = False if found: - return w + wins.append(w) + return wins + + +def find_win(display: display.Display, win: list[str], atoms: list[str] = []): + out = find_wins(display, win, atoms) + return out[0] if out else None def register_changes(display, win):