Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve window management code #53

Merged
merged 2 commits into from
Sep 20, 2024
Merged

Improve window management code #53

merged 2 commits into from
Sep 20, 2024

Conversation

Kaldaien
Copy link
Contributor

I have fixed numerous issues with the new window management functions:

  1. The logic to find the game's main window never times out, and only searches for windows running on the game's main thread

  2. ClipCursor (...) is hooked so that no other code can change the rectangle; simply setting or clearing the boundaries on window activation is inadequate to prevent the cursor from slipping out of the window.

  3. The mouse boundaries have been shrunken so that the title bar and resize frames are always grabbable.

  4. The mouse boundaries are ignored while the user is resizing or dragging the window.

  5. The mouse boundaries automatically update if the window is programmatically moved (i.e. Windows+Shift+Left/Right) to a different monitor.

  6. WM_SETFOCUS and WM_KILLFOCUS are used instead of window activation for all things window-focus related.

  7. When swallowing window activation in order to prevent the game from muting, pass-through to DefWindowProc (...) so that RawInput stops processing mouse input when another window is active.

  8. The initialization thread is created suspended so that it does not run to completion before you can even set its priority 😸

@Kaldaien
Copy link
Contributor Author

I also added an option to disable the screensaver while the game's window is focused.

I -highly- recommend shipping this turned on by default, as the Steam forums are flooded with users complaining about their display entering power saving mode during long cutscenes. Worst of all, when the display is powered back on, the game gives them an "Operation Completed Successfully" error 🤣

@Lyall
Copy link
Owner

Lyall commented Sep 20, 2024

That looks great, and works fantastically. Disabling the screensaver is a nice touch!

@Lyall Lyall merged commit 66555f0 into Lyall:master Sep 20, 2024
@intopuddles
Copy link

intopuddles commented Sep 21, 2024

I also added an option to disable the screensaver while the game's window is focused.

I -highly- recommend shipping this turned on by default, as the Steam forums are flooded with users complaining about their display entering power saving mode during long cutscenes. Worst of all, when the display is powered back on, the game gives them an "Operation Completed Successfully" error 🤣

I just got this in a longer scene without having a screensaver enabled. I went ahead and increased my display inactivity timer from 5min in Windows, which I'm assuming will solve it. Does this merge solve that issue or is it just the screensaver?

EDIT: Just got the message again, this time because of alt+tabbing during a paused cutscene lol

@Zigbigidorlu
Copy link

Excellent! Everything seems to work perfectly.

@truduEprocEss
Copy link

truduEprocEss commented Sep 21, 2024

DisableScreenSaver isn't working for me so I checked the ini and the log.
The FFXVIFix.ini shows:
; Set "DisableScreensaver" to true to stop your display from going to sleep mid-game.
DisableScreenSaver = true

The FFXVIFix.log shows:
[2024-09-21 11:11:53.131] [FFXVIFix.log] [info] Config Parse: bDisableScreensaver: false

@Lyall
Copy link
Owner

Lyall commented Sep 21, 2024

DisableScreenSaver isn't working for me so I checked the ini and the log. The FFXVIFix.ini shows: ; Set "DisableScreensaver" to true to stop your display from going to sleep mid-game. DisableScreenSaver = true

The FFXVIFix.log shows: [2024-09-21 11:11:53.131] [FFXVIFix.log] [info] Config Parse: bDisableScreensaver: false

Typo on my part, should be fixed in the next build. f4ed0cd

@Lyall
Copy link
Owner

Lyall commented Sep 21, 2024

I also added an option to disable the screensaver while the game's window is focused.
I -highly- recommend shipping this turned on by default, as the Steam forums are flooded with users complaining about their display entering power saving mode during long cutscenes. Worst of all, when the display is powered back on, the game gives them an "Operation Completed Successfully" error 🤣

I just got this in a longer scene without having a screensaver enabled. I went ahead and increased my display inactivity timer from 5min in Windows, which I'm assuming will solve it. Does this merge solve that issue or is it just the screensaver?

EDIT: Just got the message again, this time because of alt+tabbing during a paused cutscene lol

It should stop windows from putting the display to sleep, yes.

@truduEprocEss
Copy link

DisableScreenSaver isn't working for me so I checked the ini and the log. The FFXVIFix.ini shows: ; Set "DisableScreensaver" to true to stop your display from going to sleep mid-game. DisableScreenSaver = true
The FFXVIFix.log shows: [2024-09-21 11:11:53.131] [FFXVIFix.log] [info] Config Parse: bDisableScreensaver: false

Typo on my part, should be fixed in the next build. f4ed0cd

Thanks, Lyall. I saw your fix and corrected it in my ini. It's working now.

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

Successfully merging this pull request may close these issues.

5 participants