| Summary: | [DND] Cheese after dropping TreeItem that has Image set | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Benjamin Pasero <bpasero> | ||||||||||||
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> | ||||||||||||
| Status: | CLOSED WONTFIX | QA Contact: | Kevin Barnes <cocoakevin> | ||||||||||||
| Severity: | normal | ||||||||||||||
| Priority: | P3 | CC: | benno.baumgartner, duongn, eclipse.felipe, snorthov, veronika_irvine | ||||||||||||
| Version: | 3.2 | Keywords: | triaged | ||||||||||||
| Target Milestone: | --- | ||||||||||||||
| Hardware: | PC | ||||||||||||||
| OS: | Windows 2000 | ||||||||||||||
| Whiteboard: | stalebug | ||||||||||||||
| Attachments: |
|
||||||||||||||
|
Description
Benjamin Pasero
Created attachment 35564 [details]
Image
Created attachment 35565 [details]
Other Image
Btw I can try to write a snippet on this if this is not already a known issue. Ben Got a snippet:
public class Main {
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
final Table table = new Table(shell, SWT.BORDER);
final TableItem item1 = new TableItem(table, SWT.NONE);
item1.setText("Hello");
Image img = new Image(display, 16, 16);
GC gc = new GC(img);
gc.setBackground(display.getSystemColor(SWT.COLOR_GREEN));
gc.fillRectangle(img.getBounds());
gc.dispose();
item1.setImage(img);
final TableItem item2 = new TableItem(table, SWT.NONE);
item2.setText("Hello World");
new TableItem(table, SWT.NONE).setText("Foo");
new TableItem(table, SWT.NONE).setText("Bar");
DragSource source = new DragSource(table, DND.DROP_MOVE);
source.setTransfer(new Transfer[] { TextTransfer.getInstance() });
source.addDragListener(new DragSourceAdapter() {
public void dragStart(DragSourceEvent event) {
event.doit = true;
}
public void dragSetData(DragSourceEvent event) {
event.data = "Hello World";
}
});
DropTarget drop = new DropTarget(table, DND.DROP_MOVE);
drop.setTransfer(new Transfer[] { TextTransfer.getInstance() });
drop.addDropListener(new DropTargetAdapter() {
public void drop(DropTargetEvent event) {
item1.dispose();
final TableItem item1 = new TableItem(table, SWT.NONE);
item1.setText("H");
Image img = new Image(display, 16, 16);
GC gc = new GC(img);
gc.setBackground(display.getSystemColor(SWT.COLOR_GREEN));
gc.fillRectangle(img.getBounds());
gc.dispose();
item1.setImage(img);
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
}
Steps to reproduce:
1. Select the first TableItem
2. Drag it below so that it is over the last TableItem "Bar"
3. Drop the Item
Parts of the feedback image are overdrawing the "Bar" item.
Ben
Modified the way drop target locks and unlocks for drawing to accomodate drawing in event handlers. Fixed in HEAD for I20060314 Was this fixed in the IBuild of today? I am a bit confused of the "Fixed in HEAD for I20060314" date there. Anyways, I am still able to reproduce this issue, running latest IBuild and these steps: 1. Select the last Element 2. Drag it to the first Element 3. Drop it Find some cheese top-right to the first item. Ben I am just forecasting a possible future date when I might actually get the fix right :-) lol, cool =) Ben OK, I released some new code to HEAD. We should be on track for I20060314 :o) I have restricted the drag over effect to the current application. I had noticed that Windows File Explorer did the same thing and was wondering why. This is also fixes cheese when dragging from one SWT application to another and when dragging from SWT over the Windows File Explorer. Thats great. I will play a bit with the upcoming nightly then and report anything if I still see cheeeeeese. Ben I can verify that the problem is no longer showing up with Tables. However, with Trees I still see some problems after DND. I am unable to hack a snippet for that though. Maybe I can get something right when I am back from work. See the attached images. Ben Created attachment 35959 [details]
Tree #1
Created attachment 35960 [details]
Tree #2
Created attachment 35961 [details]
Tree #3
Btw what I do on drop is rebuild the entire Tree (removeAll and adding all Items again), re-set the expanded states of TreeItems and re-select the item that has been dropped. Ben As a workaround, calling redraw() on you tree after you change everything shoudl cause the cheese to be fixed. This is only a workaround though - there should not be cheese. Sounds like a job for LockWindowUpdate - I shall give this a try. LockWindowUpdate works like a charm for Table. Not so good for Tree. Makes all applications on your desktop flash like crazy. Yeah redraw would be a workaround. But I wanted to wait for M6 anyways =o). If I can be of help with a snippet for the problem in the Tree, let me know. Ben I have released code for the next integration build (I20060321? I think :o) ) which hides the cursor before the application handles the drop event. I believe this will resolve the cheese. I am not going to do this for all DND events because it will cause too much flash. I can verify that running with HEAD this issue is resolved for me, great! Btw I noticed, while playing around with large Fonts, that Tree-DND-Effect did not show up with Image and Text when dragging around an Item with a large (16 px) Font. It just showed the Image. Is this by intention? Ben Woohoo! Glad to hear it. Regarding the image only, this is not intentional. I have seen a bug reported against Windows where only images are shown but this were based on the type of image, not the font and it was for the table not the tree. I will have a look at it. From http://www.timosoft-software.de/phpBB2/printview.php?t=39&start=0&sid=71b0d9969bd2c865bd1fb091a5e55fe5 "Microsoft's implementation of the LVM_CREATEDRAGIMAGE message has a bug, if the icon's color depth is 32bpp: The generated drag image contains the icon only and no text." I see a new problem in Tables that have the FULL_SELECTION bit set. The end of the Item's text is cut of if it exceeds a certain length (regardles of the font set). It becomes very visible when adding a CHECK bit to the table as well.
See this slightly modified snippet:
public class Main {
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
final Table table = new Table(shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK);
final TableItem item1 = new TableItem(table, SWT.NONE);
item1.setText("Hello Worlds");
Image img = new Image(display, 16, 16);
GC gc = new GC(img);
gc.setBackground(display.getSystemColor(SWT.COLOR_GREEN));
gc.fillRectangle(img.getBounds());
gc.dispose();
item1.setImage(img);
final TableItem item2 = new TableItem(table, SWT.NONE);
item2.setText("Hello World");
new TableItem(table, SWT.NONE).setText("Foo");
new TableItem(table, SWT.NONE).setText("Bar");
DragSource source = new DragSource(table, DND.DROP_MOVE);
source.setTransfer(new Transfer[] { TextTransfer.getInstance() });
source.addDragListener(new DragSourceAdapter() {
public void dragStart(DragSourceEvent event) {
event.doit = true;
}
public void dragSetData(DragSourceEvent event) {
event.data = "Hello World";
}
});
DropTarget drop = new DropTarget(table, DND.DROP_MOVE);
drop.setTransfer(new Transfer[] { TextTransfer.getInstance() });
drop.addDropListener(new DropTargetAdapter() {
public void drop(DropTargetEvent event) {
item1.dispose();
final TableItem item1 = new TableItem(table, SWT.NONE);
item1.setText("H");
Image img = new Image(display, 16, 16);
GC gc = new GC(img);
gc.setBackground(display.getSystemColor(SWT.COLOR_GREEN));
gc.fillRectangle(img.getBounds());
gc.dispose();
item1.setImage(img);
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
}
Ben
*** Bug 131682 has been marked as a duplicate of this bug. *** I can't reproduce this bug in 3.5 RC4. Note: a lot of code has changed in drag drop feedback image since 2006. This is a one-off bulk update. (The last one in the triage migration). Moving bugs from swt-triaged@eclipse to platform-swt-inbox@eclipse.org and adding "triaged" keyword as per new triage process: https://wiki.eclipse.org/SWT/Devel/Triage See Bug 518478 for details. Tag for notification/mail filters: @TriageBulkUpdate This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |