Repository navigation
[win32] Do not invert the pixels for the Button focus rectangle - #3543
Merged
Merged
Conversation
Contributor
vogella
force-pushed
the
win32-button-focus-rect
branch
from
August 31, 2026 15:40
43a1b6e to
c2a5e69
Compare
Contributor
|
How the focus rect will look like - dotted or a solid line? |
Contributor
Author
vogella
marked this pull request as ready for review
September 28, 2026 09:15
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.
vogella
force-pushed
the
win32-button-focus-rect
branch
from
September 28, 2026 09:15
c2a5e69 to
582a376
Compare
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.