aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Barkovic2014-07-29 19:01:20 (EDT)
committerJoshua Barkovic2014-07-29 19:01:20 (EDT)
commitd8145da26376e690090dc684322ff1adbf794a0e (patch)
tree1b66caa5195ade7f3c0591c9c1e0d70be519a4b3
parent0f2010e79a3a02a0e6cbbcfb3b9b4f3413094c2f (diff)
downloadeclipse.platform.swt-d8145da26376e690090dc684322ff1adbf794a0e.zip
eclipse.platform.swt-d8145da26376e690090dc684322ff1adbf794a0e.tar.gz
eclipse.platform.swt-d8145da26376e690090dc684322ff1adbf794a0e.tar.bz2
Bug 440281 - [Wayland] X11 Code can be allowed to run in Composite.javarefs/changes/00/30700/1
Kept original code, new back end independent Cairo code for Wayland Change-Id: Ie15b0d2668b25ce15e03dbfdbe1522b51d42c4f1 Signed-off-by: Joshua Barkovic <joshbarkovic@gmail.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index ecd23fe..ec34d3b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -396,13 +396,17 @@ public void drawBackground (GC gc, int x, int y, int width, int height, int offs
y += pt.y + offsetY;
long /*int*/ surface = control.backgroundImage.surface;
if (surface == 0) {
- long /*int*/ xDisplay = OS.gdk_x11_display_get_xdisplay(OS.gdk_display_get_default());
- long /*int*/ xVisual = OS.gdk_x11_visual_get_xvisual (OS.gdk_visual_get_system());
long /*int*/ drawable = control.backgroundImage.pixmap;
- long /*int*/ xDrawable = OS.GDK_PIXMAP_XID (drawable);
int [] w = new int [1], h = new int [1];
gdk_pixmap_get_size (drawable, w, h);
- surface = Cairo.cairo_xlib_surface_create (xDisplay, xDrawable, xVisual, w [0], h [0]);
+ if (OS.GDK_WINDOWING_X11 () && !OS.GDK_WINDOWING_WAYLAND ()) {
+ long /*int*/ xDisplay = OS.gdk_x11_display_get_xdisplay(OS.gdk_display_get_default());
+ long /*int*/ xVisual = OS.gdk_x11_visual_get_xvisual (OS.gdk_visual_get_system());
+ long /*int*/ xDrawable = OS.GDK_PIXMAP_XID (drawable);
+ surface = Cairo.cairo_xlib_surface_create (xDisplay, xDrawable, xVisual, w [0], h [0]);
+ } else {
+ surface = Cairo.cairo_image_surface_create(Cairo.CAIRO_FORMAT_ARGB32, w [0], h [0]);
+ }
if (surface == 0) error (SWT.ERROR_NO_HANDLES);
} else {
Cairo.cairo_surface_reference(surface);