gtk/tk: Ensure no flicker when hovering over images. #17989
Merged
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.
PR Summary
When the mouse is over an image, the status message is two lines long. This causes the toolbar to increase size slightly. On Qt, this is ignored by a sizing policy, but there is no such thing in other toolkits. On GTK this steals space from the canvas, so it re-draws a little bit smaller, until the mouse moves off the image. On Tk, the space is added to the window, unless the window is maximized, and then it's stolen from the canvas as well.
As a simple workaround, we add an additional label with invisible text (spaces) on two lines. This forces the toolbar to always be two lines high and thus not flicker. If the message were 3 or more lines long, then the same thing would happen, but we don't have any of those by default. The advantage of using a label is that it saves us having to measure text in some toolkit-specific way, and thus works regardless of theme.
PR Checklist