| Summary: | [Forms] FormText links do not erase focus ring | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Grant Gayed <grant_gayed> | ||||||
| Component: | User Assistance | Assignee: | Chris Goldthorpe <cgold> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | bhunt, cgold, cocoakevin, contact, Curtis_Windatt, eclipse.felipe, markus.kell.r, remy.suen, skovatch | ||||||
| Version: | 3.5 | ||||||||
| Target Milestone: | 3.7 M5 | ||||||||
| Hardware: | Macintosh | ||||||||
| OS: | Mac OS X | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Grant Gayed
The focus is now being drawn but it doesn't erase when focus leaves the link. Then, when focus returns to the link it redraws and makes the focus darker. Those aren't Link widgets, they're FormText objects. my test case (requires org.eclipse.ui.forms):
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
FormText text = new FormText(shell, SWT.NONE);
text.setText("<form>" +
"<li style=\"image\"><a href=\"one\">one</a></li>" +
"<li style=\"image\"><a href=\"two\">two</a></li>" +
"<li style=\"image\"><a href=\"one\">three</a></li>" +
"<li style=\"image\"><a href=\"one\">four</a></li>" +
"<li style=\"image\"><a href=\"one\">five</a></li>" +
"</form>", true, false);
text.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
Same bug happens on carbon. When the link text is selected, GC.drawFocus is called. When it's unselected, GC.drawRectangle() is called to cover the focus ring. Problem is that on mac the focus ring is more than one pixel so it isn't getting covered. Kevin, any reason you're reassigning to PDE/UI ? It's very likely a Forms (Platform/UA) issue, no?.. didn't realize there was a difference. This bug is killing me eyes on Windows XP. Halp! ;_; What platforms are people seeing the non erasure of the focus ring on? I just tried XP and did not see it. I only saw it on the Mac (Cocoa, probably also Carbon). WinXP looks fine for me. The problem is in TextSegment#paintFocus(GC, Color, Color, boolean, Rectangle) and probably other similar places. The assumption that gc.drawRectangle(..) can be used to revert gc.drawFocus(..) is not valid on the Mac. I quickly hacked FormText#paintFocusTransfer(..) like this, and that solved the issue (but that's not to say that I want you to release this hack): // oldLink.paintFocus(gc, bg, fg, false, null); Rectangle r = oldLink.getBounds(); redraw(r.x, r.y, r.width, r.height, true); update(); Created attachment 178123 [details] Fix (In reply to comment #9) Actually, I think this is the correct way to fix this bug. Here's a patch. Any chance of getting this fixed in 3.7? Yes, I will work on getting Markus's patch into the next milestone. *** Bug 234300 has been marked as a duplicate of this bug. *** Created attachment 181759 [details]
Fix 2
The fix in FormText was OK, but bounds calculation of wrapped paragraphs was also screwed, so the first fix didn't work in all cases (can e.g. be seen on the Overview page of the plugin.xml editor).
Even with this fix, we still have problems with:
- mouse hovering over links (link becomes darker and darker, was OK in 3.6.1)
- jumpy text when you select it (already broken in 3.6.1)
Markus's patch does fix the focus problem on Mac and I did not see any regressions on other platforms when testing. Patch committed to HEAD, Fixed. |