diff options
author | Eric Williams | 2019-01-28 20:10:43 +0000 |
---|---|---|
committer | Eric Williams | 2019-01-28 21:56:21 +0000 |
commit | b7bb2e298229792df1d3f06435752e60d29939cd (patch) | |
tree | 5e80bc710532fa26639ea5205bf91824ec40094e | |
parent | 4665a93467ac895b9727b19b38b28f2a6555ffc9 (diff) | |
download | eclipse.platform.swt-b7bb2e298229792df1d3f06435752e60d29939cd.tar.gz eclipse.platform.swt-b7bb2e298229792df1d3f06435752e60d29939cd.tar.xz eclipse.platform.swt-b7bb2e298229792df1d3f06435752e60d29939cd.zip |
Bug 543912: [GTK4] Adapt to GdkCursor API changes
Replace GdkCursor functions from GTK3 with proper named cursors in GTK4.
Change-Id: I49297d74d10159b700df0033f37ff8d913a12f89
Signed-off-by: Eric Williams <ericwill@redhat.com>
10 files changed, 154 insertions, 65 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 b10967a0a7..2567165ed9 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 @@ -380,18 +380,6 @@ JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1cairo_1set_1source_1window) } #endif -#ifndef NO__1gdk_1cursor_1new_1for_1display -JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1cursor_1new_1for_1display) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) -{ - jintLong rc = 0; - GDK_NATIVE_ENTER(env, that, _1gdk_1cursor_1new_1for_1display_FUNC); - rc = (jintLong)gdk_cursor_new_for_display((GdkDisplay *)arg0, (GdkCursorType)arg1); - GDK_NATIVE_EXIT(env, that, _1gdk_1cursor_1new_1for_1display_FUNC); - return rc; -} -#endif - #if (!defined(NO__1gdk_1cursor_1new_1from_1name__I_3B) && !defined(JNI64)) || (!defined(NO__1gdk_1cursor_1new_1from_1name__J_3B) && defined(JNI64)) #ifndef JNI64 JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1cursor_1new_1from_1name__I_3B)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) @@ -458,6 +446,18 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1cursor_1new_1from_1pixbuf) } #endif +#ifndef NO__1gdk_1cursor_1new_1from_1texture +JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1cursor_1new_1from_1texture) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jintLong arg3) +{ + jintLong rc = 0; + GDK_NATIVE_ENTER(env, that, _1gdk_1cursor_1new_1from_1texture_FUNC); + rc = (jintLong)gdk_cursor_new_from_texture((GdkTexture *)arg0, (gint)arg1, (gint)arg2, (GdkCursor *)arg3); + GDK_NATIVE_EXIT(env, that, _1gdk_1cursor_1new_1from_1texture_FUNC); + return rc; +} +#endif + #ifndef NO__1gdk_1device_1get_1associated_1device JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1device_1get_1associated_1device) (JNIEnv *env, jclass that, jintLong arg0) @@ -2503,6 +2503,18 @@ fail: } #endif +#ifndef NO__1gdk_1texture_1new_1for_1pixbuf +JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1texture_1new_1for_1pixbuf) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + GDK_NATIVE_ENTER(env, that, _1gdk_1texture_1new_1for_1pixbuf_FUNC); + rc = (jintLong)gdk_texture_new_for_pixbuf((GdkPixbuf *)arg0); + GDK_NATIVE_EXIT(env, that, _1gdk_1texture_1new_1for_1pixbuf_FUNC); + return rc; +} +#endif + #ifndef NO__1gdk_1unicode_1to_1keyval JNIEXPORT jint JNICALL GDK_NATIVE(_1gdk_1unicode_1to_1keyval) (JNIEnv *env, jclass that, jint arg0) 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 edcacb3d9f..8174758979 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 @@ -370,7 +370,6 @@ #define NO_GDK_1EVENT_1WINDOW // GdkCursor removals -#define NO__1gdk_1cursor_1new_1for_1display #define NO__1gdk_1cursor_1new_1from_1pixbuf #define NO__1gdk_1display_1supports_1cursor_1color #define NO__1gdk_1cursor_1new_1from_1name__I_3B @@ -435,12 +434,18 @@ // Miscellaneous functions not present on GTK3 #define NO__1gdk_1device_1warp__III #define NO__1gdk_1device_1warp__JII -#define NO__1gdk_1cursor_1new_1from_1name___3BI -#define NO__1gdk_1cursor_1new_1from_1name___3BJ #define NO__1gdk_1display_1get_1keymap #define NO__1gtk_1widget_1measure #define NO__1gtk_1style_1context_1add_1provider_1for_1display +// GdkCursor API changes from GTK3 -> GTK4 +#define NO__1gdk_1cursor_1new_1from_1name___3BI +#define NO__1gdk_1cursor_1new_1from_1name___3BJ +#define NO__1gdk_1cursor_1new_1from_1texture + +// No GdkTexture on GTK3 +#define NO__1gdk_1texture_1new_1for_1pixbuf + // GtkEventController related functions for GTK4 #define NO__1gtk_1event_1controller_1key_1new #define NO__1gtk_1event_1controller_1motion_1new 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 0a29907f25..3be969bd6b 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 @@ -50,7 +50,6 @@ char * GDK_nativeFunctionNames[] = { "_1gdk_1cairo_1set_1source_1pixbuf", "_1gdk_1cairo_1set_1source_1rgba", "_1gdk_1cairo_1set_1source_1window", - "_1gdk_1cursor_1new_1for_1display", #ifndef JNI64 "_1gdk_1cursor_1new_1from_1name__I_3B", #else @@ -62,6 +61,7 @@ char * GDK_nativeFunctionNames[] = { "_1gdk_1cursor_1new_1from_1name___3BJ", #endif "_1gdk_1cursor_1new_1from_1pixbuf", + "_1gdk_1cursor_1new_1from_1texture", "_1gdk_1device_1get_1associated_1device", "_1gdk_1device_1get_1seat", "_1gdk_1device_1get_1surface_1at_1position", @@ -204,6 +204,7 @@ char * GDK_nativeFunctionNames[] = { "_1gdk_1surface_1show", "_1gdk_1surface_1show_1unraised", "_1gdk_1text_1property_1to_1utf8_1list_1for_1display", + "_1gdk_1texture_1new_1for_1pixbuf", "_1gdk_1unicode_1to_1keyval", "_1gdk_1utf8_1to_1string_1target", "_1gdk_1visual_1get_1depth", 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 55b2013aed..c66c7e4fdd 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 @@ -60,7 +60,6 @@ typedef enum { _1gdk_1cairo_1set_1source_1pixbuf_FUNC, _1gdk_1cairo_1set_1source_1rgba_FUNC, _1gdk_1cairo_1set_1source_1window_FUNC, - _1gdk_1cursor_1new_1for_1display_FUNC, #ifndef JNI64 _1gdk_1cursor_1new_1from_1name__I_3B_FUNC, #else @@ -72,6 +71,7 @@ typedef enum { _1gdk_1cursor_1new_1from_1name___3BJ_FUNC, #endif _1gdk_1cursor_1new_1from_1pixbuf_FUNC, + _1gdk_1cursor_1new_1from_1texture_FUNC, _1gdk_1device_1get_1associated_1device_FUNC, _1gdk_1device_1get_1seat_FUNC, _1gdk_1device_1get_1surface_1at_1position_FUNC, @@ -214,6 +214,7 @@ typedef enum { _1gdk_1surface_1show_FUNC, _1gdk_1surface_1show_1unraised_FUNC, _1gdk_1text_1property_1to_1utf8_1list_1for_1display_FUNC, + _1gdk_1texture_1new_1for_1pixbuf_FUNC, _1gdk_1unicode_1to_1keyval_FUNC, _1gdk_1utf8_1to_1string_1target_FUNC, _1gdk_1visual_1get_1depth_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 5eba0c0bec..5a235524cb 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 @@ -647,19 +647,6 @@ public class GDK extends OS { lock.unlock(); } } - /** @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); - /** [GTK3 only, if-def'd in os.h] */ - public static final long /*int*/ gdk_cursor_new_for_display(long /*int*/ display, long /*int*/ cursor_type) { - lock.lock(); - try { - return _gdk_cursor_new_for_display(display, cursor_type); - } finally { - lock.unlock(); - } - } /** * @param display cast=(GdkDisplay *) * @param cursor_name cast=(const gchar *) @@ -705,6 +692,22 @@ public class GDK extends OS { } } /** + * @param texture cast=(GdkTexture *) + * @param x cast=(gint) + * @param y cast=(gint) + * @param fallback cast=(GdkCursor *) + */ + public static final native long /*int*/ _gdk_cursor_new_from_texture(long /*int*/ texture, int x, int y, long /*int*/ fallback); + /** [GTK4 only, if-def'd in os.h] */ + public static final long /*int*/ gdk_cursor_new_from_texture(long /*int*/ texture, int x, int y, long /*int*/ fallback) { + lock.lock(); + try { + return _gdk_cursor_new_from_texture(texture, x, y, fallback); + } finally { + lock.unlock(); + } + } + /** * @param device cast=(GdkDevice *) * @param screen cast=(GdkScreen *) * @param x cast=(gint) @@ -2152,6 +2155,19 @@ public class GDK extends OS { lock.unlock(); } } + /** + * @param pixbuf cast=(GdkPixbuf *) + */ + public static final native long /*int*/ _gdk_texture_new_for_pixbuf (long /*int*/ pixbuf); + /** [GTK4 only, if-def'd in os.h] */ + public static final long /*int*/ gdk_texture_new_for_pixbuf (long /*int*/ pixbuf) { + lock.lock(); + try { + return _gdk_texture_new_for_pixbuf(pixbuf); + } finally { + lock.unlock(); + } + } public static final native void gdk_threads_leave (); public static final native int _gdk_unicode_to_keyval(int wc); public static final int gdk_unicode_to_keyval(int wc) { 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 4e60d64a6f..f20bd7207c 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 @@ -141,33 +141,37 @@ public Cursor(Device device, int style) { int shape = 0; byte[] name = null; switch (style) { - case SWT.CURSOR_APPSTARTING: name = Converter.wcsToMbcs("progress", true) ; break; - case SWT.CURSOR_ARROW: shape = GDK.GDK_LEFT_PTR; break; - case SWT.CURSOR_WAIT: shape = GDK.GDK_WATCH; break; - case SWT.CURSOR_CROSS: shape = GDK.GDK_CROSS; break; - case SWT.CURSOR_HAND: shape = GDK.GDK_HAND2; break; - case SWT.CURSOR_HELP: shape = GDK.GDK_QUESTION_ARROW; break; - case SWT.CURSOR_SIZEALL: shape = GDK.GDK_FLEUR; break; - case SWT.CURSOR_SIZENESW: shape = GDK.GDK_SIZING; name=Converter.wcsToMbcs("nesw-resize", true); break; - case SWT.CURSOR_SIZENS: shape = GDK.GDK_DOUBLE_ARROW; break; - case SWT.CURSOR_SIZENWSE: shape = GDK.GDK_SIZING; name=Converter.wcsToMbcs("nwse-resize", true); break; - case SWT.CURSOR_SIZEWE: shape = GDK.GDK_SB_H_DOUBLE_ARROW; break; - case SWT.CURSOR_SIZEN: shape = GDK.GDK_TOP_SIDE; break; - case SWT.CURSOR_SIZES: shape = GDK.GDK_BOTTOM_SIDE; break; - case SWT.CURSOR_SIZEE: shape = GDK.GDK_RIGHT_SIDE; break; - case SWT.CURSOR_SIZEW: shape = GDK.GDK_LEFT_SIDE; break; - case SWT.CURSOR_SIZENE: shape = GDK.GDK_TOP_RIGHT_CORNER; break; - case SWT.CURSOR_SIZESE: shape = GDK.GDK_BOTTOM_RIGHT_CORNER; break; - case SWT.CURSOR_SIZESW: shape = GDK.GDK_BOTTOM_LEFT_CORNER; break; - case SWT.CURSOR_SIZENW: shape = GDK.GDK_TOP_LEFT_CORNER; break; - case SWT.CURSOR_UPARROW: shape = GDK.GDK_SB_UP_ARROW; break; - case SWT.CURSOR_IBEAM: shape = GDK.GDK_XTERM; break; - case SWT.CURSOR_NO: shape = GDK.GDK_X_CURSOR; name=Converter.wcsToMbcs("not-allowed", true) ; break; - default: - SWT.error(SWT.ERROR_INVALID_ARGUMENT); + case SWT.CURSOR_APPSTARTING: name = Converter.wcsToMbcs("progress", true) ; break; + case SWT.CURSOR_ARROW: name = Converter.wcsToMbcs("default", true) ; break; + case SWT.CURSOR_WAIT: name = Converter.wcsToMbcs("wait", true) ; break; + case SWT.CURSOR_CROSS: name = Converter.wcsToMbcs("cell", true) ; break; + case SWT.CURSOR_HAND: name = Converter.wcsToMbcs("pointer", true) ; break; + case SWT.CURSOR_HELP: name = Converter.wcsToMbcs("help", true) ; break; + case SWT.CURSOR_SIZEALL: name = Converter.wcsToMbcs("all-scroll", true) ; break; + case SWT.CURSOR_SIZENESW: name = Converter.wcsToMbcs("nesw-resize", true); break; + case SWT.CURSOR_SIZENS: name = Converter.wcsToMbcs("row-resize", true) ; break; + case SWT.CURSOR_SIZENWSE: name = Converter.wcsToMbcs("nwse-resize", true); break; + case SWT.CURSOR_SIZEWE: name = Converter.wcsToMbcs("col-resize", true); break; + case SWT.CURSOR_SIZEN: name = Converter.wcsToMbcs("n-resize", true); break; + case SWT.CURSOR_SIZES: name = Converter.wcsToMbcs("s-resize", true); break; + case SWT.CURSOR_SIZEE: name = Converter.wcsToMbcs("e-resize", true); break; + case SWT.CURSOR_SIZEW: name = Converter.wcsToMbcs("w-resize", true); break; + case SWT.CURSOR_SIZENE: name = Converter.wcsToMbcs("ne-resize", true); break; + case SWT.CURSOR_SIZESE: name = Converter.wcsToMbcs("se-resize", true); break; + case SWT.CURSOR_SIZESW: name = Converter.wcsToMbcs("sw-resize", true); break; + case SWT.CURSOR_SIZENW: name = Converter.wcsToMbcs("nw-resize", true); break; + case SWT.CURSOR_UPARROW: name = Converter.wcsToMbcs("ns-resize", true); break; + case SWT.CURSOR_IBEAM: name = Converter.wcsToMbcs("text", true); break; + case SWT.CURSOR_NO: name = Converter.wcsToMbcs("not-allowed", true) ; break; + default: + SWT.error(SWT.ERROR_INVALID_ARGUMENT); } if (name != null) { - handle = GDK.gdk_cursor_new_from_name (GDK.gdk_display_get_default(), name); + if (GTK.GTK4) { + handle = GDK.gdk_cursor_new_from_name(name, 0); + } else { + handle = GDK.gdk_cursor_new_from_name (GDK.gdk_display_get_default(), name); + } } if (handle == 0) { if (shape == 0 && style == SWT.CURSOR_APPSTARTING) { @@ -176,8 +180,6 @@ public Cursor(Device device, int style) { byte[] mask = new byte[APPSTARTING_MASK.length]; System.arraycopy(APPSTARTING_MASK, 0, mask, 0, mask.length); handle = createCursor(src, mask, 32, 32, 2, 2, true); - } else { - handle = GDK.gdk_cursor_new_for_display(GDK.gdk_display_get_default(), shape); } } if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES); @@ -509,7 +511,13 @@ long /*int*/ createCursor(byte[] sourceData, byte[] maskData, int width, int hei int stride = GDK.gdk_pixbuf_get_rowstride(pixbuf); long /*int*/ pixels = GDK.gdk_pixbuf_get_pixels(pixbuf); C.memmove(pixels, data, stride * height); - long /*int*/ cursor = GDK.gdk_cursor_new_from_pixbuf(GDK.gdk_display_get_default(), pixbuf, hotspotX, hotspotY); + long /*int*/ cursor; + if (GTK.GTK4) { + long /*int*/ texture = GDK.gdk_texture_new_for_pixbuf (pixbuf); + cursor = GDK.gdk_cursor_new_from_texture (texture, hotspotX, hotspotY, 0); + } else { + cursor = GDK.gdk_cursor_new_from_pixbuf(GDK.gdk_display_get_default(), pixbuf, hotspotX, hotspotY); + } OS.g_object_unref(pixbuf); return cursor; } 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 0c80cdfb38..d1d27b351b 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 @@ -145,8 +145,21 @@ void createHandle (int index) { if (handle == 0) error (SWT.ERROR_NO_HANDLES); gtk_widget_set_has_surface_or_window (handle, true); GTK.gtk_widget_set_can_focus (handle, true); - int type = (style & SWT.VERTICAL) != 0 ? GDK.GDK_SB_H_DOUBLE_ARROW : GDK.GDK_SB_V_DOUBLE_ARROW; - defaultCursor = GDK.gdk_cursor_new_for_display (GDK.gdk_display_get_default(), type); + if ((style & SWT.VERTICAL) != 0) { + byte [] name = Converter.wcsToMbcs("w-resize", true); + if (GTK.GTK4) { + defaultCursor = GDK.gdk_cursor_new_from_name(name, 0); + } else { + defaultCursor = GDK.gdk_cursor_new_from_name(GDK.gdk_display_get_default(), name); + } + } else { + byte [] name = Converter.wcsToMbcs("ns-resize", true); + if (GTK.GTK4) { + defaultCursor = GDK.gdk_cursor_new_from_name(name, 0); + } else { + defaultCursor = GDK.gdk_cursor_new_from_name(GDK.gdk_display_get_default(), name); + } + } } 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 a8f221c9fe..554709ecaf 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 @@ -1652,9 +1652,28 @@ long /*int*/ gtk_motion_notify_event (long /*int*/ widget, long /*int*/ event) { GDK.gdk_event_get_coords(event, eventX, eventY); int mode = getResizeMode (eventX[0], eventY[0]); if (mode != display.resizeMode) { - 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); + long /*int*/ cursor; + byte [] name; + switch (mode) { + case GDK.GDK_BOTTOM_RIGHT_CORNER: name = Converter.wcsToMbcs("se-resize", true); break; + case GDK.GDK_BOTTOM_LEFT_CORNER: name = Converter.wcsToMbcs("sw-resize", true); break; + case GDK.GDK_TOP_LEFT_CORNER: name = Converter.wcsToMbcs("nw-resize", true); break; + case GDK.GDK_TOP_RIGHT_CORNER: name = Converter.wcsToMbcs("ne-resize", true); break; + case GDK.GDK_BOTTOM_SIDE: name = Converter.wcsToMbcs("s-resize", true); break; + case GDK.GDK_TOP_SIDE: name = Converter.wcsToMbcs("n-resize", true); break; + case GDK.GDK_LEFT_SIDE: name = Converter.wcsToMbcs("w-resize", true); break; + case GDK.GDK_RIGHT_SIDE: name = Converter.wcsToMbcs("e-resize", true); break; + default: name = Converter.wcsToMbcs("none", true); break; + } + if (GTK.GTK4) { + long /*int*/ surface = gtk_widget_get_surface(shellHandle); + cursor = GDK.gdk_cursor_new_from_name(name, 0); + GDK.gdk_surface_set_cursor(surface, cursor); + } else { + long /*int*/ window = gtk_widget_get_window (shellHandle); + cursor = GDK.gdk_cursor_new_from_name (GDK.gdk_display_get_default(), name); + GDK.gdk_window_set_cursor (window, 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 727a982651..79ee9f54e2 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 @@ -923,7 +923,14 @@ void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rg @Override 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); + if (cursor == 0) { + byte [] name = Converter.wcsToMbcs("text", true); + if (GTK.GTK4) { + defaultCursor = GDK.gdk_cursor_new_from_name(name, 0); + } else { + defaultCursor = GDK.gdk_cursor_new_from_name(GDK.gdk_display_get_default(), name); + } + } super.setCursor (cursor != 0 ? cursor : 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 2ddd9ab39a..95314f9738 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 @@ -2281,7 +2281,14 @@ void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rg @Override 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); + if (cursor == 0) { + byte [] name = Converter.wcsToMbcs("text", true); + if (GTK.GTK4) { + GDK.gdk_cursor_new_from_name(name, 0); + } else { + GDK.gdk_cursor_new_from_name(GDK.gdk_display_get_default(), name); + } + } super.setCursor (cursor != 0 ? cursor : defaultCursor); if (cursor == 0) OS.g_object_unref (defaultCursor); } |