Repository navigation
Interface: a screen that is up has the focus, as the original's (isFocused) - #169
Open
MortenLyhr wants to merge 1 commit into
Open
MortenLyhr wants to merge 1 commit into
MortenLyhr wants to merge 1 commit into
Conversation
CvInterface::isFocused was a stub that said no, so with the city screen or
an advisor up the map's controls still ran: W (Cycle Units, Alt) and
Return (Cycle Units) closed the city screen and selected a unit, and
Shift+F5 saved the game from under the city screen or the Financial
Advisor. In the original (seen in Wine) W and Shift+F5 do nothing there,
and Return on the city screen only leaves it. The game core holds back
those controls itself when isFocused says so (CvGame::canDoControl; its
note in CvDLLWidgetData::doUnitModel: "if a screen is up"), and
CvMainInterface.py treats the city screen as focused ("not isFocused() or
isCityScreenUp()").
isFocused now says yes while the city screen or a script's own screen (an
advisor, the Civilopedia, a movie) is up; popups and diplomacy are not
counted, the core asks isDiploOrPopupWaiting for them. Which screen is up
is asked once a frame on the main thread, since the core also asks
isFocused during the turn's work. Return on the city screen leaves it, as
Esc. --keys gets "%-" for F11 (the globe) to test it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenCiv4's
CvInterface::isFocused()was a stub that always returned false. The game core uses it to hold back the map's controls while a screen is up:CvGame::canDoControllets the unit cycles, the camera, quick save and load, the globe and ending the turn run only when nothing has the focus. Its note inCvDLLWidgetData::doUnitModelsays "if a screen is up". So with the city screen or an advisor up, those keys still ran:In the original (seen in Wine, BtS 3.19) W and Shift+F5 do nothing on the city screen or under an advisor, and Return on the city screen only leaves it.
Now
isFocused()is true while the city screen or a script's own screen (an advisor, the Civilopedia, a movie) is up. The city screen counts becauseCvMainInterface.pyasksnot isFocused() or isCityScreenUp()for its own keys there. Popups and the diplomacy screen don't count; the core asksisDiploOrPopupWaitingfor those. Whether a script's screen is up is read once a frame on the main thread, because the core also callsisFocusedduring the turn's work. Return on the city screen leaves it, as Esc does.--keysgains%-for F11 to test the globe.Checks
--turns 100 --map Fractal --size STANDARD --seed 7):D7D43800, unchanged.Interface.h(Bundle 4/6: the options screen #148–Bundle 6/6: screens and advisors #150): keep both.🤖 Generated with Claude Code