D689 shows one use case where we would like to execute some JS code after the window was resized (to conditionally show the follow-player label).
Details
Confirm that the message is also received even if multiple GUI pages are opened, for example a delete dialog in the session.
Consider whether the SendEventToAll should be done in a separate loop after the existing loop instead (doesn't seem needed to me, since those are different GUI contexts to begin with that can't influence each other afaik).
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Checking XML files...
http://jw:8080/job/phabricator/1656/ for more details.
Executing section Default... Executing section Source... Executing section JS... Executing section XML GUI... Executing section Python... Executing section Perl...
http://jw:8080/job/phabricator_lint/259/ for more details.
As reported by temple, Engine.GetGUIObjectByName fails because it looked in the top page instead of the page were called the event in.
If we look into that function we see that it checks for m_CurrentGUI and that TickObjects changes that member.
Changing that member here as well fixes the issue.
Updated the wrong diff with the last update.
Simplification: Call CList::UpdateCachedSize() only from CDropDown::UpdateCachedSize(), not from CDropDown::SetupText().
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Checking XML files...
http://jw:8080/job/phabricator/1658/ for more details.
Executing section Default... Executing section Source... Executing section JS... Executing section XML GUI... Executing section Python... Executing section Perl...
http://jw:8080/job/phabricator_lint/261/ for more details.
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Checking XML files...
http://jw:8080/job/phabricator/1659/ for more details.
Executing section Default... Executing section Source... Executing section JS... Executing section XML GUI... Executing section Python... Executing section Perl...
http://jw:8080/job/phabricator_lint/262/ for more details.
Updated D692 instead of D694 again.
See Vladislav two comments in https://code.wildfiregames.com/D692?id=2749#27635
(As reported by temple, Engine.GetGUIObjectByName fails because it looked in the top page instead of the page were called the event in.
If we look into that function we see that it checks for m_CurrentGUI and that TickObjects changes that member.
Changing that member here as well fixes the issue.)
Answering https://code.wildfiregames.com/D692?id=2749#27635
See the upload commnet for that.
We have to use m_CurrentGUI, because the code executed in the JS event would be executed in the top page, not the page of the stack.
For example if subscribe session.xml to the resized event but opened a delete-dialog, then the session.js code would look for the civ icon in the delete dialog (top page).
We have to reset afterwards, so that the GUI manager doesn't do things on that pointer anymore but on the top page by default.
Answering https://code.wildfiregames.com/D692?id=2749#27643
The name is accurate and this is the only resized stack afaics.
source/gui/GUIManager.cpp | ||
---|---|---|
409 ↗ | (On Diff #2753) | Compare with this |
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Checking XML files...
http://jw:8080/job/phabricator/1661/ for more details.
Executing section Default... Executing section Source... Executing section JS... Executing section XML GUI... Executing section Python... Executing section Perl...
http://jw:8080/job/phabricator_lint/264/ for more details.
I don't know the details of the code, but this and D692 fixed the problems with hiding the follow player label and getting the right dropdown length when resizing the window (D689 plus the on WindowResized action).
Edit: I didn't phrase that in the best way, so to be clear: this patch allows the follow player label to hide when the window's resized. D692 fixing the dropdown height is independent of this.
Copy the page stack so that all pages are traversed properly, even if the we would push or pop GUI pages in the script handler
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Checking XML files...
http://jw:8080/job/phabricator/1666/ for more details.
Executing section Default... Executing section Source... Executing section JS... Executing section XML GUI... Executing section Python... Executing section Perl...
http://jw:8080/job/phabricator_lint/267/ for more details.