Dialogs and message boxes inherit the owner window styling (white-flash / photosensitivity fix)#1
Open
douglas-carmichael wants to merge 1 commit into
Conversation
All dialogs (AbstractDialog subclasses, the Alert based message/error/ confirmation boxes and the text input dialog) were rendered with the platform default styling: with a dark application theme they appeared in the light theme and always with a bright white flash while the window was rendered for the first time - a real risk for photo-sensitive users. The new public helper Functions.inheritStyling copies the stylesheets and the scene fill color of the owner window to the dialog scene. It is applied at every dialog creation site and AbstractDialog re-applies it on every show since the application theme might have changed in the meantime.
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.
Companion to git-moss/ConvertWithMoss#199, which fixes the same problem for the two dialogs ConvertWithMoss creates itself. The message boxes created inside uitools (
Functions.message/error/yesOrNo/choose/inputText/ progress dialog) have the same two issues and can only be fixed here:Changes:
Functions.inheritStyling (Dialog<?>, Window): copies the stylesheets and the scene fill color of the owner window to the dialog scene (null-safe for owner-less dialogs).Functions.AbstractDialogapplies it in the constructor and re-applies it on every show (viashowingProperty), since the application theme might have been switched while a persistent dialog (e.g. a settings dialog) was hidden.Since a dialog simply inherits whatever the owner scene carries, this is theme-agnostic: applications without custom styling see no change (they inherit an empty stylesheet list and the default white fill).
Note: this repository is at version 2.0.1 while ConvertWithMoss 19.0.0 ships uitools 2.0.5, so this branch may need porting to your current development line - happy to adapt it if you can push the newer source.
Verified: compiles against JDK 25; the logic mirrors the app-side fix in ConvertWithMoss#199. If you cut a uitools release with this, the explicit dialog styling in ConvertWithMoss#199 becomes redundant (but harmless).