Community
Participate
Working Groups
This blocks: https://bugs.eclipse.org/bugs/show_bug.cgi?id=428852 Gtk3-specific: If you have widgets inside an SWT Group widget, then a DND 'drop/motion' event doesn't reach those child widgets. As a result DND (drop) doesn't work for widgets that are children of Group. Instead, drop/motion events are swallowed by the group Widget itself. I discovered that Group's child widgets are added as 'siblings' rather than 'children' to the gtkFrame. Thus events didn't make it all the way through to the children. i.e, When rendered, group's hierarchy looks as following: SwtFixed (fixedHandle) +-- GtkFrame (handle) | +-- SwtFixed (clientHandle) +-- Child1 +-- Child2 And then input_shape_region captures events for the clientHandle. (Observe, children are added to 'fixedHandle' as siblings to GtkFrame instead of being GtkFrame's children). I'm working on a fix to have children nested under the client handle: SwtFixed (fixeldHandle) +-- GtkFrame (handle) +--SwtFixed (clientHandle) +-- Child1 +- -Child2 & remove the input_shape_region code. (I will post link to gerrit review in a minute). This fixes DND for Group. However, it breaks the positioning of children if the Group's label is set to something. I.e, children are added ~10pix or so lower than expected and you get funky behavior upon window-resizing**1. It appears to be an issue in some compute* function somewhere. There are also a lot of sibling_link errors in console when you fire up ControlExample. I will post further comments in a bit: **1 child controls keep expanding, never getting smaller upon resize.
Created attachment 249079 [details] . Preview of patch to fix group-hierarchy issue: https://git.eclipse.org/r/#/c/37430/ With both fixes applied: - The attached test illustrates that if a group doesn't have a label, positioning is ok. - If it has a label, or if one is set later, positioning is messed up.
Created attachment 249080 [details] . Attached is a simple test to illustrate that DND works for controls inside a group. In fact, with the patch applied, DNDExample's DND works, (but child widget's position is broken).
While I'm still working on the patch, please let me know your thoughts about fixing/changing how group gets it's children. Also, let me know if you have tips on how to fix the child-position issue.
(sorry about attachements description typo).
The child positioning is broken because clientHandle's x/y position are altered by native gtk calls: - gtk_widget_size_allocate and - gtk_widget_set_allocation. (e.g when called from shell). Previously it didn't matter that clientHandle had broken x/y coordinates because children were nested under fixedHandle and not clientHandle, but now with children being added under clientHandle, the broken x/y coords affects us. At the moment we can't get away from using *_allocate calls, so I overrode the getClientArea function to fix the x/y position. This puts children into the right position. However, there are still warnings in the console that I have to work on.
Ok, the fix for group is complete. Now DND works for widgets inside a group. (This also fixes an absolute position bug in group that caused absolute widgets to be drawn on top of the label instead of inside the frame). Could somebody please - test - let me know feedback - merge if all ok: https://git.eclipse.org/r/#/c/37430/ With this patch, DNDExample.java works fully and DND for widgets inside group work well. In addition, I also tested everything that touched 'clientHandle' afaik: - Layouts (row/grid/fill/Form/Absolute) - Drag and Drop - Drag and Drop between groups - Drag and Drop in nested groups - Group with various mouse events (tooltip/clicking/motion) - Group with Background fyi, these were my personal tests for the widget: https://github.com/LeoUfimtsev/swtTesting/blob/master/src/junit/tests/GroupManualUITest.java
With the fixed hierarchy, manual fixes like this: if (OS.GTK3) { OS.gtk_widget_override_background_color (clientHandle, OS.GTK_STATE_FLAG_NORMAL, new GdkRGBA ()); } Are no longer needed. -> Removing. (tested background works still on gtk2/3).
Pushed the patch to master - http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=846f013efc3b1566f8c1a545a6c06380f66b2d0c Thanks Leo! Good to see DNDExample working now on all GTK+ versions :)
We should probably port this and other DND fixes to 4.4.2 as well...
Verified in build I20150127-0900 on Ubuntu 14.04 GTK3 X86_64
(In reply to Arun Thondapu from comment #9) > We should probably port this and other DND fixes to 4.4.2 as well... This has been fixed in 4.4.2 as well. http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?h=R4_4_maintenance&id=eae521189070933c6966d9738a8f8035c0991c7b http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?h=R4_4_maintenance&id=802d80ccf1406e5dd15acc74836439b36978bf20