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

Fix Unity killing window managers with insane window sizes #93

Merged
merged 2 commits into from
Nov 5, 2022

Conversation

TellowKrinkle
Copy link
Member

Unity versions ≤ 5.5.3p3 have a broken window resize function that sends uninitialized stack data to XSetWMNormalHints, which tends to not be appreciated by window managers.

Patch the function to immediately return, and reimplement it ourselves.

@drojf
Copy link
Contributor

drojf commented Nov 4, 2022

sorry I took so long to see this, I don't seem to get email notifications for PR on this repo? I'm going to try to figure out how to turn it on....

@drojf
Copy link
Contributor

drojf commented Nov 4, 2022

OK, tested this fix on Meakashi ep5 on my Manjaro, and it works fine now.

Looking at the unity versions, am I correct in thinking chapters 1,2,3,4,5,6 are the only ones which can have this problem?

Chapters which I've double checked where the fix works (and doesn't cause any other problems):

Fix Tested Chapter Store Unmodded Crashes
Yes 1 Steam No
Yes 2 Steam No
Yes 3 Steam Yes
Yes 4 Steam Yes
Yes 5 Steam Yes
Yes 6 Steam Yes

I'll go ahead and test on the other chapters as well, unless you think it's not necessary for the type of changes you made.

@drojf
Copy link
Contributor

drojf commented Nov 4, 2022

I noticed these minor issues which probably aren't related to this issue, but might be. I've seen some of them before but didn't note them down anywhere. I'll raise another issue later with these items once this PR is closed.

  • One small issue I noticed (I don't think it's due to this issue), is that on my system I can forcibly resize the window by dragging it to touch the top of the screen (this kind of pins it as windowed mode, but fills the whole screen). Once it is in this state, you can't change the windowed resolution (it will change briefly, then change back). Going fullscreen, then back to windowed doesn't fix the issue. You need to drag the window out of the pinned state, then it returns to normal.

    • This seems very much like a window manager thing so I don't think we can fix this, but may be worth noting.
  • Another unrelated? issue I noticed is that I can set the windowed resolution greater than the resolution of my screen (for example, set 2560x1440 when my screen is 1920x1080). Changing to a lower windowed resolution is then only possible if you go fullscreen again via a hotkey, which is complicated by the next issue (because you cannot see the resolution change buttons anymore as they are off the screen).

    • I should check whether the Windows version lets you do this or not, or if it caps the resolution.
  • Going fullscreen via the f key only works if you're not in a menu - you have to be in normal mode - 'StateNormal' as it is called in DLL I think.

    • This one should be pretty easy to fix.
  • Using ALT-Enter to change from windowed to fullscreen has no effect (hopefully it's not my laptop keyboard setup or something). I thought I noticed the window trying to change resolution when I pressed alt-enter, but I can't seem to reproduce it.

Copy link
Contributor

@drojf drojf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh I can't fully check this since I don't understand everything, but I tried lol

@drojf
Copy link
Contributor

drojf commented Nov 4, 2022

I tested on chapters 1-6 with no issues, you can merge if you're ready

@drojf drojf merged commit d4d5aa1 into 07th-mod:mod Nov 5, 2022
@TellowKrinkle
Copy link
Member Author

Looking at the unity versions, am I correct in thinking chapters 1,2,3,4,5,6 are the only ones which can have this problem?

Correct. Ch 7 uses 5.6.7f1, which has a new function for setting resolutions. I can't say anything for whether it's broken or not, but you'd hope that if they rewrote it they didn't replace it with another broken one.

@TellowKrinkle TellowKrinkle deleted the FixLinuxResize branch November 5, 2022 03:33
@drojf
Copy link
Contributor

drojf commented Nov 5, 2022

I tested vanilla ch7 and ch8 just now and they work fine.

From previous testing, ch9 (Rei) also works fine, so I think we're all good 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.

None yet

2 participants