Hide FScrollPane arrow buttons when their pane stops showing - #11906
Open
leriomaggio wants to merge 4 commits into
Open
leriomaggio wants to merge 4 commits into
leriomaggio wants to merge 4 commits into
Conversation
FScrollPane's arrow buttons are not its children. FAbsolutePositioner parks them on one shared overlay panel above every screen, and only paint() and setVisible(false) ever take them off it. A pane removed from its container, or one whose parent is hidden, gets neither: it stops painting, so it cannot correct itself, and its arrows stay on the overlay over whatever is drawn next, including a completely different screen. Hide them from a HierarchyListener on SHOWING_CHANGED instead, so a pane cleans up after itself rather than every caller having to remember. Registered only when the pane actually uses arrow buttons. Nothing restores them explicitly: paint() already shows whichever arrow is warranted once the pane shows again. FAbsolutePositioner.hide now repaints the vacated bounds. Container.remove invalidates but does not repaint, and that panel has a null layout, so the pixels stayed until something else repainted the region. Its only caller is hideArrowButtons, so the paint-time path is unaffected.
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.
Fixes #11901
Problem
FScrollPane's arrow buttons are not children of the pane.FAbsolutePositioner.show()adds them to one shared panel parented to the window's
JLayeredPane, positioned inwindow coordinates, so they float above every screen.
They are taken off that overlay in only two ways: the paint-time recompute in
updateArrowButton, andhideArrowButtons()viaFScrollPane.setVisible(false).A pane removed from its container with
removeAll(), or one whose parent is hidden, getsneither. It stops painting, so it cannot correct itself, and its arrows stay on the overlay
over whatever is drawn next, including a different screen.
FAbsolutePositioner.hideAll()would clear them but is only called from
SLayoutIOon layout load andCHomeUI.itemClickon a left-bar submenu click, so navigation within one submenu never reaches it.
Change
FScrollPaneregisters aHierarchyListeneronSHOWING_CHANGEDthat calls theexisting
hideArrowButtons()when the pane is no longer showing. Registered only whenthe pane actually uses arrow buttons. Nothing restores them explicitly:
paint()alreadyshows whichever arrow is warranted once the pane shows again.
FAbsolutePositioner.hide()repaints the vacated bounds.Container.removeinvalidatesbut does not repaint, and that panel has a null layout, so the pixels stayed until
something else repainted the region. Its only caller is
hideArrowButtons(), so thepaint-time path is unchanged.
Testing
Reproduced the issue from #11901, then verified with the change that leaving the lobby
clears the arrow. Also checked that arrows still appear, switch direction and disappear
normally while scrolling.