Skip to content

[ExtMFD] Fix ExtMFD size amnesia#663

Open
EvESpirit wants to merge 1 commit into
orbitersim:mainfrom
EvESpirit:extmfd-size
Open

[ExtMFD] Fix ExtMFD size amnesia#663
EvESpirit wants to merge 1 commit into
orbitersim:mainfrom
EvESpirit:extmfd-size

Conversation

@EvESpirit
Copy link
Copy Markdown
Contributor

This PR fixes #355, an issue with ExtMFD from 3 years ago (sheesh). The core issues were actually two things:

While ImGuiCond_Once sounds like the correct flag, it just means something like "apply this rule the first time this code is executed per runtime session.". This obviously causes it to default out. The fix makes it so it only defaults if there's no saved size data for a specific window.

The second one was weird, basically the ImGui dialog's "name" was generated using the memory pointer of the MFDWindow instance - meaning that features like ASLR that are fairly standard these days force it to always think that it's a different window that needs a new name - so eventhough we save (after the first modification), we still are unable to retrieve the size info, so we default. I fixed this with a tiny and simple ID system for extmfd windows since that seemed like the easiest option.

@TheGondos
Copy link
Copy Markdown
Contributor

Gave it a try, this is nice. Also since the position is saved, the layout is conserved too.


static std::vector<bool> g_usedWindowIds;

int GetFreeWindowId() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could be static

return g_usedWindowIds.size();
}

void FreeWindowId(int id) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

static

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.

Make External MFD save/load a previous set window size

2 participants