Remove viewport focus check from MapView _process#673
Conversation
|
From Devin: 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. |
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>
dbadcf8 to
a20df82
Compare
Summary
is_input_handled()check fromMapView._processthat was clearing province hover.NOTIFICATION_WM_MOUSE_ENTERandNOTIFICATION_WM_MOUSE_EXITinstead.Made with Cursor