Bug 577878 - [GTK] Table/Tree with SWT.PaintItem don't show rows when dragging them
Summary: [GTK] Table/Tree with SWT.PaintItem don't show rows when dragging them
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.23   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.24 M1   Edit
Assignee: Alexandr Miloslavskiy CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-17 17:20 EST by Alexandr Miloslavskiy CLA
Modified: 2022-04-07 02:19 EDT (History)
4 users (show)

See Also:


Attachments
Reproducer snippet (3.79 KB, text/plain)
2021-12-17 17:48 EST, Alexandr Miloslavskiy CLA
no flags Details
Content assist broken after the patch (109.35 KB, image/png)
2022-03-23 02:51 EDT, Andrey Loskutov CLA
no flags Details
screenshot of broken "drag" effect (53.45 KB, image/png)
2022-03-25 10:15 EDT, Andrey Loskutov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandr Miloslavskiy CLA 2021-12-17 17:20:22 EST
Without 'SWT.PaintItem', rows are shown correctly when dragging. With 'SWT.PaintItem' however, a "file" icon is shown instead.

I have debugged; 'TreeDragSourceEffect.getDragSourceImage()' and
'TableDragSourceEffect.getDragSourceImage()' have this code written 13 years ago
    //TEMPORARY CODE
    if (table.isListening(SWT.EraseItem) ||
        table.isListening (SWT.PaintItem)) return null;

It was added in commit:
    5a8028d0 by Steve Northover at 2008-04-29 07:56:43
    disable drag images in table and tree for custom draw

I have tried removing this early return, but found that only the first item shows correctly and others merely show empty rectangle when dragging.

I'll try to make a patch.
Comment 1 Alexandr Miloslavskiy CLA 2021-12-17 17:48:36 EST
Created attachment 287706 [details]
Reproducer snippet
Comment 2 Eclipse Genie CLA 2021-12-17 23:37:40 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/188983
Comment 4 Andrey Loskutov CLA 2022-03-23 02:51:48 EDT
Created attachment 288270 [details]
Content assist broken after the patch

(In reply to Eclipse Genie from comment #3)
> Gerrit change
> https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/188983 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=b324b57ca1e55a287e2900604c974402a6ed337b

This broke content assist proposals, they don't have icons anymore.
Comment 5 Andrey Loskutov CLA 2022-03-23 02:52:21 EDT
Please provide a fix or revert.
Comment 6 Andrey Loskutov CLA 2022-03-23 03:04:52 EDT
(In reply to Andrey Loskutov from comment #4)
> This broke content assist proposals, they don't have icons anymore.

Also "Open Type" / "Open Resource" tables miss icons.
Comment 7 Alexander Kurtakov CLA 2022-03-23 04:11:31 EDT
Alexandr, please let us know whether you plan to work on it or to revert.
Comment 8 Alexandr Miloslavskiy CLA 2022-03-23 10:38:46 EDT
I'll investigate today.
Comment 9 Alexandr Miloslavskiy CLA 2022-03-23 17:41:31 EDT
I confirm that problem is seen with my patch and not seen without it.
Comment 10 Eclipse Genie CLA 2022-03-23 20:51:40 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/192203
Comment 12 Andrey Loskutov CLA 2022-03-25 02:13:42 EDT
Verified in I20220324-1800
Comment 13 Andrey Loskutov CLA 2022-03-25 10:15:19 EDT
I've found another regression.
While dragging elements in the tree, before the patches here we had some system "copy" icon shown next to the cursor. Now we have a light lengthy rectangle shown.
Comment 14 Andrey Loskutov CLA 2022-03-25 10:15:47 EDT
Created attachment 288296 [details]
screenshot of broken "drag" effect
Comment 15 Andrey Loskutov CLA 2022-03-25 10:17:05 EDT
(In reply to Andrey Loskutov from comment #13)
> Now we have a light lengthy rectangle shown.

Is this a row rectangle we drag now???

I'm on RHEL 7.9 / gtk3-3.22.30-5.el7.x86_64
Comment 16 Alexandr Miloslavskiy CLA 2022-03-25 16:35:18 EDT
I see two problems:

1) Drag image is too wide

On Windows, SWT drag images seem to be limited to width/height of 301px. I'm still trying to find where exactly it happens. In Thunderbird on Windows, drag image seems to be limited by Control's width, and it always looked fine to me (I actually drag a lot to put incoming emails into various folders). I think that it would make sense to limit to 301px or Control's width on GTK. What do you think?

Also note that Table/Tree without SWT.Paint is not affected by the patch; you can use snippet to make column very wide (wider than Control) and you'll see the same there. So this isn't exactly a regression, rather, it fixes SWT.Paint case to behave the same as standard painting.

2) Drag image has no contents

Now this is unexpected and needs to be debugged. I wouldn't be too surprised if it's an Eclipse bug where it paints item contents at wrong coords.

I'm investigating it already.
Comment 17 Eclipse Genie CLA 2022-03-25 23:15:57 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/192263
Comment 18 Eclipse Genie CLA 2022-03-25 23:15:59 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/192264
Comment 19 Eclipse Genie CLA 2022-03-25 23:16:01 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/192265
Comment 20 Alexandr Miloslavskiy CLA 2022-03-25 23:17:23 EDT
Indeed, it was Eclipse's bug where it painted at wrong coordinates.

I added workaround for it (similar to already existing workaround on macOS) and also limited drag image's width to Control's size.
Comment 23 Alexandr Miloslavskiy CLA 2022-04-07 02:19:38 EDT
Fixed via gerrits here and
https://github.com/eclipse-platform/eclipse.platform.swt/pull/3