Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Restrict mouse to window #1

Closed
Niamor opened this issue Mar 6, 2018 · 31 comments
Closed

Restrict mouse to window #1

Niamor opened this issue Mar 6, 2018 · 31 comments

Comments

@Niamor
Copy link

Niamor commented Mar 6, 2018

Hello,
First of all thank you very much for this, much needed feature in pretty much any game.
I'd like to ask if it was possible to add a way to restrict the mouse to the Dying Light window with either a hotkey or just when focused and not alt-tabbed.
In a dual monitor setup my mouse goes to my other monitor and even though not visible, does interact with it if I use my mouse wheel for example or if it goes all the way top right on my taskbar and show my desktop.

Thanks again.
Niamor.

@ThirteenAG
Copy link
Owner

It should be pretty easy to do, if you want I can try tomorrow.

@Niamor
Copy link
Author

Niamor commented Mar 6, 2018

I'm getting so frustrated having to shift-tab or alt-tab every time I want to use mouse wheel or here in borderless windowed showing my desktop in the middle of an invasion!
I didn't think it was going to be super hard so wanted to ask before I look it up myself.
That would mean so much to me.
Thank you very much.

@ThirteenAG
Copy link
Owner

Can't reproduce the issue, mouse cursor doesn't move for me if the game window is active.
However try this, see if it helps: https://transfer.sh/285bp/DyingLight.BorderlessWindowedMode.asi

@Niamor
Copy link
Author

Niamor commented Mar 7, 2018

Hello,
Easy way to reproduce would be while ingame move towards your second monitor then use shift-tab to bring the steam overlay then your windows mouse should appear on your second monitor instead of ingame.
Not sure how to really explain.
In any case your fix is working like a charm, mouse seems to stay in the middle of the window now, perfect. Thank you so much!!

@ThirteenAG
Copy link
Owner

I see, maybe in this case there's no need to constantly reset mouse, try this one as well: https://transfer.sh/hDEjS/DyingLight.BorderlessWindowedMode.asi

@Niamor
Copy link
Author

Niamor commented Mar 7, 2018

That one seems to work as well, mouse seems to be moving this time but without affecting anything on my second monitor if I use mouse wheel for example or in my case trying to move it top right to trigger the taskbar icon "show desktop". It doesn't until I hit shift-tab which then brings mouse and triggers it.
Both are good to me.
Thanks again.

@ThirteenAG
Copy link
Owner

So, which one would you prefer? I'll release it.

@Niamor
Copy link
Author

Niamor commented Mar 7, 2018

Both seems good really, looks like you reset the position of the mouse in the second one if alt tabbed, not when bringing up the steam overlay but it really doesn't matter much to me as long as my mouse doesn't interfere with my second monitor and both seems to be doing that just fine.
Played with the first one for hours earlier and no issues, felt so good!

@ThirteenAG
Copy link
Owner

Okay, updated with the second one.

@Niamor
Copy link
Author

Niamor commented Mar 8, 2018

Alright first of all I'm really sorry.
I decided to do some more tests and manage to pretty much reproduce the issue every single time with both of the .asi as well as original windowed and fullscreen version of the game.

At launch in (borderless)windowed mode the mouse will interact with second monitor (at least mouse wheel).
I couldn't reproduce the showing desktop issue that I had the first time using borderless windowed mode.
If I use alt tab then refocus on the game it seems like the mouse cannot interact with second monitor windows anymore.
Using Steam-Overlay seems to reset that state where the mouse can once again interact with second monitor windows.
On fullscreen even after using alt-tab and refocus on the game the mouse still interact with second monitor windows.

I made a quick video showing it: https://streamable.com/tx84p

I guess at the end what you added didn't do much? I'm really sorry.
Even though I guess I could just remember not to shift tab and use alt tab to focus the game again I wish my mouse wouldn't wander on my other windows.

Thanks again.

@ThirteenAG
Copy link
Owner

@ThirteenAG
Copy link
Owner

So, have you had a change to try the build above?

@Niamor
Copy link
Author

Niamor commented Mar 10, 2018

Sorry I did, I just wanted to be sure to do proper testing this time.
It doesn't fix the mouse going on my second monitor at launch, I can see it being "blocked" at first for a bit but as soon as the intro movie starts it "releases" it.
If I alt-tab it fixes it like before but it also fixes it if I shift tab to bring the steam overlay and I wasn't able to reproduce using the steam overlay to reset mouse cursor being able to interact with my other windows this time.
So as long as I alt-tab then focus back on the game which I do pretty much every single time when I launch the game anyway it doesn't look like the mouse have any way of interacting with my other windows anymore.
Edit: I wonder if I skip intro videos it would change something let me try.
Edit2: It doesn't.

@ThirteenAG
Copy link
Owner

What about this one then: https://transfer.sh/kMmil/DyingLight.BorderlessWindowedMode.asi

@Niamor
Copy link
Author

Niamor commented Mar 10, 2018

Same thing.

@ThirteenAG
Copy link
Owner

Ok, this should do it for startup I think: https://transfer.sh/Ygj3f/DyingLight.BorderlessWindowedMode.asi

@Niamor
Copy link
Author

Niamor commented Mar 10, 2018

Still the same.

@ThirteenAG
Copy link
Owner

@Niamor
Copy link
Author

Niamor commented Mar 10, 2018

Sorry about late reply, just tried and same thing.

@ThirteenAG
Copy link
Owner

So, you mean when you start the game and don't do anything, by the time you get to menu the mouse is still active on the other desktop unless you alt-tab and back?

@Niamor
Copy link
Author

Niamor commented Mar 10, 2018

Exactly.

@ThirteenAG
Copy link
Owner

I believe this should do it then: https://transfer.sh/2Wwx2/DyingLight.BorderlessWindowedMode.asi

@Niamor
Copy link
Author

Niamor commented Mar 10, 2018

Apparently not.

@ThirteenAG
Copy link
Owner

How come? For me when menu is loaded I can no longer interact with windows on the second screen.

@ThirteenAG
Copy link
Owner

Ah, actually no, was able to reproduce. Weird.

@Niamor
Copy link
Author

Niamor commented Mar 10, 2018

https://streamable.com/86egp
I don't know.

@ThirteenAG
Copy link
Owner

Ok, I think it stops happening if I set cursor position also, try this: https://transfer.sh/JXi1K/DyingLight.BorderlessWindowedMode.asi

@Niamor
Copy link
Author

Niamor commented Mar 11, 2018

It doesn't seem to show my cursor at the beginning anymore (which was only for a few seconds) but still interact with my other windows.

@ThirteenAG
Copy link
Owner

If this doesn't work, then I'm out of ideas, probably have to leave it that way: https://transfer.sh/QDLTE/DyingLight.BorderlessWindowedMode.asi

@Niamor
Copy link
Author

Niamor commented Mar 11, 2018

Tested it a bit and I think you got it this time, works like a charm.
Thanks a lot for your dedication on this, I would have been fine with the first one really and that's amazing that you took the time for it.

@ThirteenAG
Copy link
Owner

Nice, new version should be released shortly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants