diff options
author | Alexander Kurtakov | 2018-10-18 05:28:19 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2018-10-18 05:28:19 +0000 |
commit | f2c989edceb3846426bca539c39f79e306ac85c8 (patch) | |
tree | 0313cc0cfad0ac1fafe6091a9d432960b438dd86 | |
parent | 097889d81b9a2ea1750f83c442fc322ad60fbc52 (diff) | |
download | eclipse.platform.swt-f2c989edceb3846426bca539c39f79e306ac85c8.tar.gz eclipse.platform.swt-f2c989edceb3846426bca539c39f79e306ac85c8.tar.xz eclipse.platform.swt-f2c989edceb3846426bca539c39f79e306ac85c8.zip |
Bug 540202 - Default button is visually undistinguishable
Remove "suggested-action" class from the lastDefault to prevent multiple
buttons being rendered as such.
Change-Id: I345496d4493e09b6e982d9e7757f5b42e339532d
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
5 files changed, 36 insertions, 0 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 e467ca0f30..f0e00540c2 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 @@ -8373,6 +8373,20 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1invalidate) } #endif +#ifndef NO__1gtk_1style_1context_1remove_1class +JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1remove_1class) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) +{ + jbyte *lparg1=NULL; + GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1remove_1class_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + gtk_style_context_remove_class((GtkStyleContext *)arg0, (const gchar *)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1remove_1class_FUNC); +} +#endif + #ifndef NO__1gtk_1style_1context_1restore JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1restore) (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 7825627bc4..1fab85850f 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 @@ -717,6 +717,7 @@ char * GTK_nativeFunctionNames[] = { "_1gtk_1style_1context_1get_1font", "_1gtk_1style_1context_1get_1padding", "_1gtk_1style_1context_1invalidate", + "_1gtk_1style_1context_1remove_1class", "_1gtk_1style_1context_1restore", "_1gtk_1style_1context_1save", "_1gtk_1style_1context_1set_1state", 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 234f0ae32f..1c158c076a 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 @@ -715,6 +715,7 @@ typedef enum { _1gtk_1style_1context_1get_1font_FUNC, _1gtk_1style_1context_1get_1padding_FUNC, _1gtk_1style_1context_1invalidate_FUNC, + _1gtk_1style_1context_1remove_1class_FUNC, _1gtk_1style_1context_1restore_FUNC, _1gtk_1style_1context_1save_FUNC, _1gtk_1style_1context_1set_1state_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java index 8f7d978d54..1f7ce3e475 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java @@ -5588,6 +5588,19 @@ public class GTK extends OS { lock.unlock(); } } + /** + * @param context cast=(GtkStyleContext *) + * @param class_name cast=(const gchar *) + */ + public static final native void _gtk_style_context_remove_class(long /*int*/ context, byte[] class_name); + public static final void gtk_style_context_remove_class(long /*int*/ context, byte[] class_name) { + lock.lock(); + try { + _gtk_style_context_remove_class(context, class_name); + } finally { + lock.unlock(); + } + } /** @method flags=dynamic */ public static final native void _gtk_style_context_get_background_color(long /*int*/ context, int state, GdkRGBA color); /** [GTK3; 3.16 deprecated, replaced] */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java index 85fca9d857..7993783dd9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java @@ -557,6 +557,13 @@ boolean restoreFocus () { public void setDefaultButton (Button button) { checkWidget(); long /*int*/ buttonHandle = 0; + if (saveDefault != null && !saveDefault.isDisposed () ) { + long /*int*/ saveButtonHandle = saveDefault.handle; + if (saveButtonHandle != 0) { + long /*int*/ context = GTK.gtk_widget_get_style_context (saveButtonHandle); + GTK.gtk_style_context_remove_class(context, GTK.GTK_STYLE_CLASS_SUGGESTED_ACTION); + } + } if (button != null) { if (button.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); if (button.menuShell () != this) error (SWT.ERROR_INVALID_PARENT); |