Fix file browser modal opening off-screen on smaller/4:3 displays#96
Open
gjforte wants to merge 1 commit into
Open
Fix file browser modal opening off-screen on smaller/4:3 displays#96gjforte wants to merge 1 commit into
gjforte wants to merge 1 commit into
Conversation
The file browser popup persists its size in imgui.ini, but SetNextWindowSize only clamped it to the display on FirstUseEver. When the same config is used across machines, a size saved on a large monitor is restored verbatim on a smaller/4:3 screen, opening the modal taller than the display with its title bar and OK/Cancel buttons off-screen. Being modal, it then blocks all input while appearing not to render. Add SetNextWindowSizeConstraints(min, viewport.WorkSize) before BeginPopupModal each frame so the window can never exceed the current display. Position was already re-centered on appear. Co-Authored-By: Claude Opus 4.8 <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.
Problem
On a smaller (e.g. 4:3 laptop) display, the Open/Save file browser fails to display and blocks the whole app: being modal, it eats all input, but its title bar and the OK/Cancel buttons are off the bottom of the screen, so there's no way to interact with or dismiss it.
Cause
The file browser popup persists its size in
imgui.ini, butSetNextWindowSizeclamps to the display only withImGuiCond.FirstUseEver:When the same config is reused across machines (or after moving from a larger monitor to a smaller one), the size saved on the large display is restored verbatim —
FirstUseEvernever re-clamps it — so the modal opens taller than the current screen with its controls off-screen.Fix
Add
SetNextWindowSizeConstraints(min, viewport.WorkSize)beforeBeginPopupModalevery frame, so the window can never exceed the current display regardless of what's stored inimgui.ini. Position is already re-centered on appear, so that side was already fine. No behavior change on displays large enough to hold the default size.One file changed (
src/Rained/EditorGui/FileBrowser.cs).