diff options
author | Eric Williams | 2015-06-15 20:07:39 +0000 |
---|---|---|
committer | Eric Williams | 2015-07-14 15:09:19 +0000 |
commit | 553a09a5cc5f2a22e042c994eeb46b04e51fe7fb (patch) | |
tree | 2c1fddecf61a65d19bc77f722d2a035ea80e7524 | |
parent | 9f15df97b21445f1fe89db1532851795b9656519 (diff) | |
download | eclipse.platform.swt-553a09a5cc5f2a22e042c994eeb46b04e51fe7fb.tar.gz eclipse.platform.swt-553a09a5cc5f2a22e042c994eeb46b04e51fe7fb.tar.xz eclipse.platform.swt-553a09a5cc5f2a22e042c994eeb46b04e51fe7fb.zip |
Bug 470220: [gtk3] Replace deprecated gdk_cursor_new
Tested with Snippet119 on Gtk2 and Gtk3. AllNonBrowser JUnit tests
passed in Gtk2 and Gtk3.
gdk_cursor_new() is deprecated: its replacement is
gdk_cursor_new_for_display(). gdk_cursor_new() was simply calling
gdk_cursor_new_for_display() to begin with. gdk_cursor_new() has been
removed entirely and replaced with gdk_cursor_new_for_display().
Change-Id: I90972336b2e63ed0875bb7af1b1171689b87ed66
Signed-off-by: Eric Williams <ericwill@redhat.com>
9 files changed, 19 insertions, 17 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 14c8a5d58f..668eca1adf 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 @@ -5404,14 +5404,14 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1colormap_1get_1system) } #endif -#ifndef NO__1gdk_1cursor_1new -JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1cursor_1new) - (JNIEnv *env, jclass that, jintLong arg0) +#ifndef NO__1gdk_1cursor_1new_1for_1display +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1cursor_1new_1for_1display) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) { jintLong rc = 0; - OS_NATIVE_ENTER(env, that, _1gdk_1cursor_1new_FUNC); - rc = (jintLong)gdk_cursor_new((GdkCursorType)arg0); - OS_NATIVE_EXIT(env, that, _1gdk_1cursor_1new_FUNC); + OS_NATIVE_ENTER(env, that, _1gdk_1cursor_1new_1for_1display_FUNC); + rc = (jintLong)gdk_cursor_new_for_display((GdkDisplay *)arg0, (GdkCursorType)arg1); + OS_NATIVE_EXIT(env, that, _1gdk_1cursor_1new_1for_1display_FUNC); return rc; } #endif 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 157145a6c0..fc2b255c2b 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 @@ -445,7 +445,7 @@ char * OS_nativeFunctionNames[] = { "_1gdk_1colormap_1alloc_1color", "_1gdk_1colormap_1free_1colors", "_1gdk_1colormap_1get_1system", - "_1gdk_1cursor_1new", + "_1gdk_1cursor_1new_1for_1display", "_1gdk_1cursor_1new_1from_1pixbuf", "_1gdk_1cursor_1new_1from_1pixmap", "_1gdk_1cursor_1unref", 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 05432e91b2..b0c0e1e5f0 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 @@ -455,7 +455,7 @@ typedef enum { _1gdk_1colormap_1alloc_1color_FUNC, _1gdk_1colormap_1free_1colors_FUNC, _1gdk_1colormap_1get_1system_FUNC, - _1gdk_1cursor_1new_FUNC, + _1gdk_1cursor_1new_1for_1display_FUNC, _1gdk_1cursor_1new_1from_1pixbuf_FUNC, _1gdk_1cursor_1new_1from_1pixmap_FUNC, _1gdk_1cursor_1unref_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index 88c8e40581..3a0c280566 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -4072,12 +4072,14 @@ public static final void gdk_cursor_unref(long /*int*/ cursor) { lock.unlock(); } } -/** @param cursor_type cast=(GdkCursorType) */ -public static final native long /*int*/ _gdk_cursor_new(long /*int*/ cursor_type); -public static final long /*int*/ gdk_cursor_new(long /*int*/ cursor_type) { +/** @param display cast=(GdkDisplay *) + * @param cursor_type cast=(GdkCursorType) + */ +public static final native long /*int*/ _gdk_cursor_new_for_display(long /*int*/ display, long /*int*/ cursor_type); +public static final long /*int*/ gdk_cursor_new_for_display(long /*int*/ display, long /*int*/ cursor_type) { lock.lock(); try { - return _gdk_cursor_new(cursor_type); + return _gdk_cursor_new_for_display(display, cursor_type); } finally { lock.unlock(); } 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 b112419968..982ed3984c 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 @@ -168,7 +168,7 @@ public Cursor(Device device, int style) { System.arraycopy(APPSTARTING_MASK, 0, mask, 0, mask.length); handle = createCursor(src, mask, 32, 32, 2, 2, true); } else { - handle = OS.gdk_cursor_new(shape); + handle = OS.gdk_cursor_new_for_display (OS.gdk_display_get_default(), shape); } if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES); init(); 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 ad9ae65a7e..0d786adf1f 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 @@ -144,7 +144,7 @@ void createHandle (int index) { OS.gtk_widget_set_has_window (handle, true); OS.gtk_widget_set_can_focus (handle, true); int type = (style & SWT.VERTICAL) != 0 ? OS.GDK_SB_H_DOUBLE_ARROW : OS.GDK_SB_V_DOUBLE_ARROW; - defaultCursor = OS.gdk_cursor_new (type); + defaultCursor = OS.gdk_cursor_new_for_display (OS.gdk_display_get_default(), type); } void drawBand (int x, int y, int width, int height) { 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 60856c873d..03d8e40941 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 @@ -1470,7 +1470,7 @@ long /*int*/ gtk_motion_notify_event (long /*int*/ widget, long /*int*/ event) { int mode = getResizeMode (gdkEvent.x, gdkEvent.y); if (mode != display.resizeMode) { long /*int*/ window = gtk_widget_get_window (shellHandle); - long /*int*/ cursor = OS.gdk_cursor_new (mode); + long /*int*/ cursor = OS.gdk_cursor_new_for_display (OS.gdk_display_get_default(), mode); OS.gdk_window_set_cursor (window, cursor); gdk_cursor_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 5208f87067..7550122021 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 @@ -931,7 +931,7 @@ void setBackgroundColor (GdkColor color) { @Override void setCursor (long /*int*/ cursor) { long /*int*/ defaultCursor = 0; - if (cursor == 0) defaultCursor = OS.gdk_cursor_new (OS.GDK_XTERM); + if (cursor == 0) defaultCursor = OS.gdk_cursor_new_for_display (OS.gdk_display_get_default(), OS.GDK_XTERM); super.setCursor (cursor != 0 ? cursor : defaultCursor); if (cursor == 0) gdk_cursor_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 ec609a2dfa..9aa3a52d91 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 @@ -2156,7 +2156,7 @@ void setBackgroundColor (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba @Override void setCursor (long /*int*/ cursor) { long /*int*/ defaultCursor = 0; - if (cursor == 0) defaultCursor = OS.gdk_cursor_new (OS.GDK_XTERM); + if (cursor == 0) defaultCursor = OS.gdk_cursor_new_for_display (OS.gdk_display_get_default(), OS.GDK_XTERM); super.setCursor (cursor != 0 ? cursor : defaultCursor); if (cursor == 0) gdk_cursor_unref (defaultCursor); } |