Bug 565969 - [Big Sur] Table selection drawn over text/checkbox when SWT.EraseItem is hooked (Git History: Can't Read Any Text Except "Committed Date" on Selected Commits)
Summary: [Big Sur] Table selection drawn over text/checkbox when SWT.EraseItem is hook...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.17   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: 4.18 RC1   Edit
Assignee: Lakshmi P Shanmugam CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 568827 568905 (view as bug list)
Depends on:
Blocks: 565691
  Show dependency tree
 
Reported: 2020-08-10 15:48 EDT by Ingo Mohr CLA
Modified: 2021-02-16 09:00 EST (History)
14 users (show)

See Also:
sravankumarl: review+


Attachments
Selection Background makes commit messages invisible (407.62 KB, image/png)
2020-08-10 15:48 EDT, Ingo Mohr CLA
no flags Details
Eclipse I20200925-1800; macOS 11.0 Beta (20A5374i); Git integration 5.10.0.202009212321 (916.96 KB, image/gif)
2020-09-26 09:01 EDT, Ingo Mohr CLA
no flags Details
Table with check boxes (592.65 KB, image/png)
2020-10-30 14:58 EDT, Phil Beauvoir CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Mohr CLA 2020-08-10 15:48:42 EDT
Created attachment 283826 [details]
Selection Background makes commit messages invisible

Hi all,

I'm facing this problem with EGit 5.8.0.202006091008-r installed to Eclipse Integration build I20200808-1800.

In the "History" view, I cannot see any commit messages of those commits I select in the table.

This is the same for both Light theme, Dark and Classic.
Comment 1 Thomas Wolf CLA 2020-08-11 03:02:20 EDT
Cannot reproduce. Might be a platform problem. Which OS X version?
Comment 2 Ingo Mohr CLA 2020-08-11 09:44:19 EDT
Ah, sorry. Forgot to mention that.
MacOS11 Beta 4.
Comment 3 Thomas Wolf CLA 2020-08-11 09:51:47 EDT
In that case it's probably a platform problem. Moving to Platform/SWT.
Comment 4 Ingo Mohr CLA 2020-09-14 17:40:39 EDT
The problem still exists with the latest integration build of Eclipse (13th Sep) on MacOS Big sur.
Comment 5 Ingo Mohr CLA 2020-09-26 09:01:41 EDT
Created attachment 284284 [details]
Eclipse I20200925-1800; macOS 11.0 Beta (20A5374i); Git integration 5.10.0.202009212321

The text-hiding effect doesn't seem to appear on any of the tables/trees of the Eclipse platform (see attachment).

This is on:
- Eclipse I20200925-1800
- macOS 11.0 Beta (20A5374i)
- Git integration 5.10.0.202009212321
Comment 6 Ingo Mohr CLA 2020-10-21 06:20:26 EDT
Same on macOS 11.0 Beta (20A5395g)
Comment 7 Phil Beauvoir CLA 2020-10-30 13:41:52 EDT
Same on Big Sur 11.0.1 beta (20B5012d)

But this is only on the Git table, so is this SWT? And I can see white text in the "Committed Date" column. Is there something in the Git table label provider that is not respecting the system table color or font?
Comment 8 Ingo Mohr CLA 2020-10-30 13:49:25 EDT
I didn't check the implementation yet - but with the commit graph displayed in oneof the table's columns, this is probably not just plain SWT used by a JFace StructuredViewer API.

That's why I created the issue in the EGit integration project - in the hope that someone from the EGit-UI-developer-team could help.

What I can say is that I see the described effect solely on the Git history table. I'm now working on macOS11-only for a week, and all other tables are just fine.
Comment 9 Phil Beauvoir CLA 2020-10-30 13:57:16 EDT
(In reply to Ingo Mohr from comment #8)
> I didn't check the implementation yet - but with the commit graph displayed
> in oneof the table's columns, this is probably not just plain SWT used by a
> JFace StructuredViewer API.
> 
> That's why I created the issue in the EGit integration project - in the hope
> that someone from the EGit-UI-developer-team could help.
> 
> What I can say is that I see the described effect solely on the Git history
> table. I'm now working on macOS11-only for a week, and all other tables are
> just fine.

Yes, that table does some special rendering to plot the commit graph. My feeling is that this is an EGit_UI issue.
Comment 10 Thomas Wolf CLA 2020-10-30 13:58:33 EDT
It doesn't occur on OS X 10. Therefore I suspect that something is different on OS X 11 that causes problems in JFace or SWT with such a table. The only special thing I can think of is that the column showing the graph and the commit messages is owner drawn. All other columns are normal. If it were a problem in EGit's owner draw code I'd expect it to affect only that one column and none of the others.

I don't have OS X 11, so I can't dig into this myself.
Comment 11 Phil Beauvoir CLA 2020-10-30 14:58:04 EDT
Created attachment 284617 [details]
Table with check boxes

(In reply to Thomas Wolf from comment #10)
> It doesn't occur on OS X 10. Therefore I suspect that something is different
> on OS X 11 that causes problems in JFace or SWT with such a table. The only
> special thing I can think of is that the column showing the graph and the
> commit messages is owner drawn. All other columns are normal. If it were a
> problem in EGit's owner draw code I'd expect it to affect only that one
> column and none of the others.
> 
> I don't have OS X 11, so I can't dig into this myself.

Yes, owner drawn columns exhibit this behaviour. It happens also if a checkbox is used in a table. See attached screenshot.
Comment 12 Lakshmi P Shanmugam CLA 2020-11-05 06:23:23 EST
I'm also able to see this in Eclipse Quick search dialog and with Snippet 231.
Comment 13 Yanming Zhou CLA 2020-11-12 23:31:32 EST
I confirm that, macOS 11.0.1 (20B29)
Comment 14 Lakshmi P Shanmugam CLA 2020-11-16 04:32:43 EST
*** Bug 568827 has been marked as a duplicate of this bug. ***
Comment 15 Matthias Sohn CLA 2020-11-17 12:04:18 EST
(In reply to Thomas Wolf from comment #10)
> It doesn't occur on OS X 10. Therefore I suspect that something is different
> on OS X 11 that causes problems in JFace or SWT with such a table. The only
> special thing I can think of is that the column showing the graph and the
> commit messages is owner drawn. All other columns are normal. If it were a
> problem in EGit's owner draw code I'd expect it to affect only that one
> column and none of the others.
> 
> I don't have OS X 11, so I can't dig into this myself.

I upgraded to MacOS 11.0.1 last weekend and now also suffer from this.
Do you have any hints where to dig ?
Comment 16 Thomas Wolf CLA 2020-11-17 14:07:44 EST
(In reply to Matthias Sohn from comment #15)
> Do you have any hints where to dig ?

If I wanted to debug this, I think I'd start with a breakpoint in Table.drawInteriorWithFrame_inView() and check the rectangles. It feels as if the background for the owner drawn cell is drawn across the whole row.

But maybe Lakshmi can give a better idea of where to start.
Comment 17 Matthias Sohn CLA 2020-11-17 15:55:06 EST
I see additional issues :

Hover over a variable when stepping statements during debugging. This opens the debug hover card but that doesn't show the variable and its current value but is empty.

When stepping over a method call with an active breakpoint inside this method the editor jumps to the method with the breakpoint and the lines above the breakpoint are not refreshed. The Java editor still shows the code from the previously shown method above the breakpoint where the debugger stopped.
Comment 18 Thomas Wolf CLA 2020-11-17 16:14:18 EST
(In reply to Matthias Sohn from comment #17)
> I see additional issues :
> 
> Hover over a variable when stepping statements during debugging. This opens
> the debug hover card but that doesn't show the variable and its current
> value but is empty.

That's bug 567787.

> When stepping over a method call with an active breakpoint inside this
> method the editor jumps to the method with the breakpoint and the lines
> above the breakpoint are not refreshed. The Java editor still shows the code
> from the previously shown method above the breakpoint where the debugger
> stopped.

Might be new, perhaps related to bug 567615.

The tracking bug for OS X 11 problems is bug 565691.
Comment 19 Thomas Wolf CLA 2020-11-18 03:32:54 EST
This bug here seems to be caused by the SWT.EraseItem listener? See bug 568905.
Comment 20 Lakshmi P Shanmugam CLA 2020-11-18 04:11:44 EST
(In reply to Thomas Wolf from comment #19)
> This bug here seems to be caused by the SWT.EraseItem listener? See bug
> 568905.

Yes, the Bug happens only when there is a SWT.EraseItem listener. For example try Snippet 231.

In Table/Tree, we don't draw the highlight in highlightSelectionInClipRect() if there is a EraseItem listener (see if (hooks (SWT.EraseItem)) return;)
In drawInteriorWithFrame_inView(), when selection has to be drawn, we call callSuper (widget.id, OS.sel_highlightSelectionInClipRect_, cellRect);
This draws the selection properly on older versions, but on BigSur, looks like this draws the selection over the text and checkbox.
Interestingly, only the last column is not affected by this problem, the selection in the last column seems to be drawn correctly in the background.

Any help or ideas to fix this are welcome.
Comment 21 Lakshmi P Shanmugam CLA 2020-11-18 05:22:33 EST
*** Bug 568905 has been marked as a duplicate of this bug. ***
Comment 22 Thomas Wolf CLA 2020-11-18 05:38:12 EST
(In reply to Lakshmi P Shanmugam from comment #20)
> callSuper (widget.id, OS.sel_highlightSelectionInClipRect_, cellRect);

Is the cellRect correct at that point? Or does it encompass the whole row? If this call draws the selection over the whole row, it's clear that only the last column drawn will look correct.
Comment 23 Lakshmi P Shanmugam CLA 2020-11-18 07:06:09 EST
(In reply to Thomas Wolf from comment #22)
> (In reply to Lakshmi P Shanmugam from comment #20)
> > callSuper (widget.id, OS.sel_highlightSelectionInClipRect_, cellRect);
> 
> Is the cellRect correct at that point? Or does it encompass the whole row?
> If this call draws the selection over the whole row, it's clear that only
> the last column drawn will look correct.

cellRect looks correct there, it doesn't include the whole row.
Comment 24 Lakshmi P Shanmugam CLA 2020-11-18 10:00:53 EST
(In reply to Lakshmi P Shanmugam from comment #23)
> (In reply to Thomas Wolf from comment #22)
> > (In reply to Lakshmi P Shanmugam from comment #20)
> > > callSuper (widget.id, OS.sel_highlightSelectionInClipRect_, cellRect);
> > 
> > Is the cellRect correct at that point? Or does it encompass the whole row?
> > If this call draws the selection over the whole row, it's clear that only
> > the last column drawn will look correct.
> 
> cellRect looks correct there, it doesn't include the whole row.

Thanks Thomas for the pointer. Though the cellRect is correct and doesn't include the whole row, the full row is being drawn for every cell. In the patch, we draw the background ourselves in this case.
Comment 25 Lakshmi P Shanmugam CLA 2020-11-18 10:34:30 EST
@Sravan, this issue looks bad on BigSur. It would be good if we can push this change for M3 so that it gets some testing.
Comment 27 Lakshmi P Shanmugam CLA 2020-11-19 06:37:24 EST
Tested with I20201118-1800.

Few more issues remain when EraseItem is hooked
1. Full selection is not drawn for the whole row
2. Selection not drawn in checkbox column
3. In eclipse, the non-focus table/tree selection color looks different.

I believe https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172487 addresses issues 1 & 2.
Comment 28 Thomas Wolf CLA 2020-11-19 08:01:24 EST
(In reply to Lakshmi P Shanmugam from comment #27)
> I believe https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172487
> addresses issues 1 & 2.

Perhaps, but that work-around is getting big and not so nice anymore. Can't we really figure out what's causing this? Does setting NSTableView.style to fullWidth explicitly help?
Comment 29 Lakshmi P Shanmugam CLA 2020-11-19 12:23:04 EST
(In reply to Thomas Wolf from comment #28)
> (In reply to Lakshmi P Shanmugam from comment #27)
> > I believe https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172487
> > addresses issues 1 & 2.
> 
> Perhaps, but that work-around is getting big and not so nice anymore. 
I agree, see comments in gerrit.

> Can't we really figure out what's causing this? 
It looks like a Cocoa bug here, since the direct call to highlightSelectionInClipRect is drawing the full row instead of the just the clipRect.

> Does setting NSTableView.style to fullWidth explicitly help?
Mac Table/Tree are always FULL_SELECTION, so full selection has to be drawn.
Setting to any of the styles, doesn't help.

Will investigate further for RC1.
Comment 30 Marc-André Laperle CLA 2020-11-19 23:00:01 EST
> It looks like a Cocoa bug here

I've had luck in the past reporting bugs through Apple's developer bug report system, by providing code sample and/or patches. Is that something doable here? Would love to help but know nothing about Cocoa so it's a steep curve for this bug :)
Comment 31 Lakshmi P Shanmugam CLA 2020-11-20 13:59:22 EST
I opened a Bug with Apple for this issue - 
FB8909897 (BigSur: NSTableView.highlightSelectionInClipRect: draws highlight for whole row instead of only clipRect)
Comment 32 Lakshmi P Shanmugam CLA 2020-11-23 16:21:18 EST
(In reply to Lakshmi P Shanmugam from comment #27)
> Tested with I20201118-1800.
> 
> Few more issues remain when EraseItem is hooked
> 1. Full selection is not drawn for the whole row
> 2. Selection not drawn in checkbox column

I tested Table with EraseItem on macOS 10.15 today saw the same behavior there.
When EraseItem is hooked, Full selection is not drawn and selection is not drawn for the checkbox column. Also, found a old for this - Bug 312735.

Since this (1 & 2) are not a BigSur issues, it has to fixed on all macOS versions for consistency and will be tracked by Bug 312735.

> 3. In eclipse, the non-focus table/tree selection color looks different.
This is seen in Eclipse Dark mode and is caused by the fix, will address it in this bug.
Comment 33 Eclipse Genie CLA 2020-11-25 13:55:47 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172839
Comment 35 Lakshmi P Shanmugam CLA 2020-11-26 10:44:46 EST
> > 3. In eclipse, the non-focus table/tree selection color looks different.
> This is seen in Eclipse Dark mode and is caused by the fix, will address it
> in this bug.
This is seen only in Eclipse, looks like the color is being initialised too early and the color for light theme is being used.

Resolving bug. Opened Bug 569224 to track this.
Comment 36 Lakshmi P Shanmugam CLA 2020-12-03 07:07:02 EST
Verified with M3 build.
Comment 37 Lakshmi P Shanmugam CLA 2021-02-16 09:00:37 EST
(In reply to Lakshmi P Shanmugam from comment #31)
> I opened a Bug with Apple for this issue - 
> FB8909897 (BigSur: NSTableView.highlightSelectionInClipRect: draws highlight
> for whole row instead of only clipRect)

The bug has been fixed by Apple in 11.3 Beta!
I guess we can remove the workaround for 4.20.