Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2016-12-14 11:13:19 +0000
committerAlexander Kurtakov2016-12-14 11:13:19 +0000
commitd0fe4cf655fd77c7ae6184a4713c38c4ee88f04f (patch)
treea62d06861de673465ab203ca92303c13be74c483 /bundles/org.eclipse.swt/Eclipse SWT Drag and Drop
parent70e52cc3cd3a374e2c3dced3fb0b6ac3007e2009 (diff)
downloadeclipse.platform.swt-d0fe4cf655fd77c7ae6184a4713c38c4ee88f04f.tar.gz
eclipse.platform.swt-d0fe4cf655fd77c7ae6184a4713c38c4ee88f04f.tar.xz
eclipse.platform.swt-d0fe4cf655fd77c7ae6184a4713c38c4ee88f04f.zip
Bug 509210 - Table|TreeDragSourceEffect assume cairo xlib surface which
breaks on non-x11 Other GDK backends use image surface so check the surface and use the respective backend methods. Change-Id: I20226e026d75dfd22e2e9c064906ba3700e4512b Signed-off-by: Alexander Kurtakov <akurtako@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/TableDragSourceEffect.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragSourceEffect.java12
2 files changed, 20 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragSourceEffect.java
index 01f7f0ac49..b222cd03b0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragSourceEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragSourceEffect.java
@@ -116,8 +116,16 @@ public class TableDragSourceEffect extends DragSourceEffect {
OS.gtk_tree_view_get_cell_area (handle, path, 0, rect);
icons[i] = OS.gtk_tree_view_create_row_drag_icon(handle, path);
if (OS.GTK3) {
- w[0] = Cairo.cairo_xlib_surface_get_width(icons[i]);
- h[0] = Cairo.cairo_xlib_surface_get_height(icons[i]);
+ switch (Cairo.cairo_surface_get_type(icons[i])) {
+ case Cairo.CAIRO_SURFACE_TYPE_IMAGE:
+ w[0] = Cairo.cairo_image_surface_get_width(icons[i]);
+ h[0] = Cairo.cairo_image_surface_get_height(icons[i]);
+ break;
+ case Cairo.CAIRO_SURFACE_TYPE_XLIB:
+ w[0] = Cairo.cairo_xlib_surface_get_width(icons[i]);
+ h[0] = Cairo.cairo_xlib_surface_get_height(icons[i]);
+ break;
+ }
} else {
OS.gdk_pixmap_get_size(icons[i], w, h);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragSourceEffect.java
index a0dd9794fc..348f8bbe3d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragSourceEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragSourceEffect.java
@@ -115,8 +115,16 @@ public class TreeDragSourceEffect extends DragSourceEffect {
OS.gtk_tree_view_get_cell_area (handle, path, 0, rect);
icons[i] = OS.gtk_tree_view_create_row_drag_icon(handle, path);
if (OS.GTK3) {
- w[0] = Cairo.cairo_xlib_surface_get_width(icons[i]);
- h[0] = Cairo.cairo_xlib_surface_get_height(icons[i]);
+ switch (Cairo.cairo_surface_get_type(icons[i])) {
+ case Cairo.CAIRO_SURFACE_TYPE_IMAGE:
+ w[0] = Cairo.cairo_image_surface_get_width(icons[i]);
+ h[0] = Cairo.cairo_image_surface_get_height(icons[i]);
+ break;
+ case Cairo.CAIRO_SURFACE_TYPE_XLIB:
+ w[0] = Cairo.cairo_xlib_surface_get_width(icons[i]);
+ h[0] = Cairo.cairo_xlib_surface_get_height(icons[i]);
+ break;
+ }
} else {
OS.gdk_pixmap_get_size(icons[i], w, h);
}

Back to the top