summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-08-29 10:55:21 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-08-29 10:55:21 -0400
commit742806238aa69633cd6fc8812a666523c4c7585d (patch)
tree4a950818f345961140bd25882b079b937c7f4d7f
parent7ac2d15e081f50dc81d21e4d632f358a2190c759 (diff)
parentf161484e8ba50495a84a24c63f2849d4a2a53fb6 (diff)
downloadeclipse.platform.swt-742806238aa69633cd6fc8812a666523c4c7585d.tar.gz
eclipse.platform.swt-742806238aa69633cd6fc8812a666523c4c7585d.tar.xz
eclipse.platform.swt-742806238aa69633cd6fc8812a666523c4c7585d.zip
Merge branch 'master' of http://git.eclipse.org/gitroot/platform/eclipse.platform.swt.git
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c56
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java30
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java2
9 files changed, 102 insertions, 24 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java
index f6de5c5d92..6e2a842c06 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java
@@ -76,7 +76,12 @@ public void javaToNative (Object object, TransferData transferData) {
int[] format = new int[1];
int /*long*/[] ctext = new int /*long*/[1];
int[] length = new int[1];
- boolean result = OS.gdk_utf8_to_compound_text(utf8, encoding, format, ctext, length);
+ boolean result;
+ if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) {
+ result = OS.gdk_x11_display_utf8_to_compound_text (OS.gdk_display_get_default(), utf8, encoding, format, ctext, length);
+ } else {
+ result = OS.gdk_utf8_to_compound_text(utf8, encoding, format, ctext, length);
+ }
if (!result) return;
transferData.type = encoding[0];
transferData.format = format[0];
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 16ad4e8134..90c1ebac16 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
@@ -6542,7 +6542,15 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1gdk_1utf8_1to_1compound_1text)
if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail;
if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail;
- rc = (jboolean)gdk_utf8_to_compound_text((const gchar *)lparg0, (GdkAtom *)lparg1, (gint *)lparg2, (guchar **)lparg3, (gint *)lparg4);
+/*
+ rc = (jboolean)gdk_utf8_to_compound_text(lparg0, lparg1, lparg2, lparg3, lparg4);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_utf8_to_compound_text)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jbyte *, jintLong *, jint *, jintLong *, jint *))fp)(lparg0, lparg1, lparg2, lparg3, lparg4);
+ }
+ }
fail:
if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0);
@@ -7158,6 +7166,42 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1display_1get_1xdisplay)
}
#endif
+#ifndef NO__1gdk_1x11_1display_1utf8_1to_1compound_1text
+JNIEXPORT jboolean JNICALL OS_NATIVE(_1gdk_1x11_1display_1utf8_1to_1compound_1text)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLongArray arg2, jintArray arg3, jintLongArray arg4, jintArray arg5)
+{
+ jbyte *lparg1=NULL;
+ jintLong *lparg2=NULL;
+ jint *lparg3=NULL;
+ jintLong *lparg4=NULL;
+ jint *lparg5=NULL;
+ jboolean rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gdk_1x11_1display_1utf8_1to_1compound_1text_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetIntLongArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ if (arg4) if ((lparg4 = (*env)->GetIntLongArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ if (arg5) if ((lparg5 = (*env)->GetIntArrayElements(env, arg5, NULL)) == NULL) goto fail;
+/*
+ rc = (jboolean)gdk_x11_display_utf8_to_compound_text((GdkDisplay *)arg0, lparg1, lparg2, lparg3, lparg4, lparg5);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_x11_display_utf8_to_compound_text)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(GdkDisplay *, jbyte *, jintLong *, jint *, jintLong *, jint *))fp)((GdkDisplay *)arg0, lparg1, lparg2, lparg3, lparg4, lparg5);
+ }
+ }
+fail:
+ if (arg5 && lparg5) (*env)->ReleaseIntArrayElements(env, arg5, lparg5, 0);
+ if (arg4 && lparg4) (*env)->ReleaseIntLongArrayElements(env, arg4, lparg4, 0);
+ if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
+ if (arg2 && lparg2) (*env)->ReleaseIntLongArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ OS_NATIVE_EXIT(env, that, _1gdk_1x11_1display_1utf8_1to_1compound_1text_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1x11_1drawable_1get_1xdisplay
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1drawable_1get_1xdisplay)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -13836,6 +13880,16 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1toolbar_1new)
}
#endif
+#ifndef NO__1gtk_1toolbar_1set_1icon_1size
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1toolbar_1set_1icon_1size)
+ (JNIEnv *env, jclass that, jintLong arg0, jint arg1)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1toolbar_1set_1icon_1size_FUNC);
+ gtk_toolbar_set_icon_size((GtkToolbar *)arg0, arg1);
+ OS_NATIVE_EXIT(env, that, _1gtk_1toolbar_1set_1icon_1size_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1toolbar_1set_1orientation
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1toolbar_1set_1orientation)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
index 69b44542ef..09073e9c3e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
@@ -233,6 +233,8 @@
#define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK
#define gdk_x11_screen_lookup_visual_LIB LIB_GDK
#define gdk_x11_window_lookup_for_display_LIB LIB_GDK
+#define gdk_x11_display_utf8_to_compound_text_LIB LIB_GDK
+#define gdk_utf8_to_compound_text_LIB LIB_GDK
#define gdk_threads_set_lock_functions_LIB LIB_GDK
#define atk_object_add_relationship_LIB LIB_ATK
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 657e02529d..119f1c66aa 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
@@ -18,8 +18,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1333;
-int OS_nativeFunctionCallCount[1333];
+int OS_nativeFunctionCount = 1335;
+int OS_nativeFunctionCallCount[1335];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -573,6 +573,7 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1window_1show_1unraised",
"_1gdk_1x11_1atom_1to_1xatom",
"_1gdk_1x11_1display_1get_1xdisplay",
+ "_1gdk_1x11_1display_1utf8_1to_1compound_1text",
"_1gdk_1x11_1drawable_1get_1xdisplay",
"_1gdk_1x11_1drawable_1get_1xid",
"_1gdk_1x11_1screen_1get_1window_1manager_1name",
@@ -1061,6 +1062,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1tool_1item_1set_1proxy_1menu_1item",
"_1gtk_1toolbar_1insert",
"_1gtk_1toolbar_1new",
+ "_1gtk_1toolbar_1set_1icon_1size",
"_1gtk_1toolbar_1set_1orientation",
"_1gtk_1toolbar_1set_1show_1arrow",
"_1gtk_1toolbar_1set_1style",
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 e97f22092c..20250dbe2b 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
@@ -581,6 +581,7 @@ typedef enum {
_1gdk_1window_1show_1unraised_FUNC,
_1gdk_1x11_1atom_1to_1xatom_FUNC,
_1gdk_1x11_1display_1get_1xdisplay_FUNC,
+ _1gdk_1x11_1display_1utf8_1to_1compound_1text_FUNC,
_1gdk_1x11_1drawable_1get_1xdisplay_FUNC,
_1gdk_1x11_1drawable_1get_1xid_FUNC,
_1gdk_1x11_1screen_1get_1window_1manager_1name_FUNC,
@@ -1069,6 +1070,7 @@ typedef enum {
_1gtk_1tool_1item_1set_1proxy_1menu_1item_FUNC,
_1gtk_1toolbar_1insert_FUNC,
_1gtk_1toolbar_1new_FUNC,
+ _1gtk_1toolbar_1set_1icon_1size_FUNC,
_1gtk_1toolbar_1set_1orientation_FUNC,
_1gtk_1toolbar_1set_1show_1arrow_FUNC,
_1gtk_1toolbar_1set_1style_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 c0ae254c02..c2310b7878 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
@@ -4926,11 +4926,7 @@ public static final void gdk_set_program_class(byte[] program_class) {
}
}
/**
- * @param str cast=(const gchar *)
- * @param encoding cast=(GdkAtom *)
- * @param format cast=(gint *)
- * @param ctext cast=(guchar **)
- * @param length cast=(gint *)
+ * @method flags=dynamic
*/
public static final native boolean _gdk_utf8_to_compound_text(byte[] str, int /*long*/[] encoding, int[] format, int /*long*/[] ctext, int[] length);
public static final boolean gdk_utf8_to_compound_text(byte[] str, int /*long*/[] encoding, int[] format, int /*long*/[] ctext, int[] length) {
@@ -4941,6 +4937,19 @@ public static final boolean gdk_utf8_to_compound_text(byte[] str, int /*long*/[]
lock.unlock();
}
}
+/**
+ * @param display cast=(GdkDisplay *)
+ * @method flags=dynamic
+ */
+public static final native boolean _gdk_x11_display_utf8_to_compound_text(int /*long*/ display, byte[] str, int /*long*/[] encoding, int[] format, int /*long*/[] ctext, int[] length);
+public static final boolean gdk_x11_display_utf8_to_compound_text(int /*long*/ display, byte[] str, int /*long*/[] encoding, int[] format, int /*long*/[] ctext, int[] length) {
+ lock.lock();
+ try {
+ return _gdk_x11_display_utf8_to_compound_text(display, str, encoding, format, ctext, length);
+ } finally {
+ lock.unlock();
+ }
+}
/** @param str cast=(const gchar *) */
public static final native int /*long*/ _gdk_utf8_to_string_target(byte[] str);
public static final int /*long*/ gdk_utf8_to_string_target(byte[] str) {
@@ -10717,6 +10726,17 @@ public static final void gtk_toolbar_set_style(int /*long*/ toolbar, int style)
lock.unlock();
}
}
+/** @param toolbar cast=(GtkToolbar *)
+ */
+public static final native void _gtk_toolbar_set_icon_size(int /*long*/ toolbar, int size);
+public static final void gtk_toolbar_set_icon_size(int /*long*/ toolbar, int size) {
+ lock.lock();
+ try {
+ _gtk_toolbar_set_icon_size(toolbar, size);
+ } finally {
+ lock.unlock();
+ }
+}
/** @method flags=dynamic */
public static final native int /*long*/ _gtk_tooltips_data_get(int /*long*/ widget);
public static final int /*long*/ gtk_tooltips_data_get(int /*long*/ widget) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 7993e54757..e23576990a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -4260,21 +4260,7 @@ public boolean setParent (Composite parent) {
oldDecorations.fixAccelGroup ();
}
int /*long*/ newParent = parent.parentingHandle();
-
- /*
- * Bug in GTK. GTK will segment fault if gtk_widget_reparent() is called
- * on a toolbar or on a widget hierarchy containing a toolbar. The fix is
- * to reparent by removing the widget from its current parent and adding it
- * to the new parent.
- *
- * Temporarily put back for bug#387496.
- */
OS.gtk_widget_reparent(topHandle, newParent);
-// OS.g_object_ref (topHandle);
-// OS.gtk_container_remove (OS.gtk_widget_get_parent (topHandle), topHandle);
-// OS.gtk_container_add (newParent, topHandle);
-// OS.g_object_unref (topHandle);
-
OS.gtk_fixed_move (newParent, topHandle, x, y);
/*
* Restore the original widget size since GTK does not keep it.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
index 821beed3b0..0ba8e94db7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
@@ -138,6 +138,13 @@ void createHandle (int index) {
byte [] swt_toolbar_flat = Converter.wcsToMbcs (null, "swt-toolbar-flat", true);
OS.gtk_widget_set_name (handle, swt_toolbar_flat);
}
+ /*
+ * Bug in GTK. GTK will segment fault if gtk_widget_reparent() is called
+ * on a toolbar or on a widget hierarchy containing a toolbar when the icon
+ * size is not GTK_ICON_SIZE_LARGE_TOOLBAR. The fix is to set the icon
+ * size to GTK_ICON_SIZE_LARGE_TOOLBAR.
+ */
+ OS.gtk_toolbar_set_icon_size (handle, OS.GTK_ICON_SIZE_LARGE_TOOLBAR);
}
public Point computeSize (int wHint, int hHint, boolean changed) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
index 1ee867b046..2dd7b19b88 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
@@ -265,7 +265,7 @@ void createHandle (int index) {
OS.gtk_widget_set_app_paintable (handle, true);
OS.gtk_window_set_type_hint (handle, OS.GDK_WINDOW_TYPE_HINT_TOOLTIP);
} else {
- if (OS.GTK_VERSION >= OS.VERSION (2, 12, 0)) {
+ if (OS.GTK_VERSION < OS.VERSION (2, 12, 0)) {
state |= HANDLE;
handle = OS.gtk_tooltips_new ();
if (handle == 0) error (SWT.ERROR_NO_HANDLES);