97 lines
4.8 KiB
Diff
97 lines
4.8 KiB
Diff
|
From faa3866df482c0e42ac5b308a5551882f833a3aa Mon Sep 17 00:00:00 2001
|
||
|
From: Alexander Kurtakov
|
||
|
Date: Thu, 10 Jul 2014 09:06:28 +0300
|
||
|
Subject: Bug 438992 - Combo dropdown has empty space at top
|
||
|
|
||
|
Setting wrap_width also trims the empty whitespace on top for combo
|
||
|
popup.
|
||
|
|
||
|
Change-Id: I073d1ccef913de8f1ccfa0ff1eb09538606f8f74
|
||
|
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
|
||
|
|
||
|
diff --git a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
|
||
|
index 89185b9..813f451 100644
|
||
|
--- a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
|
||
|
+++ b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
|
||
|
@@ -9970,6 +9970,16 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1combo_1box_1set_1focus_1on_1click)
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
+#ifndef NO__1gtk_1combo_1box_1set_1wrap_1width
|
||
|
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1combo_1box_1set_1wrap_1width)
|
||
|
+ (JNIEnv *env, jclass that, jintLong arg0, jint arg1)
|
||
|
+{
|
||
|
+ OS_NATIVE_ENTER(env, that, _1gtk_1combo_1box_1set_1wrap_1width_FUNC);
|
||
|
+ gtk_combo_box_set_wrap_width((GtkComboBox *)arg0, (gint)arg1);
|
||
|
+ OS_NATIVE_EXIT(env, that, _1gtk_1combo_1box_1set_1wrap_1width_FUNC);
|
||
|
+}
|
||
|
+#endif
|
||
|
+
|
||
|
#ifndef NO__1gtk_1combo_1box_1text_1insert
|
||
|
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1combo_1box_1text_1insert)
|
||
|
(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jbyteArray arg2, jbyteArray arg3)
|
||
|
diff --git a/eclipse.platform.swt/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 fefc07e..16d6664 100644
|
||
|
--- a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
|
||
|
+++ b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
|
||
|
@@ -723,6 +723,7 @@ char * OS_nativeFunctionNames[] = {
|
||
|
"_1gtk_1combo_1box_1remove_1text",
|
||
|
"_1gtk_1combo_1box_1set_1active",
|
||
|
"_1gtk_1combo_1box_1set_1focus_1on_1click",
|
||
|
+ "_1gtk_1combo_1box_1set_1wrap_1width",
|
||
|
"_1gtk_1combo_1box_1text_1insert",
|
||
|
"_1gtk_1combo_1box_1text_1new",
|
||
|
"_1gtk_1combo_1box_1text_1new_1with_1entry",
|
||
|
diff --git a/eclipse.platform.swt/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 aa408c5..78460d0 100644
|
||
|
--- a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
|
||
|
+++ b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
|
||
|
@@ -733,6 +733,7 @@ typedef enum {
|
||
|
_1gtk_1combo_1box_1remove_1text_FUNC,
|
||
|
_1gtk_1combo_1box_1set_1active_FUNC,
|
||
|
_1gtk_1combo_1box_1set_1focus_1on_1click_FUNC,
|
||
|
+ _1gtk_1combo_1box_1set_1wrap_1width_FUNC,
|
||
|
_1gtk_1combo_1box_1text_1insert_FUNC,
|
||
|
_1gtk_1combo_1box_1text_1new_FUNC,
|
||
|
_1gtk_1combo_1box_1text_1new_1with_1entry_FUNC,
|
||
|
diff --git a/eclipse.platform.swt/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 b531bf9..ab42819 100644
|
||
|
--- a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
|
||
|
+++ b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
|
||
|
@@ -7135,6 +7135,19 @@ public static final void gtk_combo_box_set_active(long /*int*/ combo_box, int in
|
||
|
lock.unlock();
|
||
|
}
|
||
|
}
|
||
|
+/**
|
||
|
+ * @param combo_box cast=(GtkComboBox *)
|
||
|
+ * @param width cast=(gint)
|
||
|
+ */
|
||
|
+public static final native void _gtk_combo_box_set_wrap_width(long /*int*/ combo_box, int width);
|
||
|
+public static final void gtk_combo_box_set_wrap_width(long /*int*/ combo_box, int width) {
|
||
|
+ lock.lock();
|
||
|
+ try {
|
||
|
+ _gtk_combo_box_set_wrap_width(combo_box, width);
|
||
|
+ } finally {
|
||
|
+ lock.unlock();
|
||
|
+ }
|
||
|
+}
|
||
|
/** @method flags=dynamic */
|
||
|
public static final native int _gtk_combo_box_get_active(long /*int*/ combo_box);
|
||
|
public static final int gtk_combo_box_get_active(long /*int*/ combo_box) {
|
||
|
diff --git a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
|
||
|
index ea5a93e..6589c9e 100644
|
||
|
--- a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
|
||
|
+++ b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
|
||
|
@@ -455,6 +455,8 @@ void createHandle (int index) {
|
||
|
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
|
||
|
cellHandle = OS.gtk_bin_get_child (handle);
|
||
|
if (cellHandle == 0) error (SWT.ERROR_NO_HANDLES);
|
||
|
+ // Setting wrap width has the side effect of removing the whitespace on top in popup bug#438992
|
||
|
+ OS.gtk_combo_box_set_wrap_width(handle, 1);
|
||
|
} else {
|
||
|
if (OS.GTK3) {
|
||
|
handle = OS.gtk_combo_box_text_new_with_entry();
|
||
|
--
|
||
|
cgit v0.10.1-9-gd18e
|
||
|
|