Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Pun2017-02-07 19:53:43 +0000
committerAlexander Kurtakov2017-03-15 13:57:36 +0000
commit860641a84d915424de3c6c214008ed5fc87c3a6f (patch)
treeb1cd65a0e2adc8c48306e64a7a0b3b6dedff3bc3 /bundles/org.eclipse.swt/Eclipse SWT Drag and Drop
parent2b94846bdaa006ecd846977dd8595a03d1a114a3 (diff)
downloadeclipse.platform.swt-860641a84d915424de3c6c214008ed5fc87c3a6f.tar.gz
eclipse.platform.swt-860641a84d915424de3c6c214008ed5fc87c3a6f.tar.xz
eclipse.platform.swt-860641a84d915424de3c6c214008ed5fc87c3a6f.zip
Bug 503431 - [wayland] Mouse button release event not triggering from
gdk_event_get() causing DND timeout - Reworked DND logic to be done through the use of GTKGestures, which are created in the constructor of a Control. - Moved DragDetect() call to be used in the motion notify event callback in order to get GTKGesture mouse position offsets correctly. - Changed labels to use gtk_event_box instead of box in order to have them output correct signals when being dragged. GtkBox is currently nested inside a GTk Event Box in order to preserve images. - Reworked tree/list/table so that drag and drop with multiple items selected work. Selection method is now called in a conditional call in release_event() as opposed to press_event(). - added dragEndReleaseSelection() in Control to be used by dragSource in order to fix issue where release events are not called during DnD in Wayland. The fix was to have the logic in the release event from multiselection widgets in the connected signal DragEnd as well. Change-Id: I3c8f2e90069c874cd831d44a5ca8b23fd70558ad Signed-off-by: Ian Pun <ipun@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
index 9286b4692e..a6d8d51ff0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
@@ -170,6 +170,19 @@ public DragSource(Control control, int style) {
OS.g_signal_connect(control.handle, OS.drag_end, DragEnd.getAddress(), 0);
OS.g_signal_connect(control.handle, OS.drag_data_delete, DragDataDelete.getAddress(), 0);
+ /*
+ * Feature in GTK: release events are not signaled during the dragEnd phrase of a Drag and Drop
+ * in Wayland. In order to work with the current logic for DnD in multiselection
+ * Widgets (tree, table, list), the selection function needs to be set back to
+ * true on dragEnd as well as release_event(). See bug 503431.
+ */
+
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
+ Callback dragReleaseCb = new Callback(control, "dragEndReleaseSelection", 2); //$NON-NLS-1$
+ if (dragReleaseCb.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS);
+ OS.g_signal_connect(control.handle, OS.drag_end, dragReleaseCb.getAddress(), 0);
+ }
+
controlListener = event -> {
if (event.type == SWT.Dispose) {
if (!DragSource.this.isDisposed()) {
@@ -336,16 +349,24 @@ void dragEnd(long /*int*/ widget, long /*int*/ context){
if (context != 0) {
long /*int*/ dest_window = 0;
int action = 0;
+ /*
+ * Feature in GTK: dest_window information is not gathered here in Wayland as the
+ * DragEnd signal does not give the correct destination window. GTK3.14+ with
+ * GTKGestures will handle file operations correctly without the
+ * gdk_drag_context_get_dest_window() call. See Bug 503431.
+ */
if (OS.GTK3) {
- dest_window = OS.gdk_drag_context_get_dest_window(context);
action = OS.gdk_drag_context_get_selected_action(context);
+ if (OS.GTK_VERSION < OS.VERSION(3, 14, 0)) {
+ dest_window = OS.gdk_drag_context_get_dest_window(context);
+ }
} else {
GdkDragContext gdkDragContext = new GdkDragContext ();
OS.memmove(gdkDragContext, context, GdkDragContext.sizeof);
dest_window = gdkDragContext.dest_window;
action = gdkDragContext.action;
}
- if (dest_window != 0) { //NOTE: if dest_window is 0, drag was aborted
+ if (dest_window != 0 || OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { //NOTE: if dest_window is 0, drag was aborted
if (moveData) {
operation = DND.DROP_MOVE;
} else {
@@ -354,7 +375,6 @@ void dragEnd(long /*int*/ widget, long /*int*/ context){
}
}
}
-
DNDEvent event = new DNDEvent();
event.widget = this;
//event.time = ???

Back to the top