Skip to content

unify(client): Move GUI window managers and message boxes to Core#2617

Closed
DevGeniusCode wants to merge 1 commit intoTheSuperHackers:mainfrom
DevGeniusCode:unify/client-gui-window-managers
Closed

unify(client): Move GUI window managers and message boxes to Core#2617
DevGeniusCode wants to merge 1 commit intoTheSuperHackers:mainfrom
DevGeniusCode:unify/client-gui-window-managers

Conversation

@DevGeniusCode
Copy link
Copy Markdown

Summary

This PR is the second part of the series aimed at reducing code duplication between Generals and GeneralsMD (following PR #2616). It unifies the GUI window managers, message boxes, and client dispatch files into the shared Core directory.

Key Changes

  • File Relocation: Moved 14 GameClient files (Source and Include) related to GUI systems and framework to the Core directory.
  • Functional Parity: The logic across all moved files remains strictly intact and functionally identical between Vanilla and Zero Hour.

Files Moved:

GUI & Window Managers:

  • AnimateWindowManager.cpp / AnimateWindowManager.h
  • GameWindowManager.cpp / GameWindowManager.h
  • GameWindowID.h

Message Boxes:

  • MessageBox.cpp / MessageBox.h
  • ExtendedMessageBox.cpp / ExtendedMessageBox.h

Client Core & Updates:

  • GameClientDispatch.cpp
  • HotKey.cpp / HotKey.h
  • SwayClientUpdate.cpp / SwayClientUpdate.h

@DevGeniusCode DevGeniusCode added the Unify Unifies code between Generals and Zero Hour label Apr 18, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 18, 2026

Greptile Summary

This PR moves 14 GUI/window manager files (headers and sources) from the game-specific Generals/ and GeneralsMD/ directories into the shared Core/GameEngine/ tree, continuing the deduplication effort from PR #2616. The Generals and GeneralsMD CMakeLists entries for these files are commented out, while the Core CMakeLists entries are activated. No functional logic changes are made.

Confidence Score: 5/5

Safe to merge — pure file relocation with no functional changes.

All moved files retain correct GPL/EA copyright headers, use #pragma once, and have no NULL pointer or logic issues in the moved content. CMakeLists.txt is correctly updated across all three targets (Core, Generals, GeneralsMD). Remaining findings are all P2 or lower.

No files require special attention.

Important Files Changed

Filename Overview
Core/GameEngine/CMakeLists.txt Activates 14 GUI/window files in the Core build; entries are properly uncommented and consistent with the moved sources.
Generals/Code/GameEngine/CMakeLists.txt All moved files are correctly commented out; no active duplicate entries remain.
GeneralsMD/Code/GameEngine/CMakeLists.txt Mirrors the Generals CMakeLists change; all unified entries commented out correctly.
Core/GameEngine/Include/GameClient/GameWindowManager.h Moved intact from GeneralsMD; uses #pragma once, proper EA copyright, no logic changes.
Core/GameEngine/Include/GameClient/AnimateWindowManager.h Moved intact; uses #pragma once, EA copyright, and existing wnd namespace for WinUser.h collision avoidance.
Core/GameEngine/Source/GameClient/GameClientDispatch.cpp Moved intact; GPL/EA header present, no functional changes.
scripts/cpp/unify_move_files.py New commented-out unify_file calls document this PR's operations. Minor style nit: parameter named type shadows the Python built-in; substring matching in modify_cmakelists could match over-broadly for certain filename pairs.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before["Before PR #2617"]
        G["Generals/Code/GameEngine/\nInclude+Source (active)"]
        Z["GeneralsMD/Code/GameEngine/\nInclude+Source (active)"]
    end

    subgraph After["After PR #2617"]
        G2["Generals/Code/GameEngine/\nInclude+Source (commented out)"]
        Z2["GeneralsMD/Code/GameEngine/\nInclude+Source (commented out)"]
        C["Core/GameEngine/\nInclude+Source (active)"]
    end

    subgraph Files["Unified Files"]
        F1["AnimateWindowManager .h/.cpp"]
        F2["GameWindowManager .h/.cpp"]
        F3["GameWindowID.h"]
        F4["MessageBox .h/.cpp"]
        F5["ExtendedMessageBox .h/.cpp"]
        F6["GameClientDispatch.cpp"]
        F7["HotKey .h/.cpp"]
        F8["SwayClientUpdate .h/.cpp"]
    end

    G -- "move to" --> C
    Z -- "delete duplicate" --> C
    C --> F1 & F2 & F3 & F4 & F5 & F6 & F7 & F8
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: scripts/cpp/unify_move_files.py
Line: 58-71

Comment:
**`type` parameter shadows Python built-in**

The parameter name `type` in `modify_cmakelists` shadows the Python built-in `type()`. While this doesn't affect functionality here, it is a common Python anti-pattern. Consider renaming it to `modify_type` or `action` for clarity.

```suggestion
def modify_cmakelists(cmakeFile: str, searchString: str, modify_type: CmakeModifyType):
```

Then update the internal usages (`if type ==``if modify_type ==`) accordingly.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (4): Last reviewed commit: "unify(client): Move GUI window managers ..." | Re-trigger Greptile

@DevGeniusCode DevGeniusCode changed the title unify(client): Merge and move GUI window managers and message boxes to Core unify(client): Move GUI window managers and message boxes to Core Apr 20, 2026
@DevGeniusCode DevGeniusCode force-pushed the unify/client-gui-window-managers branch from d37addd to 48b5f97 Compare April 20, 2026 18:19
@xezon
Copy link
Copy Markdown

xezon commented Apr 21, 2026

Needs rebase.

@DevGeniusCode DevGeniusCode force-pushed the unify/client-gui-window-managers branch from 48b5f97 to 44d1f1d Compare April 22, 2026 02:56
@DevGeniusCode DevGeniusCode force-pushed the unify/client-gui-window-managers branch from 44d1f1d to 8022ae9 Compare April 22, 2026 03:04
@DevGeniusCode
Copy link
Copy Markdown
Author

rebased

Copy link
Copy Markdown

@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.

You have created 3 changes for moving GUI related files.

I think the way this should go is first merge all GUI code, then move all GUI files to Core. That will be 2 commits total.

@DevGeniusCode
Copy link
Copy Markdown
Author

Since there are no logic differences at all (the files are already identical), a preliminary commit to merge logic isn't needed.

Because the branches are stacked, PR #2619 already contains all the file moves from the first two. The first two PRs can simply be closed, and PR #2619 can be updated and merged as a single, unified PR.

Copy link
Copy Markdown

@Skyaero42 Skyaero42 left a comment

Choose a reason for hiding this comment

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

Verified that all files are the same.

This is correct except one file: HotKey.h, which in Zero hour fixes a spelling mistake in a comment.

@xezon
Copy link
Copy Markdown

xezon commented Apr 26, 2026

Since there are no logic differences at all (the files are already identical), a preliminary commit to merge logic isn't needed.

Because the branches are stacked, PR #2619 already contains all the file moves from the first two. The first two PRs can simply be closed, and PR #2619 can be updated and merged as a single, unified PR.

So far we have always tried to move files to Core in logical batches. That means we pick a certain subsystem, such as Network, then merge all Network code, and then move all Network files to Core.

For GUI, we can split it in ControlBar, Gadgets and Menus. So the logical approach here is to merge all ControlBar files, then move them to Core. Then merge all Gadgets, move to Core. Then merge all Menus, move to Core.

This approach is better than just picking pieces because picking pieces will create more isolated commits in the history.

@DevGeniusCode DevGeniusCode deleted the unify/client-gui-window-managers branch May 2, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Unify Unifies code between Generals and Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants