diff options
author | Eric Williams | 2018-01-11 18:40:58 +0000 |
---|---|---|
committer | Eric Williams | 2018-01-17 16:05:23 +0000 |
commit | bf4f51d091c1ca54883063f9567fd83cddafeb63 (patch) | |
tree | 66187284e35f133830ea90f959ec2fb91303253e /bundles/org.eclipse.swt/Eclipse SWT PI/gtk | |
parent | 247d7f9a4fdc740d6f8a82838c37cd93fd029b14 (diff) | |
download | eclipse.platform.swt-bf4f51d091c1ca54883063f9567fd83cddafeb63.tar.gz eclipse.platform.swt-bf4f51d091c1ca54883063f9567fd83cddafeb63.tar.xz eclipse.platform.swt-bf4f51d091c1ca54883063f9567fd83cddafeb63.zip |
Bug 528284: [GTK3] Toolbar: TCF dropdown control is cutoff
Still testing, DO NOT MERGE.
PART 1/2: SWT fix (other fix is for TCF UI code)
Use gtk_button_set_image() instead of gtk_container_add() to prevent
smaller buttons from having trimmed arrow icons when SWT.ARROW is
specified. This change in logic is due to GTK3 using an actual GtkImage
for icons, where GTK2 uses GtkArrow which is its own widget.
Tested with ControlExample and the TCF Target Explorer ToolBar
contribution. No AllNonBrowser JUnit tests fail.
Change-Id: I3c4c33acb689ac36c4567cc8d7bbb5b3ff4e4c19
Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/gtk')
4 files changed, 21 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 526464acbc..282f8fd346 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 @@ -7741,6 +7741,16 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1button_1new) } #endif +#ifndef NO__1gtk_1button_1set_1image +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1button_1set_1image) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1button_1set_1image_FUNC); + gtk_button_set_image(arg0, arg1); + OS_NATIVE_EXIT(env, that, _1gtk_1button_1set_1image_FUNC); +} +#endif + #ifndef NO__1gtk_1calendar_1clear_1marks JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1calendar_1clear_1marks) (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 209d6b4c39..f5bc1cc4c0 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 @@ -633,6 +633,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1box_1set_1spacing", "_1gtk_1button_1clicked", "_1gtk_1button_1new", + "_1gtk_1button_1set_1image", "_1gtk_1calendar_1clear_1marks", "_1gtk_1calendar_1get_1date", "_1gtk_1calendar_1mark_1day", 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 7b36883b7f..41480bd6d2 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 @@ -643,6 +643,7 @@ typedef enum { _1gtk_1box_1set_1spacing_FUNC, _1gtk_1button_1clicked_FUNC, _1gtk_1button_1new_FUNC, + _1gtk_1button_1set_1image_FUNC, _1gtk_1calendar_1clear_1marks_FUNC, _1gtk_1calendar_1get_1date_FUNC, _1gtk_1calendar_1mark_1day_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 1a35dee7c9..3fa2ede5c6 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 @@ -6180,6 +6180,15 @@ public static final long /*int*/ gtk_button_new() { lock.unlock(); } } +public static final native void /*int*/ _gtk_button_set_image(long /*int*/ handle, long /*int*/ image); +public static final void /*int*/ gtk_button_set_image(long /*int*/ handle, long /*int*/ image) { + lock.lock(); + try { + _gtk_button_set_image(handle, image); + } finally { + lock.unlock(); + } +} public static final native long /*int*/ _gtk_calendar_new(); public static final long /*int*/ gtk_calendar_new() { lock.lock(); |