Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2018-09-18 19:36:30 +0000
committerEric Williams2018-09-18 21:04:48 +0000
commit75056a5b6cb7d60b6c1f91493ba169564260f78b (patch)
treed91b21d58e596146b2a4cf0dde9bee1ad2c3fd73
parentdb4023b58ce1ae64bb57b3815ff0f85c061a5882 (diff)
downloadeclipse.platform.swt-75056a5b6cb7d60b6c1f91493ba169564260f78b.tar.gz
eclipse.platform.swt-75056a5b6cb7d60b6c1f91493ba169564260f78b.tar.xz
eclipse.platform.swt-75056a5b6cb7d60b6c1f91493ba169564260f78b.zip
Bug 530841: [GTK2] Remove GTK 2.x supportI20180918-1800
Remove pixmap from Image, as there are no pixmaps on GTK3 anymore: https://developer.gnome.org/gtk3/stable/ch26s02.html#id-1.6.3.4.5 Also remove printWindow() functionality, as it will never work on GTK3 because it uses GdkDrawable. It will need to be re-implemented. Change-Id: I7d1dd7d9cb7ce52cdf27fe707d45cca0f477f562 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c106
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java77
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java116
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java2
11 files changed, 23 insertions, 345 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java
index 109b6139c0..0b69f7f95a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java
@@ -137,7 +137,9 @@ public GLCanvas (Composite parent, int style, GLData data) {
attrs.visual = gdkvisual;
glWindow = GDK.gdk_window_new (window, attrs, GDK.GDK_WA_VISUAL);
GDK.gdk_window_set_user_data (glWindow, handle);
- if ((style & SWT.NO_BACKGROUND) != 0) GDK.gdk_window_set_back_pixmap (window, 0, false);
+ if ((style & SWT.NO_BACKGROUND) != 0) {
+ //TODO: implement this on GTK3 as pixmaps are gone.
+ }
xWindow = GDK.gdk_x11_window_get_xid (glWindow);
GDK.gdk_window_show (glWindow);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 44da5c38b5..b967288d9c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -240,18 +240,6 @@ JNIEXPORT jint JNICALL GDK_NATIVE(GdkWindowAttr_1sizeof)
}
#endif
-#ifndef NO__1GDK_1PIXMAP_1XID
-JNIEXPORT jintLong JNICALL GDK_NATIVE(_1GDK_1PIXMAP_1XID)
- (JNIEnv *env, jclass that, jintLong arg0)
-{
- jintLong rc = 0;
- GDK_NATIVE_ENTER(env, that, _1GDK_1PIXMAP_1XID_FUNC);
- rc = (jintLong)GDK_PIXMAP_XID((GdkPixmap *)arg0);
- GDK_NATIVE_EXIT(env, that, _1GDK_1PIXMAP_1XID_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO__1GDK_1TYPE_1PIXBUF
JNIEXPORT jintLong JNICALL GDK_NATIVE(_1GDK_1TYPE_1PIXBUF)
(JNIEnv *env, jclass that)
@@ -1530,31 +1518,6 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1pixbuf_1scale_1simple)
}
#endif
-#ifndef NO__1gdk_1pixmap_1get_1size
-JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1pixmap_1get_1size)
- (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2)
-{
- jint *lparg1=NULL;
- jint *lparg2=NULL;
- GDK_NATIVE_ENTER(env, that, _1gdk_1pixmap_1get_1size_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail;
- if (arg2) if ((lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL)) == NULL) goto fail;
-/*
- gdk_pixmap_get_size(arg0, (gint *)lparg1, (gint *)lparg2);
-*/
- {
- GDK_LOAD_FUNCTION(fp, gdk_pixmap_get_size)
- if (fp) {
- ((void (CALLING_CONVENTION*)(jintLong, gint *, gint *))fp)(arg0, (gint *)lparg1, (gint *)lparg2);
- }
- }
-fail:
- if (arg2 && lparg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, 0);
- if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, 0);
- GDK_NATIVE_EXIT(env, that, _1gdk_1pixmap_1get_1size_FUNC);
-}
-#endif
-
#ifndef NO__1gdk_1property_1get
JNIEXPORT jboolean JNICALL GDK_NATIVE(_1gdk_1property_1get)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4, jint arg5, jintLongArray arg6, jintArray arg7, jintArray arg8, jintLongArray arg9)
@@ -2083,19 +2046,6 @@ JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1window_1add_1filter)
}
#endif
-#ifndef NO__1gdk_1window_1begin_1paint_1rect
-JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1window_1begin_1paint_1rect)
- (JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
-{
- GdkRectangle _arg1, *lparg1=NULL;
- GDK_NATIVE_ENTER(env, that, _1gdk_1window_1begin_1paint_1rect_FUNC);
- if (arg1) if ((lparg1 = getGdkRectangleFields(env, arg1, &_arg1)) == NULL) goto fail;
- gdk_window_begin_paint_rect((GdkWindow *)arg0, (GdkRectangle *)lparg1);
-fail:
- GDK_NATIVE_EXIT(env, that, _1gdk_1window_1begin_1paint_1rect_FUNC);
-}
-#endif
-
#ifndef NO__1gdk_1window_1create_1similar_1surface
JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1window_1create_1similar_1surface)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3)
@@ -2126,16 +2076,6 @@ JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1window_1destroy)
}
#endif
-#ifndef NO__1gdk_1window_1end_1paint
-JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1window_1end_1paint)
- (JNIEnv *env, jclass that, jintLong arg0)
-{
- GDK_NATIVE_ENTER(env, that, _1gdk_1window_1end_1paint_FUNC);
- gdk_window_end_paint((GdkWindow *)arg0);
- GDK_NATIVE_EXIT(env, that, _1gdk_1window_1end_1paint_FUNC);
-}
-#endif
-
#ifndef NO__1gdk_1window_1focus
JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1window_1focus)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
@@ -2254,34 +2194,6 @@ JNIEXPORT jint JNICALL GDK_NATIVE(_1gdk_1window_1get_1height)
}
#endif
-#ifndef NO__1gdk_1window_1get_1internal_1paint_1info
-JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1window_1get_1internal_1paint_1info)
- (JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1, jintArray arg2, jintArray arg3)
-{
- jintLong *lparg1=NULL;
- jint *lparg2=NULL;
- jint *lparg3=NULL;
- GDK_NATIVE_ENTER(env, that, _1gdk_1window_1get_1internal_1paint_1info_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetIntLongArrayElements(env, arg1, NULL)) == NULL) goto fail;
- if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
- if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail;
-/*
- gdk_window_get_internal_paint_info((GdkWindow *)arg0, lparg1, (gint *)lparg2, (gint *)lparg3);
-*/
- {
- GDK_LOAD_FUNCTION(fp, gdk_window_get_internal_paint_info)
- if (fp) {
- ((void (CALLING_CONVENTION*)(GdkWindow *, jintLong *, gint *, gint *))fp)((GdkWindow *)arg0, lparg1, (gint *)lparg2, (gint *)lparg3);
- }
- }
-fail:
- if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
- if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- if (arg1 && lparg1) (*env)->ReleaseIntLongArrayElements(env, arg1, lparg1, 0);
- GDK_NATIVE_EXIT(env, that, _1gdk_1window_1get_1internal_1paint_1info_FUNC);
-}
-#endif
-
#ifndef NO__1gdk_1window_1get_1origin
JNIEXPORT jint JNICALL GDK_NATIVE(_1gdk_1window_1get_1origin)
(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2)
@@ -2573,24 +2485,6 @@ JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1window_1restack)
}
#endif
-#ifndef NO__1gdk_1window_1set_1back_1pixmap
-JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1window_1set_1back_1pixmap)
- (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jboolean arg2)
-{
- GDK_NATIVE_ENTER(env, that, _1gdk_1window_1set_1back_1pixmap_FUNC);
-/*
- gdk_window_set_back_pixmap((GdkWindow *)arg0, arg1, (gboolean)arg2);
-*/
- {
- GDK_LOAD_FUNCTION(fp, gdk_window_set_back_pixmap)
- if (fp) {
- ((void (CALLING_CONVENTION*)(GdkWindow *, jintLong, gboolean))fp)((GdkWindow *)arg0, arg1, (gboolean)arg2);
- }
- }
- GDK_NATIVE_EXIT(env, that, _1gdk_1window_1set_1back_1pixmap_FUNC);
-}
-#endif
-
#ifndef NO__1gdk_1window_1set_1background_1pattern
JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1window_1set_1background_1pattern)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
index 9c3995cab7..bef9ef9712 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
@@ -159,7 +159,6 @@ X#define NO__1XWarpPointer
#endif
// TODO: the following are still called in code even on GTK3.
-#define NO__1GDK_1PIXMAP_1XID
#define NO_GdkImage
#define NO_GTK_1ENTRY_1IM_1CONTEXT
#define NO_GTK_1TEXTVIEW_1IM_1CONTEXT
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 5ec1bf4cdb..9891521339 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -40,7 +40,6 @@ char * GDK_nativeFunctionNames[] = {
"GdkRGBA_1sizeof",
"GdkRectangle_1sizeof",
"GdkWindowAttr_1sizeof",
- "_1GDK_1PIXMAP_1XID",
"_1GDK_1TYPE_1PIXBUF",
"_1GDK_1TYPE_1RGBA",
"_1gdk_1atom_1intern",
@@ -118,7 +117,6 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1pixbuf_1new_1from_1file",
"_1gdk_1pixbuf_1save_1to_1bufferv",
"_1gdk_1pixbuf_1scale_1simple",
- "_1gdk_1pixmap_1get_1size",
"_1gdk_1property_1get",
"_1gdk_1rgba_1free",
"_1gdk_1rgba_1hash",
@@ -151,10 +149,8 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1visual_1get_1depth",
"_1gdk_1visual_1get_1system",
"_1gdk_1window_1add_1filter",
- "_1gdk_1window_1begin_1paint_1rect",
"_1gdk_1window_1create_1similar_1surface",
"_1gdk_1window_1destroy",
- "_1gdk_1window_1end_1paint",
"_1gdk_1window_1focus",
"_1gdk_1window_1get_1children",
"_1gdk_1window_1get_1device_1position",
@@ -162,7 +158,6 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1window_1get_1events",
"_1gdk_1window_1get_1frame_1extents",
"_1gdk_1window_1get_1height",
- "_1gdk_1window_1get_1internal_1paint_1info",
"_1gdk_1window_1get_1origin",
"_1gdk_1window_1get_1parent",
"_1gdk_1window_1get_1position",
@@ -183,7 +178,6 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1window_1raise",
"_1gdk_1window_1resize",
"_1gdk_1window_1restack",
- "_1gdk_1window_1set_1back_1pixmap",
"_1gdk_1window_1set_1background_1pattern",
"_1gdk_1window_1set_1cursor",
"_1gdk_1window_1set_1decorations",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index c4aebb0f73..caf869e18e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -50,7 +50,6 @@ typedef enum {
GdkRGBA_1sizeof_FUNC,
GdkRectangle_1sizeof_FUNC,
GdkWindowAttr_1sizeof_FUNC,
- _1GDK_1PIXMAP_1XID_FUNC,
_1GDK_1TYPE_1PIXBUF_FUNC,
_1GDK_1TYPE_1RGBA_FUNC,
_1gdk_1atom_1intern_FUNC,
@@ -128,7 +127,6 @@ typedef enum {
_1gdk_1pixbuf_1new_1from_1file_FUNC,
_1gdk_1pixbuf_1save_1to_1bufferv_FUNC,
_1gdk_1pixbuf_1scale_1simple_FUNC,
- _1gdk_1pixmap_1get_1size_FUNC,
_1gdk_1property_1get_FUNC,
_1gdk_1rgba_1free_FUNC,
_1gdk_1rgba_1hash_FUNC,
@@ -161,10 +159,8 @@ typedef enum {
_1gdk_1visual_1get_1depth_FUNC,
_1gdk_1visual_1get_1system_FUNC,
_1gdk_1window_1add_1filter_FUNC,
- _1gdk_1window_1begin_1paint_1rect_FUNC,
_1gdk_1window_1create_1similar_1surface_FUNC,
_1gdk_1window_1destroy_FUNC,
- _1gdk_1window_1end_1paint_FUNC,
_1gdk_1window_1focus_FUNC,
_1gdk_1window_1get_1children_FUNC,
_1gdk_1window_1get_1device_1position_FUNC,
@@ -172,7 +168,6 @@ typedef enum {
_1gdk_1window_1get_1events_FUNC,
_1gdk_1window_1get_1frame_1extents_FUNC,
_1gdk_1window_1get_1height_FUNC,
- _1gdk_1window_1get_1internal_1paint_1info_FUNC,
_1gdk_1window_1get_1origin_FUNC,
_1gdk_1window_1get_1parent_FUNC,
_1gdk_1window_1get_1position_FUNC,
@@ -193,7 +188,6 @@ typedef enum {
_1gdk_1window_1raise_FUNC,
_1gdk_1window_1resize_FUNC,
_1gdk_1window_1restack_FUNC,
- _1gdk_1window_1set_1back_1pixmap_FUNC,
_1gdk_1window_1set_1background_1pattern_FUNC,
_1gdk_1window_1set_1cursor_FUNC,
_1gdk_1window_1set_1decorations_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
index 05acd992f6..312b44f620 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
@@ -281,16 +281,6 @@ public class GDK extends OS {
public static final native long /*int*/ GDK_EVENT_WINDOW(long /*int*/ event);
/** @param display cast=(GdkDisplay *) */
public static final native boolean GDK_IS_X11_DISPLAY(long /*int*/ display);
- /** @param pixmap cast=(GdkPixmap *) */
- public static final native long /*int*/ _GDK_PIXMAP_XID(long /*int*/ pixmap);
- public static final long /*int*/ GDK_PIXMAP_XID(long /*int*/ pixmap) {
- lock.lock();
- try {
- return _GDK_PIXMAP_XID(pixmap);
- } finally {
- lock.unlock();
- }
- }
/** @method flags=const */
public static final native long /*int*/ _GDK_TYPE_RGBA();
public static final long /*int*/ GDK_TYPE_RGBA() {
@@ -763,21 +753,6 @@ public class GDK extends OS {
}
/**
* @method flags=dynamic
- * @param width cast=(gint *),flags=no_in critical
- * @param height cast=(gint *),flags=no_in critical
- * @method flags=dynamic
- */
- public static final native void _gdk_pixmap_get_size(long /*int*/ pixmap, int[] width, int[] height);
- public static final void gdk_pixmap_get_size(long /*int*/ pixmap, int[] width, int[] height) {
- lock.lock();
- try {
- _gdk_pixmap_get_size (pixmap,width,height);
- } finally {
- lock.unlock();
- }
- }
- /**
- * @method flags=dynamic
* @param x cast=(gint)
* @param y cast=(gint)
* @param width cast=(gint)
@@ -1785,19 +1760,6 @@ public class GDK extends OS {
}
}
/**
- * @param window cast=(GdkWindow *)
- * @param rectangle cast=(GdkRectangle *),flags=no_out
- */
- public static final native void _gdk_window_begin_paint_rect(long /*int*/ window, GdkRectangle rectangle);
- public static final void gdk_window_begin_paint_rect(long /*int*/ window, GdkRectangle rectangle) {
- lock.lock();
- try {
- _gdk_window_begin_paint_rect(window, rectangle);
- } finally {
- lock.unlock();
- }
- }
- /**
* @method flags=dynamic
* @param window cast=(GdkWindow *)
*/
@@ -1821,16 +1783,6 @@ public class GDK extends OS {
}
}
/** @param window cast=(GdkWindow *) */
- public static final native void _gdk_window_end_paint(long /*int*/ window);
- public static final void gdk_window_end_paint(long /*int*/ window) {
- lock.lock();
- try {
- _gdk_window_end_paint(window);
- } finally {
- lock.unlock();
- }
- }
- /** @param window cast=(GdkWindow *) */
public static final native long /*int*/ _gdk_window_get_children(long /*int*/ window);
public static final long /*int*/ gdk_window_get_children(long /*int*/ window) {
lock.lock();
@@ -1874,21 +1826,6 @@ public class GDK extends OS {
}
}
/**
- * @method flags=dynamic
- * @param window cast=(GdkWindow *)
- * @param x_offset cast=(gint *)
- * @param y_offset cast=(gint *)
- */
- public static final native void _gdk_window_get_internal_paint_info(long /*int*/ window, long /*int*/ [] real_drawable, int[] x_offset, int[] y_offset);
- public static final void gdk_window_get_internal_paint_info(long /*int*/ window, long /*int*/ [] real_drawable, int[] x_offset, int[] y_offset) {
- lock.lock();
- try {
- _gdk_window_get_internal_paint_info(window, real_drawable, x_offset, y_offset);
- } finally {
- lock.unlock();
- }
- }
- /**
* @param window cast=(GdkWindow *)
* @param x cast=(gint *)
* @param y cast=(gint *)
@@ -2133,20 +2070,6 @@ public class GDK extends OS {
}
}
/**
- * @method flags=dynamic
- * @param window cast=(GdkWindow *)
- * @param parent_relative cast=(gboolean)
- */
- public static final native void _gdk_window_set_back_pixmap(long /*int*/ window, long /*int*/ pixmap, boolean parent_relative);
- public static final void gdk_window_set_back_pixmap(long /*int*/ window, long /*int*/ pixmap, boolean parent_relative) {
- lock.lock();
- try {
- _gdk_window_set_back_pixmap(window, pixmap, parent_relative);
- } finally {
- lock.unlock();
- }
- }
- /**
* @param window cast=(GdkWindow *)
* @param cursor cast=(GdkCursor *)
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
index 614fc6a1e5..d415fe9a62 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
@@ -88,20 +88,6 @@ public final class Image extends Resource implements Drawable {
public int type;
/**
- * The handle to the OS pixmap resource.
- * (Warning: This field is platform dependent)
- * <p>
- * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT
- * public API. It is marked public only so that it can be shared
- * within the packages provided by SWT. It is not available on all
- * platforms and should never be accessed from application code.
- * </p>
- *
- * @noreference This field is not intended to be referenced by clients.
- */
- public long /*int*/ pixmap;
-
- /**
* The handle to the OS mask resource.
* (Warning: This field is platform dependent)
* <p>
@@ -671,7 +657,7 @@ public Image(Device device, ImageFileNameProvider imageFileNameProvider) {
String filename = DPIUtil.validateAndGetImagePathAtZoom (imageFileNameProvider, currentDeviceZoom, found);
if (found[0]) {
initNative (filename);
- if (this.pixmap == 0 && this.surface == 0) {
+ if (this.surface == 0) {
ImageData data = new ImageData(filename);
init(data);
}
@@ -745,7 +731,7 @@ boolean refreshImageForZoom () {
/* Release current native resources */
destroy ();
initNative(filename);
- if (this.pixmap == 0 && this.surface == 0) {
+ if (this.surface == 0) {
ImageData data = new ImageData(filename);
init(data);
}
@@ -938,10 +924,9 @@ void destroyMask() {
@Override
void destroy() {
if (memGC != null) memGC.dispose();
- if (pixmap != 0) OS.g_object_unref(pixmap);
if (mask != 0) OS.g_object_unref(mask);
if (surface != 0) Cairo.cairo_surface_destroy(surface);
- surface = pixmap = mask = 0;
+ surface = mask = 0;
memGC = null;
}
@@ -1032,9 +1017,8 @@ public Rectangle getBoundsInPixels() {
if (width != -1 && height != -1) {
return new Rectangle(0, 0, width, height);
}
- int[] w = new int[1]; int[] h = new int[1];
- GDK.gdk_pixmap_get_size(pixmap, w, h);
- return new Rectangle(0, 0, width = w[0], height = h[0]);
+ // There are no pixmaps on GTK3, so this will just return 0
+ return new Rectangle(0, 0, 0, 0);
}
/**
@@ -1458,7 +1442,6 @@ public long /*int*/ internal_new_GC (GCData data) {
}
}
data.device = device;
- data.drawable = pixmap;
data.foregroundRGBA = device.COLOR_BLACK.handle;
data.backgroundRGBA = device.COLOR_WHITE.handle;
data.font = device.systemFont;
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 f2c6658937..fe9bd61d73 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
@@ -485,22 +485,8 @@ void drawBackgroundInPixels (GC gc, int x, int y, int width, int height, int off
x += pt.x + offsetX;
y += pt.y + offsetY;
long /*int*/ surface = control.backgroundImage.surface;
- if (surface == 0) {
- long /*int*/ drawable = control.backgroundImage.pixmap;
- int [] w = new int [1], h = new int [1];
- GDK.gdk_pixmap_get_size (drawable, w, h);
- if (OS.isX11()) {
- long /*int*/ xDisplay = GDK.gdk_x11_display_get_xdisplay(GDK.gdk_display_get_default());
- long /*int*/ xVisual = GDK.gdk_x11_visual_get_xvisual (GDK.gdk_visual_get_system());
- long /*int*/ xDrawable = GDK.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);
- }
+ if (surface == 0) error (SWT.ERROR_NO_HANDLES);
+ Cairo.cairo_surface_reference(surface);
long /*int*/ pattern = Cairo.cairo_pattern_create_for_surface (surface);
if (pattern == 0) error (SWT.ERROR_NO_HANDLES);
Cairo.cairo_pattern_set_extend (pattern, Cairo.CAIRO_EXTEND_REPEAT);
@@ -882,8 +868,7 @@ long /*int*/ gtk_scroll_child (long /*int*/ widget, long /*int*/ scrollType, lon
long /*int*/ gtk_style_set (long /*int*/ widget, long /*int*/ previousStyle) {
long /*int*/ result = super.gtk_style_set (widget, previousStyle);
if ((style & SWT.NO_BACKGROUND) != 0) {
- long /*int*/ window = gtk_widget_get_window (paintHandle ());
- if (window != 0) GDK.gdk_window_set_back_pixmap (window, 0, false);
+ //TODO: implement this on GTK3 as pixmaps are gone.
}
return result;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index fd61479a01..d4937c0c40 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -520,89 +520,11 @@ void printWidget (GC gc, long /*int*/ drawable, int depth, int x, int y) {
}
void printWindow (boolean first, Control control, GC gc, long /*int*/ drawable, int depth, long /*int*/ window, int x, int y) {
- if (GDK.gdk_drawable_get_depth (window) != depth) return;
- GdkRectangle rect = new GdkRectangle ();
- int [] width = new int [1], height = new int [1];
- gdk_window_get_size (window, width, height);
- rect.width = width [0];
- rect.height = height [0];
- GDK.gdk_window_begin_paint_rect (window, rect);
- long /*int*/ [] real_drawable = new long /*int*/ [1];
- int [] x_offset = new int [1], y_offset = new int [1];
- GDK.gdk_window_get_internal_paint_info (window, real_drawable, x_offset, y_offset);
- long /*int*/ [] userData = new long /*int*/ [1];
- GDK.gdk_window_get_user_data (window, userData);
- if (userData [0] != 0) {
- long /*int*/ eventPtr = GDK.gdk_event_new (GDK.GDK_EXPOSE);
- GdkEventExpose event = new GdkEventExpose ();
- event.type = GDK.GDK_EXPOSE;
- event.window = OS.g_object_ref (window);
- event.area_width = rect.width;
- event.area_height = rect.height;
- cairo_rectangle_int_t cairoRect = new cairo_rectangle_int_t();
- cairoRect.convertFromGdkRectangle(rect);
- event.region = Cairo.cairo_region_create_rectangle (cairoRect);
- OS.memmove (eventPtr, event, GdkEventExpose.sizeof);
- GTK.gtk_widget_send_expose (userData [0], eventPtr);
- GDK.gdk_event_free (eventPtr);
- }
- int destX = x, destY = y, destWidth = width [0], destHeight = height [0];
- if (!first) {
- int [] cX = new int [1], cY = new int [1];
- GDK.gdk_window_get_position (window, cX, cY);
- long /*int*/ parentWindow = GDK.gdk_window_get_parent (window);
- int [] pW = new int [1], pH = new int [1];
- gdk_window_get_size (parentWindow, pW, pH);
- destX = x - cX [0];
- destY = y - cY [0];
- destWidth = Math.min (cX [0] + width [0], pW [0]);
- destHeight = Math.min (cY [0] + height [0], pH [0]);
- }
- GCData gcData = gc.getGCData();
- long /*int*/ cairo = gcData.cairo;
- long /*int*/ xDisplay = GDK.gdk_x11_display_get_xdisplay(GDK.gdk_display_get_default());
- long /*int*/ xVisual = GDK.gdk_x11_visual_get_xvisual(GDK.gdk_visual_get_system());
- long /*int*/ xDrawable = GDK.GDK_PIXMAP_XID(real_drawable [0]);
- long /*int*/ surface = Cairo.cairo_xlib_surface_create(xDisplay, xDrawable, xVisual, width [0], height [0]);
- if (surface == 0) error(SWT.ERROR_NO_HANDLES);
- Cairo.cairo_save(cairo);
- Cairo.cairo_rectangle(cairo, destX , destY, destWidth, destHeight);
- Cairo.cairo_clip(cairo);
- Cairo.cairo_translate(cairo, destX, destY);
- long /*int*/ pattern = Cairo.cairo_pattern_create_for_surface(surface);
- if (pattern == 0) error(SWT.ERROR_NO_HANDLES);
- Cairo.cairo_pattern_set_filter(pattern, Cairo.CAIRO_FILTER_BEST);
- Cairo.cairo_set_source(cairo, pattern);
- if (gcData.alpha != 0xFF) {
- Cairo.cairo_paint_with_alpha(cairo, gcData.alpha / (float)0xFF);
- } else {
- Cairo.cairo_paint(cairo);
- }
- Cairo.cairo_restore(cairo);
- Cairo.cairo_pattern_destroy(pattern);
- Cairo.cairo_surface_destroy(surface);
- GDK.gdk_window_end_paint (window);
- long /*int*/ children = GDK.gdk_window_get_children (window);
- if (children != 0) {
- long /*int*/ windows = children;
- while (windows != 0) {
- long /*int*/ child = OS.g_list_data (windows);
- if (GDK.gdk_window_is_visible (child)) {
- long /*int*/ [] data = new long /*int*/ [1];
- GDK.gdk_window_get_user_data (child, data);
- if (data [0] != 0) {
- Widget widget = display.findWidget (data [0]);
- if (widget == null || widget == control) {
- int [] x_pos = new int [1], y_pos = new int [1];
- GDK.gdk_window_get_position (child, x_pos, y_pos);
- printWindow (false, control, gc, drawable, depth, child, x + x_pos [0], y + y_pos [0]);
- }
- }
- }
- windows = OS.g_list_next (windows);
- }
- OS.g_list_free (children);
- }
+ /*
+ * TODO: this needs to be re-implemented for GTK3 as it uses GdkDrawable which is gone.
+ * See: https://developer.gnome.org/gtk3/stable/ch26s02.html#id-1.6.3.4.7
+ */
+ return;
}
/**
@@ -3722,7 +3644,7 @@ long /*int*/ gtk_realize (long /*int*/ widget) {
GTK.gtk_im_context_set_client_window (imHandle, window);
}
if (backgroundImage != null) {
- setBackgroundPixmap (backgroundImage);
+ setBackgroundSurface (backgroundImage);
}
return 0;
}
@@ -3768,7 +3690,7 @@ long /*int*/ gtk_show_help (long /*int*/ widget, long /*int*/ helpType) {
@Override
long /*int*/ gtk_style_set (long /*int*/ widget, long /*int*/ previousStyle) {
if (backgroundImage != null) {
- setBackgroundPixmap (backgroundImage);
+ setBackgroundSurface (backgroundImage);
}
return 0;
}
@@ -4624,7 +4546,7 @@ public void setBackgroundImage (Image image) {
backgroundAlpha = 255;
this.backgroundImage = image;
if (backgroundImage != null) {
- setBackgroundPixmap (backgroundImage);
+ setBackgroundSurface (backgroundImage);
redrawWidget (0, 0, 0, 0, true, false, false);
} else {
setWidgetBackground ();
@@ -4632,33 +4554,15 @@ public void setBackgroundImage (Image image) {
redrawChildren ();
}
-void setBackgroundPixmap (Image image) {
+void setBackgroundSurface (Image image) {
long /*int*/ window = gtk_widget_get_window (paintHandle ());
if (window != 0) {
- if (image.pixmap != 0) {
- GDK.gdk_window_set_back_pixmap (window, image.pixmap, false);
- } else if (image.surface != 0) {
+ if (image.surface != 0) {
long /*int*/ pattern = Cairo.cairo_pattern_create_for_surface(image.surface);
if (pattern == 0) SWT.error(SWT.ERROR_NO_HANDLES);
Cairo.cairo_pattern_set_extend(pattern, Cairo.CAIRO_EXTEND_REPEAT);
GDK.gdk_window_set_background_pattern(window, pattern);
Cairo.cairo_pattern_destroy(pattern);
- /*
- * TODO This code code is commented because it does not work since the pixmap
- * created with gdk_pixmap_foreign_new() does not have colormap. Another option
- * would be to create a pixmap on the fly from the surface.
- *
- * For now draw background in windowProc().
- */
-// long /*int*/ surface = image.surface;
-// int type = Cairo.cairo_surface_get_type(surface);
-// switch (type) {
-// case Cairo.CAIRO_SURFACE_TYPE_XLIB:
-// long /*int*/ pixmap = OS.gdk_pixmap_foreign_new(Cairo.cairo_xlib_surface_get_drawable(surface));
-// OS.gdk_window_set_back_pixmap (window, pixmap, false);
-// OS.g_object_unref(pixmap);
-// break;
-// }
}
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index 181c8c15b0..e2cb45d128 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -3266,7 +3266,7 @@ void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rg
}
@Override
-void setBackgroundPixmap (Image image) {
+void setBackgroundSurface (Image image) {
ownerDraw = true;
recreateRenderers ();
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index 2e53ab8a48..2628d3b63d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -3332,7 +3332,7 @@ void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rg
}
@Override
-void setBackgroundPixmap (Image image) {
+void setBackgroundSurface (Image image) {
ownerDraw = true;
recreateRenderers ();
}

Back to the top