From 10dd0322d4459f83528f44d7c1a7e12074e60d6d Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Thu, 18 Nov 2021 22:02:30 +0000 Subject: [PATCH] steamcompmgr: Resolve transient links before determining input focus Helps with launchers like FO:NV and other games where we end up having the visuals disjoint from what we actually want to input to. Signed-off-by: Joshua Ashton --- src/steamcompmgr.cpp | 50 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 6c8733f..acbc93b 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -1729,31 +1729,6 @@ found: gameFocused = focus->appID != 0; } - unsigned long focusedWindow = 0; - unsigned long focusedAppId = 0; - - if ( inputFocus == NULL ) - { - inputFocus = focus; - } - - if ( focus ) - { - focusedWindow = focus->id; - focusedAppId = inputFocus->appID; - } - - XChangeProperty( dpy, root, gamescopeFocusedAppAtom, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&focusedAppId, focusedAppId != 0 ? 1 : 0 ); - - XChangeProperty( dpy, root, gamescopeFocusedWindowAtom, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&focusedWindow, focusedWindow != 0 ? 1 : 0 ); - - if (!focus) - { - return; - } - if ( gameFocused ) { // Do some searches through game windows to follow transient links if needed @@ -1779,6 +1754,31 @@ found: } } + unsigned long focusedWindow = 0; + unsigned long focusedAppId = 0; + + if ( inputFocus == NULL ) + { + inputFocus = focus; + } + + if ( focus ) + { + focusedWindow = focus->id; + focusedAppId = inputFocus->appID; + } + + XChangeProperty( dpy, root, gamescopeFocusedAppAtom, XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&focusedAppId, focusedAppId != 0 ? 1 : 0 ); + + XChangeProperty( dpy, root, gamescopeFocusedWindowAtom, XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&focusedWindow, focusedWindow != 0 ? 1 : 0 ); + + if (!focus) + { + return; + } + // if (fadeOutWindow.id == None && currentFocusWindow != focus->id) // { // // Initiate fade out if switching focus