Way to force cursor grab for a game window
Hello, I am running Bazzite on a desktop with two monitors and I have a question. Is it possible to force cursor grabbing to a window for a game?
I recently ran into some issues with Fallout 4. The game is set to Exclusive Fullscreen, and it's cursor respects its own window, but the OS cursor pops right out and continues going to the other screen.
Similarly, I have ran into other games such as Age of Wonders 4 which really just offer windowed borderless. For strategy game is not as much of an issue, but I will like to get have a way to lock to cursor that is not dependent on the developer to add a bespoke setting.
Solution:Jump to solution
Alright, did some testing and it works.
For anyone finding this thread for Lutris:
-Go to the game and right click, the configure.
-Go to System Options. Scroll down to Gamescope.
-Toggle Gamescope on. Toggle "Relative Mouse Mode" on. Set resolutions to your monitor resolutions for both Output and Game. Then, make sure Window Mode is Fullscreen....
13 Replies
set the games launch options to
gamescope -w inputwidth -h inputheight -W outputwidth -H outputheight -e -- %command%
this will open it inside a gamescope window and the game will think that gamescope is the only monitor that exists
fixes issues like this usuallySorry, forgot to mention that this is running through Lutris from GOG
if you have a polaris card use
gamescope-legacy
insteadbut the command is usefull for Steam games regardless
lutris has a gamescope toggle
wont work on polaris cards though since it uses the
gamescope
binary and does not know about gamescope-legacy
This would be ran in System options > Command Prefix, correct?
i dont use lutris myself
but should be somewhere for the game/prefix settings i think
I am going to double check it in Steam, but sadly it did not work. The game window maintains focus now if one clicks off the screen, but it does prevent the cursor just leaving it.
it is not perfect but it solves the main problem
there is a
--force-grab-cursor
flag too, never had to use it
--force-grab-cursor always use relative mouse mode instead of flipping dependent on cursor visibility.
I will test further tomorrow. It seems promising.
It complains about Gamescope WSI Layer Error errors left and right but --force-grab-cursor is doing it!
try set
ENABLE_GAMESCOPE_WSI=0
as env var for the game, might helpSolution
Alright, did some testing and it works.
For anyone finding this thread for Lutris:
-Go to the game and right click, the configure.
-Go to System Options. Scroll down to Gamescope.
-Toggle Gamescope on. Toggle "Relative Mouse Mode" on. Set resolutions to your monitor resolutions for both Output and Game. Then, make sure Window Mode is Fullscreen.
This cause Fallout to lock the mouse inside the screen. It does seem that it does not shut down 100% properly but stopping the game in Lutris works.
As for Fallout London. Sadly, this breaks F4SE. Disabling the above settings works, but you go back to the initial mouse issue with Fallout 4. I do think this issue is caused by weirdness with Gamescope so this it out of scope of the original issue.
Thanks @HikariKnight for all the help.
mark it as the solution and we are all good then π
right click your message and choose "apps" and mark as solution π