Skip to content

[GEN][ZH] Fix left alt freezing game in window mode #837

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Mauller
Copy link

@Mauller Mauller commented May 10, 2025

This PR prevents the game from freezing when the left ALT key is pressed.

The underlying issue is due to the games window process not acknowledging the WM_SYSCOMMAND SC_KEYMENU message.

Due to this, the message is then processed by the default window process which then will try to open the windows context menu which does not exist in this instance but causes the message loop to freeze.

This may also help prevent some mismatches that could be caused by a game freezing for too long when someone is playing in window mode.

@Mauller Mauller self-assigned this May 10, 2025
@Mauller Mauller added Generals Related Generals only ZeroHour Relates to Zero Hour Fix Is fixing something labels May 10, 2025
@@ -373,6 +373,10 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message,
case SC_SIZE:
case SC_MAXIMIZE:
case SC_KEYMENU:
// TheSuperHackers @bugfix Mauller 10/05/2025 Handle left ALT when in windowed mode to prevent game freezing
Copy link

Choose a reason for hiding this comment

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

Uses tabs incorrectly.

Copy link
Author

Choose a reason for hiding this comment

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

How do you mean? As in the alignment?

Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

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

I think the way it should be fixed is like so:

            switch( wParam )
            {
                case SC_MOVE:
                case SC_SIZE:
                case SC_MAXIMIZE:
                case SC_MONITORPOWER:
                  if( FALSE == ApplicationIsWindowed )
                    return 1;
                  break;
                case SC_KEYMENU:
                  return 1;
            }

@Mauller Mauller force-pushed the fix-left-alt-freeze branch from d83b11a to 0dc277c Compare May 11, 2025 16:15
@Mauller
Copy link
Author

Mauller commented May 11, 2025

I think the way it should be fixed is like so:

            switch( wParam )
            {
                case SC_MOVE:
                case SC_SIZE:
                case SC_MAXIMIZE:
                case SC_MONITORPOWER:
                  if( FALSE == ApplicationIsWindowed )
                    return 1;
                  break;
                case SC_KEYMENU:
                  return 1;
            }

Did something similar to this but i stuck the SC_KEYMENU option first in the switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Is fixing something Generals Related Generals only ZeroHour Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pressing ALT key in Windowed Mode stops the game update
3 participants