[win32] Do not invert the pixels for the Button focus rectangle - #3543
Draft
vogella wants to merge 1 commit into
Draft
[win32] Do not invert the pixels for the Button focus rectangle#3543vogella wants to merge 1 commit into
vogella wants to merge 1 commit into
Conversation
With a custom foreground SWT paints the button content itself, and drew the focus rectangle with DrawFocusRect(), which XOR-inverts the pixels below it. On background #0071BC that gave a #FF8E43 rectangle, on mid-gray it was invisible. Use a dotted pen in the foreground color instead, the color the button text already uses. Geometry is unchanged. Adds Snippet395.
Contributor
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.
When a
Buttonhas a custom foreground, SWT paints the button content itself and therefore also paints the focus indication. It usedDrawFocusRect(), which XOR-inverts the pixels below it, so the focus rectangle takes on whatever the complement of the background happens to be. On a button styled with background#0071BCand white text the rectangle came out as#FF8E43, and on a mid-gray background it is close to invisible, which makes the focus indicator unreliable.The rectangle is now drawn with a dotted pen in the foreground color, the same color the button label uses, so it is legible on whatever surface the label is legible on. The rectangle geometry, the background fill and the path where only a background is set are unchanged, so unstyled buttons and the default Eclipse theme look exactly as before.
Snippet395demonstrates the case. This is win32-only code and I could only compile it on Linux, so a visual check on Windows 11 is still needed, which is why this is a draft.