Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-09-13 11:51:58 +0000
committerAlexander Kurtakov2018-09-13 12:05:00 +0000
commit2ef4ba346d76f10c341caa70473a5d8533d7a74c (patch)
treeddc6e07bbc676107b42df4782443be396dcca93d
parentf16fc2568aa2ac13e5545d2466611b75a229ee1f (diff)
downloadeclipse.platform.swt-2ef4ba346d76f10c341caa70473a5d8533d7a74c.tar.gz
eclipse.platform.swt-2ef4ba346d76f10c341caa70473a5d8533d7a74c.tar.xz
eclipse.platform.swt-2ef4ba346d76f10c341caa70473a5d8533d7a74c.zip
Bug 530841: [GTK2] Remove GTK 2.x support
Handle graphics package. Change-Id: Iefbb076575112d018e1de40c9ee0289eea34663d Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c72
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java39
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java60
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java8
16 files changed, 44 insertions, 232 deletions
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 d8af758632..3cf1ea9765 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
@@ -422,24 +422,6 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1cairo_1region_1create_1from_1surfac
}
#endif
-#ifndef NO__1gdk_1cairo_1reset_1clip
-JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1cairo_1reset_1clip)
- (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
-{
- GDK_NATIVE_ENTER(env, that, _1gdk_1cairo_1reset_1clip_FUNC);
-/*
- gdk_cairo_reset_clip(arg0, arg1);
-*/
- {
- GDK_LOAD_FUNCTION(fp, gdk_cairo_reset_clip)
- if (fp) {
- ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
- }
- }
- GDK_NATIVE_EXIT(env, that, _1gdk_1cairo_1reset_1clip_FUNC);
-}
-#endif
-
#ifndef NO__1gdk_1cairo_1set_1source_1pixbuf
JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1cairo_1set_1source_1pixbuf)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3)
@@ -546,24 +528,6 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1cursor_1new_1from_1pixbuf)
}
#endif
-#ifndef NO__1gdk_1cursor_1unref
-JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1cursor_1unref)
- (JNIEnv *env, jclass that, jintLong arg0)
-{
- GDK_NATIVE_ENTER(env, that, _1gdk_1cursor_1unref_FUNC);
-/*
- gdk_cursor_unref(arg0);
-*/
- {
- GDK_LOAD_FUNCTION(fp, gdk_cursor_unref)
- if (fp) {
- ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0);
- }
- }
- GDK_NATIVE_EXIT(env, that, _1gdk_1cursor_1unref_FUNC);
-}
-#endif
-
#ifndef NO__1gdk_1device_1get_1associated_1device
JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1device_1get_1associated_1device)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -1999,30 +1963,6 @@ JNIEXPORT jboolean JNICALL GDK_NATIVE(_1gdk_1region_1point_1in)
}
#endif
-#ifndef NO__1gdk_1region_1polygon
-JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1region_1polygon)
- (JNIEnv *env, jclass that, jintArray arg0, jint arg1, jint arg2)
-{
- jint *lparg0=NULL;
- jintLong rc = 0;
- GDK_NATIVE_ENTER(env, that, _1gdk_1region_1polygon_FUNC);
- if (arg0) if ((lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL)) == NULL) goto fail;
-/*
- rc = (jintLong)gdk_region_polygon(lparg0, arg1, arg2);
-*/
- {
- GDK_LOAD_FUNCTION(fp, gdk_region_polygon)
- if (fp) {
- rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jint *, jint, jint))fp)(lparg0, arg1, arg2);
- }
- }
-fail:
- if (arg0 && lparg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0);
- GDK_NATIVE_EXIT(env, that, _1gdk_1region_1polygon_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO__1gdk_1region_1rect_1in
JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1region_1rect_1in)
(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
@@ -2419,18 +2359,6 @@ JNIEXPORT jint JNICALL GDK_NATIVE(_1gdk_1screen_1width)
}
#endif
-#ifndef NO__1gdk_1screen_1width_1mm
-JNIEXPORT jint JNICALL GDK_NATIVE(_1gdk_1screen_1width_1mm)
- (JNIEnv *env, jclass that)
-{
- jint rc = 0;
- GDK_NATIVE_ENTER(env, that, _1gdk_1screen_1width_1mm_FUNC);
- rc = (jint)gdk_screen_width_mm();
- GDK_NATIVE_EXIT(env, that, _1gdk_1screen_1width_1mm_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO__1gdk_1seat_1get_1pointer
JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1seat_1get_1pointer)
(JNIEnv *env, jclass that, jintLong arg0)
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 4c16d77eda..a69797bd9a 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
@@ -51,14 +51,12 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1cairo_1get_1clip_1rectangle",
"_1gdk_1cairo_1region",
"_1gdk_1cairo_1region_1create_1from_1surface",
- "_1gdk_1cairo_1reset_1clip",
"_1gdk_1cairo_1set_1source_1pixbuf",
"_1gdk_1cairo_1set_1source_1rgba",
"_1gdk_1cairo_1set_1source_1window",
"_1gdk_1cursor_1new_1for_1display",
"_1gdk_1cursor_1new_1from_1name",
"_1gdk_1cursor_1new_1from_1pixbuf",
- "_1gdk_1cursor_1unref",
"_1gdk_1device_1get_1associated_1device",
"_1gdk_1device_1get_1window_1at_1position",
"_1gdk_1device_1grab",
@@ -145,7 +143,6 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1region_1new",
"_1gdk_1region_1offset",
"_1gdk_1region_1point_1in",
- "_1gdk_1region_1polygon",
"_1gdk_1region_1rect_1in",
"_1gdk_1region_1rectangle",
"_1gdk_1region_1subtract",
@@ -168,7 +165,6 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1screen_1get_1resolution",
"_1gdk_1screen_1height",
"_1gdk_1screen_1width",
- "_1gdk_1screen_1width_1mm",
"_1gdk_1seat_1get_1pointer",
"_1gdk_1seat_1grab",
"_1gdk_1seat_1ungrab",
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 136021b6e7..91c07048f1 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
@@ -61,14 +61,12 @@ typedef enum {
_1gdk_1cairo_1get_1clip_1rectangle_FUNC,
_1gdk_1cairo_1region_FUNC,
_1gdk_1cairo_1region_1create_1from_1surface_FUNC,
- _1gdk_1cairo_1reset_1clip_FUNC,
_1gdk_1cairo_1set_1source_1pixbuf_FUNC,
_1gdk_1cairo_1set_1source_1rgba_FUNC,
_1gdk_1cairo_1set_1source_1window_FUNC,
_1gdk_1cursor_1new_1for_1display_FUNC,
_1gdk_1cursor_1new_1from_1name_FUNC,
_1gdk_1cursor_1new_1from_1pixbuf_FUNC,
- _1gdk_1cursor_1unref_FUNC,
_1gdk_1device_1get_1associated_1device_FUNC,
_1gdk_1device_1get_1window_1at_1position_FUNC,
_1gdk_1device_1grab_FUNC,
@@ -155,7 +153,6 @@ typedef enum {
_1gdk_1region_1new_FUNC,
_1gdk_1region_1offset_FUNC,
_1gdk_1region_1point_1in_FUNC,
- _1gdk_1region_1polygon_FUNC,
_1gdk_1region_1rect_1in_FUNC,
_1gdk_1region_1rectangle_FUNC,
_1gdk_1region_1subtract_FUNC,
@@ -178,7 +175,6 @@ typedef enum {
_1gdk_1screen_1get_1resolution_FUNC,
_1gdk_1screen_1height_FUNC,
_1gdk_1screen_1width_FUNC,
- _1gdk_1screen_1width_1mm_FUNC,
_1gdk_1seat_1get_1pointer_FUNC,
_1gdk_1seat_1grab_FUNC,
_1gdk_1seat_1ungrab_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 cbfb0d22e6..a5abade138 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
@@ -514,16 +514,6 @@ public class GDK extends OS {
}
}
/** @method flags=dynamic */
- public static final native void _gdk_cairo_reset_clip(long /*int*/ cairo, long /*int*/ drawable);
- public static final void gdk_cairo_reset_clip(long /*int*/ cairo, long /*int*/ drawable) {
- lock.lock();
- try {
- _gdk_cairo_reset_clip(cairo, drawable);
- } finally {
- lock.unlock();
- }
- }
- /** @method flags=dynamic */
public static final native void _gdk_cairo_set_source_rgba(long /*int*/ cairo, GdkRGBA rgba);
public static final void gdk_cairo_set_source_rgba(long /*int*/ cairo, GdkRGBA rgba) {
lock.lock();
@@ -600,16 +590,6 @@ public class GDK extends OS {
lock.unlock();
}
}
- /** @method flags=dynamic */
- public static final native void _gdk_cursor_unref(long /*int*/ cursor);
- public static final void gdk_cursor_unref(long /*int*/ cursor) {
- lock.lock();
- try {
- _gdk_cursor_unref(cursor);
- } finally {
- lock.unlock();
- }
- }
/** @param display cast=(GdkDisplay *)
* @param cursor_type cast=(GdkCursorType)
*/
@@ -1674,16 +1654,6 @@ public class GDK extends OS {
lock.unlock();
}
}
- /** @method flags=dynamic */
- public static final native long /*int*/ _gdk_region_polygon(int[] points, int npoints, int fill_rule);
- public static final long /*int*/ gdk_region_polygon(int[] points, int npoints, int fill_rule) {
- lock.lock();
- try {
- return _gdk_region_polygon(points, npoints, fill_rule);
- } finally {
- lock.unlock();
- }
- }
/**
* @param rectangle flags=no_out
*/
@@ -2014,15 +1984,6 @@ public class GDK extends OS {
lock.unlock();
}
}
- public static final native int _gdk_screen_width_mm();
- public static final int gdk_screen_width_mm() {
- lock.lock();
- try {
- return _gdk_screen_width_mm();
- } finally {
- lock.unlock();
- }
- }
/**
* @method flags=dynamic
* @param screen cast=(GdkScreen *)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java
index 4ccac95b6a..84e562a651 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -354,7 +354,6 @@ public RGBA getRGBA () {
* @noreference This method is not intended to be referenced by clients.
*/
public static Color gtk_new(Device device, GdkRGBA gdkRGBA) {
- assert GTK.GTK3 : "GTK3 code was run by GTK2";
Color color = new Color(device);
color.handleRGBA = gdkRGBA;
color.alpha = (int) (gdkRGBA.alpha * 255);
@@ -378,7 +377,6 @@ public static Color gtk_new(Device device, GdkRGBA gdkRGBA) {
* @noreference This method is not intended to be referenced by clients.
*/
public static Color gtk_new(Device device, GdkRGBA gdkRGBA, int alpha) {
- assert GTK.GTK3 : "GTK3 code was run by GTK2";
Color color = new Color(device);
color.handleRGBA = gdkRGBA;
color.alpha = alpha;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java
index aac2ab45cc..353cc3481b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java
@@ -512,7 +512,7 @@ long /*int*/ createCursor(byte[] sourceData, byte[] maskData, int width, int hei
@Override
void destroy() {
- gdk_cursor_unref(handle);
+ OS.g_object_unref(handle);
handle = 0;
}
@@ -597,12 +597,4 @@ public String toString () {
return "Cursor {" + handle + "}";
}
-void gdk_cursor_unref (long /*int*/ cursor) {
- if (GTK.GTK3) {
- OS.g_object_unref (cursor);
- } else {
- GDK.gdk_cursor_unref(cursor);
- }
-}
-
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index 80749902a6..275c70b549 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -468,23 +468,17 @@ public FontData[] getFontList (String faceName, boolean scalable) {
Point getScreenDPI () {
int dpi = 96; //default value
- if (GTK.GTK3) {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 22, 0)) {
- long /*int*/ display = GDK.gdk_display_get_default();
- long /*int*/ pMonitor = GDK.gdk_display_get_primary_monitor(display);
- if (pMonitor == 0) {
- pMonitor = GDK.gdk_display_get_monitor(display, 0);
- }
- int widthMM = GDK.gdk_monitor_get_width_mm(pMonitor);
- int scaleFactor = GDK.gdk_monitor_get_scale_factor(pMonitor);
- GdkRectangle monitorGeometry = new GdkRectangle ();
- GDK.gdk_monitor_get_geometry(pMonitor, monitorGeometry);
- dpi = Compatibility.round (254 * monitorGeometry.width * scaleFactor, widthMM * 10);
+ if (GTK.GTK_VERSION >= OS.VERSION(3, 22, 0)) {
+ long /*int*/ display = GDK.gdk_display_get_default();
+ long /*int*/ pMonitor = GDK.gdk_display_get_primary_monitor(display);
+ if (pMonitor == 0) {
+ pMonitor = GDK.gdk_display_get_monitor(display, 0);
}
- } else {
- int widthMM = GDK.gdk_screen_width_mm ();
- int width = GDK.gdk_screen_width ();
- dpi = Compatibility.round (254 * width, widthMM * 10);
+ int widthMM = GDK.gdk_monitor_get_width_mm(pMonitor);
+ int scaleFactor = GDK.gdk_monitor_get_scale_factor(pMonitor);
+ GdkRectangle monitorGeometry = new GdkRectangle ();
+ GDK.gdk_monitor_get_geometry(pMonitor, monitorGeometry);
+ dpi = Compatibility.round (254 * monitorGeometry.width * scaleFactor, widthMM * 10);
}
return new Point (dpi, dpi);
}
@@ -672,23 +666,18 @@ protected void init () {
/* Initialize the system font slot */
long /*int*/ [] defaultFontArray = new long /*int*/ [1];
long /*int*/ defaultFont;
- if (GTK.GTK3) {
- long /*int*/ context = GTK.gtk_widget_get_style_context (shellHandle);
- if ((GTK.GTK_VERSION < OS.VERSION(3, 8, 0))|| ("ppc64le".equals(System.getProperty("os.arch")))) {
- defaultFont = GTK.gtk_style_context_get_font (context, GTK.GTK_STATE_FLAG_NORMAL);
- } else if (GTK.GTK_VERSION >= OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_save(context);
- GTK.gtk_style_context_set_state(context, GTK.GTK_STATE_FLAG_NORMAL);
- GTK.gtk_style_context_get(context, GTK.GTK_STATE_FLAG_NORMAL, GTK.gtk_style_property_font, defaultFontArray, 0);
- GTK.gtk_style_context_restore(context);
- defaultFont = defaultFontArray [0];
- } else {
- GTK.gtk_style_context_get(context, GTK.GTK_STATE_FLAG_NORMAL, GTK.gtk_style_property_font, defaultFontArray, 0);
- defaultFont = defaultFontArray [0];
- }
+ long /*int*/ context = GTK.gtk_widget_get_style_context (shellHandle);
+ if ((GTK.GTK_VERSION < OS.VERSION(3, 8, 0))|| ("ppc64le".equals(System.getProperty("os.arch")))) {
+ defaultFont = GTK.gtk_style_context_get_font (context, GTK.GTK_STATE_FLAG_NORMAL);
+ } else if (GTK.GTK_VERSION >= OS.VERSION(3, 18, 0)) {
+ GTK.gtk_style_context_save(context);
+ GTK.gtk_style_context_set_state(context, GTK.GTK_STATE_FLAG_NORMAL);
+ GTK.gtk_style_context_get(context, GTK.GTK_STATE_FLAG_NORMAL, GTK.gtk_style_property_font, defaultFontArray, 0);
+ GTK.gtk_style_context_restore(context);
+ defaultFont = defaultFontArray [0];
} else {
- long /*int*/ style = GTK.gtk_widget_get_style (shellHandle);
- defaultFont = GTK.gtk_style_get_font_desc (style);
+ GTK.gtk_style_context_get(context, GTK.GTK_STATE_FLAG_NORMAL, GTK.gtk_style_property_font, defaultFontArray, 0);
+ defaultFont = defaultFontArray [0];
}
defaultFont = OS.pango_font_description_copy (defaultFont);
Point dpi = getDPI(), screenDPI = getScreenDPI();
@@ -698,9 +687,7 @@ protected void init () {
}
systemFont = Font.gtk_new (this, defaultFont);
- if (GTK.GTK3) {
- overrideThemeValues();
- }
+ overrideThemeValues();
}
/**
@@ -720,7 +707,6 @@ protected void init () {
* Note that much of eclipse 'dark theme' is done by platform.ui's CSS engine, not by SWT.
*/
private void overrideThemeValues () {
- assert GTK.GTK3;
long /*int*/ screen = GDK.gdk_screen_get_default();
long /*int*/ provider = GTK.gtk_css_provider_new();
if (screen == 0 || provider == 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
index 338dbd2010..980d7a3290 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
@@ -549,12 +549,7 @@ void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int
Cairo.cairo_paint(handle);
Cairo.cairo_restore(handle);
if (paint) {
- long /*int*/ visibleRegion;
- if (GTK.GTK3) {
- visibleRegion = GDK.gdk_window_get_visible_region (drawable);
- } else {
- visibleRegion = GDK.gdk_drawable_get_visible_region (drawable);
- }
+ long /*int*/ visibleRegion = GDK.gdk_window_get_visible_region (drawable);
GdkRectangle srcRect = new GdkRectangle ();
srcRect.x = srcX;
srcRect.y = srcY;
@@ -748,22 +743,8 @@ public void drawFocus(int x, int y, int width, int height) {
void drawFocusInPixels(int x, int y, int width, int height) {
long /*int*/ cairo = data.cairo;
checkGC(FOREGROUND);
- if (GTK.GTK3) {
- long /*int*/ context = GTK.gtk_widget_get_style_context(data.device.shellHandle);
- GTK.gtk_render_focus(context, cairo, x, y, width, height);
- } else {
- int[] lineWidth = new int[1];
- GTK.gtk_widget_style_get(data.device.shellHandle, OS.focus_line_width, lineWidth, 0);
- Cairo.cairo_save(cairo);
- Cairo.cairo_set_line_width(cairo, lineWidth[0]);
- double[] dashes = new double[]{1, 1};
- double dash_offset = -lineWidth[0] / 2f;
- while (dash_offset < 0) dash_offset += 2;
- Cairo.cairo_set_dash(cairo, dashes, dashes.length, dash_offset);
- Cairo.cairo_rectangle(cairo, x + lineWidth[0] / 2f, y + lineWidth[0] / 2f, width, height);
- Cairo.cairo_stroke(cairo);
- Cairo.cairo_restore(cairo);
- }
+ long /*int*/ context = GTK.gtk_widget_get_style_context(data.device.shellHandle);
+ GTK.gtk_render_focus(context, cairo, x, y, width, height);
}
/**
@@ -1580,7 +1561,7 @@ void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean
* to set the device scale to current scale factor
*/
long /*int*/ surface = Cairo.cairo_get_target(cairo);
- if ((GTK.GTK3)&&(surface != 0)) {
+ if (surface != 0) {
float scaleFactor = DPIUtil.getDeviceZoom() / 100f;
Cairo.cairo_surface_set_device_scale(surface, scaleFactor, scaleFactor);
}
@@ -2892,11 +2873,7 @@ static void setCairoPatternColor(long /*int*/ pattern, int offset, Color c, int
void setCairoClip(long /*int*/ damageRgn, long /*int*/ clipRgn) {
long /*int*/ cairo = data.cairo;
- if (data.drawable != 0 && !GTK.GTK3) {
- GDK.gdk_cairo_reset_clip(cairo, data.drawable);
- } else {
- Cairo.cairo_reset_clip(cairo);
- }
+ Cairo.cairo_reset_clip(cairo);
if (damageRgn != 0) {
double[] matrix = new double[6];
Cairo.cairo_get_matrix(cairo, matrix);
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 6e551d3339..8f914b3f37 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
@@ -303,7 +303,7 @@ public Image(Device device, Image srcImage, int flag) {
boolean hasAlpha = format == Cairo.CAIRO_FORMAT_ARGB32;
surface = Cairo.cairo_image_surface_create(format, width, height);
if (surface == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- if (GTK.GTK3 && DPIUtil.useCairoAutoScale()) {
+ if (DPIUtil.useCairoAutoScale()) {
double scaleFactor = DPIUtil.getDeviceZoom() / 100f;
Cairo.cairo_surface_set_device_scale(surface, scaleFactor, scaleFactor);
}
@@ -828,7 +828,7 @@ void createFromPixbuf(int type, long /*int*/ pixbuf) {
int format = hasAlpha ? Cairo.CAIRO_FORMAT_ARGB32 : Cairo.CAIRO_FORMAT_RGB24;
surface = Cairo.cairo_image_surface_create(format, width, height);
if (surface == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- if (GTK.GTK3&&DPIUtil.useCairoAutoScale()) {
+ if (DPIUtil.useCairoAutoScale()) {
double scaleFactor = DPIUtil.getDeviceZoom() / 100f;
Cairo.cairo_surface_set_device_scale(surface, scaleFactor, scaleFactor);
}
@@ -924,8 +924,6 @@ void createMask() {
void createSurface() {
if (surface != 0) return;
- /* There is no pixmaps in GTK 3. */
- if (GTK.GTK3) return;
}
/**
@@ -1211,12 +1209,7 @@ public ImageData getImageData (int zoom) {
public static Image gtk_new(Device device, int type, long /*int*/ imageHandle, long /*int*/ mask) {
Image image = new Image(device);
image.type = type;
- if (GTK.GTK3) {
- image.surface = imageHandle;
- } else {
- image.pixmap = imageHandle;
- image.createSurface();
- }
+ image.surface = imageHandle;
image.mask = mask;
return image;
}
@@ -1276,7 +1269,7 @@ void init(int width, int height) {
if (surface == 0) SWT.error(SWT.ERROR_NO_HANDLES);
// When we create a blank image we need to set it to 100 in GTK3 as we draw using 100% scale.
// Cairo will take care of scaling for us when image needs to be scaled.
- if (GTK.GTK3 && DPIUtil.useCairoAutoScale()) {
+ if (DPIUtil.useCairoAutoScale()) {
currentDeviceZoom = 100;
Cairo.cairo_surface_set_device_scale(surface, 1f, 1f);
} else {
@@ -1304,7 +1297,7 @@ void init(ImageData image) {
int format = hasAlpha ? Cairo.CAIRO_FORMAT_ARGB32 : Cairo.CAIRO_FORMAT_RGB24;
surface = Cairo.cairo_image_surface_create(format, width, height);
if (surface == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- if (GTK.GTK3 && DPIUtil.useCairoAutoScale()) {
+ if (DPIUtil.useCairoAutoScale()) {
double scaleFactor = DPIUtil.getDeviceZoom() / 100f;
Cairo.cairo_surface_set_device_scale(surface, scaleFactor, scaleFactor);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
index 38fe66716c..96d466fb8f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -95,9 +95,6 @@ Region(Device device, long /*int*/ handle) {
}
static long /*int*/ gdk_region_polygon(int[] pointArray, int npoints, int fill_rule) {
- if (!GTK.GTK3) {
- return GDK.gdk_region_polygon(pointArray, npoints, fill_rule);
- }
//TODO this does not perform well and could fail if the polygon is too big
int minX = pointArray[0], maxX = minX;
int minY = pointArray[1], maxY = minY;
@@ -133,10 +130,6 @@ static long /*int*/ gdk_region_polygon(int[] pointArray, int npoints, int fill_r
}
static void gdk_region_get_rectangles(long /*int*/ region, long /*int*/[] rectangles, int[] n_rectangles) {
- if (!GTK.GTK3) {
- GDK.gdk_region_get_rectangles (region, rectangles, n_rectangles);
- return;
- }
int num = Cairo.cairo_region_num_rectangles (region);
if (n_rectangles != null) n_rectangles[0] = num;
rectangles[0] = OS.g_malloc(GdkRectangle.sizeof * num);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java
index c5d670e66b..887c1e9b27 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -34,7 +34,7 @@ public static long /*int*/ convertSurface(Image image) {
int type = Cairo.cairo_surface_get_type(newSurface);
if (type != Cairo.CAIRO_SURFACE_TYPE_IMAGE) {
Rectangle bounds;
- if (GTK.GTK3 && DPIUtil.useCairoAutoScale()) {
+ if (DPIUtil.useCairoAutoScale()) {
bounds = image.getBounds();
} else {
bounds = image.getBoundsInPixels();
@@ -43,7 +43,7 @@ public static long /*int*/ convertSurface(Image image) {
newSurface = Cairo.cairo_image_surface_create(format, bounds.width, bounds.height);
if (newSurface == 0) SWT.error(SWT.ERROR_NO_HANDLES);
//retain device scale set in the original surface
- if (GTK.GTK3 && DPIUtil.useCairoAutoScale()) {
+ if (DPIUtil.useCairoAutoScale()) {
double sx[] = new double[1];
double sy[] = new double[1];
Cairo.cairo_surface_get_device_scale(image.surface, sx, sy);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
index db6253bbbb..7d9b59137c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -425,7 +425,7 @@ void hookEvents () {
@Override
void releaseWidget () {
super.releaseWidget ();
- if (defaultCursor != 0) gdk_cursor_unref (defaultCursor);
+ if (defaultCursor != 0) OS.g_object_unref (defaultCursor);
defaultCursor = 0;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 20234dc385..05cae862ba 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -1584,7 +1584,7 @@ long /*int*/ gtk_motion_notify_event (long /*int*/ widget, long /*int*/ event) {
long /*int*/ window = gtk_widget_get_window (shellHandle);
long /*int*/ cursor = GDK.gdk_cursor_new_for_display (GDK.gdk_display_get_default(), mode);
GDK.gdk_window_set_cursor (window, cursor);
- gdk_cursor_unref (cursor);
+ OS.g_object_unref (cursor);
display.resizeMode = mode;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
index 374c3173ee..a1e395d38e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
@@ -949,7 +949,7 @@ void setCursor (long /*int*/ cursor) {
long /*int*/ defaultCursor = 0;
if (cursor == 0) defaultCursor = GDK.gdk_cursor_new_for_display (GDK.gdk_display_get_default(), GDK.GDK_XTERM);
super.setCursor (cursor != 0 ? cursor : defaultCursor);
- if (cursor == 0) gdk_cursor_unref (defaultCursor);
+ if (cursor == 0) OS.g_object_unref (defaultCursor);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index effbb10066..b074bfd97e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -2251,7 +2251,7 @@ void setCursor (long /*int*/ cursor) {
long /*int*/ defaultCursor = 0;
if (cursor == 0) defaultCursor = GDK.gdk_cursor_new_for_display (GDK.gdk_display_get_default(), GDK.GDK_XTERM);
super.setCursor (cursor != 0 ? cursor : defaultCursor);
- if (cursor == 0) gdk_cursor_unref (defaultCursor);
+ if (cursor == 0) OS.g_object_unref (defaultCursor);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index 4a3cf89e95..2aba6133f5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -1995,14 +1995,6 @@ long /*int*/ windowProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ ar
}
}
-void gdk_cursor_unref (long /*int*/ cursor) {
- if (GTK.GTK3) {
- OS.g_object_unref (cursor);
- } else {
- GDK.gdk_cursor_unref(cursor);
- }
-}
-
long /*int*/ gdk_window_get_device_position (long /*int*/ window, int[] x, int[] y, int[] mask) {
if (GTK.GTK3) {
long /*int*/ display = 0;

Back to the top