Skip to content

Remove viewport focus check from MapView _process#673

Merged
Catylist0 merged 1 commit into
masterfrom
fix/map-province-hover-notifications
Jul 19, 2026
Merged

Remove viewport focus check from MapView _process#673
Catylist0 merged 1 commit into
masterfrom
fix/map-province-hover-notifications

Conversation

@Catylist0

Copy link
Copy Markdown
Contributor

Summary

  • Remove the per-frame viewport focus / is_input_handled() check from MapView._process that was clearing province hover.
  • Track mouse presence over the map via NOTIFICATION_WM_MOUSE_ENTER and NOTIFICATION_WM_MOUSE_EXIT instead.

Made with Cursor

@Catylist0
Catylist0 requested a review from a team as a code owner May 20, 2026 12:46
Comment thread game/src/Systems/Session/Map/MapView.gd
@wvpm

wvpm commented May 25, 2026

Copy link
Copy Markdown
Contributor

From Devin:
_Missing window-focus-loss handling causes indefinite edge scrolling when alt-tabbing

The old code checked _is_viewport_inactive() every frame in _process, which returned true when not get_window().has_focus(). This set _mouse_over_viewport = false whenever the game window lost focus (e.g., alt-tab). The new code replaces this per-frame check with NOTIFICATION_WM_MOUSE_ENTER/NOTIFICATION_WM_MOUSE_EXIT notifications, but these only fire when the mouse cursor physically enters/leaves the window rect — they do not fire when the window merely loses focus while the cursor remains inside it.

Consequently, if the user alt-tabs away while the mouse cursor is near a window edge, _mouse_over_viewport stays true and _mouse_pos_viewport freezes at the last known position. Since _process continues running, edge_scrolling_vector() (MapView.gd:316-323) returns a non-zero vector every frame, causing the camera to scroll indefinitely until the user returns to the game.

To be fair, that is what Paradox games also do, so I suppose you nailed it.

Comment thread game/src/Systems/Session/Map/MapView.gd Outdated
@Catylist0
Catylist0 enabled auto-merge July 19, 2026 17:04
Stop clearing province hover based on window focus and input handling in _process; use mouse enter/exit notifications instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
@BrickPi
BrickPi force-pushed the fix/map-province-hover-notifications branch from dbadcf8 to a20df82 Compare July 19, 2026 17:17
@Catylist0
Catylist0 added this pull request to the merge queue Jul 19, 2026
Merged via the queue into master with commit e35b775 Jul 19, 2026
11 checks passed
@Catylist0
Catylist0 deleted the fix/map-province-hover-notifications branch July 19, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants