Skip to content

Keys and clicks go to the screen up, not the map under it (Enter on a tech's splash) - #167

Open
MortenLyhr wants to merge 2 commits into
bssth:masterfrom
MortenLyhr:fix/screen-holds-input
Open

MortenLyhr wants to merge 2 commits into
bssth:masterfrom
MortenLyhr:fix/screen-holds-input

Conversation

@MortenLyhr

@MortenLyhr MortenLyhr commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Split out of #111 as asked in its review. Stacked on #111: it needs the popups to wait under the splash.

The problem

With a new tech's splash (or an advisor) up, OpenCiv4 sent the keys and clicks on to the map under it:

  • Enter ran Cycle Units (with every unit moved, the end of the turn). The splash stayed (key 13: action 429 Cycle Units).
  • Space skipped the selected unit.
  • A click on the map beside the splash selected or deselected a unit under it.

What the original does (Wine, BUG + BULL)

With a new tech's splash up:

  • Enter closes it, as its Continue button does. The civic question comes next (wine-enter44/2-enter.png).
  • Space does nothing (7-space.png).
  • A click on the map beside the splash does nothing (8-click-outside.png).

With the Tech Advisor up (F6):

  • Space does nothing (adv/a2-space.png).
  • Enter closes it (adv/a3-enter.png).
  • F1 still opens the Domestic Advisor over it (adv/a4-f6-then-f1.png).

What it changes

A screen shown without bPassInput holds the map's input while it is up. That is showScreen(state, False): the splash, the advisors, the Civilopedia. It is not the main interface, the city screen, a talk or the dot-map overlay.

  1. holdsInput (oc4screens.holdsInput(), Screens::holdsInput()): true while such a screen is shown. It uses the passInput flag that showScreen already stores (One advisor at a time; advisors open over a talk and leave it as it was #158). It is always false on the main menu outside a game (m_menu).
  2. Enter closes the top screen (main.cpp, press): plain Enter under such a screen calls screens.escape(), as Esc does. So Enter never reaches the map's hotkeys, or a popup waiting under the screen (Popups wait while a screen of its own is up (a new tech's splash) #111). Shift/Ctrl/Alt+Enter go on as before.
  3. Unit orders, selection, cycling and end turn are skipped (hotkeyAction, screenHolds): actions whose control is NO_CONTROL (the units' missions and commands) or up to CONTROL_AUTOMOVES in ControlTypes. That covers centring on and selecting units and cities, next/previous/cycle unit, end turn and Force End of Turn. The numpad moves are skipped too. The screens' own controls come after CONTROL_AUTOMOVES (the advisors, the Civilopedia, options, saving, ping, sign, grid, yields), so they still work: F1 over an advisor opens the next one.
  4. Map clicks are dropped (main.cpp, the frame loop): while such a screen is up, the plot clicks the window hands on (takeClicks) are cleared, so a click beside the splash selects nothing.

How it was checked

OpenCiv4 (BUG + BULL, the test map, research one turn from done with testgames/shots/round2/tech-next-turn.py; > ends the turn and shows the splash):

  • Before (master before Leave Go To (and every interface mode) when the selection changes, as the original #156/One advisor at a time; advisors open over a talk and leave it as it was #158, oc4-round2/44-enter-before.log), --keys ">......%e": key 13: action 429 Cycle Units, and the splash stays.

  • After, the same keys: key 13: closes the screen up, and the civic question is up, as in Wine.

  • After, ">...... " (Space): key 32: action -1 (none), and the splash stays.

  • After, ">......<300,450>" (a click on the map beside the splash): the splash stays and the Settler is still selected. The same click with no splash deselects it.

  • After, the Tech Advisor (%6), as in Wine: Enter closes it (key 13: closes the screen up), Space does nothing (key 32: action -1 (none); it stays, the unit stays selected), F1 opens the Domestic Advisor (key 112: action 471 Domestic Advisor). In Wine, a click beside an advisor, the numpad moves and unit order keys other than Space were not tried.

ctest 15/15. Sync checksums equal to #111's on all 100 turns (D7D43800): interface only.

Pictures (Wine | OpenCiv4)

Enter on a new tech's splash: Wine before, Wine after (the civic question is up), OpenCiv4 before (Cycle Units, the splash stays), OpenCiv4 after.

Wine splash
Wine Enter
OpenCiv4 before
OpenCiv4 after

A click on the map beside the splash: Wine (nothing), OpenCiv4 after (the Settler stays selected), and the same click with no splash up (it deselects).

Wine click
OpenCiv4 click under the splash
OpenCiv4 click, no splash

Wine, the Tech Advisor: Enter closes it; F1 over it opens the Domestic Advisor.

Wine advisor Enter
Wine advisor F1

🤖 Generated with Claude Code

MortenLyhr and others added 2 commits November 23, 2026 09:11
When the tech being researched is discovered, the original shows only
its splash screen: the civic and "what to research next" questions come
after it is closed, so Esc closes the splash first (Wine, BUG + BULL).
OpenCiv4 showed the popups at once under the splash, and Esc closed the
popup underneath. The game's queued popups now wait while a screen of
its own (an advisor, a splash, a wonder's movie) is up, as wonder movies
already did; what is opened at once (the game's menu, a script's popup)
still shows over it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… tech's splash)

With a new tech's splash or an advisor up, the original keeps the map's
input: Enter closes the screen as its Continue or Exit does, Space and the
units' keys do nothing, and a click on the map beside it goes nowhere;
F1 and the other screens' keys still open the next advisor (Wine, BUG +
BULL). OpenCiv4 sent them on to the map: Enter cycled the units (or ended
the turn), Space skipped the unit, a click selected under the splash.
A screen shown without bPassInput now holds that input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant