Page MenuHomeWildfire Games

ResetCursor after init call and for hotloading following rP18933
ClosedPublic

Authored by elexis on Nov 12 2019, 1:53 PM.

Details

Summary

As reported in rP18933:

The ResetCursor call is done after LoadPage and LoadPage calls the JS init function of the loading screen which calls Engine.SetCursor("cursor-wait").
So this call broke the cursor during loading screen (by resetting after loading and running the JS script files and calling the JS init function) (or any page setting a cursor on int).
Instead, the cursor should be Reset just prior to the page construction.

Also notice that the cursor is not reset when the page is hotloaded.
This is incorrect, since the by design the page is enabled to expect / rely on the default cursor being set when the page is opened (and hotloading is the same as opening the same page again).
Therefore the ResetCursor should actually be in LoadPage.

Test Plan

Reproduce that the statement is necessary and placed correctly by:

  1. setting the ingame cursor to the gather cursor by hovering a tree, then open the JS console with F9 and type endGame();. The cursor will be carried throughout the mainmenu despite the session / g_Game having been closed and deleted unless the line is in this place.
  1. See the input.js TODO in https://trac.wildfiregames.com/ticket/539#comment:40 and that this is orthogonal to the code in question and not affected.
  1. Test that the cursor in the loading screen is the hourglass icon, with and without hotloading.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

elexis created this revision.Nov 12 2019, 1:53 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/564/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/gui/GUIManager.h
|  42| class·CGUIManager
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCGUIManager{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1078/display/redirect

This revision was not accepted when it landed; it landed in state Needs Review.Nov 12 2019, 3:45 PM
This revision was automatically updated to reflect the committed changes.
elexis updated the Trac tickets for this revision.Nov 12 2019, 3:45 PM