aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor2013-02-07 15:35:15 (EST)
committerLakshmi Shanmugam2013-02-28 03:26:12 (EST)
commit2790bcfe60b3e7f8ce22350fe25d1448b588095d (patch)
tree2b660bfbfc6e4df6ddf994f69079546eb95ea692
parentaffb06e3862648e89ed200291b040d88a91641bc (diff)
downloadeclipse.platform.swt-2790bcfe60b3e7f8ce22350fe25d1448b588095d.zip
eclipse.platform.swt-2790bcfe60b3e7f8ce22350fe25d1448b588095d.tar.gz
eclipse.platform.swt-2790bcfe60b3e7f8ce22350fe25d1448b588095d.tar.bz2
This patch solves clipping and wrong default sizing of GtkEntry in GTK3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java3
5 files changed, 28 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 e96c142..b579c98 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
@@ -10027,6 +10027,16 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1entry_1set_1visibility)
}
#endif
+#ifndef NO__1gtk_1entry_1set_1width_1chars
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1entry_1set_1width_1chars)
+ (JNIEnv *env, jclass that, jintLong arg0, jint arg1)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1entry_1set_1width_1chars_FUNC);
+ gtk_entry_set_width_chars((GtkEntry *)arg0, (gint)arg1);
+ OS_NATIVE_EXIT(env, that, _1gtk_1entry_1set_1width_1chars_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1entry_1text_1index_1to_1layout_1index
JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1entry_1text_1index_1to_1layout_1index)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
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 4226bc9..cc331d4 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
@@ -745,6 +745,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1entry_1set_1placeholder_1text",
"_1gtk_1entry_1set_1text",
"_1gtk_1entry_1set_1visibility",
+ "_1gtk_1entry_1set_1width_1chars",
"_1gtk_1entry_1text_1index_1to_1layout_1index",
"_1gtk_1enumerate_1printers",
"_1gtk_1expander_1get_1expanded",
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 91c52e6..237c57e 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
@@ -755,6 +755,7 @@ typedef enum {
_1gtk_1entry_1set_1placeholder_1text_FUNC,
_1gtk_1entry_1set_1text_FUNC,
_1gtk_1entry_1set_1visibility_FUNC,
+ _1gtk_1entry_1set_1width_1chars_FUNC,
_1gtk_1entry_1text_1index_1to_1layout_1index_FUNC,
_1gtk_1enumerate_1printers_FUNC,
_1gtk_1expander_1get_1expanded_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 f9e7110..f5ab078 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
@@ -7129,6 +7129,19 @@ public static final long /*int*/ gtk_entry_get_inner_border (long /*int*/ entry)
lock.unlock();
}
}
+/**
+ * @param self cast=(GtkEntry *)
+ * @param n_chars cast=(gint)
+ */
+public static final native void _gtk_entry_set_width_chars (long /*int*/ self, int n_chars);
+public static final void gtk_entry_set_width_chars (long /*int*/ self, int n_chars) {
+ lock.lock();
+ try {
+ _gtk_entry_set_width_chars(self, n_chars);
+ } finally {
+ lock.unlock();
+ }
+}
/** @param entry cast=(GtkEntry *) */
public static final native char _gtk_entry_get_invisible_char(long /*int*/ entry);
public static final char gtk_entry_get_invisible_char(long /*int*/ entry) {
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 db9f4d1..46cf274 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
@@ -232,6 +232,9 @@ void createHandle (int index) {
}
if (OS.GTK3) {
imContext = OS.imContextLast();
+ if ((style & SWT.SINGLE) != 0) {
+ OS.gtk_entry_set_width_chars(handle, 6);
+ }
}
}