diff options
author | Alexander Kurtakov | 2016-12-22 07:15:49 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2016-12-22 07:15:49 +0000 |
commit | 8719787f5c34beaf06229310c09d6063a7bb6e08 (patch) | |
tree | 66e47309ffa1f821cb9ab070ba80ed0a936a6dbe /bundles | |
parent | 06068755734d046d4f34a7b6c1cf5ddd8bf43eb5 (diff) | |
download | eclipse.platform.swt-8719787f5c34beaf06229310c09d6063a7bb6e08.tar.gz eclipse.platform.swt-8719787f5c34beaf06229310c09d6063a7bb6e08.tar.xz eclipse.platform.swt-8719787f5c34beaf06229310c09d6063a7bb6e08.zip |
Bug 125023 - SWT.NO_CURSOR is not correct
Use "not-allowed" named cursor instead of GDK_X_CURSOR.
Change-Id: I270d8ab0bc88d17fec6ae7f216f8297ce32e5441
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles')
5 files changed, 38 insertions, 2 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 c895572104..bf01315f4f 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 @@ -4005,6 +4005,22 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1cursor_1new_1for_1display) } #endif +#ifndef NO__1gdk_1cursor_1new_1from_1name +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1cursor_1new_1from_1name) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) +{ + jbyte *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gdk_1cursor_1new_1from_1name_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jintLong)gdk_cursor_new_from_name((GdkDisplay *)arg0, (const gchar *)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1gdk_1cursor_1new_1from_1name_FUNC); + return rc; +} +#endif + #ifndef NO__1gdk_1cursor_1new_1from_1pixbuf JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1cursor_1new_1from_1pixbuf) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3) 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 45098cd68f..1fe59020d1 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 @@ -391,6 +391,7 @@ char * OS_nativeFunctionNames[] = { "_1gdk_1colormap_1free_1colors", "_1gdk_1colormap_1get_1system", "_1gdk_1cursor_1new_1for_1display", + "_1gdk_1cursor_1new_1from_1name", "_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 2422f90737..bec1159889 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 @@ -401,6 +401,7 @@ typedef enum { _1gdk_1colormap_1free_1colors_FUNC, _1gdk_1colormap_1get_1system_FUNC, _1gdk_1cursor_1new_1for_1display_FUNC, + _1gdk_1cursor_1new_1from_1name_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 b31801737c..8334ceca3e 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 @@ -3570,6 +3570,18 @@ public static final long /*int*/ gdk_cursor_new_for_display(long /*int*/ display lock.unlock(); } } +/** @param display cast=(GdkDisplay *) + * @param cursor_name cast=(const gchar *) + */ +public static final native long /*int*/ _gdk_cursor_new_from_name(long /*int*/ display, byte[] cursor_name); +public static final long /*int*/ gdk_cursor_new_from_name(long /*int*/ display, byte[] cursor_name) { + lock.lock(); + try { + return _gdk_cursor_new_from_name(display, cursor_name); + } finally { + lock.unlock(); + } +} /** * @method flags=dynamic * @param fg cast=(GdkColor *),flags=no_out 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 982ed3984c..6f5ff5720e 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 @@ -12,6 +12,7 @@ package org.eclipse.swt.graphics; import org.eclipse.swt.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; /** @@ -135,6 +136,7 @@ Cursor (Device device) { public Cursor(Device device, int style) { super(device); int shape = 0; + byte[] name = null; switch (style) { case SWT.CURSOR_APPSTARTING: break; case SWT.CURSOR_ARROW: shape = OS.GDK_LEFT_PTR; break; @@ -157,7 +159,7 @@ public Cursor(Device device, int style) { case SWT.CURSOR_SIZENW: shape = OS.GDK_TOP_LEFT_CORNER; break; case SWT.CURSOR_UPARROW: shape = OS.GDK_SB_UP_ARROW; break; case SWT.CURSOR_IBEAM: shape = OS.GDK_XTERM; break; - case SWT.CURSOR_NO: shape = OS.GDK_X_CURSOR; break; + case SWT.CURSOR_NO: shape = OS.GDK_X_CURSOR; name=Converter.wcsToMbcs("not-allowed", true) ; break; default: SWT.error(SWT.ERROR_INVALID_ARGUMENT); } @@ -168,7 +170,11 @@ 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_for_display (OS.gdk_display_get_default(), shape); + if (name != null) { + handle = OS.gdk_cursor_new_from_name (OS.gdk_display_get_default(), name); + } else { + handle = OS.gdk_cursor_new_for_display (OS.gdk_display_get_default(), shape); + } } if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES); init(); |