[SCM] Debian packaging for swt-gtk. branch, upstream, updated. upstream/3.6.2-1-gde8527b
Ahmed El-Mahmoudy
aelmahmoudy-guest at alioth.debian.org
Sat Jun 25 07:58:12 UTC 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Debian packaging for swt-gtk.".
The branch, upstream has been updated
via de8527be87ae450ddd01db4c3e500024a04a5f24 (commit)
from 52010cd6b2759142a1bb867945f70a496cd5d033 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
atk.c | 66 ++
atk_stats.c | 16 +-
atk_stats.h | 12 +
atk_structs.c | 49 ++
atk_structs.h | 12 +
build.sh | 18 +-
cairo.c | 2 +-
cairo.h | 2 +-
cairo_custom.h | 2 +-
cairo_stats.c | 2 +-
cairo_stats.h | 2 +-
cairo_structs.c | 2 +-
cairo_structs.h | 2 +-
callback.c | 16 -
gnome.h | 2 +-
make_aix.mak | 2 +-
make_common.mak | 6 +-
make_aix.mak => make_hpux.mak | 28 +-
make_linux.mak | 6 +-
make_solaris.mak | 6 +-
org/eclipse/swt/SWT.java | 203 +++++-
org/eclipse/swt/accessibility/Accessible.java | 107 ++-
.../swt/accessibility/AccessibleActionEvent.java | 2 +-
.../accessibility/AccessibleAttributeAdapter.java | 6 +-
.../accessibility/AccessibleAttributeEvent.java | 2 +-
.../accessibility/AccessibleAttributeListener.java | 6 +-
.../AccessibleEditableTextAdapter.java | 107 +++
.../accessibility/AccessibleEditableTextEvent.java | 90 ++
.../AccessibleEditableTextListener.java | 110 +++
.../swt/accessibility/AccessibleFactory.java | 55 ++-
.../accessibility/AccessibleHyperlinkEvent.java | 2 +-
.../swt/accessibility/AccessibleObject.java | 341 ++++++++
.../accessibility/AccessibleTableCellEvent.java | 2 +-
.../swt/accessibility/AccessibleTableEvent.java | 2 +-
.../AccessibleTextAttributeEvent.java | 64 ++-
.../AccessibleTextExtendedListener.java | 4 +-
.../swt/accessibility/AccessibleValueEvent.java | 2 +-
org/eclipse/swt/browser/Browser.java | 56 +-
org/eclipse/swt/browser/BrowserFactory.java | 41 +
org/eclipse/swt/browser/BrowserFunction.java | 19 +-
org/eclipse/swt/browser/External.java | 44 +-
org/eclipse/swt/browser/Mozilla.java | 450 ++++++----
org/eclipse/swt/browser/MozillaDelegate.java | 4 +-
org/eclipse/swt/browser/WebBrowser.java | 16 +-
org/eclipse/swt/browser/WebKit.java | 265 ++++---
org/eclipse/swt/custom/CBanner.java | 5 +-
org/eclipse/swt/custom/CCombo.java | 51 +-
org/eclipse/swt/custom/CTabFolder.java | 35 +-
org/eclipse/swt/custom/CTabFolderRenderer.java | 69 ++-
org/eclipse/swt/custom/PopupList.java | 7 +-
org/eclipse/swt/custom/SashForm.java | 22 +-
org/eclipse/swt/custom/StyledText.java | 143 ++--
org/eclipse/swt/custom/StyledTextRenderer.java | 3 +-
org/eclipse/swt/custom/TableEditor.java | 9 +-
org/eclipse/swt/dnd/Clipboard.java | 30 +-
org/eclipse/swt/dnd/ClipboardProxy.java | 24 +-
org/eclipse/swt/events/GestureEvent.java | 158 ++++
.../{PaintListener.java => GestureListener.java} | 31 +-
org/eclipse/swt/events/TouchEvent.java | 93 ++
...{DragDetectListener.java => TouchListener.java} | 27 +-
org/eclipse/swt/graphics/Device.java | 23 +-
org/eclipse/swt/graphics/Font.java | 12 +-
org/eclipse/swt/graphics/FontData.java | 2 +-
org/eclipse/swt/graphics/GC.java | 7 +-
org/eclipse/swt/graphics/Image.java | 2 +-
org/eclipse/swt/graphics/LineAttributes.java | 59 ++-
org/eclipse/swt/graphics/TextLayout.java | 102 ++-
org/eclipse/swt/graphics/TextStyle.java | 8 +-
org/eclipse/swt/internal/LONG.java | 4 +-
org/eclipse/swt/internal/Library.java | 38 +-
org/eclipse/swt/internal/Lock.java | 2 +-
org/eclipse/swt/internal/SWTMessages.properties | 17 +-
org/eclipse/swt/internal/SWTMessages_ar.properties | 9 +-
...ges_mn.properties => SWTMessages_bg.properties} | 2 +-
org/eclipse/swt/internal/SWTMessages_cs.properties | 9 +-
org/eclipse/swt/internal/SWTMessages_da.properties | 9 +-
org/eclipse/swt/internal/SWTMessages_de.properties | 11 +-
org/eclipse/swt/internal/SWTMessages_el.properties | 9 +-
org/eclipse/swt/internal/SWTMessages_es.properties | 8 +
org/eclipse/swt/internal/SWTMessages_et.properties | 3 +
org/eclipse/swt/internal/SWTMessages_fa.properties | 54 ++
org/eclipse/swt/internal/SWTMessages_fi.properties | 9 +-
org/eclipse/swt/internal/SWTMessages_fr.properties | 11 +-
...ges_mn.properties => SWTMessages_hi.properties} | 2 +-
org/eclipse/swt/internal/SWTMessages_hu.properties | 9 +-
org/eclipse/swt/internal/SWTMessages_it.properties | 9 +-
org/eclipse/swt/internal/SWTMessages_iw.properties | 11 +-
org/eclipse/swt/internal/SWTMessages_ja.properties | 11 +-
org/eclipse/swt/internal/SWTMessages_ko.properties | 11 +-
org/eclipse/swt/internal/SWTMessages_mn.properties | 3 +-
org/eclipse/swt/internal/SWTMessages_nl.properties | 9 +-
org/eclipse/swt/internal/SWTMessages_no.properties | 9 +-
org/eclipse/swt/internal/SWTMessages_pl.properties | 9 +-
org/eclipse/swt/internal/SWTMessages_pt.properties | 9 +-
.../swt/internal/SWTMessages_pt_BR.properties | 9 +-
org/eclipse/swt/internal/SWTMessages_ro.properties | 7 +-
org/eclipse/swt/internal/SWTMessages_ru.properties | 8 +
org/eclipse/swt/internal/SWTMessages_sl.properties | 65 ++
org/eclipse/swt/internal/SWTMessages_sv.properties | 9 +-
org/eclipse/swt/internal/SWTMessages_tr.properties | 7 +
org/eclipse/swt/internal/SWTMessages_uk.properties | 3 +
org/eclipse/swt/internal/SWTMessages_zh.properties | 9 +
.../swt/internal/SWTMessages_zh_TW.properties | 11 +-
.../swt/internal/accessibility/gtk/ATK.java | 13 +
.../gtk/AtkEditableTextIface.java} | 23 +-
org/eclipse/swt/internal/gtk/OS.java | 252 ++++++-
org/eclipse/swt/internal/image/JPEGDecoder.java | 18 +-
org/eclipse/swt/internal/mozilla/XPCOM.java | 2 +-
.../{nsICancelable.java => init/GREProperty.java} | 28 +-
.../swt/internal/mozilla/init/GREVersionRange.java | 35 +-
.../swt/internal/mozilla/init/XPCOMInit.java | 9 +-
.../internal/mozilla/nsDynamicFunctionLoad.java | 35 +-
org/eclipse/swt/internal/mozilla/nsID.java | 21 +-
org/eclipse/swt/internal/theme/ButtonDrawData.java | 12 +-
org/eclipse/swt/internal/theme/ComboDrawData.java | 13 +-
org/eclipse/swt/internal/theme/Theme.java | 10 +-
org/eclipse/swt/internal/webkit/WebKitGTK.java | 3 +-
org/eclipse/swt/layout/GridData.java | 2 +-
org/eclipse/swt/layout/GridLayout.java | 5 +-
org/eclipse/swt/printing/PrintDialog.java | 76 ++-
org/eclipse/swt/printing/Printer.java | 203 ++++--
org/eclipse/swt/printing/PrinterData.java | 66 ++-
org/eclipse/swt/program/Program.java | 67 +-
org/eclipse/swt/widgets/Button.java | 177 ++++-
org/eclipse/swt/widgets/Caret.java | 3 +-
org/eclipse/swt/widgets/ColorDialog.java | 12 +-
org/eclipse/swt/widgets/Combo.java | 111 ++--
org/eclipse/swt/widgets/Composite.java | 29 +-
org/eclipse/swt/widgets/Control.java | 268 ++++++-
org/eclipse/swt/widgets/CoolBar.java | 15 +-
org/eclipse/swt/widgets/DateTime.java | 885 +++++++++++++++-----
org/eclipse/swt/widgets/Decorations.java | 7 +
org/eclipse/swt/widgets/DirectoryDialog.java | 20 +-
org/eclipse/swt/widgets/Display.java | 92 ++-
org/eclipse/swt/widgets/Event.java | 41 +-
org/eclipse/swt/widgets/ExpandBar.java | 11 +-
org/eclipse/swt/widgets/ExpandItem.java | 15 +-
org/eclipse/swt/widgets/FileDialog.java | 20 +-
org/eclipse/swt/widgets/FontDialog.java | 12 +-
org/eclipse/swt/widgets/Group.java | 11 +-
org/eclipse/swt/widgets/IME.java | 6 +-
org/eclipse/swt/widgets/Label.java | 14 +-
org/eclipse/swt/widgets/Link.java | 9 +-
org/eclipse/swt/widgets/List.java | 25 +-
org/eclipse/swt/widgets/Menu.java | 96 ++-
org/eclipse/swt/widgets/MenuItem.java | 55 +-
org/eclipse/swt/widgets/MessageBox.java | 12 +-
org/eclipse/swt/widgets/ProgressBar.java | 3 +-
org/eclipse/swt/widgets/Sash.java | 3 +-
org/eclipse/swt/widgets/Scale.java | 3 +-
org/eclipse/swt/widgets/ScrollBar.java | 13 +-
org/eclipse/swt/widgets/Scrollable.java | 15 +-
org/eclipse/swt/widgets/Shell.java | 79 ++-
org/eclipse/swt/widgets/Slider.java | 10 +-
org/eclipse/swt/widgets/Spinner.java | 20 +-
org/eclipse/swt/widgets/Synchronizer.java | 5 +-
org/eclipse/swt/widgets/TabFolder.java | 11 +-
org/eclipse/swt/widgets/TabItem.java | 17 +-
org/eclipse/swt/widgets/Table.java | 39 +-
org/eclipse/swt/widgets/TableColumn.java | 13 +-
org/eclipse/swt/widgets/Text.java | 233 ++++--
org/eclipse/swt/widgets/ToolBar.java | 10 +-
org/eclipse/swt/widgets/ToolItem.java | 32 +-
org/eclipse/swt/widgets/ToolTip.java | 3 +-
org/eclipse/swt/widgets/Touch.java | 100 +++
org/eclipse/swt/widgets/TouchSource.java | 89 ++
org/eclipse/swt/widgets/TrayItem.java | 10 +-
org/eclipse/swt/widgets/Tree.java | 57 ++-
org/eclipse/swt/widgets/TreeColumn.java | 13 +-
org/eclipse/swt/widgets/TypedListener.java | 12 +-
org/eclipse/swt/widgets/Widget.java | 10 +-
os.c | 362 ++++++++-
os_custom.c | 71 ++-
os_custom.h | 20 +-
os_stats.c | 39 +-
os_stats.h | 35 +-
swt.h | 2 +-
version.txt | 2 +-
webkitgtk.h | 7 +-
xpcom_custom.cpp | 2 +-
xpcom_custom.h | 2 +-
xpcominit.cpp | 24 +-
xpcominit_stats.cpp | 7 +-
xpcominit_stats.h | 3 +-
xpcominit_structs.cpp | 36 +-
xpcominit_structs.h | 14 +-
186 files changed, 6364 insertions(+), 1491 deletions(-)
diff --git a/atk.c b/atk.c
index 3b25002..f542499 100644
--- a/atk.c
+++ b/atk.c
@@ -55,6 +55,18 @@ JNIEXPORT jintLong JNICALL ATK_NATIVE(ATK_1TYPE_1COMPONENT)
}
#endif
+#ifndef NO_ATK_1TYPE_1EDITABLE_1TEXT
+JNIEXPORT jintLong JNICALL ATK_NATIVE(ATK_1TYPE_1EDITABLE_1TEXT)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ ATK_NATIVE_ENTER(env, that, ATK_1TYPE_1EDITABLE_1TEXT_FUNC);
+ rc = (jintLong)ATK_TYPE_EDITABLE_TEXT;
+ ATK_NATIVE_EXIT(env, that, ATK_1TYPE_1EDITABLE_1TEXT_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_ATK_1TYPE_1HYPERTEXT
JNIEXPORT jintLong JNICALL ATK_NATIVE(ATK_1TYPE_1HYPERTEXT)
(JNIEnv *env, jclass that)
@@ -223,6 +235,18 @@ JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1COMPONENT_1GET_1IFACE)
}
#endif
+#ifndef NO__1ATK_1EDITABLE_1TEXT_1GET_1IFACE
+JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1EDITABLE_1TEXT_1GET_1IFACE)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ ATK_NATIVE_ENTER(env, that, _1ATK_1EDITABLE_1TEXT_1GET_1IFACE_FUNC);
+ rc = (jintLong)ATK_EDITABLE_TEXT_GET_IFACE(arg0);
+ ATK_NATIVE_EXIT(env, that, _1ATK_1EDITABLE_1TEXT_1GET_1IFACE_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1ATK_1HYPERTEXT_1GET_1IFACE
JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1HYPERTEXT_1GET_1IFACE)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -737,6 +761,27 @@ JNIEXPORT void JNICALL ATK_NATIVE(memmove__JLorg_eclipse_swt_internal_accessibil
}
#endif
+#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL ATK_NATIVE(memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#else
+JNIEXPORT void JNICALL ATK_NATIVE(memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#endif
+{
+#ifndef JNI64
+ ATK_NATIVE_ENTER(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2_FUNC);
+#else
+ ATK_NATIVE_ENTER(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2_FUNC);
+#endif
+ if (arg1) getAtkEditableTextIfaceFields(env, arg1, (AtkEditableTextIface *)arg0);
+#ifndef JNI64
+ ATK_NATIVE_EXIT(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2_FUNC);
+#else
+ ATK_NATIVE_EXIT(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2_FUNC);
+#endif
+}
+#endif
+
#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL ATK_NATIVE(memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
@@ -999,6 +1044,27 @@ JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibili
}
#endif
+#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2I) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2J) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2I)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1)
+#else
+JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2J)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1)
+#endif
+{
+#ifndef JNI64
+ ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2I_FUNC);
+#else
+ ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2J_FUNC);
+#endif
+ if (arg0) setAtkEditableTextIfaceFields(env, arg0, (AtkEditableTextIface *)arg1);
+#ifndef JNI64
+ ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2I_FUNC);
+#else
+ ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2J_FUNC);
+#endif
+}
+#endif
+
#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2I) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2J) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2I)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1)
diff --git a/atk_stats.c b/atk_stats.c
index 880122a..8563724 100644
--- a/atk_stats.c
+++ b/atk_stats.c
@@ -18,12 +18,13 @@
#ifdef NATIVE_STATS
-int ATK_nativeFunctionCount = 74;
-int ATK_nativeFunctionCallCount[74];
+int ATK_nativeFunctionCount = 78;
+int ATK_nativeFunctionCallCount[78];
char * ATK_nativeFunctionNames[] = {
"ATK_1IS_1NO_1OP_1OBJECT_1FACTORY",
"ATK_1TYPE_1ACTION",
"ATK_1TYPE_1COMPONENT",
+ "ATK_1TYPE_1EDITABLE_1TEXT",
"ATK_1TYPE_1HYPERTEXT",
"ATK_1TYPE_1OBJECT_1FACTORY",
"ATK_1TYPE_1SELECTION",
@@ -38,6 +39,7 @@ char * ATK_nativeFunctionNames[] = {
"GTK_1TYPE_1ACCESSIBLE",
"_1ATK_1ACTION_1GET_1IFACE",
"_1ATK_1COMPONENT_1GET_1IFACE",
+ "_1ATK_1EDITABLE_1TEXT_1GET_1IFACE",
"_1ATK_1HYPERTEXT_1GET_1IFACE",
"_1ATK_1OBJECT_1FACTORY_1CLASS",
"_1ATK_1SELECTION_1GET_1IFACE",
@@ -110,6 +112,11 @@ char * ATK_nativeFunctionNames[] = {
"memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2",
#endif
#ifndef JNI64
+ "memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2",
+#else
+ "memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2",
+#endif
+#ifndef JNI64
"memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2",
#else
"memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2",
@@ -170,6 +177,11 @@ char * ATK_nativeFunctionNames[] = {
"memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2J",
#endif
#ifndef JNI64
+ "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2I",
+#else
+ "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2J",
+#endif
+#ifndef JNI64
"memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2I",
#else
"memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2J",
diff --git a/atk_stats.h b/atk_stats.h
index 10e1400..4b40bb9 100644
--- a/atk_stats.h
+++ b/atk_stats.h
@@ -32,6 +32,7 @@ typedef enum {
ATK_1IS_1NO_1OP_1OBJECT_1FACTORY_FUNC,
ATK_1TYPE_1ACTION_FUNC,
ATK_1TYPE_1COMPONENT_FUNC,
+ ATK_1TYPE_1EDITABLE_1TEXT_FUNC,
ATK_1TYPE_1HYPERTEXT_FUNC,
ATK_1TYPE_1OBJECT_1FACTORY_FUNC,
ATK_1TYPE_1SELECTION_FUNC,
@@ -46,6 +47,7 @@ typedef enum {
GTK_1TYPE_1ACCESSIBLE_FUNC,
_1ATK_1ACTION_1GET_1IFACE_FUNC,
_1ATK_1COMPONENT_1GET_1IFACE_FUNC,
+ _1ATK_1EDITABLE_1TEXT_1GET_1IFACE_FUNC,
_1ATK_1HYPERTEXT_1GET_1IFACE_FUNC,
_1ATK_1OBJECT_1FACTORY_1CLASS_FUNC,
_1ATK_1SELECTION_1GET_1IFACE_FUNC,
@@ -118,6 +120,11 @@ typedef enum {
memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2_FUNC,
#endif
#ifndef JNI64
+ memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2_FUNC,
+#else
+ memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2_FUNC,
+#endif
+#ifndef JNI64
memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2_FUNC,
#else
memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2_FUNC,
@@ -178,6 +185,11 @@ typedef enum {
memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2J_FUNC,
#endif
#ifndef JNI64
+ memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2I_FUNC,
+#else
+ memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkEditableTextIface_2J_FUNC,
+#endif
+#ifndef JNI64
memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2I_FUNC,
#else
memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkHypertextIface_2J_FUNC,
diff --git a/atk_structs.c b/atk_structs.c
index 0f18573..cf07ec8 100644
--- a/atk_structs.c
+++ b/atk_structs.c
@@ -163,6 +163,55 @@ void setAtkComponentIfaceFields(JNIEnv *env, jobject lpObject, AtkComponentIface
}
#endif
+#ifndef NO_AtkEditableTextIface
+typedef struct AtkEditableTextIface_FID_CACHE {
+ int cached;
+ jclass clazz;
+ jfieldID set_run_attributes, set_text_contents, insert_text, copy_text, cut_text, delete_text, paste_text;
+} AtkEditableTextIface_FID_CACHE;
+
+AtkEditableTextIface_FID_CACHE AtkEditableTextIfaceFc;
+
+void cacheAtkEditableTextIfaceFields(JNIEnv *env, jobject lpObject)
+{
+ if (AtkEditableTextIfaceFc.cached) return;
+ AtkEditableTextIfaceFc.clazz = (*env)->GetObjectClass(env, lpObject);
+ AtkEditableTextIfaceFc.set_run_attributes = (*env)->GetFieldID(env, AtkEditableTextIfaceFc.clazz, "set_run_attributes", I_J);
+ AtkEditableTextIfaceFc.set_text_contents = (*env)->GetFieldID(env, AtkEditableTextIfaceFc.clazz, "set_text_contents", I_J);
+ AtkEditableTextIfaceFc.insert_text = (*env)->GetFieldID(env, AtkEditableTextIfaceFc.clazz, "insert_text", I_J);
+ AtkEditableTextIfaceFc.copy_text = (*env)->GetFieldID(env, AtkEditableTextIfaceFc.clazz, "copy_text", I_J);
+ AtkEditableTextIfaceFc.cut_text = (*env)->GetFieldID(env, AtkEditableTextIfaceFc.clazz, "cut_text", I_J);
+ AtkEditableTextIfaceFc.delete_text = (*env)->GetFieldID(env, AtkEditableTextIfaceFc.clazz, "delete_text", I_J);
+ AtkEditableTextIfaceFc.paste_text = (*env)->GetFieldID(env, AtkEditableTextIfaceFc.clazz, "paste_text", I_J);
+ AtkEditableTextIfaceFc.cached = 1;
+}
+
+AtkEditableTextIface *getAtkEditableTextIfaceFields(JNIEnv *env, jobject lpObject, AtkEditableTextIface *lpStruct)
+{
+ if (!AtkEditableTextIfaceFc.cached) cacheAtkEditableTextIfaceFields(env, lpObject);
+ lpStruct->set_run_attributes = (gboolean (*)())(*env)->GetIntLongField(env, lpObject, AtkEditableTextIfaceFc.set_run_attributes);
+ lpStruct->set_text_contents = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkEditableTextIfaceFc.set_text_contents);
+ lpStruct->insert_text = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkEditableTextIfaceFc.insert_text);
+ lpStruct->copy_text = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkEditableTextIfaceFc.copy_text);
+ lpStruct->cut_text = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkEditableTextIfaceFc.cut_text);
+ lpStruct->delete_text = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkEditableTextIfaceFc.delete_text);
+ lpStruct->paste_text = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkEditableTextIfaceFc.paste_text);
+ return lpStruct;
+}
+
+void setAtkEditableTextIfaceFields(JNIEnv *env, jobject lpObject, AtkEditableTextIface *lpStruct)
+{
+ if (!AtkEditableTextIfaceFc.cached) cacheAtkEditableTextIfaceFields(env, lpObject);
+ (*env)->SetIntLongField(env, lpObject, AtkEditableTextIfaceFc.set_run_attributes, (jintLong)lpStruct->set_run_attributes);
+ (*env)->SetIntLongField(env, lpObject, AtkEditableTextIfaceFc.set_text_contents, (jintLong)lpStruct->set_text_contents);
+ (*env)->SetIntLongField(env, lpObject, AtkEditableTextIfaceFc.insert_text, (jintLong)lpStruct->insert_text);
+ (*env)->SetIntLongField(env, lpObject, AtkEditableTextIfaceFc.copy_text, (jintLong)lpStruct->copy_text);
+ (*env)->SetIntLongField(env, lpObject, AtkEditableTextIfaceFc.cut_text, (jintLong)lpStruct->cut_text);
+ (*env)->SetIntLongField(env, lpObject, AtkEditableTextIfaceFc.delete_text, (jintLong)lpStruct->delete_text);
+ (*env)->SetIntLongField(env, lpObject, AtkEditableTextIfaceFc.paste_text, (jintLong)lpStruct->paste_text);
+}
+#endif
+
#ifndef NO_AtkHypertextIface
typedef struct AtkHypertextIface_FID_CACHE {
int cached;
diff --git a/atk_structs.h b/atk_structs.h
index cc692cd..873fdae 100644
--- a/atk_structs.h
+++ b/atk_structs.h
@@ -51,6 +51,18 @@ void setAtkComponentIfaceFields(JNIEnv *env, jobject lpObject, AtkComponentIface
#define AtkComponentIface_sizeof() 0
#endif
+#ifndef NO_AtkEditableTextIface
+void cacheAtkEditableTextIfaceFields(JNIEnv *env, jobject lpObject);
+AtkEditableTextIface *getAtkEditableTextIfaceFields(JNIEnv *env, jobject lpObject, AtkEditableTextIface *lpStruct);
+void setAtkEditableTextIfaceFields(JNIEnv *env, jobject lpObject, AtkEditableTextIface *lpStruct);
+#define AtkEditableTextIface_sizeof() sizeof(AtkEditableTextIface)
+#else
+#define cacheAtkEditableTextIfaceFields(a,b)
+#define getAtkEditableTextIfaceFields(a,b,c) NULL
+#define setAtkEditableTextIfaceFields(a,b,c)
+#define AtkEditableTextIface_sizeof() 0
+#endif
+
#ifndef NO_AtkHypertextIface
void cacheAtkHypertextIfaceFields(JNIEnv *env, jobject lpObject);
AtkHypertextIface *getAtkHypertextIfaceFields(JNIEnv *env, jobject lpObject, AtkHypertextIface *lpStruct);
diff --git a/build.sh b/build.sh
index 55f98da..1eb3a06 100755
--- a/build.sh
+++ b/build.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#*******************************************************************************
-# Copyright (c) 2000, 2010 IBM Corporation and others.
+# Copyright (c) 2000, 2011 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -24,6 +24,22 @@ if [ "${CC}" = "" ]; then
export CC
fi
+# Check if we have to compile external.xpt from external.idl
+COMPONENTS_DIR=`pwd`/../../components
+if test ! -f ${COMPONENTS_DIR}/external.xpt; then
+ if test ! -f ${COMPONENTS_DIR}/external.idl; then
+ echo "Can't find ${COMPONENTS_DIR}/external.idl"
+ else
+ IDLDIR=`pkg-config --variable=idldir libxul | sed 's@/stable$@@'`/unstable
+ if test ! -d ${IDLDIR}; then
+ IDLDIR=`pkg-config --variable=idldir libxul`
+ fi
+ XPIDL=`pkg-config --variable=sdkdir libxul`/bin/xpidl
+ echo "${XPIDL} -m typelib -I ${IDLDIR} -e ${COMPONENTS_DIR}/external.xpt ${COMPONENTS_DIR}/external.idl"
+ ${XPIDL} -m typelib -I ${IDLDIR} -e ${COMPONENTS_DIR}/external.xpt ${COMPONENTS_DIR}/external.idl
+ fi
+fi
+
# Determine which OS we are on
if [ "${OS}" = "" ]; then
OS=`uname -s`
diff --git a/cairo.c b/cairo.c
index cbdd5b1..e9ed5ad 100644
--- a/cairo.c
+++ b/cairo.c
@@ -15,7 +15,7 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2008 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2009 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
diff --git a/cairo.h b/cairo.h
index eb79671..0500b3b 100644
--- a/cairo.h
+++ b/cairo.h
@@ -15,7 +15,7 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2006 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2009 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
diff --git a/cairo_custom.h b/cairo_custom.h
index 44c5e55..0eb3d23 100644
--- a/cairo_custom.h
+++ b/cairo_custom.h
@@ -15,7 +15,7 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2006 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2010 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
diff --git a/cairo_stats.c b/cairo_stats.c
index 57be51f..b387ce3 100644
--- a/cairo_stats.c
+++ b/cairo_stats.c
@@ -15,7 +15,7 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2008 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2009 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
diff --git a/cairo_stats.h b/cairo_stats.h
index 1b2a1b5..f5f3bbf 100644
--- a/cairo_stats.h
+++ b/cairo_stats.h
@@ -15,7 +15,7 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2008 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2009 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
diff --git a/cairo_structs.c b/cairo_structs.c
index 3225703..085d180 100644
--- a/cairo_structs.c
+++ b/cairo_structs.c
@@ -15,7 +15,7 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2008 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2009 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
diff --git a/cairo_structs.h b/cairo_structs.h
index 3a87645..1e0ece9 100644
--- a/cairo_structs.h
+++ b/cairo_structs.h
@@ -15,7 +15,7 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2008 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2009 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
diff --git a/callback.c b/callback.c
index a344d01..73d9851 100644
--- a/callback.c
+++ b/callback.c
@@ -26,9 +26,6 @@ static int callbackEnabled = 1;
static int callbackEntryCount = 0;
static int initialized = 0;
static jint JNI_VERSION = 0;
-#ifdef COCOA
-static NSException *nsException = nil;
-#endif
#ifdef DEBUG_CALL_PRINTS
static int counter = 0;
@@ -1247,13 +1244,6 @@ jintLong callback(int index, ...)
va_end(vl);
ATOMIC_DEC(callbackEntryCount);
-#ifdef COCOA
- if (callbackEntryCount == 0 && nsException) {
- [nsException release];
- nsException = nil;
- }
-#endif
-
done:
/* If an exception has occurred in Java, return the error result. */
if ((ex = (*env)->ExceptionOccurred(env))) {
@@ -1263,12 +1253,6 @@ done:
(*env)->ExceptionDescribe(env);
#endif
result = callbackData[index].errorResult;
-#ifdef COCOA
- if (nsException == NULL) {
- nsException = [[NSException alloc] initWithName:NSGenericException reason:@"Java exception occurred" userInfo:nil];
- [nsException raise];
- }
-#endif
}
if (detach) {
diff --git a/gnome.h b/gnome.h
index 4cebd6d..07f1b5a 100644
--- a/gnome.h
+++ b/gnome.h
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved.
+* Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
diff --git a/make_aix.mak b/make_aix.mak
index a951b1b..5dc0ca5 100644
--- a/make_aix.mak
+++ b/make_aix.mak
@@ -1,5 +1,5 @@
#*******************************************************************************
-# Copyright (c) 2000, 2010 IBM Corporation and others.
+# Copyright (c) 2010, 2011 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
diff --git a/make_common.mak b/make_common.mak
index 7182563..edb5f04 100644
--- a/make_common.mak
+++ b/make_common.mak
@@ -1,5 +1,5 @@
#*******************************************************************************
-# Copyright (c) 2000, 2010 IBM Corporation and others.
+# Copyright (c) 2000, 2011 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -10,5 +10,5 @@
#*******************************************************************************
maj_ver=3
-min_ver=659
-comma_ver=3,6,5,9
+min_ver=735
+comma_ver=3,7,3,5
diff --git a/make_aix.mak b/make_hpux.mak
similarity index 87%
copy from make_aix.mak
copy to make_hpux.mak
index a951b1b..b6d0f30 100644
--- a/make_aix.mak
+++ b/make_hpux.mak
@@ -1,5 +1,5 @@
#*******************************************************************************
-# Copyright (c) 2000, 2010 IBM Corporation and others.
+# Copyright (c) 2010, 2011 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -26,14 +26,14 @@ ATK_PREFIX = swt-atk
GNOME_PREFIX = swt-gnome
GLX_PREFIX = swt-glx
-SWT_LIB = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).a
-CDE_LIB = lib$(CDE_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).a
-AWT_LIB = lib$(AWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).a
-SWTPI_LIB = lib$(SWTPI_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).a
-CAIRO_LIB = lib$(CAIRO_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).a
-ATK_LIB = lib$(ATK_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).a
-GNOME_LIB = lib$(GNOME_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).a
-GLX_LIB = lib$(GLX_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).a
+SWT_LIB = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
+CDE_LIB = lib$(CDE_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
+AWT_LIB = lib$(AWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
+SWTPI_LIB = lib$(SWTPI_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
+CAIRO_LIB = lib$(CAIRO_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
+ATK_LIB = lib$(ATK_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
+GNOME_LIB = lib$(GNOME_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
+GLX_LIB = lib$(GLX_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
CAIROCFLAGS = `pkg-config --cflags cairo`
CAIROLIBS = `pkg-config --libs cairo` -lcairo
@@ -44,7 +44,8 @@ GTKLIBS = `pkg-config --libs gtk+-2.0 gthread-2.0` $(XLIB64) -L/usr/X11R6/lib -l
CDE_LIBS = -L$(CDE_HOME)/lib -R$(CDE_HOME)/lib -lXt -lX11 -lDtSvc
AWT_LFLAGS = -shared -s ${SWT_LFLAGS}
-AWT_LIBS = -L$(AWT_LIB_PATH) -ljawt -lX11
+AWT_LIBS = -L$(AWT_LIB_PATH) -L$(AWT_LIB_PATH)/server -ljawt -lX11
+
ATKCFLAGS = `pkg-config --cflags atk gtk+-2.0`
ATKLIBS = `pkg-config --libs atk gtk+-2.0`
@@ -69,8 +70,9 @@ GLX_OBJECTS = swt.o glx.o glx_structs.o glx_stats.o
CFLAGS = -O -Wall \
-DSWT_VERSION=$(SWT_VERSION) \
$(NATIVE_STATS) \
- -DAIX -DGTK \
+ -DHPUX -DGTK \
-I$(JAVA_HOME)/include \
+ -I$(JAVA_HOME)/include/hp-ux \
${SWT_PTR_CFLAGS}
LFLAGS = -shared -s ${SWT_LFLAGS}
@@ -189,10 +191,10 @@ glx_stats.o: glx_stats.c glx_stats.h
# Install
#
install: all
- cp *.a $(OUTPUT_DIR)
+ cp *.so $(OUTPUT_DIR)
#
# Clean
#
clean:
- rm -f *.o *.a
+ rm -f *.o *.so
diff --git a/make_linux.mak b/make_linux.mak
index 8b8f1a8..25bb83b 100644
--- a/make_linux.mak
+++ b/make_linux.mak
@@ -1,5 +1,5 @@
#*******************************************************************************
-# Copyright (c) 2000, 2010 IBM Corporation and others.
+# Copyright (c) 2000, 2011 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -91,8 +91,8 @@ MOZILLAEXCLUDES = -DNO__1XPCOMGlueShutdown \
-DNO_nsDynamicFunctionLoad
XULRUNNEREXCLUDES = -DNO__1NS_1InitXPCOM2
-WEBKITCFLAGS = `pkg-config --cflags gtk+-2.0` -I/usr/include/webkit-1.0 -I/usr/include/libsoup-2.4
-WEBKITLIBS = -lwebkit-1.0
+WEBKITCFLAGS = `pkg-config --cflags webkit-1.0`
+WEBKITLIBS = `pkg-config --libs webkit-1.0`
SWT_OBJECTS = swt.o c.o c_stats.o callback.o
CDE_OBJECTS = swt.o cde.o cde_structs.o cde_stats.o
diff --git a/make_solaris.mak b/make_solaris.mak
index 20f711c..308e1c4 100644
--- a/make_solaris.mak
+++ b/make_solaris.mak
@@ -48,9 +48,9 @@ CAIROLIBS = `pkg-config --libs-only-L cairo` -lcairo
GTKCFLAGS = `pkg-config --cflags gtk+-2.0`
GTKLIBS = `pkg-config --libs-only-L gtk+-2.0 gthread-2.0` -lgtk-x11-2.0 -lgthread-2.0 -L/usr/openwin/lib -Wl,-R -Wl,/usr/openwin/lib -lXtst
-CDE_LIBS = -L$(CDE_HOME)/lib -R$(CDE_HOME)/lib -lXt -lX11 -lDtSvc
+CDE_LIBS = -L$(CDE_HOME)/lib$(SWT_CDE_64SUFFIX) -R$(CDE_HOME)/lib$(SWT_CDE_64SUFFIX) -lXt -lX11 -lDtSvc
-AWT_LFLAGS = -G -s
+AWT_LFLAGS = -G -s $(SWT_LFLAGS)
AWT_LIBS = -L$(AWT_LIB_PATH) -ljawt
ATKCFLAGS = `pkg-config --cflags atk gtk+-2.0`
@@ -108,7 +108,7 @@ CFLAGS = -O \
-K PIC \
${SWT_PTR_CFLAGS} \
-I$(CDE_HOME)/include
-LFLAGS = -G -K PIC -s
+LFLAGS = -G -K PIC -s $(SWT_LFLAGS)
all: make_swt make_atk make_awt make_glx make_cde
diff --git a/org/eclipse/swt/SWT.java b/org/eclipse/swt/SWT.java
index 8d7c355..ae95091 100644
--- a/org/eclipse/swt/SWT.java
+++ b/org/eclipse/swt/SWT.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -715,6 +715,39 @@ public class SWT {
*/
public static final int OpenDocument = 46;
+ /**
+ * The touch event type (value is 47).
+ *
+ * <p>
+ * This event is sent when a touch has been performed
+ * on a touch-based input source.
+ * </p>
+ *
+ * @see org.eclipse.swt.widgets.Display#addListener
+ * @see org.eclipse.swt.widgets.Event
+ *
+ * @since 3.7
+ */
+ public static final int Touch = 47;
+
+ /**
+ * The gesture event type (value is 48).
+ *
+ * <p>
+ * This event is sent when a gesture has been performed.
+ * </p>
+ *
+ * @see org.eclipse.swt.widgets.Display#addListener
+ * @see org.eclipse.swt.widgets.Event
+ * @see SWT#GESTURE_MAGNIFY
+ * @see SWT#GESTURE_PAN
+ * @see SWT#GESTURE_ROTATE
+ * @see SWT#GESTURE_SWIPE
+ *
+ * @since 3.7
+ */
+ public static final int Gesture = 48;
+
/* Event Details */
/**
@@ -897,6 +930,82 @@ public class SWT {
* (value is 1<<9).
*/
public static final int TRAVERSE_PAGE_NEXT = 1 << 9;
+
+ /**
+ * Gesture event detail field value indicating that a continuous
+ * gesture is about to begin.
+ *
+ * @since 3.7
+ */
+ public static final int GESTURE_BEGIN = 1 << 1;
+
+ /**
+ * Gesture event detail field value indicating that a continuous
+ * gesture has ended.
+ *
+ * @since 3.7
+ */
+ public static final int GESTURE_END = 1 << 2;
+
+ /**
+ * Gesture event detail field value indicating that a
+ * rotation gesture has happened. Only the rotation field
+ * of the event is valid.
+ *
+ * @since 3.7
+ */
+ public static final int GESTURE_ROTATE = 1 << 3;
+
+ /**
+ * Gesture event detail field value indicating that a
+ * swipe gesture has happened.
+ *
+ * @since 3.7
+ */
+ public static final int GESTURE_SWIPE = 1 << 4;
+
+ /**
+ * Gesture event detail field value indicating that a
+ * magnification gesture has happened.
+ *
+ * @since 3.7
+ */
+ public static final int GESTURE_MAGNIFY = 1 << 5;
+
+ /**
+ * Gesture event detail field value indicating that a
+ * panning (two-finger scroll) gesture has happened.
+ *
+ * @since 3.7
+ */
+ public static final int GESTURE_PAN = 1 << 6;
+
+ /**
+ * A constant indicating that a finger touched the device.
+ *
+ * @see org.eclipse.swt.widgets.Touch#state
+ *
+ * @since 3.7
+ */
+ public static final int TOUCHSTATE_DOWN = 1 << 0;
+
+ /**
+ * A constant indicating that a finger moved on the device.
+ *
+ * @see org.eclipse.swt.widgets.Touch#state
+ *
+ * @since 3.7
+ */
+ public static final int TOUCHSTATE_MOVE = 1 << 1;
+
+ /**
+ * A constant indicating that a finger was lifted from the device.
+ *
+ * @see org.eclipse.swt.widgets.Touch#state
+ *
+ * @since 3.7
+ */
+ public static final int TOUCHSTATE_UP = 1 << 2;
/**
* A constant indicating that widgets have changed.
@@ -981,7 +1090,6 @@ public class SWT {
/**
* Style constant for drop down menu/list behavior (value is 1<<2).
- * <br>Note that for <code>DateTime</code> this is a <em>HINT</em>.
* <p><b>Used By:</b><ul>
* <li><code>Menu</code></li>
* <li><code>ToolItem</code></li>
@@ -1010,6 +1118,16 @@ public class SWT {
*/
public static final int SEPARATOR = 1 << 1;
+ /**
+ * Constant representing a flexible space separator in a ToolBar.
+ * <p><b>Used By:</b><ul>
+ * <li><code>ToolItem.setWidth()</code></li>
+ * </ul></p>
+ *
+ * @since 3.7
+ */
+ public static final int SEPARATOR_FILL = -2;
+
/**
* Style constant for toggle button behavior (value is 1<<1).
* <p><b>Used By:</b><ul>
@@ -1123,6 +1241,7 @@ public class SWT {
/**
* Style constant for simple (not drop down) behavior (value is 1<<6).
+ * <br>Note that this is a <em>HINT</em>.
* <p><b>Used By:</b><ul>
* <li><code>Combo</code></li>
* </ul></p>
@@ -1940,6 +2059,18 @@ public class SWT {
public static final int MOZILLA = 1 << 15;
/**
+ * Style constant specifying that a Browser should use WebKit
+ * for rendering its content (value is 1<<16).
+ * <p>
+ * <p><b>Used By:</b><ul>
+ * <li><code>Browser</code></li>
+ * </ul></p>
+ *
+ * @since 3.7
+ */
+ public static final int WEBKIT = 1 << 16;
+
+ /**
* Style constant for balloon behavior (value is 1<<12).
* <p><b>Used By:</b><ul>
* <li><code>ToolTip</code></li>
@@ -2034,6 +2165,14 @@ public class SWT {
public static final char TAB = '\t';
/**
+ * ASCII character convenience constant for the space character
+ * (value is the <code>char</code> ' ').
+ *
+ * @since 3.7
+ */
+ public static final char SPACE = ' ';
+
+ /**
* keyboard and/or mouse event mask indicating that the ALT key
* was pushed on the keyboard when the event was generated
* (value is 1<<16).
@@ -3850,6 +3989,66 @@ public class SWT {
public static final int ALL = 1 << 0;
/**
+ * ID for the About menu item (value is -1).
+ *
+ * @see org.eclipse.swt.widgets.MenuItem#setID(int)
+ * @see org.eclipse.swt.widgets.MenuItem#getID()
+ *
+ * @since 3.7
+ */
+ public static final int ID_ABOUT = -1;
+
+ /**
+ * ID for the Preferences menu item (value is -2).
+ *
+ * @see org.eclipse.swt.widgets.MenuItem#setID(int)
+ * @see org.eclipse.swt.widgets.MenuItem#getID()
+ *
+ * @since 3.7
+ */
+ public static final int ID_PREFERENCES = -2;
+
+ /**
+ * ID for the Hide menu item (value is -3).
+ *
+ * @see org.eclipse.swt.widgets.MenuItem#setID(int)
+ * @see org.eclipse.swt.widgets.MenuItem#getID()
+ *
+ * @since 3.7
+ */
+ public static final int ID_HIDE = -3;
+
+ /**
+ * ID for the Hide Others menu item (value is -4).
+ *
+ * @see org.eclipse.swt.widgets.MenuItem#setID(int)
+ * @see org.eclipse.swt.widgets.MenuItem#getID()
+ *
+ * @since 3.7
+ */
+ public static final int ID_HIDE_OTHERS = -4;
+
+ /**
+ * ID for the Show All menu item (value is -5).
+ *
+ * @see org.eclipse.swt.widgets.MenuItem#setID(int)
+ * @see org.eclipse.swt.widgets.MenuItem#getID()
+ *
+ * @since 3.7
+ */
+ public static final int ID_SHOW_ALL = -5;
+
+ /**
+ * ID for the Quit menu item (value is -6).
+ *
+ * @see org.eclipse.swt.widgets.MenuItem#setID(int)
+ * @see org.eclipse.swt.widgets.MenuItem#getID()
+ *
+ * @since 3.7
+ */
+ public static final int ID_QUIT = -6;
+
+ /**
* Key value for setting and getting the skin class of a widget.
*
* @see org.eclipse.swt.widgets.Widget#getData(String)
diff --git a/org/eclipse/swt/accessibility/Accessible.java b/org/eclipse/swt/accessibility/Accessible.java
index f1b21b9..73c155f 100644
--- a/org/eclipse/swt/accessibility/Accessible.java
+++ b/org/eclipse/swt/accessibility/Accessible.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -45,6 +45,7 @@ public class Accessible {
Vector accessibleControlListeners = new Vector ();
Vector accessibleTextListeners = new Vector ();
Vector accessibleActionListeners = new Vector();
+ Vector accessibleEditableTextListeners = new Vector();
Vector accessibleHyperlinkListeners = new Vector();
Vector accessibleTableListeners = new Vector();
Vector accessibleTableCellListeners = new Vector();
@@ -83,6 +84,7 @@ public class Accessible {
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
*
+ * @see #dispose
* @see Control#getAccessible
*
* @since 3.6
@@ -209,10 +211,10 @@ public class Accessible {
/**
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleAction</code> interface.
+ * defined in the <code>AccessibleActionListener</code> interface.
*
* @param listener the listener that should be notified when the receiver
- * is asked for <code>AccessibleAction</code> interface properties
+ * is asked for <code>AccessibleActionListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -236,10 +238,37 @@ public class Accessible {
/**
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleHyperlink</code> interface.
+ * defined in the <code>AccessibleEditableTextListener</code> interface.
*
* @param listener the listener that should be notified when the receiver
- * is asked for <code>AccessibleHyperlink</code> interface properties
+ * is asked for <code>AccessibleEditableTextListener</code> interface properties
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @see AccessibleEditableTextListener
+ * @see #removeAccessibleEditableTextListener
+ *
+ * @since 3.7
+ */
+ public void addAccessibleEditableTextListener(AccessibleEditableTextListener listener) {
+ checkWidget();
+ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ accessibleEditableTextListeners.addElement(listener);
+ }
+
+ /**
+ * Adds the listener to the collection of listeners that will be
+ * notified when an accessible client asks for any of the properties
+ * defined in the <code>AccessibleHyperlinkListener</code> interface.
+ *
+ * @param listener the listener that should be notified when the receiver
+ * is asked for <code>AccessibleHyperlinkListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -263,10 +292,10 @@ public class Accessible {
/**
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleTable</code> interface.
+ * defined in the <code>AccessibleTableListener</code> interface.
*
* @param listener the listener that should be notified when the receiver
- * is asked for <code>AccessibleTable</code> interface properties
+ * is asked for <code>AccessibleTableListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -290,10 +319,10 @@ public class Accessible {
/**
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleTableCell</code> interface.
+ * defined in the <code>AccessibleTableCellListener</code> interface.
*
* @param listener the listener that should be notified when the receiver
- * is asked for <code>AccessibleTableCell</code> interface properties
+ * is asked for <code>AccessibleTableCellListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -317,10 +346,10 @@ public class Accessible {
/**
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleValue</code> interface.
+ * defined in the <code>AccessibleValueListener</code> interface.
*
* @param listener the listener that should be notified when the receiver
- * is asked for <code>AccessibleValue</code> interface properties
+ * is asked for <code>AccessibleValueListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -344,10 +373,10 @@ public class Accessible {
/**
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleAttribute</code> interface.
+ * defined in the <code>AccessibleAttributeListener</code> interface.
*
* @param listener the listener that should be notified when the receiver
- * is asked for <code>AccessibleAttribute</code> interface properties
+ * is asked for <code>AccessibleAttributeListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -587,10 +616,10 @@ public class Accessible {
/**
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleAction</code> interface.
+ * defined in the <code>AccessibleActionListener</code> interface.
*
* @param listener the listener that should no longer be notified when the receiver
- * is asked for <code>AccessibleAction</code> interface properties
+ * is asked for <code>AccessibleActionListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -614,10 +643,37 @@ public class Accessible {
/**
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleHyperlink</code> interface.
+ * defined in the <code>AccessibleEditableTextListener</code> interface.
+ *
+ * @param listener the listener that should no longer be notified when the receiver
+ * is asked for <code>AccessibleEditableTextListener</code> interface properties
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @see AccessibleEditableTextListener
+ * @see #addAccessibleEditableTextListener
+ *
+ * @since 3.7
+ */
+ public void removeAccessibleEditableTextListener(AccessibleEditableTextListener listener) {
+ checkWidget();
+ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ accessibleEditableTextListeners.removeElement(listener);
+ }
+
+ /**
+ * Removes the listener from the collection of listeners that will be
+ * notified when an accessible client asks for any of the properties
+ * defined in the <code>AccessibleHyperlinkListener</code> interface.
*
* @param listener the listener that should no longer be notified when the receiver
- * is asked for <code>AccessibleHyperlink</code> interface properties
+ * is asked for <code>AccessibleHyperlinkListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -641,10 +697,10 @@ public class Accessible {
/**
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleTable</code> interface.
+ * defined in the <code>AccessibleTableListener</code> interface.
*
* @param listener the listener that should no longer be notified when the receiver
- * is asked for <code>AccessibleTable</code> interface properties
+ * is asked for <code>AccessibleTableListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -668,10 +724,10 @@ public class Accessible {
/**
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleTableCell</code> interface.
+ * defined in the <code>AccessibleTableCellListener</code> interface.
*
* @param listener the listener that should no longer be notified when the receiver
- * is asked for <code>AccessibleTableCell</code> interface properties
+ * is asked for <code>AccessibleTableCellListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -695,10 +751,10 @@ public class Accessible {
/**
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleValue</code> interface.
+ * defined in the <code>AccessibleValueListener</code> interface.
*
* @param listener the listener that should no longer be notified when the receiver
- * is asked for <code>AccessibleValue</code> interface properties
+ * is asked for <code>AccessibleValueListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -722,10 +778,10 @@ public class Accessible {
/**
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
- * defined in the <code>AccessibleAttribute</code> interface.
+ * defined in the <code>AccessibleAttributeListener</code> interface.
*
* @param listener the listener that should no longer be notified when the receiver
- * is asked for <code>AccessibleAttribute</code> interface properties
+ * is asked for <code>AccessibleAttributeListener</code> interface properties
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
@@ -771,6 +827,7 @@ public class Accessible {
*
* @param event an <code>ACC</code> constant beginning with EVENT_* indicating the message to send
* @param eventData an object containing event-specific data, or null if there is no event-specific data
+ * (eventData is specified in the documentation for individual ACC.EVENT_* constants)
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
diff --git a/org/eclipse/swt/accessibility/AccessibleActionEvent.java b/org/eclipse/swt/accessibility/AccessibleActionEvent.java
index de96073..49219c3 100644
--- a/org/eclipse/swt/accessibility/AccessibleActionEvent.java
+++ b/org/eclipse/swt/accessibility/AccessibleActionEvent.java
@@ -50,7 +50,7 @@ public AccessibleActionEvent(Object source) {
* @return a string representation of the event
*/
public String toString () {
- return "AccessibleActionEvent {"
+ return "AccessibleActionEvent {" //$NON-NLS-1$
+ "string=" + result //$NON-NLS-1$
+ " count=" + count //$NON-NLS-1$
+ " index=" + index //$NON-NLS-1$
diff --git a/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java b/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java
index 43df16e..f51f7eb 100644
--- a/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java
+++ b/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java
@@ -48,14 +48,14 @@ public class AccessibleAttributeAdapter implements AccessibleAttributeListener {
* Returns text attributes specific to this Accessible object.
*
* @param e an event object containing the following fields:<ul>
- * <li>[in] offset - the 0 based text offset</li>
- * <li>[out] start - the starting offset of the character range
+ * <li>[in] offset - the 0 based text offset for which to return attribute information</li>
+ * <li>[out] start - the 0 based starting offset of the character range
* over which all text attributes match those of offset</li>
* <li>[out] end - the 0 based offset after the last character of the character range
* over which all text attributes match those of offset</li>
* <li>[out] textStyle - the TextStyle of the character range</li>
* <li>[out] attributes - an array of alternating key and value Strings
- * which represent additional (i.e. non predefined) attributes</li>
+ * that represent additional attributes that do not correspond to TextStyle fields</li>
* </ul>
*/
public void getTextAttributes(AccessibleTextAttributeEvent e) {}
diff --git a/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java b/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java
index b09ffb0..87a3a08 100644
--- a/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java
+++ b/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java
@@ -51,7 +51,7 @@ public AccessibleAttributeEvent(Object source) {
* @return a string representation of the event
*/
public String toString () {
- return "AccessibleAttributeEvent {"
+ return "AccessibleAttributeEvent {" //$NON-NLS-1$
+ " topMargin=" + topMargin //$NON-NLS-1$
+ " bottomMargin=" + bottomMargin //$NON-NLS-1$
+ " leftMargin=" + leftMargin //$NON-NLS-1$
diff --git a/org/eclipse/swt/accessibility/AccessibleAttributeListener.java b/org/eclipse/swt/accessibility/AccessibleAttributeListener.java
index 6d08f26..da725e0 100644
--- a/org/eclipse/swt/accessibility/AccessibleAttributeListener.java
+++ b/org/eclipse/swt/accessibility/AccessibleAttributeListener.java
@@ -51,14 +51,14 @@ public interface AccessibleAttributeListener extends SWTEventListener {
* Returns text attributes specific to this Accessible object.
*
* @param e an event object containing the following fields:<ul>
- * <li>[in] offset - the 0 based text offset</li>
- * <li>[out] start - the starting offset of the character range
+ * <li>[in] offset - the 0 based text offset for which to return attribute information</li>
+ * <li>[out] start - the 0 based starting offset of the character range
* over which all text attributes match those of offset</li>
* <li>[out] end - the 0 based offset after the last character of the character range
* over which all text attributes match those of offset</li>
* <li>[out] textStyle - the TextStyle of the character range</li>
* <li>[out] attributes - an array of alternating key and value Strings
- * which represent additional (i.e. non predefined) attributes</li>
+ * that represent additional attributes that do not correspond to TextStyle fields</li>
* </ul>
*/
public void getTextAttributes(AccessibleTextAttributeEvent e);
diff --git a/org/eclipse/swt/accessibility/AccessibleEditableTextAdapter.java b/org/eclipse/swt/accessibility/AccessibleEditableTextAdapter.java
new file mode 100644
index 0000000..583ee5c
--- /dev/null
+++ b/org/eclipse/swt/accessibility/AccessibleEditableTextAdapter.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.accessibility;
+
+/**
+ * This adapter class provides default implementations for the
+ * methods in the <code>AccessibleEditableTextListener</code> interface.
+ * <p>
+ * Classes that wish to deal with <code>AccessibleEditableText</code> events can
+ * extend this class and override only the methods that they are
+ * interested in.
+ * </p>
+ *
+ * @see AccessibleEditableTextListener
+ * @see AccessibleEditableTextEvent
+ * @see AccessibleTextAttributeEvent
+ *
+ * @since 3.7
+ */
+public class AccessibleEditableTextAdapter implements AccessibleEditableTextListener {
+ /**
+ * Copies the substring beginning at the specified <code>start</code> offset
+ * and extending to the character at offset <code>end - 1</code> to the clipboard.
+ *
+ * @param e an event object containing the following information:<ul>
+ * <li>[in] start - the 0 based offset of the first character of the substring
+ * to be copied to the clipboard</li>
+ * <li>[in] end - the 0 based offset after the last character of the substring
+ * to be copied to the clipboard</li>
+ * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
+ * </ul>
+ */
+ public void copyText(AccessibleEditableTextEvent e) {};
+
+ /**
+ * Moves the substring beginning at the specified <code>start</code> offset
+ * and extending to the character at offset <code>end - 1</code> to the clipboard.
+ *
+ * @param e an event object containing the following information:<ul>
+ * <li>[in] start - the 0 based offset of the first character of the substring
+ * to be moved to the clipboard</li>
+ * <li>[in] end - the 0 based offset after the last character of the substring
+ * to be moved to the clipboard</li>
+ * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
+ * </ul>
+ */
+ public void cutText(AccessibleEditableTextEvent e) {};
+
+ /**
+ * Inserts the text in the clipboard at the leading edge of the specified <code>start</code> offset.
+ *
+ * @param e an event object containing the following information:<ul>
+ * <li>[in] start - the offset at which to insert the text from the clipboard.
+ * The valid range is 0..length</li>
+ * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
+ * </ul>
+ */
+ public void pasteText(AccessibleEditableTextEvent e) {};
+
+ /**
+ * Replaces the substring beginning at the specified <code>start</code> offset
+ * and extending to the character at offset <code>end - 1</code> by the specified string.
+ * <p>
+ * This event notification is also used to delete text if <code>string</code> is an empty string,
+ * or to insert text at the leading edge of the specified offset if <code>start</code> and <code>end</code> are equal.
+ * </p>
+ *
+ * @param e an event object containing the following information:<ul>
+ * <li>[in] start - the 0 based offset of the first character of the substring
+ * to be replaced</li>
+ * <li>[in] end - the 0 based offset after the last character of the substring
+ * to be replaced</li>
+ * <li>[in] string - the string that replaces the substring beginning at
+ * <code>start</code> and extending to <code>end - 1</code></li>
+ * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
+ * </ul>
+ */
+ public void replaceText(AccessibleEditableTextEvent e) {};
+
+ /**
+ * Replaces the set of attributes of the substring beginning at the specified <code>start</code> offset
+ * and extending to the character at offset <code>end - 1</code> by the specified set of attributes.
+ *
+ * @param e an event object containing the following information:<ul>
+ * <li>[in] start - the 0 based offset of the first character of the substring
+ * whose attributes are modified</li>
+ * <li>[in] end - the 0 based offset after the last character of the substring
+ * whose attributes are modified</li>
+ * <li>[in] textStyle - the TextStyle which contains attributes that replace the old set of attributes.
+ * The foreground, background, and font fields of this TextStyle are only valid for the duration of the event.
+ * The value of this field may be null if none of the attributes to be set correspond to TextStyle fields.</li>
+ * <li>[in] attributes - an array of alternating key and value Strings that represent the complete
+ * set of attributes to replace the old set of attributes.
+ * The value of this field may be null if no attributes are to be set.</li>
+ * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
+ * </ul>
+ */
+ public void setTextAttributes(AccessibleTextAttributeEvent e) {};
+}
diff --git a/org/eclipse/swt/accessibility/AccessibleEditableTextEvent.java b/org/eclipse/swt/accessibility/AccessibleEditableTextEvent.java
new file mode 100644
index 0000000..207614b
--- /dev/null
+++ b/org/eclipse/swt/accessibility/AccessibleEditableTextEvent.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.accessibility;
+
+import org.eclipse.swt.internal.*;
+
+/**
+ * Instances of this class are sent as a result of accessibility clients
+ * sending AccessibleEditableText messages to an accessible object.
+ *
+ * @see AccessibleEditableTextListener
+ * @see AccessibleEditableTextAdapter
+ *
+ * @since 3.7
+ */
+public class AccessibleEditableTextEvent extends SWTEventObject {
+
+ /**
+ * [in] 0-based start offset of the character range to perform
+ * the operation on
+ *
+ * @see AccessibleEditableTextListener#copyText
+ * @see AccessibleEditableTextListener#cutText
+ * @see AccessibleEditableTextListener#pasteText
+ * @see AccessibleEditableTextListener#replaceText
+ */
+ public int start;
+
+ /**
+ * [in] 0-based ending offset of the character range to perform
+ * the operation on
+ *
+ * @see AccessibleEditableTextListener#copyText
+ * @see AccessibleEditableTextListener#cutText
+ * @see AccessibleEditableTextListener#replaceText
+ */
+ public int end;
+
+ /**
+ * [in] a string that will replace the specified character range
+ *
+ * @see AccessibleEditableTextListener#replaceText
+ */
+ public String string;
+
+ /**
+ * [out] Set this field to {@link ACC#OK} if the operation
+ * was completed successfully, and <code>null</code> otherwise.
+ *
+ * @see AccessibleEditableTextListener#copyText
+ * @see AccessibleEditableTextListener#cutText
+ * @see AccessibleEditableTextListener#pasteText
+ * @see AccessibleEditableTextListener#replaceText
+ */
+ public String result;
+
+ static final long serialVersionUID = -5045447704486894646L;
+
+/**
+ * Constructs a new instance of this class.
+ *
+ * @param source the object that fired the event
+ */
+public AccessibleEditableTextEvent(Object source) {
+ super(source);
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public String toString () {
+ return "AccessibleEditableTextEvent {" //$NON-NLS-1$
+ + "start=" + start //$NON-NLS-1$
+ + " end=" + end //$NON-NLS-1$
+ + " string=" + string //$NON-NLS-1$
+ + " result=" + result //$NON-NLS-1$
+ + "}"; //$NON-NLS-1$
+}
+}
diff --git a/org/eclipse/swt/accessibility/AccessibleEditableTextListener.java b/org/eclipse/swt/accessibility/AccessibleEditableTextListener.java
new file mode 100644
index 0000000..6bbe3d6
--- /dev/null
+++ b/org/eclipse/swt/accessibility/AccessibleEditableTextListener.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.accessibility;
+
+import org.eclipse.swt.internal.SWTEventListener;
+
+/**
+ * Classes which implement this interface provide methods
+ * that handle AccessibleEditableText events.
+ * <p>
+ * After creating an instance of a class that implements
+ * this interface it can be added to an accessible using the
+ * <code>addAccessibleEditableTextListener</code> method and removed using
+ * the <code>removeAccessibleEditableTextListener</code> method.
+ * </p>
+ *
+ * @see AccessibleEditableTextAdapter
+ * @see AccessibleEditableTextEvent
+ * @see AccessibleTextAttributeEvent
+ *
+ * @since 3.7
+ */
+public interface AccessibleEditableTextListener extends SWTEventListener {
+ /**
+ * Copies the substring beginning at the specified <code>start</code> offset
+ * and extending to the character at offset <code>end - 1</code> to the clipboard.
+ *
+ * @param e an event object containing the following information:<ul>
+ * <li>[in] start - the 0 based offset of the first character of the substring
+ * to be copied to the clipboard</li>
+ * <li>[in] end - the 0 based offset after the last character of the substring
+ * to be copied to the clipboard</li>
+ * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
+ * </ul>
+ */
+ public void copyText(AccessibleEditableTextEvent e);
+
+ /**
+ * Moves the substring beginning at the specified <code>start</code> offset
+ * and extending to the character at offset <code>end - 1</code> to the clipboard.
+ *
+ * @param e an event object containing the following information:<ul>
+ * <li>[in] start - the 0 based offset of the first character of the substring
+ * to be moved to the clipboard</li>
+ * <li>[in] end - the 0 based offset after the last character of the substring
+ * to be moved to the clipboard</li>
+ * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
+ * </ul>
+ */
+ public void cutText(AccessibleEditableTextEvent e);
+
+ /**
+ * Inserts the text in the clipboard at the leading edge of the specified <code>start</code> offset.
+ *
+ * @param e an event object containing the following information:<ul>
+ * <li>[in] start - the offset at which to insert the text from the clipboard.
+ * The valid range is 0..length</li>
+ * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
+ * </ul>
+ */
+ public void pasteText(AccessibleEditableTextEvent e);
+
+ /**
+ * Replaces the substring beginning at the specified <code>start</code> offset
+ * and extending to the character at offset <code>end - 1</code> by the specified string.
+ * <p>
+ * This event notification is also used to delete text if <code>string</code> is an empty string,
+ * or to insert text at the leading edge of the specified offset if <code>start</code> and <code>end</code> are equal.
+ * </p>
+ *
+ * @param e an event object containing the following information:<ul>
+ * <li>[in] start - the 0 based offset of the first character of the substring
+ * to be replaced</li>
+ * <li>[in] end - the 0 based offset after the last character of the substring
+ * to be replaced</li>
+ * <li>[in] string - the string that replaces the substring beginning at
+ * <code>start</code> and extending to <code>end - 1</code></li>
+ * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
+ * </ul>
+ */
+ public void replaceText(AccessibleEditableTextEvent e);
+
+ /**
+ * Replaces the set of attributes of the substring beginning at the specified <code>start</code> offset
+ * and extending to the character at offset <code>end - 1</code> by the specified set of attributes.
+ *
+ * @param e an event object containing the following information:<ul>
+ * <li>[in] start - the 0 based offset of the first character of the substring
+ * whose attributes are modified</li>
+ * <li>[in] end - the 0 based offset after the last character of the substring
+ * whose attributes are modified</li>
+ * <li>[in] textStyle - the TextStyle which contains attributes that replace the old set of attributes.
+ * The foreground, background, and font fields of this TextStyle are only valid for the duration of the event.
+ * The value of this field may be null if none of the attributes to be set correspond to TextStyle fields.</li>
+ * <li>[in] attributes - an array of alternating key and value Strings that represent the complete
+ * set of attributes to replace the old set of attributes.
+ * The value of this field may be null if no attributes are to be set.</li>
+ * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
+ * </ul>
+ */
+ public void setTextAttributes(AccessibleTextAttributeEvent e);
+}
diff --git a/org/eclipse/swt/accessibility/AccessibleFactory.java b/org/eclipse/swt/accessibility/AccessibleFactory.java
index 47ed177..03e4031 100644
--- a/org/eclipse/swt/accessibility/AccessibleFactory.java
+++ b/org/eclipse/swt/accessibility/AccessibleFactory.java
@@ -29,6 +29,9 @@ class AccessibleFactory {
ACC.ROLE_SPLITBUTTON, ACC.ROLE_SPINBUTTON,
ACC.ROLE_CHECKMENUITEM, ACC.ROLE_RADIOMENUITEM,
};
+ static final int[] editableTextRoles = {
+ ACC.ROLE_TEXT, ACC.ROLE_COMBOBOX, ACC.ROLE_PARAGRAPH, ACC.ROLE_DOCUMENT,
+ };
static final int[] hypertextRoles = {
ACC.ROLE_TEXT, ACC.ROLE_LINK, ACC.ROLE_PARAGRAPH,
};
@@ -37,7 +40,7 @@ class AccessibleFactory {
};
static final int[] textRoles = {
ACC.ROLE_COMBOBOX, ACC.ROLE_LINK, ACC.ROLE_LABEL, ACC.ROLE_TEXT, ACC.ROLE_STATUSBAR,
- ACC.ROLE_PARAGRAPH,
+ ACC.ROLE_PARAGRAPH, ACC.ROLE_DOCUMENT,
};
static final int[] tableRoles = {
ACC.ROLE_TABLE, ACC.ROLE_TREE,
@@ -59,6 +62,15 @@ class AccessibleFactory {
static final Callback AtkComponentCB_get_size;
static final Callback AtkComponentCB_ref_accessible_at_point;
+ /* EditableText callbacks */
+ static final Callback AtkEditableTextCB_set_run_attributes;
+ static final Callback AtkEditableTextCB_set_text_contents;
+ static final Callback AtkEditableTextCB_insert_text;
+ static final Callback AtkEditableTextCB_copy_text;
+ static final Callback AtkEditableTextCB_cut_text;
+ static final Callback AtkEditableTextCB_delete_text;
+ static final Callback AtkEditableTextCB_paste_text;
+
/* Hypertext callbacks */
static final Callback AtkHypertextCB_get_link;
static final Callback AtkHypertextCB_get_n_links;
@@ -136,6 +148,7 @@ class AccessibleFactory {
/* interface initialization callbacks */
static final Callback InitActionIfaceCB;
static final Callback InitComponentIfaceCB;
+ static final Callback InitEditableTextIfaceCB;
static final Callback InitHypertextIfaceCB;
static final Callback GTypeInfo_base_init_type;
static final Callback InitSelectionIfaceCB;
@@ -146,6 +159,7 @@ class AccessibleFactory {
/* interface definitions */
static final int /*long*/ ActionIfaceDefinition;
static final int /*long*/ ComponentIfaceDefinition;
+ static final int /*long*/ EditableTextIfaceDefinition;
static final int /*long*/ HypertextIfaceDefinition;
static final int /*long*/ SelectionIfaceDefinition;
static final int /*long*/ TableIfaceDefinition;
@@ -161,6 +175,13 @@ class AccessibleFactory {
AtkComponentCB_get_position = newCallback (AccessibleObject.class, "atkComponent_get_position", 4); //$NON-NLS-1$
AtkComponentCB_get_size = newCallback (AccessibleObject.class, "atkComponent_get_size", 4); //$NON-NLS-1$
AtkComponentCB_ref_accessible_at_point = newCallback (AccessibleObject.class, "atkComponent_ref_accessible_at_point", 4); //$NON-NLS-1$
+ AtkEditableTextCB_set_run_attributes = newCallback (AccessibleObject.class, "atkEditableText_set_run_attributes", 4); //$NON-NLS-1$
+ AtkEditableTextCB_set_text_contents = newCallback (AccessibleObject.class, "atkEditableText_set_text_contents", 2); //$NON-NLS-1$
+ AtkEditableTextCB_insert_text = newCallback (AccessibleObject.class, "atkEditableText_insert_text", 4); //$NON-NLS-1$
+ AtkEditableTextCB_copy_text = newCallback (AccessibleObject.class, "atkEditableText_copy_text", 3); //$NON-NLS-1$
+ AtkEditableTextCB_cut_text = newCallback (AccessibleObject.class, "atkEditableText_cut_text", 3); //$NON-NLS-1$
+ AtkEditableTextCB_delete_text = newCallback (AccessibleObject.class, "atkEditableText_delete_text", 3); //$NON-NLS-1$
+ AtkEditableTextCB_paste_text = newCallback (AccessibleObject.class, "atkEditableText_paste_text", 2); //$NON-NLS-1$
AtkHypertextCB_get_link = newCallback (AccessibleObject.class, "atkHypertext_get_link", 2); //$NON-NLS-1$
AtkHypertextCB_get_n_links = newCallback (AccessibleObject.class, "atkHypertext_get_n_links", 1); //$NON-NLS-1$
AtkHypertextCB_get_link_index = newCallback (AccessibleObject.class, "atkHypertext_get_link_index", 2); //$NON-NLS-1$
@@ -236,6 +257,12 @@ class AccessibleFactory {
interfaceInfo.interface_init = InitComponentIfaceCB.getAddress ();
ComponentIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof);
OS.memmove (ComponentIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof);
+ /* EditableText interface */
+ InitEditableTextIfaceCB = newCallback (AccessibleFactory.class, "initEditableTextIfaceCB", 1); //$NON-NLS-1$
+ interfaceInfo = new GInterfaceInfo ();
+ interfaceInfo.interface_init = InitEditableTextIfaceCB.getAddress ();
+ EditableTextIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof);
+ OS.memmove (EditableTextIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof);
/* Hypertext interface */
InitHypertextIfaceCB = newCallback (AccessibleFactory.class, "initHypertextIfaceCB", 1); //$NON-NLS-1$
interfaceInfo = new GInterfaceInfo ();
@@ -334,7 +361,7 @@ class AccessibleFactory {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getRole (event);
}
- boolean action = false, hypertext = false, selection = false, table = false, text = false, value = false;
+ boolean action = false, editableText = false, hypertext = false, selection = false, table = false, text = false, value = false;
if (event.detail != 0) { /* a role was specified */
for (int i = 0; i < actionRoles.length; i++) {
if (event.detail == actionRoles [i]) {
@@ -342,6 +369,12 @@ class AccessibleFactory {
break;
}
}
+ for (int i = 0; i < editableTextRoles.length; i++) {
+ if (event.detail == editableTextRoles [i]) {
+ editableText = true;
+ break;
+ }
+ }
for (int i = 0; i < hypertextRoles.length; i++) {
if (event.detail == hypertextRoles [i]) {
hypertext = true;
@@ -373,10 +406,11 @@ class AccessibleFactory {
}
}
} else {
- action = hypertext = selection = table = text = value = true;
+ action = editableText = hypertext = selection = table = text = value = true;
}
String swtTypeName = SWT_TYPE_PREFIX + widgetTypeName;
if (action) swtTypeName += "Action"; //$NON-NLS-1$
+ if (editableText) swtTypeName += "EditableText"; //$NON-NLS-1$
if (hypertext) swtTypeName += "Hypertext"; //$NON-NLS-1$
if (selection) swtTypeName += "Selection"; //$NON-NLS-1$
if (table) swtTypeName += "Table"; //$NON-NLS-1$
@@ -402,6 +436,7 @@ class AccessibleFactory {
type = OS.g_type_register_static (parentType, nameBytes, definition, 0);
OS.g_type_add_interface_static (type, ATK.ATK_TYPE_COMPONENT(), ComponentIfaceDefinition);
if (action) OS.g_type_add_interface_static (type, ATK.ATK_TYPE_ACTION(), ActionIfaceDefinition);
+ if (editableText) OS.g_type_add_interface_static (type, ATK.ATK_TYPE_EDITABLE_TEXT(), EditableTextIfaceDefinition);
if (hypertext) OS.g_type_add_interface_static (type, ATK.ATK_TYPE_HYPERTEXT(), HypertextIfaceDefinition);
if (selection) OS.g_type_add_interface_static (type, ATK.ATK_TYPE_SELECTION(), SelectionIfaceDefinition);
if (table) OS.g_type_add_interface_static (type, ATK.ATK_TYPE_TABLE(), TableIfaceDefinition);
@@ -463,6 +498,20 @@ class AccessibleFactory {
return 0;
}
+ static int /*long*/ initEditableTextIfaceCB (int /*long*/ iface) {
+ AtkEditableTextIface inter = new AtkEditableTextIface ();
+ ATK.memmove (inter, iface);
+ inter.set_run_attributes = AtkEditableTextCB_set_run_attributes.getAddress ();
+ inter.set_text_contents = AtkEditableTextCB_set_text_contents.getAddress ();
+ inter.insert_text = AtkEditableTextCB_insert_text.getAddress ();
+ inter.copy_text = AtkEditableTextCB_copy_text.getAddress ();
+ inter.cut_text = AtkEditableTextCB_cut_text.getAddress ();
+ inter.delete_text = AtkEditableTextCB_delete_text.getAddress ();
+ inter.paste_text = AtkEditableTextCB_paste_text.getAddress ();
+ ATK.memmove (iface, inter);
+ return 0;
+ }
+
static int /*long*/ initHypertextIfaceCB (int /*long*/ iface) {
AtkHypertextIface inter = new AtkHypertextIface ();
ATK.memmove (inter, iface);
diff --git a/org/eclipse/swt/accessibility/AccessibleHyperlinkEvent.java b/org/eclipse/swt/accessibility/AccessibleHyperlinkEvent.java
index 79df0ef..5e30381 100644
--- a/org/eclipse/swt/accessibility/AccessibleHyperlinkEvent.java
+++ b/org/eclipse/swt/accessibility/AccessibleHyperlinkEvent.java
@@ -51,7 +51,7 @@ public AccessibleHyperlinkEvent(Object source) {
* @return a string representation of the event
*/
public String toString () {
- return "AccessibleHyperlinkEvent {"
+ return "AccessibleHyperlinkEvent {" //$NON-NLS-1$
+ "accessible=" + accessible //$NON-NLS-1$
+ " string=" + result //$NON-NLS-1$
+ " index=" + index //$NON-NLS-1$
diff --git a/org/eclipse/swt/accessibility/AccessibleObject.java b/org/eclipse/swt/accessibility/AccessibleObject.java
index ec4c646..80896bd 100644
--- a/org/eclipse/swt/accessibility/AccessibleObject.java
+++ b/org/eclipse/swt/accessibility/AccessibleObject.java
@@ -400,6 +400,347 @@ class AccessibleObject {
return parentResult;
}
+
+ static AtkEditableTextIface getEditableTextIface (int /*long*/ atkObject) {
+ if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_EDITABLE_TEXT())) {
+ AtkEditableTextIface iface = new AtkEditableTextIface ();
+ ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_EDITABLE_TEXT_GET_IFACE (atkObject)));
+ return iface;
+ }
+ return null;
+ }
+
+// gboolean atk_editable_text_set_run_attributes(AtkEditableText *text, AtkAttributeSet *attrib_set, gint start_offset, gint end_offset);
+ static int /*long*/ atkEditableText_set_run_attributes (int /*long*/ atkObject, int /*long*/ attrib_set, int /*long*/ start_offset, int /*long*/ end_offset) {
+ if (DEBUG) print ("-->atkEditableText_set_run_attributes");
+ AccessibleObject object = getAccessibleObject (atkObject);
+ if (object != null) {
+ Accessible accessible = object.accessible;
+ Vector listeners = accessible.accessibleEditableTextListeners;
+ int length = listeners.size();
+ if (length > 0) {
+ Display display = accessible.control.getDisplay();
+ int /*long*/ fontDesc = OS.pango_font_description_new ();
+ boolean createFont = false;
+ TextStyle style = new TextStyle();
+ String [] attributes = new String [0];
+ int /*long*/ current = attrib_set;
+ int listLength = OS.g_slist_length (attrib_set);
+ for (int i = 0; i < listLength; i++) {
+ int /*long*/ attrPtr = OS.g_slist_data (current);
+ if (attrPtr != 0) {
+ AtkAttribute attr = new AtkAttribute();
+ ATK.memmove(attr, attrPtr, AtkAttribute.sizeof);
+ String name = getString(attr.name);
+ String value = getString(attr.value);
+ OS.g_free(attrPtr);
+ if (DEBUG) print("name=" + name + ", value=" + value);
+ String [] newAttributes = new String [attributes.length + 2];
+ System.arraycopy (attributes, 0, newAttributes, 0, attributes.length);
+ newAttributes[attributes.length] = name;
+ newAttributes[attributes.length + 1] = value;
+ attributes = newAttributes;
+ try {
+ if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_RISE)))) {
+ // number of pixels above baseline
+ style.rise = Integer.parseInt(value);
+ } else if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_UNDERLINE)))) {
+ // "none", "single", "double", "low", or "error" (also allow "squiggle")
+ if (value.equals("single") || value.equals("low")) {
+ style.underline = true;
+ style.underlineStyle = SWT.UNDERLINE_SINGLE;
+ } else if (value.equals("double")) {
+ style.underline = true;
+ style.underlineStyle = SWT.UNDERLINE_DOUBLE;
+ } else if (value.equals("error")) {
+ style.underline = true;
+ style.underlineStyle = SWT.UNDERLINE_ERROR;
+ } else if (value.equals("squiggle")) {
+ style.underline = true;
+ style.underlineStyle = SWT.UNDERLINE_SQUIGGLE;
+ }
+ } else if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STRIKETHROUGH)))) {
+ // "true" or "false" (also allow "1" and "single")
+ if (value.equals("true") || value.equals("1") || value.equals("single")) style.strikeout = true;
+ } else if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_FAMILY_NAME)))) {
+ // font family name
+ byte [] buffer = Converter.wcsToMbcs(null, value, true);
+ OS.pango_font_description_set_family(fontDesc, buffer);
+ createFont = true;
+ } else if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_SIZE)))) {
+ // size of characters in points (allow fractional points)
+ float size = Float.parseFloat(value);
+ OS.pango_font_description_set_size(fontDesc, (int)(size * OS.PANGO_SCALE));
+ createFont = true;
+ } else if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STYLE)))) {
+ // "normal", "italic" or "oblique"
+ int fontStyle = -1;
+ if (value.equals("normal")) fontStyle = OS.PANGO_STYLE_NORMAL;
+ else if (value.equals("italic")) fontStyle = OS.PANGO_STYLE_ITALIC;
+ else if (value.equals("oblique")) fontStyle = OS.PANGO_STYLE_OBLIQUE;
+ if (fontStyle != -1) {
+ OS.pango_font_description_set_style(fontDesc, fontStyle);
+ createFont = true;
+ }
+ } else if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_VARIANT)))) {
+ // "normal" or "small_caps"
+ int variant = -1;
+ if (value.equals("normal")) variant = OS.PANGO_VARIANT_NORMAL;
+ else if (value.equals("small_caps")) variant = OS.PANGO_VARIANT_SMALL_CAPS;
+ if (variant != -1) {
+ OS.pango_font_description_set_variant(fontDesc, variant);
+ createFont = true;
+ }
+ } else if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STRETCH)))) {
+ //"ultra_condensed", "extra_condensed", "condensed", "semi_condensed", "normal", "semi_expanded", "expanded", "extra_expanded" or "ultra_expanded"
+ int stretch = -1;
+ if (value.equals("ultra_condensed")) stretch = OS.PANGO_STRETCH_ULTRA_CONDENSED;
+ else if (value.equals("extra_condensed")) stretch = OS.PANGO_STRETCH_EXTRA_CONDENSED;
+ else if (value.equals("condensed")) stretch = OS.PANGO_STRETCH_CONDENSED;
+ else if (value.equals("semi_condensed")) stretch = OS.PANGO_STRETCH_SEMI_CONDENSED;
+ else if (value.equals("normal")) stretch = OS.PANGO_STRETCH_NORMAL;
+ else if (value.equals("semi_expanded")) stretch = OS.PANGO_STRETCH_SEMI_EXPANDED;
+ else if (value.equals("expanded")) stretch = OS.PANGO_STRETCH_EXPANDED;
+ else if (value.equals("extra_expanded")) stretch = OS.PANGO_STRETCH_EXTRA_EXPANDED;
+ else if (value.equals("ultra_expanded")) stretch = OS.PANGO_STRETCH_ULTRA_EXPANDED;
+ if (stretch != -1) {
+ OS.pango_font_description_set_stretch(fontDesc, stretch);
+ createFont = true;
+ }
+ } else if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_WEIGHT)))) {
+ // weight of the characters
+ int weight = Integer.parseInt(value);
+ OS.pango_font_description_set_weight(fontDesc, weight);
+ createFont = true;
+ } else if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_FG_COLOR)))) {
+ // RGB value of the format "u,u,u"
+ style.foreground = colorFromString(display, value);
+ } else if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_BG_COLOR)))) {
+ // RGB value of the format "u,u,u"
+ style.background = colorFromString(display, value);
+ } else {
+ //TODO language and direction
+ }
+ } catch (NumberFormatException ex) {}
+ }
+ current = OS.g_slist_next (current);
+ }
+ if (createFont) {
+ style.font = Font.gtk_new(display, fontDesc);
+ }
+
+ AccessibleTextAttributeEvent event = new AccessibleTextAttributeEvent(accessible);
+ event.start = (int)/*64*/start_offset;
+ event.end = (int)/*64*/end_offset;
+ event.textStyle = style;
+ event.attributes = attributes;
+ for (int i = 0; i < length; i++) {
+ AccessibleEditableTextListener listener = (AccessibleEditableTextListener) listeners.elementAt(i);
+ listener.setTextAttributes(event);
+ }
+ if (style.font != null) {
+ style.font.dispose();
+ }
+ if (style.foreground != null) {
+ style.foreground.dispose();
+ }
+ if (style.background != null) {
+ style.background.dispose();
+ }
+ return ACC.OK.equals(event.result) ? 1 : 0;
+ }
+ }
+ int /*long*/ parentResult = 0;
+ AtkEditableTextIface iface = getEditableTextIface (atkObject);
+ if (iface != null && iface.set_run_attributes != 0) {
+ parentResult = ATK.call (iface.set_run_attributes, atkObject, attrib_set, start_offset, end_offset);
+ }
+ return parentResult;
+ }
+
+ /*
+ * Return a Color given a string of the form "n,n,n".
+ * @param display must be the display for the accessible's control
+ * @param rgbString must not be null
+ */
+ static Color colorFromString(Display display, String rgbString) {
+ try {
+ int comma1 = rgbString.indexOf(',');
+ int comma2 = rgbString.indexOf(',', comma1 + 1);
+ int r = Integer.parseInt(rgbString.substring(0, comma1));
+ int g = Integer.parseInt(rgbString.substring(comma1 + 1, comma2));
+ int b = Integer.parseInt(rgbString.substring(comma2 + 1, rgbString.length()));
+ return new Color(display, r, g, b);
+ } catch (NumberFormatException ex) {}
+ return null;
+ }
+
+// void atk_editable_text_set_text_contents (AtkEditableText *text, const gchar *string);
+ static int /*long*/ atkEditableText_set_text_contents (int /*long*/ atkObject, int /*long*/ string) {
+ if (DEBUG) print ("-->atkEditableText_set_text_contents");
+ AccessibleObject object = getAccessibleObject (atkObject);
+ if (object != null) {
+ Accessible accessible = object.accessible;
+ Vector listeners = accessible.accessibleEditableTextListeners;
+ int length = listeners.size();
+ if (length > 0) {
+ AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(accessible);
+ event.start = 0;
+ String text = object.getText ();
+ event.end = text == null ? 0 : text.length ();
+ event.string = getString (string);
+ for (int i = 0; i < length; i++) {
+ AccessibleEditableTextListener listener = (AccessibleEditableTextListener) listeners.elementAt(i);
+ listener.replaceText(event);
+ }
+ return ACC.OK.equals(event.result) ? 1 : 0;
+ }
+ }
+ int /*long*/ parentResult = 0;
+ AtkEditableTextIface iface = getEditableTextIface (atkObject);
+ if (iface != null && iface.set_text_contents != 0) {
+ parentResult = ATK.call (iface.set_text_contents, atkObject, string);
+ }
+ return parentResult;
+ }
+
+// void atk_editable_text_insert_text (AtkEditableText *text, const gchar *string, gint length, gint *position);
+ static int /*long*/ atkEditableText_insert_text (int /*long*/ atkObject, int /*long*/ string, int /*long*/ string_length, int /*long*/ position) {
+ if (DEBUG) print ("-->atkEditableText_insert_text");
+ AccessibleObject object = getAccessibleObject (atkObject);
+ if (object != null) {
+ Accessible accessible = object.accessible;
+ Vector listeners = accessible.accessibleEditableTextListeners;
+ int length = listeners.size();
+ if (length > 0) {
+ AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(accessible);
+ int[] pos = new int [1];
+ OS.memmove (pos, position, OS.PTR_SIZEOF);
+ event.start = event.end = pos[0];
+ event.string = getString (string);
+ for (int i = 0; i < length; i++) {
+ AccessibleEditableTextListener listener = (AccessibleEditableTextListener) listeners.elementAt(i);
+ listener.replaceText(event);
+ }
+ return ACC.OK.equals(event.result) ? 1 : 0;
+ }
+ }
+ int /*long*/ parentResult = 0;
+ AtkEditableTextIface iface = getEditableTextIface (atkObject);
+ if (iface != null && iface.insert_text != 0) {
+ parentResult = ATK.call (iface.insert_text, atkObject, string, string_length, position);
+ }
+ return parentResult;
+ }
+
+// void atk_editable_text_copy_text (AtkEditableText *text, gint start_pos, gint end_pos);
+ static int /*long*/ atkEditableText_copy_text(int /*long*/ atkObject, int /*long*/ start_pos, int /*long*/ end_pos) {
+ if (DEBUG) print ("-->atkEditableText_copy_text");
+ AccessibleObject object = getAccessibleObject (atkObject);
+ if (object != null) {
+ Accessible accessible = object.accessible;
+ Vector listeners = accessible.accessibleEditableTextListeners;
+ int length = listeners.size();
+ if (length > 0) {
+ AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(accessible);
+ event.start = (int)/*64*/start_pos;
+ event.end = (int)/*64*/end_pos;
+ for (int i = 0; i < length; i++) {
+ AccessibleEditableTextListener listener = (AccessibleEditableTextListener) listeners.elementAt(i);
+ listener.copyText(event);
+ }
+ return ACC.OK.equals(event.result) ? 1 : 0;
+ }
+ }
+ int /*long*/ parentResult = 0;
+ AtkEditableTextIface iface = getEditableTextIface (atkObject);
+ if (iface != null && iface.copy_text != 0) {
+ parentResult = ATK.call (iface.copy_text, atkObject, start_pos, end_pos);
+ }
+ return parentResult;
+ }
+
+// void atk_editable_text_cut_text (AtkEditableText *text, gint start_pos, gint end_pos);
+ static int /*long*/ atkEditableText_cut_text (int /*long*/ atkObject, int /*long*/ start_pos, int /*long*/ end_pos) {
+ if (DEBUG) print ("-->atkEditableText_cut_text");
+ AccessibleObject object = getAccessibleObject (atkObject);
+ if (object != null) {
+ Accessible accessible = object.accessible;
+ Vector listeners = accessible.accessibleEditableTextListeners;
+ int length = listeners.size();
+ if (length > 0) {
+ AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(accessible);
+ event.start = (int)/*64*/start_pos;
+ event.end = (int)/*64*/end_pos;
+ for (int i = 0; i < length; i++) {
+ AccessibleEditableTextListener listener = (AccessibleEditableTextListener) listeners.elementAt(i);
+ listener.cutText(event);
+ }
+ return ACC.OK.equals(event.result) ? 1 : 0;
+ }
+ }
+ int /*long*/ parentResult = 0;
+ AtkEditableTextIface iface = getEditableTextIface (atkObject);
+ if (iface != null && iface.cut_text != 0) {
+ parentResult = ATK.call (iface.cut_text, atkObject, start_pos, end_pos);
+ }
+ return parentResult;
+ }
+
+// void atk_editable_text_delete_text (AtkEditableText *text, gint start_pos, gint end_pos);
+ static int /*long*/ atkEditableText_delete_text (int /*long*/ atkObject, int /*long*/ start_pos, int /*long*/ end_pos) {
+ if (DEBUG) print ("-->atkEditableText_delete_text");
+ AccessibleObject object = getAccessibleObject (atkObject);
+ if (object != null) {
+ Accessible accessible = object.accessible;
+ Vector listeners = accessible.accessibleEditableTextListeners;
+ int length = listeners.size();
+ if (length > 0) {
+ AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(accessible);
+ event.start = (int)/*64*/start_pos;
+ event.end = (int)/*64*/end_pos;
+ event.string = "";
+ for (int i = 0; i < length; i++) {
+ AccessibleEditableTextListener listener = (AccessibleEditableTextListener) listeners.elementAt(i);
+ listener.replaceText(event);
+ }
+ return ACC.OK.equals(event.result) ? 1 : 0;
+ }
+ }
+ int /*long*/ parentResult = 0;
+ AtkEditableTextIface iface = getEditableTextIface (atkObject);
+ if (iface != null && iface.delete_text != 0) {
+ parentResult = ATK.call (iface.delete_text, atkObject, start_pos, end_pos);
+ }
+ return parentResult;
+ }
+
+// void atk_editable_text_paste_text (AtkEditableText *text, gint position);
+ static int /*long*/ atkEditableText_paste_text (int /*long*/ atkObject, int /*long*/ position) {
+ if (DEBUG) print ("-->atkEditableText_paste_text");
+ AccessibleObject object = getAccessibleObject (atkObject);
+ if (object != null) {
+ Accessible accessible = object.accessible;
+ Vector listeners = accessible.accessibleEditableTextListeners;
+ int length = listeners.size();
+ if (length > 0) {
+ AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(accessible);
+ event.start = (int)/*64*/position;
+ for (int i = 0; i < length; i++) {
+ AccessibleEditableTextListener listener = (AccessibleEditableTextListener) listeners.elementAt(i);
+ listener.pasteText(event);
+ }
+ return ACC.OK.equals(event.result) ? 1 : 0;
+ }
+ }
+ int /*long*/ parentResult = 0;
+ AtkEditableTextIface iface = getEditableTextIface (atkObject);
+ if (iface != null && iface.paste_text != 0) {
+ parentResult = ATK.call (iface.paste_text, atkObject, position);
+ }
+ return parentResult;
+ }
+
static AtkHypertextIface getHypertextIface (int /*long*/ atkObject) {
if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_HYPERTEXT())) {
AtkHypertextIface iface = new AtkHypertextIface ();
diff --git a/org/eclipse/swt/accessibility/AccessibleTableCellEvent.java b/org/eclipse/swt/accessibility/AccessibleTableCellEvent.java
index 47ceff4..59c6fe6 100644
--- a/org/eclipse/swt/accessibility/AccessibleTableCellEvent.java
+++ b/org/eclipse/swt/accessibility/AccessibleTableCellEvent.java
@@ -47,7 +47,7 @@ public AccessibleTableCellEvent(Object source) {
* @return a string representation of the event
*/
public String toString () {
- return "AccessibleTableCellEvent {"
+ return "AccessibleTableCellEvent {" //$NON-NLS-1$
+ " accessibles=" + accessibles //$NON-NLS-1$
+ " isSelected=" + isSelected //$NON-NLS-1$
+ " count=" + count //$NON-NLS-1$
diff --git a/org/eclipse/swt/accessibility/AccessibleTableEvent.java b/org/eclipse/swt/accessibility/AccessibleTableEvent.java
index a4dcc9b..ff059d7 100644
--- a/org/eclipse/swt/accessibility/AccessibleTableEvent.java
+++ b/org/eclipse/swt/accessibility/AccessibleTableEvent.java
@@ -56,7 +56,7 @@ public AccessibleTableEvent(Object source) {
* @return a string representation of the event
*/
public String toString () {
- return "AccessibleTableEvent {"
+ return "AccessibleTableEvent {" //$NON-NLS-1$
+ "accessible=" + accessible //$NON-NLS-1$
+ " accessibles=" + accessibles //$NON-NLS-1$
+ " string=" + result //$NON-NLS-1$
diff --git a/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java b/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java
index 96dc631..aa6ccfa 100644
--- a/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java
+++ b/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,21 +15,61 @@ import org.eclipse.swt.internal.*;
/**
* Instances of this class are sent as a result of accessibility clients
- * sending AccessibleAttribute messages to an accessible object.
+ * sending AccessibleAttribute or AccessibleEditableText messages to an
+ * accessible object.
*
* @see AccessibleAttributeListener
* @see AccessibleAttributeAdapter
+ * @see AccessibleEditableTextListener
+ * @see AccessibleEditableTextAdapter
*
* @since 3.6
*/
public class AccessibleTextAttributeEvent extends SWTEventObject {
+ /**
+ * [in] the 0-based text offset for which to return attribute information
+ *
+ * @see AccessibleAttributeListener#getTextAttributes
+ */
public int offset;
+
+ /**
+ * [in/out] the starting and ending offsets of the character range
+ *
+ * @see AccessibleAttributeListener#getTextAttributes
+ * @see AccessibleEditableTextListener#setTextAttributes
+ */
public int start, end;
+
+ /**
+ * [in/out] the TextStyle of the character range
+ *
+ * @see AccessibleAttributeListener#getTextAttributes
+ * @see AccessibleEditableTextListener#setTextAttributes
+ */
public TextStyle textStyle;
+
+ /**
+ * [in/out] an array of alternating key and value Strings
+ * that represent attributes that do not correspond to TextStyle fields
+ *
+ * @see AccessibleAttributeListener#getTextAttributes
+ * @see AccessibleEditableTextListener#setTextAttributes
+ */
public String [] attributes;
- static final long serialVersionUID = 0L; // TODO: run serialver -show
+ /**
+ * [out] Set this field to {@link ACC#OK} if the operation
+ * was completed successfully, and null otherwise.
+ *
+ * @see AccessibleEditableTextListener#setTextAttributes
+ *
+ * @since 3.7
+ */
+ public String result;
+
+ static final long serialVersionUID = 7131825608864332802L;
/**
* Constructs a new instance of this class.
@@ -47,11 +87,23 @@ public AccessibleTextAttributeEvent(Object source) {
* @return a string representation of the event
*/
public String toString () {
- return "AccessibleAttributeEvent {"
+ return "AccessibleAttributeEvent {" //$NON-NLS-1$
+ " offset=" + offset //$NON-NLS-1$
- + " startOffset=" + start //$NON-NLS-1$
- + " endOffset=" + end //$NON-NLS-1$
+ + " start=" + start //$NON-NLS-1$
+ + " end=" + end //$NON-NLS-1$
+ " textStyle=" + textStyle //$NON-NLS-1$
+ + " attributes=" + toAttributeString(attributes) //$NON-NLS-1$
+ + " result=" + result //$NON-NLS-1$
+ "}"; //$NON-NLS-1$
}
+
+String toAttributeString(String [] attributes) {
+ if (attributes == null || attributes.length == 0) return "" + attributes; //$NON-NLS-1$
+ StringBuffer attributeString = new StringBuffer();
+ for (int i = 0; i < attributes.length; i++) {
+ attributeString.append(attributes[i]);
+ attributeString.append((i % 2 == 0) ? ":" : ";"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return attributeString.toString();
+}
}
diff --git a/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java b/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java
index c4374ef..59ec5df 100644
--- a/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java
+++ b/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java
@@ -16,8 +16,8 @@ package org.eclipse.swt.accessibility;
* <p>
* After creating an instance of a class that implements
* this interface it can be added to an accessible using the
- * <code>addAccessibleTextExtendedListener</code> method and removed using
- * the <code>removeAccessibleTextExtendedListener</code> method.
+ * <code>addAccessibleTextListener</code> method and removed using
+ * the <code>removeAccessibleTextListener</code> method.
* </p>
*
* @see AccessibleTextExtendedAdapter
diff --git a/org/eclipse/swt/accessibility/AccessibleValueEvent.java b/org/eclipse/swt/accessibility/AccessibleValueEvent.java
index de42982..5c4b579 100644
--- a/org/eclipse/swt/accessibility/AccessibleValueEvent.java
+++ b/org/eclipse/swt/accessibility/AccessibleValueEvent.java
@@ -43,7 +43,7 @@ public AccessibleValueEvent(Object source) {
* @return a string representation of the event
*/
public String toString () {
- return "AccessibleValueEvent {"
+ return "AccessibleValueEvent {" //$NON-NLS-1$
+ "value=" + value //$NON-NLS-1$
+ "}"; //$NON-NLS-1$
}
diff --git a/org/eclipse/swt/browser/Browser.java b/org/eclipse/swt/browser/Browser.java
index 88c8297..7914e1c 100644
--- a/org/eclipse/swt/browser/Browser.java
+++ b/org/eclipse/swt/browser/Browser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,11 +23,14 @@ import org.eclipse.swt.widgets.*;
* </p>
* <dl>
* <dt><b>Styles:</b></dt>
- * <dd>MOZILLA</dd>
+ * <dd>MOZILLA, WEBKIT</dd>
* <dt><b>Events:</b></dt>
* <dd>CloseWindowListener, LocationListener, OpenWindowListener, ProgressListener, StatusTextListener, TitleListener, VisibilityWindowListener</dd>
* </dl>
* <p>
+ * Note: At most one of the styles MOZILLA and WEBKIT may be specified.
+ * </p>
+ * <p>
* IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
@@ -83,45 +86,15 @@ public Browser (Composite parent, int style) {
userStyle = style;
String platform = SWT.getPlatform ();
- Display display = parent.getDisplay ();
- if ("gtk".equals (platform)) display.setData (NO_INPUT_METHOD, null); //$NON-NLS-1$
- String classNames[] = null;
- if ((style & SWT.MOZILLA) != 0) {
- classNames = new String[] {"org.eclipse.swt.browser.Mozilla"}; //$NON-NLS-1$
- } else {
- if ("win32".equals (platform) || "wpf".equals (platform)) { //$NON-NLS-1$ $NON-NLS-2$
- classNames = new String[] {"org.eclipse.swt.browser.IE"}; //$NON-NLS-1$
- } else if ("motif".equals (platform)) { //$NON-NLS-1$
- classNames = new String[] {"org.eclipse.swt.browser.Mozilla"}; //$NON-NLS-1$
- } else if ("gtk".equals (platform)) { //$NON-NLS-1$
- String property = System.getProperty (PROPERTY_USEWEBKITGTK);
- if (property != null && property.equalsIgnoreCase ("true")) { //$NON-NLS-1$
- classNames = new String[] {"org.eclipse.swt.browser.WebKit", "org.eclipse.swt.browser.Mozilla"}; //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- classNames = new String[] {"org.eclipse.swt.browser.Mozilla"}; //$NON-NLS-1$
- }
- } else if ("carbon".equals (platform) || "cocoa".equals (platform)) { //$NON-NLS-1$
- classNames = new String[] {"org.eclipse.swt.browser.Safari"}; //$NON-NLS-1$
- } else if ("photon".equals (platform)) { //$NON-NLS-1$
- classNames = new String[] {"org.eclipse.swt.browser.Voyager"}; //$NON-NLS-1$
- } else {
- dispose ();
- SWT.error (SWT.ERROR_NO_HANDLES);
- }
+ if ("gtk".equals (platform)) { //$NON-NLS-1$
+ parent.getDisplay ().setData (NO_INPUT_METHOD, null);
}
- for (int i = 0; i < classNames.length; i++) {
- try {
- Class clazz = Class.forName (classNames[i]);
- webBrowser = (WebBrowser)clazz.newInstance ();
- if (webBrowser != null) {
- webBrowser.setBrowser (this);
- if (webBrowser.create (parent, style)) return;
- }
- } catch (ClassNotFoundException e) {
- } catch (IllegalAccessException e) {
- } catch (InstantiationException e) {
- }
+ webBrowser = new BrowserFactory ().createWebBrowser (style);
+ if (webBrowser != null) {
+ webBrowser.setBrowser (this);
+ webBrowser.create (parent, style);
+ return;
}
dispose ();
SWT.error (SWT.ERROR_NO_HANDLES);
@@ -149,8 +122,11 @@ static Composite checkParent (Composite parent) {
}
static int checkStyle(int style) {
+ if ((style & (SWT.MOZILLA | SWT.WEBKIT)) == (SWT.MOZILLA | SWT.WEBKIT)) {
+ style &= ~SWT.WEBKIT;
+ }
String platform = SWT.getPlatform ();
- if ((style & SWT.MOZILLA) != 0) {
+ if ((style & SWT.MOZILLA) != 0 || (style & SWT.WEBKIT) != 0) {
if ("carbon".equals (platform)) return style | SWT.EMBEDDED; //$NON-NLS-1$
if ("motif".equals (platform)) return style | SWT.EMBEDDED; //$NON-NLS-1$
return style;
diff --git a/org/eclipse/swt/browser/BrowserFactory.java b/org/eclipse/swt/browser/BrowserFactory.java
new file mode 100644
index 0000000..37a332a
--- /dev/null
+++ b/org/eclipse/swt/browser/BrowserFactory.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.browser;
+
+import org.eclipse.swt.SWT;
+
+class BrowserFactory {
+
+ static boolean mozillaLibsLoaded;
+
+WebBrowser createWebBrowser (int style) {
+ boolean webkitInstalled = WebKit.isInstalled ();
+ if ((style & SWT.MOZILLA) != 0 || (!webkitInstalled && (style & SWT.WEBKIT) == 0)) {
+ mozillaLibsLoaded = true;
+ return new Mozilla ();
+ }
+ if (!webkitInstalled) return null;
+
+ /*
+ * A crash can occur if XULRunner-1.9.2.x is loaded into a process where WebKit has
+ * already been loaded, as a result of conflicting versions of the sqlite3 library.
+ * Loading these native renderers in the reverse order does not cause a problem. The
+ * crash workaround is to ensure that Mozilla's libraries (if available) are always
+ * loaded before WebKit's.
+ */
+ if (!mozillaLibsLoaded) {
+ mozillaLibsLoaded = true;
+ Mozilla.LoadLibraries ();
+ }
+ return new WebKit ();
+}
+
+}
diff --git a/org/eclipse/swt/browser/BrowserFunction.java b/org/eclipse/swt/browser/BrowserFunction.java
index f87aef0..b77ed22 100644
--- a/org/eclipse/swt/browser/BrowserFunction.java
+++ b/org/eclipse/swt/browser/BrowserFunction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.swt.browser;
+import java.util.Random;
+
import org.eclipse.swt.*;
/**
@@ -46,6 +48,7 @@ public class BrowserFunction {
String functionString;
int index;
boolean isEvaluate;
+ long token;
/**
* Constructs a new instance of this class, which will be invokable
@@ -83,6 +86,10 @@ BrowserFunction (Browser browser, String name, boolean create) {
browser.checkWidget ();
this.browser = browser;
this.name = name;
+
+ Random random = new Random ();
+ long value = random.nextLong ();
+ token = ((value & 0xFFE0000000000000L) >>> 11) ^ (value & 0x1FFFFFFFFFFFFFL);
if (create) browser.webBrowser.createFunction (this);
}
@@ -119,12 +126,14 @@ void dispose (boolean remove) {
* javascript boolean -> <code>java.lang.Boolean</code>
* javascript array whose elements are all of supported types -> <code>java.lang.Object[]</code>
*
- * If any of the Javascript arguments are of unsupported types then the
+ * If any of the javascript arguments are of unsupported types then the
* function invocation will fail and this method will not be called.
*
- * This method must return a value with one of these supported types to
- * the javascript caller (note that any subclass of <code>java.lang.Number</code>
- * will be successfully converted to a javascript number).
+ * This method must return a value with one of these supported java types to
+ * the javascript caller. Note that <code>null</code> values are converted
+ * to javascript's <code>null</code> value (not <code>undefined</code>), and
+ * instances of any <code>java.lang.Number</code> subclass will be converted
+ * to a javascript number.
*
* @param arguments the javascript arguments converted to java equivalents
* @return the value to return to the javascript caller
diff --git a/org/eclipse/swt/browser/External.java b/org/eclipse/swt/browser/External.java
index e888c32..f971969 100644
--- a/org/eclipse/swt/browser/External.java
+++ b/org/eclipse/swt/browser/External.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -68,11 +68,11 @@ void createCOMInterfaces () {
public int /*long*/ method6 (int /*long*/[] args) {return canSetProperty (args[0], args[1], args[2]);}
};
- external = new XPCOMObject (new int[] {2, 0, 0, 3}) {
+ external = new XPCOMObject (new int[] {2, 0, 0, 4}) {
public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
- public int /*long*/ method3 (int /*long*/[] args) {return callJava ((int)/*64*/args[0], args[1], args[2]);}
+ public int /*long*/ method3 (int /*long*/[] args) {return callJava ((int)/*64*/args[0], args[1], args[2], args[3]);}
};
}
@@ -475,7 +475,7 @@ nsIVariant convertToJS (Object value, nsIComponentManager componentManager) {
result[0] = 0;
if (value == null) {
- rc = variant.SetAsVoid ();
+ rc = variant.SetAsEmpty ();
if (rc != XPCOM.NS_OK) Mozilla.error (rc);
return variant;
}
@@ -541,25 +541,35 @@ nsIVariant convertToJS (Object value, nsIComponentManager componentManager) {
return null;
}
-int callJava (int functionId, int /*long*/ args, int /*long*/ returnPtr) {
+int callJava (int functionId, int /*long*/ tokenVariant, int /*long*/ args, int /*long*/ returnPtr) {
Object key = new Integer (functionId);
BrowserFunction function = (BrowserFunction)Mozilla.AllFunctions.get (key);
Object returnValue = null;
if (function != null) {
- short[] type = new short[1]; /* PRUint16 */
- nsIVariant variant = new nsIVariant (args);
- int rc = variant.GetDataType (type);
- if (rc != XPCOM.NS_OK) Mozilla.error (rc);
try {
- Object temp = (Object[])convertToJava (variant, type[0]);
- if (temp instanceof Object[]) {
- Object[] arguments = (Object[])temp;
- try {
- returnValue = function.function (arguments);
- } catch (Exception e) {
- /* exception during function invocation */
- returnValue = WebBrowser.CreateErrorString (e.getLocalizedMessage ());
+ short[] type = new short[1]; /* PRUint16 */
+ nsIVariant variant = new nsIVariant (tokenVariant);
+ int rc = variant.GetDataType (type);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ Object temp = convertToJava (variant, type[0]);
+ type[0] = 0;
+ if (temp instanceof Number) {
+ long token = ((Number)temp).longValue ();
+ if (token == function.token) {
+ variant = new nsIVariant (args);
+ rc = variant.GetDataType (type);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ temp = convertToJava (variant, type[0]);
+ if (temp instanceof Object[]) {
+ Object[] arguments = (Object[])temp;
+ try {
+ returnValue = function.function (arguments);
+ } catch (Exception e) {
+ /* exception during function invocation */
+ returnValue = WebBrowser.CreateErrorString (e.getLocalizedMessage ());
+ }
+ }
}
}
} catch (IllegalArgumentException e) {
diff --git a/org/eclipse/swt/browser/Mozilla.java b/org/eclipse/swt/browser/Mozilla.java
index af44dda..78944cc 100644
--- a/org/eclipse/swt/browser/Mozilla.java
+++ b/org/eclipse/swt/browser/Mozilla.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -62,22 +62,25 @@ class Mozilla extends WebBrowser {
static int BrowserCount, NextJSFunctionIndex = 1;
static Hashtable AllFunctions = new Hashtable ();
static Listener DisplayListener;
- static boolean Initialized, IsPre_1_8, IsPre_1_9, PerformedVersionCheck, XPCOMWasGlued, XPCOMInitWasGlued;
+ static boolean Initialized, IsPre_1_8, IsPre_1_9, IsXULRunner, PerformedVersionCheck, XPCOMWasGlued, XPCOMInitWasGlued;
+ static String MozillaPath;
static String oldProxyHostFTP, oldProxyHostHTTP, oldProxyHostSSL;
static int oldProxyPortFTP = -1, oldProxyPortHTTP = -1, oldProxyPortSSL = -1, oldProxyType = -1;
static byte[] pathBytes_JSEvaluateUCScriptForPrincipals;
static byte[] pathBytes_NSFree;
/* XULRunner detect constants */
+ static final String GCC3 = "-gcc3"; //$NON-NLS-1$
static final String GRERANGE_LOWER = "1.8.1.2"; //$NON-NLS-1$
static final String GRERANGE_LOWER_FALLBACK = "1.8"; //$NON-NLS-1$
static final boolean LowerRangeInclusive = true;
static final String GRERANGE_UPPER = "1.9.*"; //$NON-NLS-1$
static final boolean UpperRangeInclusive = true;
+ static final String PROPERTY_ABI = "abi"; //$NON-NLS-1$
static final int MAX_PORT = 65535;
static final String DEFAULTVALUE_STRING = "default"; //$NON-NLS-1$
- static final String SEPARATOR_OS = System.getProperty ("file.separator"); //$NON-NLS-1$
+ static final char SEPARATOR_OS = System.getProperty ("file.separator").charAt (0); //$NON-NLS-1$
static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
static final String DISPOSE_LISTENER_HOOKED = "org.eclipse.swt.browser.Mozilla.disposeListenerHooked"; //$NON-NLS-1$
static final String HEADER_CONTENTTYPE = "Content-Type"; //$NON-NLS-1
@@ -106,10 +109,12 @@ class Mozilla extends WebBrowser {
static final String SHUTDOWN_PERSIST = "shutdown-persist"; //$NON-NLS-1$
static final String STARTUP = "startup"; //$NON-NLS-1$
static final String TOKENIZER_LOCALE = ","; //$NON-NLS-1$
+ static final String TRUE = "true"; //$NON-NLS-1$
static final String URI_FILEROOT = "file:///"; //$NON-NLS-1$
static final String XULRUNNER_PATH = "org.eclipse.swt.browser.XULRunnerPath"; //$NON-NLS-1$
// TEMPORARY CODE
+ static final String FACTORIES_REGISTERED = "org.eclipse.swt.browser.MozillaFactoriesRegistered"; //$NON-NLS-1$
static final String GRE_INITIALIZED = "org.eclipse.swt.browser.XULRunnerInitialized"; //$NON-NLS-1$
static {
@@ -207,7 +212,7 @@ class Mozilla extends WebBrowser {
XPCOMInit.XPCOMGlueShutdown ();
XPCOMInitWasGlued = false;
}
- Initialized = false;
+ Initialized = PerformedVersionCheck = false;
}
void revertProxySettings (nsIPrefService prefService) {
@@ -528,117 +533,143 @@ class Mozilla extends WebBrowser {
};
}
-public boolean create (Composite parent, int style) {
- delegate = new MozillaDelegate (browser);
- final Display display = parent.getDisplay ();
+static String Arch () {
+ String osArch = System.getProperty("os.arch"); //$NON-NLS-1$
+ if (osArch.equals ("i386") || osArch.equals ("i686")) return "x86"; //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
+ if (osArch.equals ("amd64")) return "x86_64"; //$NON-NLS-1$ $NON-NLS-2$
+ if (osArch.equals ("IA64N")) return "ia64_32"; //$NON-NLS-1$ $NON-NLS-2$
+ if (osArch.equals ("IA64W")) return "ia64"; //$NON-NLS-1$ $NON-NLS-2$
+ return osArch;
+}
- int /*long*/[] result = new int /*long*/[1];
- if (!Initialized) {
- boolean initLoaded = false;
- boolean isXULRunner = false;
+static void LoadLibraries () {
+ boolean initLoaded = false;
- String greInitialized = System.getProperty (GRE_INITIALIZED);
- if ("true".equals (greInitialized)) { //$NON-NLS-1$
- /*
- * Another browser has already initialized xulrunner in this process,
- * so just bind to it instead of trying to initialize a new one.
- */
- Initialized = true;
- }
+ String greInitialized = System.getProperty (GRE_INITIALIZED);
+ if (TRUE.equals (greInitialized)) {
+ /*
+ * Another browser has already initialized xulrunner in this process,
+ * so just bind to it instead of trying to initialize a new one.
+ */
+ Initialized = true;
+ }
- String mozillaPath = System.getProperty (XULRUNNER_PATH);
- /*
- * Browser clients that ship XULRunner in a plug-in must have an opportunity
- * to set the org.eclipse.swt.browser.XULRunnerPath system property to point
- * at their XULRunner before the first Mozilla-based Browser is created. To
- * facilitate this, reflection is used to reference non-existent class
- * org.eclipse.swt.browser.XULRunnerInitializer the first time a Mozilla-
- * based Browser is created. A client wishing to use this hook can do so
- * by creating a fragment of org.eclipse.swt that implements this class and
- * sets the system property in its static initializer.
- */
- if (mozillaPath == null) {
- try {
- Class.forName ("org.eclipse.swt.browser.XULRunnerInitializer"); //$NON-NLS-1$
- mozillaPath = System.getProperty (XULRUNNER_PATH);
- } catch (ClassNotFoundException e) {
- /* no fragment is providing this class, which is the typical case */
- }
+ MozillaPath = System.getProperty (XULRUNNER_PATH);
+ /*
+ * Browser clients that ship XULRunner in a plug-in must have an opportunity
+ * to set the org.eclipse.swt.browser.XULRunnerPath system property to point
+ * at their XULRunner before the first Mozilla-based Browser is created. To
+ * facilitate this, reflection is used to reference non-existent class
+ * org.eclipse.swt.browser.XULRunnerInitializer the first time a Mozilla-
+ * based Browser is created. A client wishing to use this hook can do so
+ * by creating a fragment of org.eclipse.swt that implements this class and
+ * sets the system property in its static initializer.
+ */
+ if (MozillaPath == null) {
+ try {
+ Class.forName ("org.eclipse.swt.browser.XULRunnerInitializer"); //$NON-NLS-1$
+ MozillaPath = System.getProperty (XULRUNNER_PATH);
+ } catch (ClassNotFoundException e) {
+ /* no fragment is providing this class, which is the typical case */
}
+ }
- if (mozillaPath == null) {
- try {
- String libName = delegate.getSWTInitLibraryName ();
- Library.loadLibrary (libName);
- initLoaded = true;
- } catch (UnsatisfiedLinkError e) {
- /*
- * If this library failed to load then do not attempt to detect a
- * xulrunner to use. The Browser may still be usable if MOZILLA_FIVE_HOME
- * points at a GRE.
- */
- }
+ if (MozillaPath == null) {
+ try {
+ String libName = MozillaDelegate.GetSWTInitLibraryName ();
+ Library.loadLibrary (libName);
+ initLoaded = true;
+ } catch (UnsatisfiedLinkError e) {
+ /*
+ * If this library failed to load then do not attempt to detect a
+ * xulrunner to use. The Browser may still be usable if MOZILLA_FIVE_HOME
+ * points at a GRE.
+ */
+ }
+ } else {
+ /* ensure that client-supplied path is using correct separators */
+ if (SEPARATOR_OS == '/') {
+ MozillaPath = MozillaPath.replace ('\\', SEPARATOR_OS);
} else {
- mozillaPath += SEPARATOR_OS + MozillaDelegate.getLibraryName ();
- isXULRunner = true;
+ MozillaPath = MozillaPath.replace ('/', SEPARATOR_OS);
}
- if (initLoaded) {
- /* attempt to discover a XULRunner to use as the GRE */
- mozillaPath = initDiscoverXULRunner ();
- isXULRunner = mozillaPath.length () > 0;
+ MozillaPath += SEPARATOR_OS + MozillaDelegate.getLibraryName ();
+ IsXULRunner = true;
+ }
- /*
- * Test whether the detected XULRunner can be used as the GRE before loading swt's
- * XULRunner library. If it cannot be used then fall back to attempting to use
- * the GRE pointed to by MOZILLA_FIVE_HOME.
- *
- * One case where this will fail is attempting to use a 64-bit xulrunner while swt
- * is running in 32-bit mode, or vice versa.
- */
- if (isXULRunner) {
- byte[] path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true);
- int rc = XPCOMInit.XPCOMGlueStartup (path);
- if (rc != XPCOM.NS_OK) {
- mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS));
- if (Device.DEBUG) System.out.println ("cannot use detected XULRunner: " + mozillaPath); //$NON-NLS-1$
+ if (initLoaded) {
+ /* attempt to discover a XULRunner to use as the GRE */
+ MozillaPath = InitDiscoverXULRunner ();
+ IsXULRunner = MozillaPath.length () > 0;
- /* attempt to XPCOMGlueStartup the GRE pointed at by MOZILLA_FIVE_HOME */
- int /*long*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, XPCOM.MOZILLA_FIVE_HOME, true));
- if (ptr == 0) {
- isXULRunner = false;
+ /*
+ * Test whether the detected XULRunner can be used as the GRE before loading swt's
+ * XULRunner library. If it cannot be used then fall back to attempting to use
+ * the GRE pointed to by MOZILLA_FIVE_HOME.
+ *
+ * One case where this will fail is attempting to use a 64-bit xulrunner while swt
+ * is running in 32-bit mode, or vice versa.
+ */
+ if (IsXULRunner) {
+ byte[] bytes = MozillaDelegate.wcsToMbcs (null, MozillaPath, true);
+ int rc = XPCOMInit.XPCOMGlueStartup (bytes);
+ if (rc != XPCOM.NS_OK) {
+ MozillaPath = MozillaPath.substring (0, MozillaPath.lastIndexOf (SEPARATOR_OS));
+ if (Device.DEBUG) System.out.println ("cannot use detected XULRunner: " + MozillaPath); //$NON-NLS-1$
+
+ /* attempt to XPCOMGlueStartup the GRE pointed at by MOZILLA_FIVE_HOME */
+ int /*long*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, XPCOM.MOZILLA_FIVE_HOME, true));
+ if (ptr == 0) {
+ IsXULRunner = false;
+ } else {
+ int length = C.strlen (ptr);
+ bytes = new byte[length];
+ C.memmove (bytes, ptr, length);
+ MozillaPath = new String (MozillaDelegate.mbcsToWcs (null, bytes));
+ /*
+ * Attempting to XPCOMGlueStartup a mozilla-based GRE != xulrunner can
+ * crash, so don't attempt unless the GRE appears to be xulrunner.
+ */
+ if (MozillaPath.indexOf ("xulrunner") == -1) { //$NON-NLS-1$
+ IsXULRunner = false;
} else {
- int length = C.strlen (ptr);
- byte[] buffer = new byte[length];
- C.memmove (buffer, ptr, length);
- mozillaPath = new String (MozillaDelegate.mbcsToWcs (null, buffer));
- /*
- * Attempting to XPCOMGlueStartup a mozilla-based GRE != xulrunner can
- * crash, so don't attempt unless the GRE appears to be xulrunner.
- */
- if (mozillaPath.indexOf("xulrunner") == -1) { //$NON-NLS-1$
- isXULRunner = false;
- } else {
- mozillaPath += SEPARATOR_OS + MozillaDelegate.getLibraryName ();
- path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true);
- rc = XPCOMInit.XPCOMGlueStartup (path);
- if (rc != XPCOM.NS_OK) {
- isXULRunner = false;
- mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS));
- if (Device.DEBUG) System.out.println ("failed to start as XULRunner: " + mozillaPath); //$NON-NLS-1$
+ MozillaPath += SEPARATOR_OS + MozillaDelegate.getLibraryName ();
+ bytes = MozillaDelegate.wcsToMbcs (null, MozillaPath, true);
+ rc = XPCOMInit.XPCOMGlueStartup (bytes);
+ if (rc == XPCOM.NS_OK) {
+ /* ensure that client-supplied path is using correct separators */
+ if (SEPARATOR_OS == '/') {
+ MozillaPath = MozillaPath.replace ('\\', SEPARATOR_OS);
+ } else {
+ MozillaPath = MozillaPath.replace ('/', SEPARATOR_OS);
}
+ } else {
+ IsXULRunner = false;
+ MozillaPath = MozillaPath.substring (0, MozillaPath.lastIndexOf (SEPARATOR_OS));
+ if (Device.DEBUG) System.out.println ("failed to start as XULRunner: " + MozillaPath); //$NON-NLS-1$
}
- }
- }
- if (isXULRunner) {
- XPCOMInitWasGlued = true;
- }
+ }
+ }
+ }
+ if (IsXULRunner) {
+ XPCOMInitWasGlued = true;
}
}
+ }
+}
+
+public void create (Composite parent, int style) {
+ delegate = new MozillaDelegate (browser);
+ final Display display = parent.getDisplay ();
+
+ int /*long*/[] result = new int /*long*/[1];
+ if (!Initialized) {
+ LoadLibraries ();
- if (isXULRunner) {
+ if (IsXULRunner) {
/* load swt's xulrunner library and invoke XPCOMGlueStartup to load xulrunner's dependencies */
- mozillaPath = initXULRunner (mozillaPath);
+ MozillaPath = initXULRunner (MozillaPath);
} else {
/*
* If style SWT.MOZILLA was specified then this initialization has already
@@ -646,31 +677,31 @@ public boolean create (Composite parent, int style) {
*/
if ((style & SWT.MOZILLA) != 0) {
browser.dispose ();
- String errorString = (mozillaPath != null && mozillaPath.length () > 0) ?
- " [Failed to use detected XULRunner: " + mozillaPath + "]" :
+ String errorString = (MozillaPath != null && MozillaPath.length () > 0) ?
+ " [Failed to use detected XULRunner: " + MozillaPath + "]" :
" [Could not detect registered XULRunner to use]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
SWT.error (SWT.ERROR_NO_HANDLES, null, errorString);
}
/* load swt's mozilla library */
- mozillaPath = initMozilla (mozillaPath);
+ MozillaPath = initMozilla (MozillaPath);
}
if (!Initialized) {
/* create LocationProvider, which tells mozilla where to find things on the file system */
String profilePath = delegate.getProfilePath ();
- LocationProvider = new AppFileLocProvider (mozillaPath, profilePath, isXULRunner);
+ LocationProvider = new AppFileLocProvider (MozillaPath, profilePath, IsXULRunner);
LocationProvider.AddRef ();
/* write external.xpt to the file system if needed */
initExternal (profilePath);
/* load swt's mozilla/xulrunner library and invoke appropriate Init function */
- initXPCOM (mozillaPath, isXULRunner);
+ initXPCOM (MozillaPath, IsXULRunner);
}
/* attempt to initialize JavaXPCOM in the detected XULRunner */
- if (isXULRunner) initJavaXPCOM (mozillaPath);
+ if (IsXULRunner) initJavaXPCOM (MozillaPath);
/* get the nsIComponentManager and nsIServiceManager, used throughout initialization */
int rc = XPCOM.NS_GetComponentManager (result);
@@ -700,17 +731,31 @@ public boolean create (Composite parent, int style) {
/* init the event handler if needed */
initSpinup (componentManager);
+ /*
+ * Check for the property indicating that factories have already been registered,
+ * in which case this browser should not overwrite them with its own.
+ */
+ boolean factoriesRegistered = false;
+ String propertyString = System.getProperty (FACTORIES_REGISTERED);
+ if (TRUE.equals (propertyString)) {
+ factoriesRegistered = true;
+ }
+
/* init our WindowCreator, which mozilla uses for the creation of child browsers in external Shells */
- initWindowCreator (serviceManager);
+ if (!factoriesRegistered) {
+ initWindowCreator (serviceManager);
+ }
/* notify mozilla that the profile directory has been changed from its default value */
- initProfile (serviceManager, isXULRunner);
+ initProfile (serviceManager, IsXULRunner);
/* init preference values that give desired mozilla behaviours */
initPreferences (serviceManager, componentManager);
- /* init our various factories that mozilla can invoke as needed */
- initFactories (serviceManager, componentManager, isXULRunner);
+ /* init our various factories that mozilla can invoke as needed */
+ if (!factoriesRegistered) {
+ initFactories (serviceManager, componentManager, IsXULRunner);
+ }
serviceManager.Release ();
componentManager.Release ();
@@ -780,16 +825,28 @@ public boolean create (Composite parent, int style) {
nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]);
result[0] = 0;
- HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory ();
- dialogFactory.AddRef ();
- byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID, true);
- byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "swtHelperAppLauncherDialog", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory (XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName, aContractID, dialogFactory.getAddress ());
- if (rc != XPCOM.NS_OK) {
- browser.dispose ();
- error (rc);
+ /*
+ * Check for the property indicating that factories have already been registered,
+ * in which case this browser should not overwrite them with its own.
+ */
+ boolean factoriesRegistered = false;
+ String propertyString = System.getProperty (FACTORIES_REGISTERED);
+ if (TRUE.equals (propertyString)) {
+ factoriesRegistered = true;
+ }
+
+ if (!factoriesRegistered) {
+ HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory ();
+ dialogFactory.AddRef ();
+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID, true);
+ byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "swtHelperAppLauncherDialog", true); //$NON-NLS-1$
+ rc = componentRegistrar.RegisterFactory (XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName, aContractID, dialogFactory.getAddress ());
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ dialogFactory.Release ();
}
- dialogFactory.Release ();
/*
* Check for the availability of the pre-1.8 implementation of nsIDocShell
@@ -830,16 +887,18 @@ public boolean create (Composite parent, int style) {
new nsISupports (result[0]).Release ();
result[0] = 0;
- DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8 ();
- downloadFactory_1_8.AddRef ();
- aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_TRANSFER_CONTRACTID, true);
- aClassName = MozillaDelegate.wcsToMbcs (null, "swtTransfer", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory (XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory_1_8.getAddress ());
- if (rc != XPCOM.NS_OK) {
- browser.dispose ();
- error (rc);
+ if (!factoriesRegistered) {
+ DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8 ();
+ downloadFactory_1_8.AddRef ();
+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_TRANSFER_CONTRACTID, true);
+ byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "swtTransfer", true); //$NON-NLS-1$
+ rc = componentRegistrar.RegisterFactory (XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory_1_8.getAddress ());
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ downloadFactory_1_8.Release ();
}
- downloadFactory_1_8.Release ();
} else { /* >= 1.9 */
IsPre_1_9 = false;
}
@@ -847,6 +906,8 @@ public boolean create (Composite parent, int style) {
result[0] = 0;
interfaceRequestor.Release ();
componentRegistrar.Release ();
+
+ System.setProperty (FACTORIES_REGISTERED, TRUE);
}
componentManager.Release ();
@@ -930,8 +991,6 @@ public boolean create (Composite parent, int style) {
for (int i = 0; i < folderEvents.length; i++) {
browser.addListener (folderEvents[i], listener);
}
-
- return true;
}
public boolean back () {
@@ -1543,7 +1602,18 @@ public Object getWebBrowser () {
return null;
}
-String initDiscoverXULRunner () {
+static String InitDiscoverXULRunner () {
+ /*
+ * Up to three XULRunner detection attempts will be made:
+ *
+ * 1. A XULRunner with 1.8.1.2 <= version < 2.0, and with "abi" property matching
+ * the current runtime. Note that XULRunner registrations began including abi
+ * info as of version 1.9.x, so older versions than this will not be returned.
+ * 2. A XULRunner with 1.8.1.2 <= version < 2.0. XULRunner 1.8.1.2 is the oldest
+ * release that enables the Browser to expose its JavaXPCOM interfaces to clients.
+ * 3. A XULRunner with 1.8.0.1 <= version < 2.0.
+ */
+
GREVersionRange range = new GREVersionRange ();
byte[] bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_LOWER, true);
int /*long*/ lower = C.malloc (bytes.length);
@@ -1557,26 +1627,37 @@ String initDiscoverXULRunner () {
range.upper = upper;
range.upperInclusive = UpperRangeInclusive;
+ GREProperty property = new GREProperty ();
+ bytes = MozillaDelegate.wcsToMbcs (null, PROPERTY_ABI, true);
+ int /*long*/ name = C.malloc (bytes.length);
+ C.memmove (name, bytes, bytes.length);
+ property.property = name;
+ bytes = MozillaDelegate.wcsToMbcs (null, Arch () + GCC3, true);
+ int /*long*/ value = C.malloc (bytes.length);
+ C.memmove (value, bytes, bytes.length);
+ property.value = value;
+
int length = XPCOMInit.PATH_MAX;
int /*long*/ greBuffer = C.malloc (length);
- int /*long*/ propertiesPtr = C.malloc (2 * C.PTR_SIZEOF);
- int rc = XPCOMInit.GRE_GetGREPathWithProperties (range, 1, propertiesPtr, 0, greBuffer, length);
+ int rc = XPCOMInit.GRE_GetGREPathWithProperties (range, 1, property, 1, greBuffer, length);
- /*
- * A XULRunner was not found that supports wrapping of XPCOM handles as JavaXPCOM objects.
- * Drop the lower version bound and try to detect an earlier XULRunner installation.
- */
if (rc != XPCOM.NS_OK) {
- C.free (lower);
- bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_LOWER_FALLBACK, true);
- lower = C.malloc (bytes.length);
- C.memmove (lower, bytes, bytes.length);
- range.lower = lower;
- rc = XPCOMInit.GRE_GetGREPathWithProperties (range, 1, propertiesPtr, 0, greBuffer, length);
+ /* Fall back to attempt #2 */
+ rc = XPCOMInit.GRE_GetGREPathWithProperties (range, 1, property, 0, greBuffer, length); /* note: propertiesLength is 0 */
+ if (rc != XPCOM.NS_OK) {
+ /* Fall back to attempt #3 */
+ C.free (lower);
+ bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_LOWER_FALLBACK, true);
+ lower = C.malloc (bytes.length);
+ C.memmove (lower, bytes, bytes.length);
+ range.lower = lower;
+ rc = XPCOMInit.GRE_GetGREPathWithProperties (range, 1, property, 0, greBuffer, length); /* note: propertiesLength is 0 */
+ }
}
+ C.free (value);
+ C.free (name);
C.free (lower);
C.free (upper);
- C.free (propertiesPtr);
String result = null;
if (rc == XPCOM.NS_OK) {
@@ -1618,9 +1699,6 @@ void initExternal (String profilePath) {
void initFactories (nsIServiceManager serviceManager, nsIComponentManager componentManager, boolean isXULRunner) {
int /*long*/[] result = new int /*long*/[1];
- PromptService2Factory factory = new PromptService2Factory ();
- factory.AddRef ();
-
int rc = componentManager.QueryInterface (nsIComponentRegistrar.NS_ICOMPONENTREGISTRAR_IID, result);
if (rc != XPCOM.NS_OK) {
browser.dispose ();
@@ -1635,6 +1713,8 @@ void initFactories (nsIServiceManager serviceManager, nsIComponentManager compon
result[0] = 0;
componentRegistrar.AutoRegister (0); /* detect the External component */
+ PromptService2Factory factory = new PromptService2Factory ();
+ factory.AddRef ();
byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PROMPTSERVICE_CONTRACTID, true);
byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "swtPromptService", true); //$NON-NLS-1$
rc = componentRegistrar.RegisterFactory (XPCOM.NS_PROMPTSERVICE_CID, aClassName, aContractID, factory.getAddress ());
@@ -1734,6 +1814,13 @@ String initMozilla (String mozillaPath) {
byte[] buffer = new byte[length];
C.memmove (buffer, ptr, length);
mozillaPath = new String (MozillaDelegate.mbcsToWcs (null, buffer));
+
+ /* ensure that client-supplied path is using correct separators */
+ if (SEPARATOR_OS == '/') {
+ mozillaPath = mozillaPath.replace ('\\', SEPARATOR_OS);
+ } else {
+ mozillaPath = mozillaPath.replace ('/', SEPARATOR_OS);
+ }
} else {
browser.dispose ();
SWT.error (SWT.ERROR_NO_HANDLES, null, " [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]"); //$NON-NLS-1$
@@ -1826,7 +1913,7 @@ void initXPCOM (String mozillaPath, boolean isXULRunner) {
browser.dispose ();
SWT.error (SWT.ERROR_NO_HANDLES, null, " [MOZILLA_FIVE_HOME may not point at an embeddable GRE] [NS_InitEmbedding " + mozillaPath + " error " + rc + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- System.setProperty (GRE_INITIALIZED, "true"); //$NON-NLS-1$
+ System.setProperty (GRE_INITIALIZED, TRUE);
}
void initPreferences (nsIServiceManager serviceManager, nsIComponentManager componentManager) {
@@ -2384,6 +2471,7 @@ String initXULRunner (String mozillaPath) {
*/
return mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS));
}
+
public boolean isBackEnabled () {
int /*long*/[] result = new int /*long*/[1];
int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
@@ -2841,8 +2929,7 @@ void hookDOMListeners (nsIDOMEventTarget target, boolean isTop) {
void unhookDOMListeners () {
int /*long*/[] result = new int /*long*/[1];
int rc = webBrowser.GetContentDOMWindow (result);
- if (rc != XPCOM.NS_OK) error (rc);
- if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+ if (rc != XPCOM.NS_OK || result[0] == 0) return;
nsIDOMWindow window = new nsIDOMWindow (result[0]);
result[0] = 0;
@@ -3048,7 +3135,9 @@ int OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateF
Enumeration elements = functions.elements ();
while (elements.hasMoreElements ()) {
BrowserFunction function = (BrowserFunction)elements.nextElement ();
- execute (function.functionString);
+ if (!function.isEvaluate) {
+ execute (function.functionString);
+ }
}
}
@@ -3242,7 +3331,9 @@ int OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateF
Enumeration elements = functions.elements ();
while (elements.hasMoreElements ()) {
BrowserFunction function = (BrowserFunction)elements.nextElement ();
- execute (function.functionString);
+ if (!function.isEvaluate) {
+ execute (function.functionString);
+ }
}
/*
* For Mozilla >= 1.9.2, when content is being set via nsIWebBrowserStream,
@@ -3343,27 +3434,27 @@ int OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateF
nsIRequest request = new nsIRequest (aRequest);
int rc = request.QueryInterface (nsIChannel.NS_ICHANNEL_IID, result);
- if (rc != XPCOM.NS_OK) error (rc);
- if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
- nsIChannel channel = new nsIChannel (result[0]);
- result[0] = 0;
- rc = channel.GetURI (result);
- if (rc != XPCOM.NS_OK) error (rc);
- if (result[0] == 0) error (XPCOM.NS_ERROR_NULL_POINTER);
- channel.Release ();
+ if (rc == XPCOM.NS_OK && result[0] != 0) {
+ nsIChannel channel = new nsIChannel (result[0]);
+ result[0] = 0;
+ rc = channel.GetURI (result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NULL_POINTER);
+ channel.Release ();
- nsIURI uri = new nsIURI (result[0]);
- result[0] = 0;
- int /*long*/ aSpec = XPCOM.nsEmbedCString_new ();
- rc = uri.GetSpec (aSpec);
- if (rc != XPCOM.NS_OK) error (rc);
- int length = XPCOM.nsEmbedCString_Length (aSpec);
- int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
- byte[] bytes = new byte[length];
- XPCOM.memmove (bytes, buffer, length);
- lastNavigateURL = new String (bytes);
- XPCOM.nsEmbedCString_delete (aSpec);
- uri.Release ();
+ nsIURI uri = new nsIURI (result[0]);
+ result[0] = 0;
+ int /*long*/ aSpec = XPCOM.nsEmbedCString_new ();
+ rc = uri.GetSpec (aSpec);
+ if (rc != XPCOM.NS_OK) error (rc);
+ int length = XPCOM.nsEmbedCString_Length (aSpec);
+ int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
+ byte[] bytes = new byte[length];
+ XPCOM.memmove (bytes, buffer, length);
+ lastNavigateURL = new String (bytes);
+ XPCOM.nsEmbedCString_delete (aSpec);
+ uri.Release ();
+ }
}
/*
@@ -3574,7 +3665,7 @@ int DestroyBrowserWindow () {
browser.dispose ();
return XPCOM.NS_OK;
}
-
+
int SizeBrowserTo (int aCX, int aCY) {
size = new Point (aCX, aCY);
boolean isChrome = (chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) != 0;
@@ -3626,18 +3717,26 @@ int ExitModalEventLoop (int aStatus) {
return XPCOM.NS_OK;
}
-/* nsIEmbeddingSiteWindow */
+/* nsIEmbeddingSiteWindow */
int SetDimensions (int flags, int x, int y, int cx, int cy) {
+ boolean isChrome = (chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) != 0;
if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_POSITION) != 0) {
location = new Point (x, y);
- browser.getShell ().setLocation (x, y);
+ if (isChrome) {
+ browser.getShell ().setLocation (x, y);
+ }
}
if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_SIZE_INNER) != 0) {
- browser.setSize (cx, cy);
+ size = new Point (cx, cy);
+ if (isChrome) {
+ browser.setSize (cx, cy);
+ }
}
if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_SIZE_OUTER) != 0) {
- browser.getShell ().setSize (cx, cy);
+ if (isChrome) {
+ browser.getShell ().setSize (cx, cy);
+ }
}
return XPCOM.NS_OK;
}
@@ -4306,6 +4405,7 @@ int HandleEvent (int /*long*/ event) {
rc = domMouseEvent.GetRelatedTarget (result);
if (rc != XPCOM.NS_OK) error (rc);
if (result[0] != 0) {
+ new nsISupports (result[0]).Release ();
domMouseEvent.Release ();
return XPCOM.NS_OK;
}
diff --git a/org/eclipse/swt/browser/MozillaDelegate.java b/org/eclipse/swt/browser/MozillaDelegate.java
index e2dda62..d5de1b3 100644
--- a/org/eclipse/swt/browser/MozillaDelegate.java
+++ b/org/eclipse/swt/browser/MozillaDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -113,7 +113,7 @@ String getProfilePath () {
return baseDir + Mozilla.SEPARATOR_OS + ".mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$
}
-String getSWTInitLibraryName () {
+static String GetSWTInitLibraryName () {
return "swt-xpcominit"; //$NON-NLS-1$
}
diff --git a/org/eclipse/swt/browser/WebBrowser.java b/org/eclipse/swt/browser/WebBrowser.java
index 8b93b11..31dd96b 100644
--- a/org/eclipse/swt/browser/WebBrowser.java
+++ b/org/eclipse/swt/browser/WebBrowser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -171,7 +171,7 @@ abstract class WebBrowser {
{19, SWT.PAUSE},
{3, SWT.BREAK},
- /* WebKit/Safari-specific */
+ /* WebKit-specific */
{186, ';'},
{187, '='},
{189, '-'},
@@ -300,7 +300,7 @@ static void SetPendingCookies (Vector pendingCookies) {
}
}
-public abstract boolean create (Composite parent, int style);
+public abstract void create (Composite parent, int style);
static String CreateErrorString (String error) {
return ERROR_ID + error;
@@ -325,7 +325,7 @@ public void createFunction (BrowserFunction function) {
Object key = keys.nextElement ();
BrowserFunction current = (BrowserFunction)functions.get (key);
if (current.name.equals (function.name)) {
- functions.remove (key);
+ deregisterFunction (current);
break;
}
}
@@ -339,6 +339,8 @@ public void createFunction (BrowserFunction function) {
buffer.append (function.name);
buffer.append ("() {var result = window.external.callJava("); //$NON-NLS-1$
buffer.append (function.index);
+ buffer.append (',');
+ buffer.append (function.token);
buffer.append (",Array.prototype.slice.call(arguments)); if (typeof result == 'string' && result.indexOf('"); //$NON-NLS-1$
buffer.append (ERROR_ID);
buffer.append ("') == 0) {var error = new Error(result.substring("); //$NON-NLS-1$
@@ -390,14 +392,20 @@ public Object evaluate (String script) throws SWTException {
buffer.append (functionName);
buffer.append (" == undefined) {window.external.callJava("); // $NON-NLS-1$
buffer.append (index);
+ buffer.append (',');
+ buffer.append (function.token);
buffer.append (", ['"); // $NON-NLS-1$
buffer.append (ERROR_ID);
buffer.append ("']);} else {try {var result = "); // $NON-NLS-1$
buffer.append (functionName);
buffer.append ("(); window.external.callJava("); // $NON-NLS-1$
buffer.append (index);
+ buffer.append (',');
+ buffer.append (function.token);
buffer.append (", [result]);} catch (e) {window.external.callJava("); // $NON-NLS-1$
buffer.append (index);
+ buffer.append (',');
+ buffer.append (function.token);
buffer.append (", ['"); // $NON-NLS-1$
buffer.append (ERROR_ID);
buffer.append ("' + e.message]);}}"); // $NON-NLS-1$
diff --git a/org/eclipse/swt/browser/WebKit.java b/org/eclipse/swt/browser/WebKit.java
index fa8840b..727a9ed 100644
--- a/org/eclipse/swt/browser/WebKit.java
+++ b/org/eclipse/swt/browser/WebKit.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,7 +23,7 @@ import org.eclipse.swt.internal.webkit.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
-public class WebKit extends WebBrowser {
+class WebKit extends WebBrowser {
int /*long*/ webView, webViewData, scrolledWindow;
int failureCount, lastKeyCode, lastCharCode;
String postData;
@@ -89,116 +89,127 @@ public class WebKit extends WebBrowser {
static Callback JSObjectHasPropertyProc, JSObjectGetPropertyProc, JSObjectCallAsFunctionProc;
static {
+
+ /*
+ * WebKitGTK is binary-incompatible between its 1.2 and 1.4 releases,
+ * so swt has separate libraries compiled against each.
+ */
try {
- Library.loadLibrary ("swt-webkit"); // $NON-NLS-1$
+ Library.loadLibrary ("swt-webkit12"); // $NON-NLS-1$
LibraryLoaded = true;
} catch (Throwable e) {
+ try {
+ Library.loadLibrary ("swt-webkit"); // $NON-NLS-1$
+ LibraryLoaded = true;
+ } catch (Throwable e2) {
+ }
}
- Proc2 = new Callback (WebKit.class, "Proc", 2); //$NON-NLS-1$
- if (Proc2.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- Proc3 = new Callback (WebKit.class, "Proc", 3); //$NON-NLS-1$
- if (Proc3.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- Proc4 = new Callback (WebKit.class, "Proc", 4); //$NON-NLS-1$
- if (Proc4.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- Proc5 = new Callback (WebKit.class, "Proc", 5); //$NON-NLS-1$
- if (Proc5.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- Proc6 = new Callback (WebKit.class, "Proc", 6); //$NON-NLS-1$
- if (Proc6.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- JSObjectHasPropertyProc = new Callback (WebKit.class, "JSObjectHasPropertyProc", 3); //$NON-NLS-1$
- if (JSObjectHasPropertyProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- JSObjectGetPropertyProc = new Callback (WebKit.class, "JSObjectGetPropertyProc", 4); //$NON-NLS-1$
- if (JSObjectGetPropertyProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- JSObjectCallAsFunctionProc = new Callback (WebKit.class, "JSObjectCallAsFunctionProc", 6); //$NON-NLS-1$
- if (JSObjectCallAsFunctionProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- NativeClearSessions = new Runnable () {
- public void run () {
- if (!LibraryLoaded) return;
- int /*long*/ session = WebKitGTK.webkit_get_default_session ();
- int /*long*/ type = WebKitGTK.soup_cookie_jar_get_type ();
- int /*long*/ jar = WebKitGTK.soup_session_get_feature (session, type);
- if (jar == 0) return;
- int /*long*/ cookies = WebKitGTK.soup_cookie_jar_all_cookies (jar);
- int length = OS.g_slist_length (cookies);
- int /*long*/ current = cookies;
- for (int i = 0; i < length; i++) {
- int /*long*/ cookie = OS.g_slist_data (current);
- int /*long*/ expires = WebKitGTK.SoupCookie_expires (cookie);
- if (expires == 0) {
- /* indicates a session cookie */
- WebKitGTK.soup_cookie_jar_delete_cookie (jar, cookie);
+ if (LibraryLoaded) {
+ Proc2 = new Callback (WebKit.class, "Proc", 2); //$NON-NLS-1$
+ if (Proc2.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+ Proc3 = new Callback (WebKit.class, "Proc", 3); //$NON-NLS-1$
+ if (Proc3.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+ Proc4 = new Callback (WebKit.class, "Proc", 4); //$NON-NLS-1$
+ if (Proc4.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+ Proc5 = new Callback (WebKit.class, "Proc", 5); //$NON-NLS-1$
+ if (Proc5.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+ Proc6 = new Callback (WebKit.class, "Proc", 6); //$NON-NLS-1$
+ if (Proc6.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+ JSObjectHasPropertyProc = new Callback (WebKit.class, "JSObjectHasPropertyProc", 3); //$NON-NLS-1$
+ if (JSObjectHasPropertyProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+ JSObjectGetPropertyProc = new Callback (WebKit.class, "JSObjectGetPropertyProc", 4); //$NON-NLS-1$
+ if (JSObjectGetPropertyProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+ JSObjectCallAsFunctionProc = new Callback (WebKit.class, "JSObjectCallAsFunctionProc", 6); //$NON-NLS-1$
+ if (JSObjectCallAsFunctionProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ NativeClearSessions = new Runnable () {
+ public void run () {
+ if (!LibraryLoaded) return;
+ int /*long*/ session = WebKitGTK.webkit_get_default_session ();
+ int /*long*/ type = WebKitGTK.soup_cookie_jar_get_type ();
+ int /*long*/ jar = WebKitGTK.soup_session_get_feature (session, type);
+ if (jar == 0) return;
+ int /*long*/ cookies = WebKitGTK.soup_cookie_jar_all_cookies (jar);
+ int length = OS.g_slist_length (cookies);
+ int /*long*/ current = cookies;
+ for (int i = 0; i < length; i++) {
+ int /*long*/ cookie = OS.g_slist_data (current);
+ int /*long*/ expires = WebKitGTK.SoupCookie_expires (cookie);
+ if (expires == 0) {
+ /* indicates a session cookie */
+ WebKitGTK.soup_cookie_jar_delete_cookie (jar, cookie);
+ }
+ OS.g_free (cookie);
+ current = OS.g_slist_next (current);
}
- OS.g_free (cookie);
- current = OS.g_slist_next (current);
}
- }
- };
-
- NativeGetCookie = new Runnable () {
- public void run () {
- if (!LibraryLoaded) return;
- int /*long*/ session = WebKitGTK.webkit_get_default_session ();
- int /*long*/ type = WebKitGTK.soup_cookie_jar_get_type ();
- int /*long*/ jar = WebKitGTK.soup_session_get_feature (session, type);
- if (jar == 0) return;
- byte[] bytes = Converter.wcsToMbcs (null, CookieUrl, true);
- int /*long*/ uri = WebKitGTK.soup_uri_new (bytes);
- if (uri == 0) return;
- int /*long*/ cookies = WebKitGTK.soup_cookie_jar_get_cookies (jar, uri, 0);
- WebKitGTK.soup_uri_free (uri);
- if (cookies == 0) return;
- int length = OS.strlen (cookies);
- bytes = new byte[length];
- C.memmove (bytes, cookies, length);
- OS.g_free (cookies);
- String allCookies = new String (Converter.mbcsToWcs (null, bytes));
- StringTokenizer tokenizer = new StringTokenizer (allCookies, ";"); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens ()) {
- String cookie = tokenizer.nextToken ();
- int index = cookie.indexOf ('=');
- if (index != -1) {
- String name = cookie.substring (0, index).trim ();
- if (name.equals (CookieName)) {
- CookieValue = cookie.substring (index + 1).trim ();
- return;
+ };
+
+ NativeGetCookie = new Runnable () {
+ public void run () {
+ if (!LibraryLoaded) return;
+ int /*long*/ session = WebKitGTK.webkit_get_default_session ();
+ int /*long*/ type = WebKitGTK.soup_cookie_jar_get_type ();
+ int /*long*/ jar = WebKitGTK.soup_session_get_feature (session, type);
+ if (jar == 0) return;
+ byte[] bytes = Converter.wcsToMbcs (null, CookieUrl, true);
+ int /*long*/ uri = WebKitGTK.soup_uri_new (bytes);
+ if (uri == 0) return;
+ int /*long*/ cookies = WebKitGTK.soup_cookie_jar_get_cookies (jar, uri, 0);
+ WebKitGTK.soup_uri_free (uri);
+ if (cookies == 0) return;
+ int length = OS.strlen (cookies);
+ bytes = new byte[length];
+ C.memmove (bytes, cookies, length);
+ OS.g_free (cookies);
+ String allCookies = new String (Converter.mbcsToWcs (null, bytes));
+ StringTokenizer tokenizer = new StringTokenizer (allCookies, ";"); //$NON-NLS-1$
+ while (tokenizer.hasMoreTokens ()) {
+ String cookie = tokenizer.nextToken ();
+ int index = cookie.indexOf ('=');
+ if (index != -1) {
+ String name = cookie.substring (0, index).trim ();
+ if (name.equals (CookieName)) {
+ CookieValue = cookie.substring (index + 1).trim ();
+ return;
+ }
}
}
}
-
- }
- };
-
- NativeSetCookie = new Runnable () {
- public void run () {
- if (!LibraryLoaded) return;
- int /*long*/ session = WebKitGTK.webkit_get_default_session ();
- int /*long*/ type = WebKitGTK.soup_cookie_jar_get_type ();
- int /*long*/ jar = WebKitGTK.soup_session_get_feature (session, type);
- if (jar == 0) {
- /* this happens if a navigation has not occurred yet */
- WebKitGTK.soup_session_add_feature_by_type (session, type);
- jar = WebKitGTK.soup_session_get_feature (session, type);
- }
- if (jar == 0) return;
- byte[] bytes = Converter.wcsToMbcs (null, CookieUrl, true);
- int /*long*/ uri = WebKitGTK.soup_uri_new (bytes);
- if (uri == 0) return;
- bytes = Converter.wcsToMbcs (null, CookieValue, true);
- int /*long*/ cookie = WebKitGTK.soup_cookie_parse (bytes, uri);
- if (cookie != 0) {
- WebKitGTK.soup_cookie_jar_add_cookie (jar, cookie);
- // the following line is intentionally commented
- // WebKitGTK.soup_cookie_free (cookie);
- CookieResult = true;
+ };
+
+ NativeSetCookie = new Runnable () {
+ public void run () {
+ if (!LibraryLoaded) return;
+ int /*long*/ session = WebKitGTK.webkit_get_default_session ();
+ int /*long*/ type = WebKitGTK.soup_cookie_jar_get_type ();
+ int /*long*/ jar = WebKitGTK.soup_session_get_feature (session, type);
+ if (jar == 0) {
+ /* this happens if a navigation has not occurred yet */
+ WebKitGTK.soup_session_add_feature_by_type (session, type);
+ jar = WebKitGTK.soup_session_get_feature (session, type);
+ }
+ if (jar == 0) return;
+ byte[] bytes = Converter.wcsToMbcs (null, CookieUrl, true);
+ int /*long*/ uri = WebKitGTK.soup_uri_new (bytes);
+ if (uri == 0) return;
+ bytes = Converter.wcsToMbcs (null, CookieValue, true);
+ int /*long*/ cookie = WebKitGTK.soup_cookie_parse (bytes, uri);
+ if (cookie != 0) {
+ WebKitGTK.soup_cookie_jar_add_cookie (jar, cookie);
+ // the following line is intentionally commented
+ // WebKitGTK.soup_cookie_free (cookie);
+ CookieResult = true;
+ }
+ WebKitGTK.soup_uri_free (uri);
}
- WebKitGTK.soup_uri_free (uri);
- }
- };
+ };
- if (NativePendingCookies != null) {
- SetPendingCookies (NativePendingCookies);
- NativePendingCookies = null;
+ if (NativePendingCookies != null) {
+ SetPendingCookies (NativePendingCookies);
+ NativePendingCookies = null;
+ }
}
}
@@ -209,6 +220,19 @@ static Browser findBrowser (int /*long*/ webView) {
return (Browser)Display.getCurrent ().findWidget (parent);
}
+static boolean isInstalled () {
+ if (!LibraryLoaded) return false;
+ // TODO webkit_check_version() should take care of the following, but for some
+ // reason this symbol is missing from the latest build. If it is present in
+ // Linux distro-provided builds then replace the following with this call.
+ int major = WebKitGTK.webkit_major_version ();
+ int minor = WebKitGTK.webkit_minor_version ();
+ int micro = WebKitGTK.webkit_micro_version ();
+ return major > MIN_VERSION[0] ||
+ (major == MIN_VERSION[0] && minor > MIN_VERSION[1]) ||
+ (major == MIN_VERSION[0] && minor == MIN_VERSION[1] && micro >= MIN_VERSION[2]);
+}
+
static int /*long*/ JSObjectCallAsFunctionProc (int /*long*/ ctx, int /*long*/ function, int /*long*/ thisObject, int /*long*/ argumentCount, int /*long*/ arguments, int /*long*/ exception) {
if (WebKitGTK.JSValueIsObjectOfClass (ctx, thisObject, ExternalClass) == 0) {
return WebKitGTK.JSValueMakeUndefined (ctx);
@@ -395,22 +419,12 @@ int /*long*/ webViewProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ a
}
}
-public boolean create (Composite parent, int style) {
- if (!LibraryLoaded) return false;
-
+public void create (Composite parent, int style) {
if (ExternalClass == 0) {
- // TODO webkit_check_version() should do the following, but for some reason
- // this symbol is missing from the latest build. If it is present in Linux
- // distro-provided builds then replace the following with this call.
- int major = WebKitGTK.webkit_major_version ();
- int minor = WebKitGTK.webkit_minor_version ();
- int micro = WebKitGTK.webkit_micro_version ();
- boolean success = major > MIN_VERSION[0] ||
- (major == MIN_VERSION[0] && minor > MIN_VERSION[1]) ||
- (major == MIN_VERSION[0] && minor == MIN_VERSION[1] && micro >= MIN_VERSION[2]);
- if (!success) return false;
-
if (Device.DEBUG) {
+ int major = WebKitGTK.webkit_major_version ();
+ int minor = WebKitGTK.webkit_minor_version ();
+ int micro = WebKitGTK.webkit_micro_version ();
System.out.println("WebKit version " + major + "." + minor + "." + micro); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
JSClassDefinition jsClassDefinition = new JSClassDefinition ();
@@ -471,6 +485,8 @@ public boolean create (Composite parent, int style) {
int /*long*/ settings = WebKitGTK.webkit_web_view_get_settings (webView);
OS.g_object_set (settings, WebKitGTK.javascript_can_open_windows_automatically, 1, 0);
OS.g_object_set (settings, WebKitGTK.enable_universal_access_from_file_uris, 1, 0);
+ byte[] bytes = Converter.wcsToMbcs (null, "UTF-8", true); // $NON-NLS-1$
+ OS.g_object_set (settings, WebKitGTK.default_encoding, bytes, 0);
Listener listener = new Listener () {
public void handleEvent (Event event) {
@@ -534,7 +550,7 @@ public boolean create (Composite parent, int style) {
proxyHost = PROTOCOL_HTTP + proxyHost;
}
proxyHost += ":" + port; //$NON-NLS-1$
- byte[] bytes = Converter.wcsToMbcs (null, proxyHost, true);
+ bytes = Converter.wcsToMbcs (null, proxyHost, true);
int /*long*/ uri = WebKitGTK.soup_uri_new (bytes);
if (uri != 0) {
OS.g_object_set (session, WebKitGTK.SOUP_SESSION_PROXY_URI, uri, 0);
@@ -557,8 +573,6 @@ public boolean create (Composite parent, int style) {
* be changed.
*/
browser.setData (KEY_CHECK_SUBWINDOW, Boolean.FALSE);
-
- return true;
}
void addEventHandlers (boolean top) {
@@ -693,9 +707,9 @@ public String getText () {
OS.memmove (bytes, encoding, length);
String encodingString = new String (Converter.mbcsToWcs (null, bytes));
- int /*long*/ string = OS.GString_str (data);
- length = OS.GString_len (string);
+ length = OS.GString_len (data);
bytes = new byte[length];
+ int /*long*/ string = OS.GString_str (data);
C.memmove (bytes, string, length);
try {
@@ -1727,19 +1741,22 @@ int /*long*/ webkit_window_object_cleared (int /*long*/ web_view, int /*long*/ f
int /*long*/ callJava (int /*long*/ ctx, int /*long*/ func, int /*long*/ thisObject, int /*long*/ argumentCount, int /*long*/ arguments, int /*long*/ exception) {
Object returnValue = null;
- if (argumentCount == 2) {
+ if (argumentCount == 3) {
int /*long*/[] result = new int /*long*/[1];
C.memmove (result, arguments, C.PTR_SIZEOF);
int type = WebKitGTK.JSValueGetType (ctx, result[0]);
if (type == WebKitGTK.kJSTypeNumber) {
int index = ((Double)convertToJava (ctx, result[0])).intValue ();
result[0] = 0;
- if (index > 0) {
- Object key = new Integer (index);
+ Object key = new Integer (index);
+ C.memmove (result, arguments + C.PTR_SIZEOF, C.PTR_SIZEOF);
+ type = WebKitGTK.JSValueGetType (ctx, result[0]);
+ if (type == WebKitGTK.kJSTypeNumber) {
+ long token = ((Double)convertToJava (ctx, result[0])).longValue ();
BrowserFunction function = (BrowserFunction)functions.get (key);
- if (function != null) {
+ if (function != null && token == function.token) {
try {
- C.memmove (result, arguments + C.PTR_SIZEOF, C.PTR_SIZEOF);
+ C.memmove (result, arguments + 2 * C.PTR_SIZEOF, C.PTR_SIZEOF);
Object temp = convertToJava (ctx, result[0]);
if (temp instanceof Object[]) {
Object[] args = (Object[])temp;
diff --git a/org/eclipse/swt/custom/CBanner.java b/org/eclipse/swt/custom/CBanner.java
index 0a20c6b..69d4b03 100644
--- a/org/eclipse/swt/custom/CBanner.java
+++ b/org/eclipse/swt/custom/CBanner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -102,7 +102,7 @@ public class CBanner extends Composite {
public CBanner(Composite parent, int style) {
super(parent, checkStyle(style));
super.setLayout(new CBannerLayout());
- resizeCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZEWE);
+ resizeCursor = getDisplay().getSystemCursor(SWT.CURSOR_SIZEWE);
listener = new Listener() {
public void handleEvent(Event e) {
@@ -261,7 +261,6 @@ void onDispose(Event event) {
notifyListeners(SWT.Dispose, event);
event.type = SWT.None;
- if (resizeCursor != null) resizeCursor.dispose();
resizeCursor = null;
left = null;
right = null;
diff --git a/org/eclipse/swt/custom/CCombo.java b/org/eclipse/swt/custom/CCombo.java
index aceaced..49cae17 100644
--- a/org/eclipse/swt/custom/CCombo.java
+++ b/org/eclipse/swt/custom/CCombo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -470,9 +470,9 @@ void createPopup(String[] items, int selectionIndex) {
if (foreground != null) list.setForeground (foreground);
if (background != null) list.setBackground (background);
- int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
+ int [] popupEvents = {SWT.Close, SWT.Paint};
for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener);
- int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose};
+ int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose};
for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener);
if (items != null) list.setItems (items);
@@ -1077,6 +1077,30 @@ void listEvent (Event event) {
handleFocus (SWT.FocusIn);
break;
}
+ case SWT.FocusOut: {
+ /*
+ * Behavior in Windows, GTK & Cocoa: When the arrow button is pressed
+ * with the popup list visible, the following events are received-
+ * popup control receives a deactivate event,
+ * list receives focus lost event, and then
+ * arrow button receives a selection event.
+ * If we hide the popup in the focus out event, the selection event will
+ * show it again. To prevent the popup from showing again, we will detect
+ * this case and let the selection event of the arrow button hide the popup.
+ */
+ if (!"carbon".equals(SWT.getPlatform())) {
+ Point point = arrow.toControl(getDisplay().getCursorLocation());
+ Point size = arrow.getSize();
+ Rectangle rect = new Rectangle(0, 0, size.x, size.y);
+ if (rect.contains(point)) {
+ boolean comboShellActivated = getDisplay ().getActiveShell () == getShell ();
+ if (!comboShellActivated) dropDown (false);
+ break;
+ }
+ }
+ dropDown (false);
+ break;
+ }
case SWT.MouseUp: {
if (event.button != 1) return;
dropDown (false);
@@ -1197,25 +1221,6 @@ void popupEvent(Event event) {
event.doit = false;
dropDown (false);
break;
- case SWT.Deactivate:
- /*
- * Bug in GTK. When the arrow button is pressed the popup control receives a
- * deactivate event and then the arrow button receives a selection event. If
- * we hide the popup in the deactivate event, the selection event will show
- * it again. To prevent the popup from showing again, we will let the selection
- * event of the arrow button hide the popup.
- * In Windows, hiding the popup during the deactivate causes the deactivate
- * to be called twice and the selection event to be disappear.
- */
- if (!"carbon".equals(SWT.getPlatform())) {
- Point point = arrow.toControl(getDisplay().getCursorLocation());
- Point size = arrow.getSize();
- Rectangle rect = new Rectangle(0, 0, size.x, size.y);
- if (!rect.contains(point)) dropDown (false);
- } else {
- dropDown(false);
- }
- break;
}
}
public void redraw () {
@@ -1429,7 +1434,7 @@ public void setEnabled (boolean enabled) {
}
public boolean setFocus () {
checkWidget();
- if (!isEnabled () || !isVisible ()) return false;
+ if (!isEnabled () || !getVisible ()) return false;
if (isFocusControl ()) return true;
return text.setFocus ();
}
diff --git a/org/eclipse/swt/custom/CTabFolder.java b/org/eclipse/swt/custom/CTabFolder.java
index 6549c46..f9f31b7 100644
--- a/org/eclipse/swt/custom/CTabFolder.java
+++ b/org/eclipse/swt/custom/CTabFolder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1038,6 +1038,9 @@ void initAccessible() {
}
}
}
+ if (childID == ACC.CHILDID_SELF) {
+ shortcut = "Ctrl+PageDown"; //$NON-NLS-1$
+ }
e.result = shortcut;
}
});
@@ -1964,13 +1967,12 @@ public void setBackground(Color[] colors, int[] percents) {
* </pre>
*
* @param colors an array of Color that specifies the colors to appear in the gradient
- * in order of appearance left to right. The value <code>null</code> clears the
- * background gradient. The value <code>null</code> can be used inside the array of
- * Color to specify the background color.
+ * in order of appearance from top to bottom or left to right. The value
+ * <code>null</code> clears the background gradient. The value <code>null</code>
+ * can be used inside the array of Color to specify the background color.
* @param percents an array of integers between 0 and 100 specifying the percent of the width
* of the widget at which the color should change. The size of the <code>percents</code>
* array must be one less than the size of the <code>colors</code> array.
- *
* @param vertical indicate the direction of the gradient. <code>True</code> is vertical and <code>false</code> is horizontal.
*
* @exception SWTException <ul>
@@ -2762,8 +2764,8 @@ void setSelection(int index, boolean notify) {
*/
public void setSelectionBackground (Color color) {
checkWidget();
+ if (selectionBackground.equals(color)) return;
setSelectionHighlightGradientColor(null);
- if (selectionBackground == color) return;
if (color == null) color = getDisplay().getSystemColor(SELECTION_BACKGROUND);
selectionBackground = color;
renderer.createAntialiasColors(); //TODO: need better caching strategy
@@ -2798,11 +2800,11 @@ public void setSelectionBackground(Color[] colors, int[] percents) {
setSelectionBackground(colors, percents, false);
}
/**
- * Specify a gradient of colours to be draw in the background of the selected tab.
+ * Specify a gradient of colours to be drawn in the background of the selected tab.
* For example to draw a vertical gradient that varies from dark blue to blue and then to
- * white, use the following call to setBackground:
+ * white, use the following call to setSelectionBackground:
* <pre>
- * cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE),
+ * cfolder.setSelectionBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE),
* display.getSystemColor(SWT.COLOR_BLUE),
* display.getSystemColor(SWT.COLOR_WHITE),
* display.getSystemColor(SWT.COLOR_WHITE)},
@@ -2810,13 +2812,14 @@ public void setSelectionBackground(Color[] colors, int[] percents) {
* </pre>
*
* @param colors an array of Color that specifies the colors to appear in the gradient
- * in order of appearance left to right. The value <code>null</code> clears the
+ * in order of appearance from top to bottom. The value <code>null</code> clears the
* background gradient. The value <code>null</code> can be used inside the array of
- * Color to specify the background color.
- * @param percents an array of integers between 0 and 100 specifying the percent of the width
+ * Color to specify the background color. For vertical gradients, the colors array
+ * can optionally have an extra entry at the end to specify a highlight top color.
+ * @param percents an array of increasing integers between 0 and 100 specifying the percent of the width
* of the widget at which the color should change. The size of the percents array must be one
- * less than the size of the colors array.
- *
+ * less than the size of the colors array, unless there is a highlight top color, in which
+ * case it must be exactly two less than the size of the colors array.
* @param vertical indicate the direction of the gradient. True is vertical and false is horizontal.
*
* @exception SWTException <ul>
@@ -2934,8 +2937,8 @@ void setSelectionHighlightGradientColor(Color start) {
*/
public void setSelectionBackground(Image image) {
checkWidget();
- setSelectionHighlightGradientColor(null);
if (image == selectionBgImage) return;
+ setSelectionHighlightGradientColor(null);
if (image != null) {
selectionGradientColors = null;
selectionGradientPercents = null;
@@ -2957,7 +2960,7 @@ public void setSelectionBackground(Image image) {
*/
public void setSelectionForeground (Color color) {
checkWidget();
- if (selectionForeground == color) return;
+ if (selectionForeground.equals(color)) return;
if (color == null) color = getDisplay().getSystemColor(SELECTION_FOREGROUND);
selectionForeground = color;
if (selectedIndex > -1) redraw();
diff --git a/org/eclipse/swt/custom/CTabFolderRenderer.java b/org/eclipse/swt/custom/CTabFolderRenderer.java
index 1a05182..3613304 100644
--- a/org/eclipse/swt/custom/CTabFolderRenderer.java
+++ b/org/eclipse/swt/custom/CTabFolderRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.swt.custom;
+import java.util.Hashtable;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
@@ -52,6 +53,7 @@ public class CTabFolderRenderer {
* We have to recompute the colors if the border color changes
*/
Color lastBorderColor = null;
+ static final String COLOR_CACHE = "org.eclipse.swt.custom.CTabFolderRenderer.ColorCache"; //$NON-NLS-1$
//TOP_LEFT_CORNER_HILITE is laid out in reverse (ie. top to bottom)
//so can fade in same direction as right swoop curve
@@ -124,6 +126,45 @@ public class CTabFolderRenderer {
this.parent = parent;
}
+ static Color getColor(Display display, RGB rgb) {
+ Color color;
+ Hashtable ColorCache = (Hashtable) display.getData(COLOR_CACHE);
+ if (ColorCache == null) {
+ ColorCache = new Hashtable();
+ display.setData(COLOR_CACHE, ColorCache);
+ }
+ Object [] colorData = (Object []) ColorCache.get(rgb);
+ if (colorData != null) {
+ color = (Color) colorData[0];
+ int refcount = ((Integer) colorData[1]).intValue();
+ colorData[1] = new Integer(refcount + 1);
+ } else {
+ color = new Color(display, rgb);
+ ColorCache.put(rgb, new Object[] {color, new Integer(1)});
+ }
+ return color;
+ }
+
+ static void releaseColor(Display display, Color color) {
+ RGB rgb = color.getRGB();
+ Hashtable ColorCache = (Hashtable) display.getData(COLOR_CACHE);
+ if (ColorCache == null) {
+ ColorCache = new Hashtable();
+ display.setData(COLOR_CACHE, ColorCache);
+ }
+ Object [] colorData = (Object []) ColorCache.get(rgb);
+ if (colorData != null) {
+ int refcount = ((Integer) colorData[1]).intValue();
+ refcount--;
+ if (refcount == 0) {
+ ColorCache.remove(rgb);
+ color.dispose();
+ } else {
+ colorData[1] = new Integer(refcount);
+ }
+ }
+ }
+
void antialias (int[] shape, Color innerColor, Color outerColor, GC gc){
// Don't perform anti-aliasing on Mac and WPF because the platform
// already does it. The simple style also does not require anti-aliasing.
@@ -374,7 +415,8 @@ public class CTabFolderRenderer {
void createAntialiasColors() {
disposeAntialiasColors();
- lastBorderColor = parent.getDisplay().getSystemColor(BORDER1_COLOR);
+ Display display = parent.getDisplay();
+ lastBorderColor = display.getSystemColor(BORDER1_COLOR);
RGB lineRGB = lastBorderColor.getRGB();
/* compute the selected color */
RGB innerRGB = parent.selectionBackground.getRGB();
@@ -392,7 +434,7 @@ public class CTabFolderRenderer {
int red = from.red + 2*(to.red - from.red)/3;
int green = from.green + 2*(to.green - from.green)/3;
int blue = from.blue + 2*(to.blue - from.blue)/3;
- selectedOuterColor = new Color(parent.getDisplay(), red, green, blue);
+ selectedOuterColor = getColor(display, new RGB(red, green, blue));
}
if (innerRGB != null) {
RGB from = lineRGB;
@@ -400,7 +442,7 @@ public class CTabFolderRenderer {
int red = from.red + 2*(to.red - from.red)/3;
int green = from.green + 2*(to.green - from.green)/3;
int blue = from.blue + 2*(to.blue - from.blue)/3;
- selectedInnerColor = new Color(parent.getDisplay(), red, green, blue);
+ selectedInnerColor = getColor(display, new RGB(red, green, blue));
}
/* compute the tabArea color */
outerRGB = parent.getParent().getBackground().getRGB();
@@ -410,7 +452,7 @@ public class CTabFolderRenderer {
int red = from.red + 2*(to.red - from.red)/3;
int green = from.green + 2*(to.green - from.green)/3;
int blue = from.blue + 2*(to.blue - from.blue)/3;
- tabAreaColor = new Color(parent.getDisplay(), red, green, blue);
+ tabAreaColor = getColor(display, new RGB(red, green, blue));
}
}
@@ -436,13 +478,14 @@ public class CTabFolderRenderer {
selectionHighlightGradientColorsCache = new Color[fadeGradientSize];
int denom = fadeGradientSize - 1;
+ Display display = parent.getDisplay();
for (int i = 0; i < fadeGradientSize; i++) {
int propFrom = denom - i;
int propTo = i;
int red = (to.red * propTo + from.red * propFrom) / denom;
int green = (to.green * propTo + from.green * propFrom) / denom;
int blue = (to.blue * propTo + from.blue * propFrom) / denom;
- selectionHighlightGradientColorsCache[i] = new Color(parent.getDisplay(), red, green, blue);
+ selectionHighlightGradientColorsCache[i] = getColor(display, new RGB(red, green, blue));
}
}
@@ -457,23 +500,25 @@ public class CTabFolderRenderer {
disposeAntialiasColors();
disposeSelectionHighlightGradientColors();
if (fillColor != null) {
- fillColor.dispose();
+ releaseColor(parent.getDisplay(), fillColor);
fillColor = null;
}
}
void disposeAntialiasColors() {
- if (tabAreaColor != null) tabAreaColor.dispose();
- if (selectedInnerColor != null) selectedInnerColor.dispose();
- if (selectedOuterColor != null) selectedOuterColor.dispose();
+ Display display = parent.getDisplay();
+ if (tabAreaColor != null) releaseColor(display, tabAreaColor);
+ if (selectedInnerColor != null) releaseColor(display, selectedInnerColor);
+ if (selectedOuterColor != null) releaseColor(display, selectedOuterColor);
tabAreaColor = selectedInnerColor = selectedOuterColor = null;
}
void disposeSelectionHighlightGradientColors() {
if(selectionHighlightGradientColorsCache == null)
return;
+ Display display = parent.getDisplay();
for (int i = 0; i < selectionHighlightGradientColorsCache.length; i++) {
- selectionHighlightGradientColorsCache[i].dispose();
+ releaseColor(display, selectionHighlightGradientColorsCache[i]);
}
selectionHighlightGradientColorsCache = null;
}
@@ -1624,7 +1669,7 @@ public class CTabFolderRenderer {
Color getFillColor() {
if (fillColor == null) {
- fillColor = new Color(parent.getDisplay(), CLOSE_FILL);
+ fillColor = getColor(parent.getDisplay(), CLOSE_FILL);
}
return fillColor;
}
diff --git a/org/eclipse/swt/custom/PopupList.java b/org/eclipse/swt/custom/PopupList.java
index c3bb6f0..4db6100 100644
--- a/org/eclipse/swt/custom/PopupList.java
+++ b/org/eclipse/swt/custom/PopupList.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -47,9 +47,12 @@ public PopupList(Shell parent) {
* @since 3.0
*/
public PopupList(Shell parent, int style) {
+ int listStyle = SWT.SINGLE | SWT.V_SCROLL;
+ if ((style & SWT.H_SCROLL) != 0) listStyle |= SWT.H_SCROLL;
+
shell = new Shell(parent, checkStyle(style));
- list = new List(shell, SWT.SINGLE | SWT.V_SCROLL);
+ list = new List(shell, listStyle);
// close dialog if user selects outside of the shell
shell.addListener(SWT.Deactivate, new Listener() {
diff --git a/org/eclipse/swt/custom/SashForm.java b/org/eclipse/swt/custom/SashForm.java
index 232652d..c944b71 100644
--- a/org/eclipse/swt/custom/SashForm.java
+++ b/org/eclipse/swt/custom/SashForm.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -107,6 +107,11 @@ Sash createSash() {
* Returns SWT.HORIZONTAL if the controls in the SashForm are laid out side by side
* or SWT.VERTICAL if the controls in the SashForm are laid out top to bottom.
*
+ * <p>
+ * To retrieve the bidi orientation of the SashForm use <code>{@link #getStyle()}</code>
+ * and test if the SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT bits are set.
+ * </p>
+ *
* @return SWT.HORIZONTAL or SWT.VERTICAL
*/
public int getOrientation() {
@@ -286,16 +291,27 @@ void onDragSash(Event event) {
* out side by side. If orientation is SWT.VERTICAL, lay the
* controls in the SashForm out top to bottom.
*
- * @param orientation SWT.HORIZONTAL or SWT.VERTICAL
+ * <p>
+ * Since 3.7, this method can also be called with SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT
+ * to change the bidi orientation of the SashForm.
+ * </p>
+ *
+ * @param orientation SWT.HORIZONTAL or SWT.VERTICAL, SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT
+ *
+ * @see Control#setOrientation(int)
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * <li>ERROR_INVALID_ARGUMENT - if the value of orientation is not SWT.HORIZONTAL or SWT.VERTICAL
+ * <li>ERROR_INVALID_ARGUMENT - if the value of orientation is not SWT.HORIZONTAL or SWT.VERTICAL, SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT
* </ul>
*/
public void setOrientation(int orientation) {
checkWidget();
+ if (orientation == SWT.RIGHT_TO_LEFT || orientation == SWT.LEFT_TO_RIGHT) {
+ super.setOrientation(orientation);
+ return;
+ }
if (getOrientation() == orientation) return;
if (orientation != SWT.HORIZONTAL && orientation != SWT.VERTICAL) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
diff --git a/org/eclipse/swt/custom/StyledText.java b/org/eclipse/swt/custom/StyledText.java
index c6915a2..250f2d7 100644
--- a/org/eclipse/swt/custom/StyledText.java
+++ b/org/eclipse/swt/custom/StyledText.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -149,7 +149,6 @@ public class StyledText extends Canvas {
int lastTextChangeReplaceCharCount;
int lastCharCount = 0;
int lastLineBottom; // the bottom pixel of the last line been replaced
- boolean isMirrored;
boolean bidiColoring = false; // apply the BIDI algorithm on text segments of the same color
Image leftCaretBitmap = null;
Image rightCaretBitmap = null;
@@ -1000,6 +999,7 @@ public class StyledText extends Canvas {
write("\\highlight");
write(colorIndex);
}
+ int fontStyle = style.fontStyle;
Font font = style.font;
if (font != null) {
int fontIndex = getFontIndex(font);
@@ -1008,13 +1008,13 @@ public class StyledText extends Canvas {
FontData fontData = font.getFontData()[0];
write("\\fs");
write(fontData.getHeight() * 2);
- } else {
- if ((style.fontStyle & SWT.BOLD) != 0) {
- write("\\b");
- }
- if ((style.fontStyle & SWT.ITALIC) != 0) {
- write("\\i");
- }
+ fontStyle = fontData.getStyle();
+ }
+ if ((fontStyle & SWT.BOLD) != 0) {
+ write("\\b");
+ }
+ if ((fontStyle & SWT.ITALIC) != 0) {
+ write("\\i");
}
if (style.underline) {
write("\\ul");
@@ -1028,13 +1028,11 @@ public class StyledText extends Canvas {
// guard against invalid styles and let style processing continue
copyEnd = Math.max(copyEnd, lineIndex);
write(line, lineIndex, copyEnd);
- if (font == null) {
- if ((style.fontStyle & SWT.BOLD) != 0) {
- write("\\b0");
- }
- if ((style.fontStyle & SWT.ITALIC) != 0) {
- write("\\i0");
- }
+ if ((fontStyle & SWT.BOLD) != 0) {
+ write("\\b0");
+ }
+ if ((style.fontStyle & SWT.ITALIC) != 0) {
+ write("\\i0");
}
if (style.underline) {
write("\\ul0");
@@ -1239,7 +1237,6 @@ public StyledText(Composite parent, int style) {
super.setForeground(getForeground());
super.setDragDetect(false);
Display display = getDisplay();
- isMirrored = (super.getStyle() & SWT.MIRRORED) != 0;
fixedLineHeight = true;
if ((style & SWT.READ_ONLY) != 0) {
setEditable(false);
@@ -1523,7 +1520,7 @@ public void addVerifyListener(VerifyListener verifyListener) {
*/
public void addWordMovementListener(MovementListener movementListener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (movementListener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
addListener(WordNext, new StyledTextListener(movementListener));
addListener(WordPrevious, new StyledTextListener(movementListener));
}
@@ -2469,20 +2466,16 @@ void doContentEnd() {
doLineEnd();
} else {
int length = content.getCharCount();
- if (caretOffset < length) {
- setCaretOffset(length, SWT.DEFAULT);
- showCaret();
- }
+ setCaretOffset(length, SWT.DEFAULT);
+ showCaret();
}
}
/**
* Moves the caret in front of the first character of the widget content.
*/
void doContentStart() {
- if (caretOffset > 0) {
- setCaretOffset(0, SWT.DEFAULT);
- showCaret();
- }
+ setCaretOffset(0, SWT.DEFAULT);
+ showCaret();
}
/**
* Moves the caret to the start of the selection if a selection exists.
@@ -2636,10 +2629,8 @@ void doLineEnd() {
int lineLength = content.getLine(caretLine).length();
lineEndOffset = lineOffset + lineLength;
}
- if (caretOffset < lineEndOffset) {
- setCaretOffset(lineEndOffset, PREVIOUS_OFFSET_TRAILING);
- showCaret();
- }
+ setCaretOffset(lineEndOffset, PREVIOUS_OFFSET_TRAILING);
+ showCaret();
}
/**
* Moves the caret to the beginning of the line.
@@ -2655,10 +2646,8 @@ void doLineStart() {
lineOffset += offsets[lineIndex];
renderer.disposeTextLayout(layout);
}
- if (caretOffset > lineOffset) {
- setCaretOffset(lineOffset, OFFSET_LEADING);
- showCaret();
- }
+ setCaretOffset(lineOffset, OFFSET_LEADING);
+ showCaret();
}
/**
* Moves the caret one line up and to the same character offset relative
@@ -4471,12 +4460,7 @@ int getOffsetAtPoint(int x, int y, int[] trailing, boolean inTextOnly) {
* @since 2.1.2
*/
public int getOrientation () {
- checkWidget();
- if (IS_MAC) {
- int style = super.getStyle();
- return style & (SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT);
- }
- return isMirrored() ? SWT.RIGHT_TO_LEFT : SWT.LEFT_TO_RIGHT;
+ return super.getOrientation ();
}
/**
* Returns the index of the last partially visible line.
@@ -4770,14 +4754,6 @@ public String getSelectionText() {
}
return content.getTextRange(selection.x, selection.y - selection.x);
}
-public int getStyle() {
- int style = super.getStyle();
- style &= ~(SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT | SWT.MIRRORED);
- style |= getOrientation();
- if (isMirrored()) style |= SWT.MIRRORED;
- return style;
-}
-
StyledTextEvent getBidiSegments(int lineOffset, String line) {
if (!isBidi()) return null;
if (!isListening(LineGetSegments)) {
@@ -5296,6 +5272,7 @@ int getVisualLineIndex(TextLayout layout, int offsetInLine) {
int lineY = layout.getLineBounds(lineIndex).y;
int caretY = getCaret().getLocation().y - topMargin - getLinePixel(getCaretLine());
if (lineY > caretY) lineIndex--;
+ caretAlignment = OFFSET_LEADING;
}
return lineIndex;
}
@@ -5442,7 +5419,8 @@ Point getPointAtOffset(int offset) {
TextLayout layout = renderer.getTextLayout(lineIndex);
if (lineLength != 0 && offsetInLine <= lineLength) {
if (offsetInLine == lineLength) {
- point = layout.getLocation(offsetInLine - 1, true);
+ offsetInLine = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER);
+ point = layout.getLocation(offsetInLine, true);
} else {
switch (caretAlignment) {
case OFFSET_LEADING:
@@ -5453,7 +5431,8 @@ Point getPointAtOffset(int offset) {
if (offsetInLine == 0) {
point = layout.getLocation(offsetInLine, false);
} else {
- point = layout.getLocation(offsetInLine - 1, true);
+ offsetInLine = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER);
+ point = layout.getLocation(offsetInLine, true);
}
break;
}
@@ -6685,6 +6664,35 @@ void initializeAccessible() {
e.result = ACC.OK;
}
});
+ accessible.addAccessibleEditableTextListener(new AccessibleEditableTextListener() {
+ public void setTextAttributes(AccessibleTextAttributeEvent e) {
+ // This method must be implemented by the application
+ e.result = ACC.OK;
+ }
+ public void replaceText(AccessibleEditableTextEvent e) {
+ StyledText st = StyledText.this;
+ st.replaceTextRange(e.start, e.end - e.start, e.string);
+ e.result = ACC.OK;
+ }
+ public void pasteText(AccessibleEditableTextEvent e) {
+ StyledText st = StyledText.this;
+ st.setSelection(e.start);
+ st.paste();
+ e.result = ACC.OK;
+ }
+ public void cutText(AccessibleEditableTextEvent e) {
+ StyledText st = StyledText.this;
+ st.setSelection(e.start, e.end);
+ st.cut();
+ e.result = ACC.OK;
+ }
+ public void copyText(AccessibleEditableTextEvent e) {
+ StyledText st = StyledText.this;
+ st.setSelection(e.start, e.end);
+ st.copy();
+ e.result = ACC.OK;
+ }
+ });
accessible.addAccessibleAttributeListener(new AccessibleAttributeAdapter() {
public void getAttributes(AccessibleAttributeEvent e) {
StyledText st = StyledText.this;
@@ -7078,7 +7086,7 @@ boolean invokeBlockAction(int action) {
* Temporary until SWT provides this
*/
boolean isBidi() {
- return IS_GTK || IS_MAC || BidiUtil.isBidiPlatform() || isMirrored;
+ return IS_GTK || IS_MAC || BidiUtil.isBidiPlatform() || isMirrored();
}
boolean isBidiCaret() {
return BidiUtil.isBidiPlatform();
@@ -7111,7 +7119,7 @@ boolean isLineDelimiter(int offset) {
* is left oriented
*/
boolean isMirrored() {
- return isMirrored;
+ return (getStyle() & SWT.MIRRORED) != 0;
}
/**
* Returns whether the widget can have only one line.
@@ -9236,28 +9244,17 @@ void setMouseWordSelectionAnchor() {
* @since 2.1.2
*/
public void setOrientation(int orientation) {
- if ((orientation & (SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT)) == 0) {
- return;
- }
- if ((orientation & SWT.RIGHT_TO_LEFT) != 0 && (orientation & SWT.LEFT_TO_RIGHT) != 0) {
- return;
- }
- if ((orientation & SWT.RIGHT_TO_LEFT) != 0 && isMirrored()) {
- return;
- }
- if ((orientation & SWT.LEFT_TO_RIGHT) != 0 && !isMirrored()) {
- return;
- }
- if (!BidiUtil.setOrientation(this, orientation)) {
- return;
+ int oldOrientation = getOrientation();
+ super.setOrientation(orientation);
+ int newOrientation = getOrientation();
+ if (oldOrientation != newOrientation) {
+ caretDirection = SWT.NULL;
+ resetCache(0, content.getLineCount());
+ setCaretLocation();
+ keyActionMap.clear();
+ createKeyBindings();
+ super.redraw();
}
- isMirrored = (orientation & SWT.RIGHT_TO_LEFT) != 0;
- caretDirection = SWT.NULL;
- resetCache(0, content.getLineCount());
- setCaretLocation();
- keyActionMap.clear();
- createKeyBindings();
- super.redraw();
}
/**
* Sets the right margin.
diff --git a/org/eclipse/swt/custom/StyledTextRenderer.java b/org/eclipse/swt/custom/StyledTextRenderer.java
index f1e2fba..f22fed0 100644
--- a/org/eclipse/swt/custom/StyledTextRenderer.java
+++ b/org/eclipse/swt/custom/StyledTextRenderer.java
@@ -514,7 +514,8 @@ boolean hasLink(int offset) {
}
} else {
for (int i = 0; i < styles.length; i++) {
- if (styles[i].start <= offset && offset < styles[i].start + styles[i].length && styles[i >> 1].underline && styles[i >> 1].underlineStyle == SWT.UNDERLINE_LINK) {
+ StyleRange style = styles[i];
+ if (style.start <= offset && offset < style.start + style.length && style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) {
return true;
}
}
diff --git a/org/eclipse/swt/custom/TableEditor.java b/org/eclipse/swt/custom/TableEditor.java
index 2f57b5f..05278af 100644
--- a/org/eclipse/swt/custom/TableEditor.java
+++ b/org/eclipse/swt/custom/TableEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -111,8 +111,11 @@ Rectangle computeBounds () {
if (item == null || column == -1 || item.isDisposed()) return new Rectangle(0, 0, 0, 0);
Rectangle cell = item.getBounds(column);
Rectangle rect = item.getImageBounds(column);
- cell.x = rect.x + rect.width;
- cell.width -= rect.width;
+ if (rect.width != 0) {
+ int imageGap = Math.max(rect.x - cell.x, 0);
+ cell.x = rect.x + rect.width;
+ cell.width -= (imageGap + rect.width);
+ }
Rectangle area = table.getClientArea();
if (cell.x < area.x + area.width) {
if (cell.x + cell.width > area.x + area.width) {
diff --git a/org/eclipse/swt/dnd/Clipboard.java b/org/eclipse/swt/dnd/Clipboard.java
index 87b1e17..8c2cb59 100644
--- a/org/eclipse/swt/dnd/Clipboard.java
+++ b/org/eclipse/swt/dnd/Clipboard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -292,10 +292,24 @@ public Object getContents(Transfer transfer, int clipboards) {
for (int i = 0; i < typeIds.length; i++) {
if ((clipboards & DND.CLIPBOARD) != 0) {
selection_data = gtk_clipboard_wait_for_contents(GTKCLIPBOARD, typeIds[i]);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
}
if (selection_data != 0) break;
if ((clipboards & DND.SELECTION_CLIPBOARD) != 0) {
selection_data = gtk_clipboard_wait_for_contents(GTKPRIMARYCLIPBOARD, typeIds[i]);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
}
}
if (selection_data == 0) return null;
@@ -579,6 +593,13 @@ public String[] getAvailableTypeNames() {
private int[] getAvailablePrimaryTypes() {
int[] types = new int[0];
int /*long*/ selection_data = gtk_clipboard_wait_for_contents(GTKPRIMARYCLIPBOARD, TARGET);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
if (selection_data != 0) {
try {
GtkSelectionData gtkSelectionData = new GtkSelectionData();
@@ -596,6 +617,13 @@ private int[] getAvailablePrimaryTypes() {
private int[] getAvailableClipboardTypes () {
int[] types = new int[0];
int /*long*/ selection_data = gtk_clipboard_wait_for_contents(GTKCLIPBOARD, TARGET);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
if (selection_data != 0) {
try {
GtkSelectionData gtkSelectionData = new GtkSelectionData();
diff --git a/org/eclipse/swt/dnd/ClipboardProxy.java b/org/eclipse/swt/dnd/ClipboardProxy.java
index 1c53f72..c03768f 100644
--- a/org/eclipse/swt/dnd/ClipboardProxy.java
+++ b/org/eclipse/swt/dnd/ClipboardProxy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -88,8 +88,20 @@ int /*long*/ clearFunc(int /*long*/ clipboard,int /*long*/ user_data_or_owner){
void dispose () {
if (display == null) return;
- if (activeClipboard != null) OS.gtk_clipboard_clear(Clipboard.GTKCLIPBOARD);
- if (activePrimaryClipboard != null) OS.gtk_clipboard_clear(Clipboard.GTKPRIMARYCLIPBOARD);
+ if (activeClipboard != null) {
+ if (OS.GTK_VERSION >= OS.VERSION(2, 6, 0)) {
+ OS.gtk_clipboard_store(Clipboard.GTKCLIPBOARD);
+ } else {
+ OS.gtk_clipboard_clear(Clipboard.GTKCLIPBOARD);
+ }
+ }
+ if (activePrimaryClipboard != null) {
+ if (OS.GTK_VERSION >= OS.VERSION(2, 6, 0)) {
+ OS.gtk_clipboard_store(Clipboard.GTKPRIMARYCLIPBOARD);
+ } else {
+ OS.gtk_clipboard_clear(Clipboard.GTKPRIMARYCLIPBOARD);
+ }
+ }
display = null;
if (getFunc != null ) getFunc.dispose();
getFunc = null;
@@ -178,6 +190,9 @@ boolean setData(Clipboard owner, Object[] data, Transfer[] dataTypes, int clipbo
if (!OS.gtk_clipboard_set_with_owner (Clipboard.GTKCLIPBOARD, pTargetsList, entries.length, getFuncProc, clearFuncProc, clipboardOwner)) {
return false;
}
+ if (OS.GTK_VERSION >= OS.VERSION(2, 6, 0)) {
+ OS.gtk_clipboard_set_can_store(Clipboard.GTKCLIPBOARD, 0, 0);
+ }
activeClipboard = owner;
}
if ((clipboards & DND.SELECTION_CLIPBOARD) != 0) {
@@ -188,6 +203,9 @@ boolean setData(Clipboard owner, Object[] data, Transfer[] dataTypes, int clipbo
if (!OS.gtk_clipboard_set_with_owner (Clipboard.GTKPRIMARYCLIPBOARD, pTargetsList, entries.length, getFuncProc, clearFuncProc, clipboardOwner)) {
return false;
}
+ if (OS.GTK_VERSION >= OS.VERSION(2, 6, 0)) {
+ OS.gtk_clipboard_set_can_store(Clipboard.GTKPRIMARYCLIPBOARD, 0, 0);
+ }
activePrimaryClipboard = owner;
}
return true;
diff --git a/org/eclipse/swt/events/GestureEvent.java b/org/eclipse/swt/events/GestureEvent.java
new file mode 100644
index 0000000..f6667fd
--- /dev/null
+++ b/org/eclipse/swt/events/GestureEvent.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.events;
+
+
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Instances of this class are sent in response to
+ * touch-based gestures that are triggered by the user.
+ *
+ * @see GestureListener
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
+ *
+ * @since 3.7
+ */
+public class GestureEvent extends TypedEvent {
+
+ /**
+ * The state of the keyboard modifier keys and mouse masks
+ * at the time the event was generated.
+ *
+ * @see org.eclipse.swt.SWT#MODIFIER_MASK
+ * @see org.eclipse.swt.SWT#BUTTON_MASK
+ */
+ public int stateMask;
+
+ /**
+ * The gesture type.
+ * <p><ul>
+ * <li>{@link org.eclipse.swt.SWT#GESTURE_BEGIN}</li>
+ * <li>{@link org.eclipse.swt.SWT#GESTURE_END}</li>
+ * <li>{@link org.eclipse.swt.SWT#GESTURE_MAGNIFY}</li>
+ * <li>{@link org.eclipse.swt.SWT#GESTURE_PAN}</li>
+ * <li>{@link org.eclipse.swt.SWT#GESTURE_ROTATE}</li>
+ * <li>{@link org.eclipse.swt.SWT#GESTURE_SWIPE}</li>
+ * </ul></p>
+ *
+ * This field determines the <code>GestureEvent</code> fields that contain valid data.
+ */
+ public int detail;
+
+ /**
+ * The meaning of this field is dependent on the value of the <code>detail</code> field
+ * and the platform. It can represent either the x coordinate of the centroid of the
+ * touches that make up the gesture, or the x coordinate of the cursor at the time the
+ * gesture was performed.
+ */
+ public int x;
+
+ /**
+ * The meaning of this field is dependent on the value of the <code>detail</code> field
+ * and the platform. It can represent either the y coordinate of the centroid of the
+ * touches that make up the gesture, or the y coordinate of the cursor at the time the
+ * gesture was performed.
+ */
+ public int y;
+
+ /**
+ * This field is valid when the <code>detail</code> field is set to <code>GESTURE_ROTATE</code>.
+ * It specifies the number of degrees rotated on the device since the gesture started. Positive
+ * values indicate counter-clockwise rotation, and negative values indicate clockwise rotation.
+ */
+ public double rotation;
+
+ /**
+ * This field is valid when the <code>detail</code> field is set to <code>GESTURE_SWIPE</code>
+ * or <code>GESTURE_PAN</code>. Both <code>xDirection</code> and <code>yDirection</code>
+ * can be valid for an individual gesture. The meaning of this field is dependent on the value
+ * of the <code>detail</code> field.
+ * <p>
+ * If <code>detail</code> is <code>GESTURE_SWIPE</code> then a positive value indicates a swipe
+ * to the right and a negative value indicates a swipe to the left.
+ *
+ * If <code>detail</code> is <code>GESTURE_PAN</code> then a positive value indicates a pan to
+ * the right by this field's count of pixels and a negative value indicates a pan to the left
+ * by this field's count of pixels.
+ */
+ public int xDirection;
+
+ /**
+ * This field is valid when the <code>detail</code> field is set to <code>GESTURE_SWIPE</code>
+ * or <code>GESTURE_PAN</code>. Both <code>xDirection</code> and <code>yDirection</code>
+ * can be valid for an individual gesture. The meaning of this field is dependent on the value
+ * of the <code>detail</code> field.
+ *
+ * If <code>detail</code> is <code>GESTURE_SWIPE</code> then a positive value indicates a downward
+ * swipe and a negative value indicates an upward swipe.
+ *
+ * If <code>detail</code> is <code>GESTURE_PAN</code> then a positive value indicates a downward
+ * pan by this field's count of pixels and a negative value indicates an upward pan by this
+ * field's count of pixels.
+ */
+ public int yDirection;
+
+ /**
+ * This field is valid when the <code>detail</code> field is set to <code>GESTURE_MAGNIFY</code>.
+ * This is the scale factor to be applied. This value will be 1.0 in the first received event with
+ * <code>GESTURE_MAGNIFY</code>, and will then fluctuate in subsequent events as the user moves
+ * their fingers.
+ */
+ public double magnification;
+
+ /**
+ * This flag indicates whether the operation should be allowed.
+ * Setting it to <code>false</code> will cancel the operation.
+ */
+ public boolean doit;
+
+ static final long serialVersionUID = -8348741538373572182L;
+
+/**
+ * Constructs a new instance of this class based on the
+ * information in the given untyped event.
+ *
+ * @param e the untyped event containing the information
+ */
+public GestureEvent(Event e) {
+ super(e);
+ this.stateMask = e.stateMask;
+ this.x = e.x;
+ this.y = e.y;
+ this.detail = e.detail;
+ this.rotation = e.rotation;
+ this.xDirection = e.xDirection;
+ this.yDirection = e.yDirection;
+ this.magnification = e.magnification;
+ this.doit = e.doit;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public String toString() {
+ String string = super.toString ();
+ return string.substring (0, string.length() - 1) // remove trailing '}'
+ + " stateMask=" + stateMask
+ + " detail=" + detail
+ + " x=" + x
+ + " y=" + y
+ + " rotation=" + rotation
+ + " xDirection=" + xDirection
+ + " yDirection=" + yDirection
+ + " magnification=" + magnification
+ + "}";
+}
+}
diff --git a/org/eclipse/swt/events/PaintListener.java b/org/eclipse/swt/events/GestureListener.java
similarity index 52%
copy from org/eclipse/swt/events/PaintListener.java
copy to org/eclipse/swt/events/GestureListener.java
index 7a047c8..d209263 100644
--- a/org/eclipse/swt/events/PaintListener.java
+++ b/org/eclipse/swt/events/GestureListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,29 +11,32 @@
package org.eclipse.swt.events;
-import org.eclipse.swt.internal.SWTEventListener;
+import org.eclipse.swt.internal.*;
/**
* Classes which implement this interface provide methods
- * that deal with the events that are generated when the
- * control needs to be painted.
+ * that deal with the events that are generated as gestures
+ * are triggered by the user interacting with a touch pad or
+ * touch screen.
* <p>
* After creating an instance of a class that implements
* this interface it can be added to a control using the
- * <code>addPaintListener</code> method and removed using
- * the <code>removePaintListener</code> method. When a
- * paint event occurs, the paintControl method will be
- * invoked.
+ * <code>addGestureListener</code> method and removed using
+ * the <code>removeGestureListener</code> method. When a
+ * gesture is triggered, the appropriate method will be invoked.
* </p>
*
- * @see PaintEvent
+ * @see GestureEvent
+ *
+ * @since 3.7
*/
-public interface PaintListener extends SWTEventListener {
+public interface GestureListener extends SWTEventListener {
/**
- * Sent when a paint event occurs for the control.
+ * Sent when a recognized gesture has occurred.
*
- * @param e an event containing information about the paint
+ * @param e an event containing information about the gesture.
*/
-public void paintControl(PaintEvent e);
-}
+public void gesture(GestureEvent e);
+
+}
\ No newline at end of file
diff --git a/org/eclipse/swt/events/TouchEvent.java b/org/eclipse/swt/events/TouchEvent.java
new file mode 100644
index 0000000..ae467a9
--- /dev/null
+++ b/org/eclipse/swt/events/TouchEvent.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.events;
+
+
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Instances of this class are sent in response to
+ * a touch-based input source being touched.
+ *
+ * @see TouchListener
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
+ *
+ * @since 3.7
+ */
+public class TouchEvent extends TypedEvent {
+
+ /**
+ * The set of touches representing the state of all contacts with touch input
+ * device at the time the event was generated.
+ *
+ * @see org.eclipse.swt.widgets.Touch
+ */
+ public Touch[] touches;
+
+ /**
+ * The state of the keyboard modifier keys and mouse masks
+ * at the time the event was generated.
+ *
+ * @see org.eclipse.swt.SWT#MODIFIER_MASK
+ * @see org.eclipse.swt.SWT#BUTTON_MASK
+ */
+ public int stateMask;
+
+ /**
+ * The widget-relative x coordinate of the pointer
+ * at the time the touch occurred.
+ */
+ public int x;
+
+ /**
+ * The widget-relative y coordinate of the pointer
+ * at the time the touch occurred.
+ */
+ public int y;
+
+ static final long serialVersionUID = -8348741538373572182L;
+
+/**
+ * Constructs a new instance of this class based on the
+ * information in the given untyped event.
+ *
+ * @param e the untyped event containing the information
+ */
+public TouchEvent(Event e) {
+ super(e);
+ this.touches = e.touches;
+ this.stateMask = e.stateMask;
+ this.x = e.x;
+ this.y = e.y;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public String toString() {
+ String string = super.toString();
+ string = string.substring (0, string.length() - 1); // remove trailing '}'
+ string += " stateMask=" + stateMask
+ + " x=" + x
+ + " y=" + y;
+ if (touches != null) {
+ for (int i = 0; i < touches.length; i++) {
+ string += "\n " + touches[i].toString();
+ }
+ string += "\n";
+ }
+ string += "}";
+ return string;
+}
+}
diff --git a/org/eclipse/swt/events/DragDetectListener.java b/org/eclipse/swt/events/TouchListener.java
similarity index 53%
copy from org/eclipse/swt/events/DragDetectListener.java
copy to org/eclipse/swt/events/TouchListener.java
index 805747d..f0dacf0 100644
--- a/org/eclipse/swt/events/DragDetectListener.java
+++ b/org/eclipse/swt/events/TouchListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,30 +11,31 @@
package org.eclipse.swt.events;
-import org.eclipse.swt.internal.SWTEventListener;
+import org.eclipse.swt.internal.*;
/**
* Classes which implement this interface provide methods
- * that deal with the events that are generated when a drag
- * gesture is detected.
+ * that deal with the events that are generated as touches
+ * occur on a touch-aware input surface.
* <p>
* After creating an instance of a class that implements
* this interface it can be added to a control using the
- * <code>addDragDetectListener</code> method and removed using
- * the <code>removeDragDetectListener</code> method. When the
- * drag is detected, the drageDetected method will be invoked.
+ * <code>addTouchListener</code> method and removed using
+ * the <code>removeTouchListener</code> method. When a
+ * touch occurs or changes state, the <code>touch</code> method
+ * will be invoked.
* </p>
*
- * @see DragDetectEvent
+ * @see TouchEvent
*
- * @since 3.3
+ * @since 3.7
*/
-public interface DragDetectListener extends SWTEventListener {
+public interface TouchListener extends SWTEventListener {
/**
- * Sent when a drag gesture is detected.
+ * Sent when a touch sequence begins, changes state, or ends.
*
- * @param e an event containing information about the drag
+ * @param e an event containing information about the touch
*/
-public void dragDetected(DragDetectEvent e);
+public void touch(TouchEvent e);
}
diff --git a/org/eclipse/swt/graphics/Device.java b/org/eclipse/swt/graphics/Device.java
index 32e16e8..7b89886 100644
--- a/org/eclipse/swt/graphics/Device.java
+++ b/org/eclipse/swt/graphics/Device.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -79,10 +79,13 @@ public abstract class Device implements Drawable {
/* System Font */
Font systemFont;
+ /* Device dpi */
+ Point dpi;
+
int /*long*/ emptyTab;
boolean useXRender;
-
+ boolean useCairo;
static boolean CAIRO_LOADED;
/*
@@ -406,7 +409,7 @@ public int getDepth () {
*/
public Point getDPI () {
checkDevice ();
- return new Point (72, 72);
+ return getScreenDPI();
}
/**
@@ -473,6 +476,13 @@ public FontData[] getFontList (String faceName, boolean scalable) {
return result;
}
+Point getScreenDPI () {
+ int widthMM = OS.gdk_screen_width_mm ();
+ int width = OS.gdk_screen_width ();
+ int dpi = Compatibility.round (254 * width, widthMM * 10);
+ return new Point (dpi, dpi);
+}
+
/**
* Returns the matching standard color for the given
* constant, which should be one of the color constants
@@ -568,6 +578,8 @@ public boolean getWarnings () {
* @see #create
*/
protected void init () {
+ this.dpi = getDPI();
+
if (xDisplay != 0) {
int[] event_basep = new int[1], error_basep = new int [1];
if (OS.XRenderQueryExtension (xDisplay, event_basep, error_basep)) {
@@ -576,6 +588,11 @@ protected void init () {
useXRender = major_versionp[0] > 0 || (major_versionp[0] == 0 && minor_versionp[0] >= 8);
}
}
+
+ if (OS.GTK_VERSION > OS.VERSION (2, 17, 0) && System.getProperty("org.eclipse.swt.internal.gtk.useCairo") != null) {
+ useCairo = true;
+ }
+
//TODO: Remove; temporary code only
boolean fixAIX = OS.IsAIX && OS.PTR_SIZEOF == 8;
diff --git a/org/eclipse/swt/graphics/Font.java b/org/eclipse/swt/graphics/Font.java
index 2619dbb..70a7b7d 100644
--- a/org/eclipse/swt/graphics/Font.java
+++ b/org/eclipse/swt/graphics/Font.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -186,6 +186,8 @@ public FontData[] getFontData() {
OS.memmove(buffer, family, length);
String name = new String(Converter.mbcsToWcs(null, buffer));
float height = (float)OS.pango_font_description_get_size(handle) / OS.PANGO_SCALE;
+ Point dpi = device.dpi, screenDPI = device.getScreenDPI();
+ float size = height * screenDPI.y / dpi.y;
int pangoStyle = OS.pango_font_description_get_style(handle);
int pangoWeight = OS.pango_font_description_get_weight(handle);
int style = SWT.NORMAL;
@@ -197,7 +199,7 @@ public FontData[] getFontData() {
buffer = new byte [length + 1];
OS.memmove (buffer, fontString, length);
OS.g_free (fontString);
- FontData data = new FontData(name, height, style);
+ FontData data = new FontData(name, size, style);
data.string = buffer;
return new FontData[]{data};
}
@@ -240,6 +242,8 @@ public int hashCode() {
void init(String name, float height, int style, byte[] fontString) {
if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ Point dpi = device.dpi, screenDPI = device.getScreenDPI();
+ float size = height * dpi.y / screenDPI.y;
if (fontString != null) {
handle = OS.pango_font_description_from_string (fontString);
if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
@@ -248,8 +252,8 @@ void init(String name, float height, int style, byte[] fontString) {
if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
byte[] buffer = Converter.wcsToMbcs(null, name, true);
OS.pango_font_description_set_family(handle, buffer);
- if (height > 0) {
- OS.pango_font_description_set_size(handle, (int)(0.5f + height * OS.PANGO_SCALE));
+ if (size > 0) {
+ OS.pango_font_description_set_size(handle, (int)(0.5f + size * OS.PANGO_SCALE));
}
OS.pango_font_description_set_stretch(handle, OS.PANGO_STRETCH_NORMAL);
int pangoStyle = OS.PANGO_STYLE_NORMAL;
diff --git a/org/eclipse/swt/graphics/FontData.java b/org/eclipse/swt/graphics/FontData.java
index 39a350c..204f6f7 100644
--- a/org/eclipse/swt/graphics/FontData.java
+++ b/org/eclipse/swt/graphics/FontData.java
@@ -318,7 +318,7 @@ public int getStyle() {
* @see #equals
*/
public int hashCode () {
- return name.hashCode() ^ getHeight() ^ style;
+ return name.hashCode() ^ getHeight() << 8 ^ style;
}
/**
diff --git a/org/eclipse/swt/graphics/GC.java b/org/eclipse/swt/graphics/GC.java
index ac76e2c..4cb4b66 100644
--- a/org/eclipse/swt/graphics/GC.java
+++ b/org/eclipse/swt/graphics/GC.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -2813,6 +2813,9 @@ void init(Drawable drawable, GCData data, int /*long*/ gdkGC) {
this.drawable = drawable;
this.data = data;
handle = gdkGC;
+ if (device.useCairo) {
+ initCairo();
+ }
if ((data.style & SWT.MIRRORED) != 0) {
initCairo();
int /*long*/ cairo = data.cairo;
@@ -2949,7 +2952,7 @@ boolean isIdentity(double[] matrix) {
*/
public void setAdvanced(boolean advanced) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if ((data.style & SWT.MIRRORED) != 0) {
+ if ((data.style & SWT.MIRRORED) != 0 || device.useCairo) {
if (!advanced) {
setAlpha(0xFF);
setAntialias(SWT.DEFAULT);
diff --git a/org/eclipse/swt/graphics/Image.java b/org/eclipse/swt/graphics/Image.java
index 08c0da6..c70a42a 100644
--- a/org/eclipse/swt/graphics/Image.java
+++ b/org/eclipse/swt/graphics/Image.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org/eclipse/swt/graphics/LineAttributes.java b/org/eclipse/swt/graphics/LineAttributes.java
index 6d02341..011d993 100644
--- a/org/eclipse/swt/graphics/LineAttributes.java
+++ b/org/eclipse/swt/graphics/LineAttributes.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -119,4 +119,61 @@ public LineAttributes(float width, int cap, int join, int style, float[] dash, f
this.dashOffset = dashOffset;
this.miterLimit = miterLimit;
}
+
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode()
+ */
+public boolean equals (Object object) {
+ if (object == this) return true;
+ if (!(object instanceof LineAttributes)) return false;
+ LineAttributes p = (LineAttributes)object;
+ if (p.width != width) return false;
+ if (p.cap != cap) return false;
+ if (p.join != join) return false;
+ if (p.style != style) return false;
+ if (p.dashOffset != dashOffset) return false;
+ if (p.miterLimit != miterLimit) return false;
+ if (p.dash != null && dash != null) {
+ if (p.dash.length != dash.length) return false;
+ for (int i = 0; i < dash.length; i++) {
+ if (p.dash[i] != dash[i]) return false;
+ }
+ } else {
+ if (p.dash != null || dash != null) return false;
+ }
+ return true;
+}
+
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals(Object)
+ */
+public int hashCode () {
+ int hashCode = Float.floatToIntBits(width);
+ hashCode = 31 * hashCode + cap;
+ hashCode = 31 * hashCode + join;
+ hashCode = 31 * hashCode + style;
+ hashCode = 31 * hashCode + Float.floatToIntBits(dashOffset);
+ hashCode = 31 * hashCode + Float.floatToIntBits(miterLimit);
+ if (dash != null) {
+ for (int i = 0; i < dash.length; i++) {
+ hashCode = 31 * hashCode + Float.floatToIntBits(dash[i]);
+ }
+ }
+ return hashCode;
+}
+
}
diff --git a/org/eclipse/swt/graphics/TextLayout.java b/org/eclipse/swt/graphics/TextLayout.java
index 372b628..11adbc6 100644
--- a/org/eclipse/swt/graphics/TextLayout.java
+++ b/org/eclipse/swt/graphics/TextLayout.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -142,7 +142,7 @@ void computeRuns () {
attribute.end_index = bytePos + offset + 6;
OS.memmove (attr, attribute, PangoAttribute.sizeof);
OS.pango_attr_list_insert(attrList, attr);
- int pos = (int)/*64*/OS.g_utf8_pointer_to_offset(ptr, ptr + bytePos);
+ int pos = (int)/*64*/OS.g_utf16_pointer_to_offset(ptr, ptr + bytePos);
chars[pos + lineIndex * 2] = ZWS;
chars[pos + lineIndex * 2 + 1] = ZWNBS;
segmentsText.getChars(oldPos, pos, chars, oldPos + lineIndex * 2);
@@ -166,7 +166,7 @@ void computeRuns () {
int segmentCount = 0;
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
- if (c == ZWS && lineOffsets != null && i == lineOffsets[lineIndex]) {
+ if (c == ZWS && lineOffsets != null && lineIndex < lineOffsets.length && i == lineOffsets[lineIndex]) {
invalidOffsets[offsetCount++] = i; //ZWS
invalidOffsets[offsetCount++] = ++i; //ZWNBS
lineIndex++;
@@ -184,8 +184,8 @@ void computeRuns () {
if (style == null) continue;
int start = translateOffset(styleItem.start);
int end = translateOffset(styles[i+1].start - 1);
- int byteStart = (int)/*64*/(OS.g_utf8_offset_to_pointer(ptr, start) - ptr);
- int byteEnd = (int)/*64*/(OS.g_utf8_offset_to_pointer(ptr, end + 1) - ptr);
+ int byteStart = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, start) - ptr);
+ int byteEnd = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, end + 1) - ptr);
byteStart = Math.min(byteStart, strlen);
byteEnd = Math.min(byteEnd, strlen);
Font font = style.font;
@@ -408,7 +408,7 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo
boolean hasSelection = selectionStart <= selectionEnd && selectionStart != -1 && selectionEnd != -1;
GCData data = gc.data;
int /*long*/ cairo = data.cairo;
- if (flags != 0 && (hasSelection || (flags & SWT.LAST_LINE_SELECTION) != 0)) {
+ if ((flags & (SWT.FULL_SELECTION | SWT.DELIMITER_SELECTION)) != 0 && (hasSelection || (flags & SWT.LAST_LINE_SELECTION) != 0)) {
int /*long*/[] attrs = new int /*long*/[1];
int[] nAttrs = new int[1];
PangoLogAttr logAttr = new PangoLogAttr();
@@ -430,9 +430,9 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo
OS.pango_layout_iter_get_line_extents(iter, null, rect);
if (OS.pango_layout_iter_next_line(iter)) {
int bytePos = OS.pango_layout_iter_get_index(iter);
- lineEnd = (int)/*64*/OS.g_utf8_pointer_to_offset(ptr, ptr + bytePos);
+ lineEnd = (int)/*64*/OS.g_utf16_pointer_to_offset(ptr, ptr + bytePos);
} else {
- lineEnd = (int)/*64*/OS.g_utf8_strlen(ptr, -1);
+ lineEnd = (int)/*64*/OS.g_utf16_strlen(ptr, -1);
}
boolean extent = false;
if (lineIndex == lineCount - 1 && (flags & SWT.LAST_LINE_SELECTION) != 0) {
@@ -494,7 +494,7 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo
} else {
selectionStart = Math.min(Math.max(0, selectionStart), length - 1);
selectionEnd = Math.min(Math.max(0, selectionEnd), length - 1);
- length = (int)/*64*/OS.g_utf8_strlen(OS.pango_layout_get_text(layout), -1);
+ length = (int)/*64*/OS.g_utf16_strlen(OS.pango_layout_get_text(layout), -1);
selectionStart = translateOffset(selectionStart);
selectionEnd = translateOffset(selectionEnd);
if (selectionForeground == null) selectionForeground = device.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
@@ -518,8 +518,8 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo
}
} else {
int /*long*/ ptr = OS.pango_layout_get_text(layout);
- int byteSelStart = (int)/*64*/(OS.g_utf8_offset_to_pointer(ptr, selectionStart) - ptr);
- int byteSelEnd = (int)/*64*/(OS.g_utf8_offset_to_pointer(ptr, selectionEnd + 1) - ptr);
+ int byteSelStart = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, selectionStart) - ptr);
+ int byteSelEnd = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, selectionEnd + 1) - ptr);
int strlen = OS.strlen(ptr);
byteSelStart = Math.min(byteSelStart, strlen);
byteSelEnd = Math.min(byteSelEnd, strlen);
@@ -599,8 +599,8 @@ void drawBorder(GC gc, int x, int y, GdkColor selectionColor) {
}
start = translateOffset(start);
int end = translateOffset(styles[i+1].start - 1);
- int byteStart = (int)/*64*/(OS.g_utf8_offset_to_pointer(ptr, start) - ptr);
- int byteEnd = (int)/*64*/(OS.g_utf8_offset_to_pointer(ptr, end + 1) - ptr);
+ int byteStart = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, start) - ptr);
+ int byteEnd = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, end + 1) - ptr);
int[] ranges = new int[]{byteStart, byteEnd};
int /*long*/ rgn = OS.gdk_pango_layout_get_clip_region(layout, x, y, ranges, ranges.length / 2);
if (rgn != 0) {
@@ -677,8 +677,8 @@ void drawBorder(GC gc, int x, int y, GdkColor selectionColor) {
}
start = translateOffset(start);
int end = translateOffset(styles[i+1].start - 1);
- int byteStart = (int)/*64*/(OS.g_utf8_offset_to_pointer(ptr, start) - ptr);
- int byteEnd = (int)/*64*/(OS.g_utf8_offset_to_pointer(ptr, end + 1) - ptr);
+ int byteStart = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, start) - ptr);
+ int byteEnd = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, end + 1) - ptr);
int[] ranges = new int[]{byteStart, byteEnd};
int /*long*/ rgn = OS.gdk_pango_layout_get_clip_region(layout, x, y, ranges, ranges.length / 2);
if (rgn != 0) {
@@ -776,8 +776,8 @@ void drawBorder(GC gc, int x, int y, GdkColor selectionColor) {
}
start = translateOffset(start);
int end = translateOffset(styles[i+1].start - 1);
- int byteStart = (int)/*64*/(OS.g_utf8_offset_to_pointer(ptr, start) - ptr);
- int byteEnd = (int)/*64*/(OS.g_utf8_offset_to_pointer(ptr, end + 1) - ptr);
+ int byteStart = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, start) - ptr);
+ int byteEnd = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, end + 1) - ptr);
int[] ranges = new int[]{byteStart, byteEnd};
int /*long*/ rgn = OS.gdk_pango_layout_get_clip_region(layout, x, y, ranges, ranges.length / 2);
if (rgn != 0) {
@@ -946,8 +946,8 @@ public Rectangle getBounds(int start, int end) {
start = translateOffset(start);
end = translateOffset(end);
int /*long*/ ptr = OS.pango_layout_get_text(layout);
- int byteStart = (int)/*64*/(OS.g_utf8_offset_to_pointer (ptr, start) - ptr);
- int byteEnd = (int)/*64*/(OS.g_utf8_offset_to_pointer (ptr, end + 1) - ptr);
+ int byteStart = (int)/*64*/(OS.g_utf16_offset_to_pointer (ptr, start) - ptr);
+ int byteEnd = (int)/*64*/(OS.g_utf16_offset_to_pointer (ptr, end + 1) - ptr);
int strlen = OS.strlen(ptr);
byteStart = Math.min(byteStart, strlen);
byteEnd = Math.min(byteEnd, strlen);
@@ -1086,7 +1086,7 @@ public int getLevel(int offset) {
PangoItem item = new PangoItem();
PangoLayoutRun run = new PangoLayoutRun();
int /*long*/ ptr = OS.pango_layout_get_text(layout);
- int /*long*/ byteOffset = OS.g_utf8_offset_to_pointer(ptr, offset) - ptr;
+ int /*long*/ byteOffset = OS.g_utf16_offset_to_pointer(ptr, offset) - ptr;
int strlen = OS.strlen(ptr);
byteOffset = Math.min(byteOffset, strlen);
do {
@@ -1180,7 +1180,7 @@ public int getLineIndex(int offset) {
offset = translateOffset(offset);
int line = 0;
int /*long*/ ptr = OS.pango_layout_get_text(layout);
- int /*long*/ byteOffset = OS.g_utf8_offset_to_pointer(ptr,offset) - ptr;
+ int /*long*/ byteOffset = OS.g_utf16_offset_to_pointer(ptr,offset) - ptr;
int strlen = OS.strlen(ptr);
byteOffset = Math.min(byteOffset, strlen);
int /*long*/ iter = OS.pango_layout_get_iter(layout);
@@ -1253,7 +1253,7 @@ public int[] getLineOffsets() {
for (int i = 0; i < lineCount; i++) {
int /*long*/ linePtr = OS.pango_layout_get_line(layout, i);
OS.memmove(line, linePtr, PangoLayoutLine.sizeof);
- int pos = (int)/*64*/OS.g_utf8_pointer_to_offset(ptr, ptr + line.start_index);
+ int pos = (int)/*64*/OS.g_utf16_pointer_to_offset(ptr, ptr + line.start_index);
offsets[i] = untranslateOffset(pos);
}
offsets[lineCount] = text.length();
@@ -1283,7 +1283,7 @@ public Point getLocation(int offset, boolean trailing) {
if (!(0 <= offset && offset <= length)) SWT.error(SWT.ERROR_INVALID_RANGE);
offset = translateOffset(offset);
int /*long*/ ptr = OS.pango_layout_get_text(layout);
- int byteOffset = (int)/*64*/(OS.g_utf8_offset_to_pointer(ptr, offset) - ptr);
+ int byteOffset = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, offset) - ptr);
int strlen = OS.strlen(ptr);
byteOffset = Math.min(byteOffset, strlen);
PangoRectangle pos = new PangoRectangle();
@@ -1337,32 +1337,50 @@ int _getOffset (int offset, int movement, boolean forward) {
int[] nAttrs = new int[1];
OS.pango_layout_get_log_attrs(layout, attrs, nAttrs);
if (attrs[0] == 0) return offset + step;
- length = (int)/*64*/OS.g_utf8_strlen(OS.pango_layout_get_text(layout), -1);
- offset += step;
- int internalOffset = translateOffset(offset);
+
+ int /*long*/ ptr = OS.pango_layout_get_text(layout);
+ int utf8Offset = (int)/*64*/OS.g_utf16_offset_to_utf8_offset (ptr, translateOffset(offset));
+ int utf8Length = (int)/*64*/OS.g_utf8_strlen(ptr, -1);
+ utf8Offset += step;
PangoLogAttr logAttr = new PangoLogAttr();
- while (0 < internalOffset && internalOffset < length) {
- OS.memmove(logAttr, attrs[0] + internalOffset * PangoLogAttr.sizeof, PangoLogAttr.sizeof);
- if (((movement & SWT.MOVEMENT_CLUSTER) != 0) && logAttr.is_cursor_position) break;
+ while (0 <= utf8Offset && utf8Offset <= utf8Length) {
+ OS.memmove(logAttr, attrs[0] + utf8Offset * PangoLogAttr.sizeof, PangoLogAttr.sizeof);
+ boolean found = false;
+ if (((movement & SWT.MOVEMENT_CLUSTER) != 0) && logAttr.is_cursor_position) found = true;
if ((movement & SWT.MOVEMENT_WORD) != 0) {
if (forward) {
- if (logAttr.is_word_end) break;
+ if (logAttr.is_word_end) found = true;
} else {
- if (logAttr.is_word_start) break;
+ if (logAttr.is_word_start) found = true;
}
}
if ((movement & SWT.MOVEMENT_WORD_START) != 0) {
- if (logAttr.is_word_start) break;
- if (logAttr.is_sentence_end) break;
+ if (logAttr.is_word_start) found = true;
+ if (logAttr.is_sentence_end) found = true;
}
if ((movement & SWT.MOVEMENT_WORD_END) != 0) {
- if (logAttr.is_word_end) break;
+ if (logAttr.is_word_end) found = true;
+ if (logAttr.is_sentence_start) found = true;
}
- offset += step;
- internalOffset = translateOffset(offset);
+ if (found) {
+ int testOffset = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, utf8Offset);
+ if (invalidOffsets != null) {
+ for (int i = 0; i < invalidOffsets.length; i++) {
+ if (testOffset == invalidOffsets[i]) {
+ found = false;
+ break;
+ }
+ }
+ }
+ if (found) {
+ offset = untranslateOffset(testOffset);
+ break;
+ }
+ }
+ utf8Offset += step;
}
OS.g_free(attrs[0]);
- return Math.min(Math.max(0, offset), text.length());
+ return Math.min(Math.max(0, offset), length);
}
/**
@@ -1454,8 +1472,13 @@ public int getOffset(int x, int y, int[] trailing) {
int[] piTrailing = new int[1];
OS.pango_layout_xy_to_index(layout, x * OS.PANGO_SCALE, y * OS.PANGO_SCALE, index, piTrailing);
int /*long*/ ptr = OS.pango_layout_get_text(layout);
- int offset = (int)/*64*/OS.g_utf8_pointer_to_offset(ptr, ptr + index[0]);
- if (trailing != null) trailing[0] = piTrailing[0];
+ int offset = (int)/*64*/OS.g_utf16_pointer_to_offset(ptr, ptr + index[0]);
+ if (trailing != null) {
+ trailing[0] = piTrailing[0];
+ if (piTrailing[0] != 0) {
+ trailing[0] = (int)/*64*/OS.g_utf8_offset_to_utf16_offset(ptr, OS.g_utf8_pointer_to_offset(ptr, ptr + index[0]) + piTrailing[0]) - offset;
+ }
+ }
return untranslateOffset(offset);
}
@@ -1911,6 +1934,7 @@ public void setOrientation(int orientation) {
if ((orientation & SWT.LEFT_TO_RIGHT) != 0) orientation = SWT.LEFT_TO_RIGHT;
int baseDir = orientation == SWT.RIGHT_TO_LEFT ? OS.PANGO_DIRECTION_RTL : OS.PANGO_DIRECTION_LTR;
if (OS.pango_context_get_base_dir(context) == baseDir) return;
+ freeRuns();
OS.pango_context_set_base_dir(context, baseDir);
OS.pango_layout_context_changed(layout);
int align = OS.pango_layout_get_alignment(layout);
diff --git a/org/eclipse/swt/graphics/TextStyle.java b/org/eclipse/swt/graphics/TextStyle.java
index 6b7b1cd..769a0f1 100644
--- a/org/eclipse/swt/graphics/TextStyle.java
+++ b/org/eclipse/swt/graphics/TextStyle.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -74,7 +74,7 @@ public class TextStyle {
* <p>
* This value should be one of <code>SWT.UNDERLINE_SINGLE</code>,
* <code>SWT.UNDERLINE_DOUBLE</code>, <code>SWT.UNDERLINE_ERROR</code>,
- * or <code>SWT.UNDERLINE_SQUIGGLE</code>.
+ * <code>SWT.UNDERLINE_SQUIGGLE</code>, or <code>SWT.UNDERLINE_LINK</code>.
* </p>
*
* @see SWT#UNDERLINE_SINGLE
@@ -262,8 +262,8 @@ public int hashCode() {
if (background != null) hash ^= background.hashCode();
if (font != null) hash ^= font.hashCode();
if (metrics != null) hash ^= metrics.hashCode();
- if (underline) hash ^= hash;
- if (strikeout) hash ^= hash;
+ if (underline) hash ^= (hash << 1);
+ if (strikeout) hash ^= (hash << 2);
hash ^= rise;
if (underlineColor != null) hash ^= underlineColor.hashCode();
if (strikeoutColor != null) hash ^= strikeoutColor.hashCode();
diff --git a/org/eclipse/swt/internal/LONG.java b/org/eclipse/swt/internal/LONG.java
index 8609adc..91f0a09 100644
--- a/org/eclipse/swt/internal/LONG.java
+++ b/org/eclipse/swt/internal/LONG.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,6 +26,6 @@ public class LONG {
}
public int hashCode () {
- return (int)/*64*/value;
+ return (int)/*64*/(value ^ (value >>> 32));
}
}
diff --git a/org/eclipse/swt/internal/Library.java b/org/eclipse/swt/internal/Library.java
index 87d1355..0858efa 100644
--- a/org/eclipse/swt/internal/Library.java
+++ b/org/eclipse/swt/internal/Library.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,7 +24,7 @@ public class Library {
/**
* SWT Minor version number (must be in the range 0..999)
*/
- static int MINOR_VERSION = 659;
+ static int MINOR_VERSION = 735;
/**
* SWT revision number (must be >= 0)
@@ -42,16 +42,36 @@ public class Library {
/* 64-bit support */
static final boolean IS_64 = longConst() == (int /*long*/)longConst();
static final String SUFFIX_64 = "-64"; //$NON-NLS-1$
- static final String SWTDIR_32 = "swtlib-32"; //$NON-NLS-1$
- static final String SWTDIR_64 = "swtlib-64"; //$NON-NLS-1$
+ static final String SWT_LIB_DIR;
static {
DELIMITER = System.getProperty("line.separator"); //$NON-NLS-1$
SEPARATOR = System.getProperty("file.separator"); //$NON-NLS-1$
+ SWT_LIB_DIR = ".swt" + SEPARATOR + "lib" + SEPARATOR + os() + SEPARATOR + arch(); //$NON-NLS-1$ $NON-NLS-2$
JAVA_VERSION = parseVersion(System.getProperty("java.version")); //$NON-NLS-1$
SWT_VERSION = SWT_VERSION(MAJOR_VERSION, MINOR_VERSION);
}
+static String arch() {
+ String osArch = System.getProperty("os.arch"); //$NON-NLS-1$
+ if (osArch.equals ("i386") || osArch.equals ("i686")) return "x86"; //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
+ if (osArch.equals ("amd64")) return "x86_64"; //$NON-NLS-1$ $NON-NLS-2$
+ if (osArch.equals ("IA64N")) return "ia64_32"; //$NON-NLS-1$ $NON-NLS-2$
+ if (osArch.equals ("IA64W")) return "ia64"; //$NON-NLS-1$ $NON-NLS-2$
+ return osArch;
+}
+
+static String os() {
+ String osName = System.getProperty("os.name"); //$NON-NLS-1$
+ if (osName.equals ("Linux")) return "linux"; //$NON-NLS-1$ $NON-NLS-2$
+ if (osName.equals ("AIX")) return "aix"; //$NON-NLS-1$ $NON-NLS-2$
+ if (osName.equals ("Solaris") || osName.equals ("SunOS")) return "solaris"; //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
+ if (osName.equals ("HP-UX")) return "hpux"; //$NON-NLS-1$ $NON-NLS-2$
+ if (osName.equals ("Mac OS X")) return "macosx"; //$NON-NLS-1$ $NON-NLS-2$
+ if (osName.startsWith ("Win")) return "win32"; //$NON-NLS-1$ $NON-NLS-2$
+ return osName;
+}
+
static void chmod(String permision, String path) {
if (Platform.PLATFORM.equals ("win32")) return; //$NON-NLS-1$
try {
@@ -240,14 +260,12 @@ public static void loadLibrary (String name, boolean mapName) {
String fileName1 = mappedName1;
String fileName2 = mappedName2;
if (path == null) {
- path = System.getProperty ("java.io.tmpdir"); //$NON-NLS-1$
- File dir = new File (path, IS_64 ? SWTDIR_64 : SWTDIR_32);
- boolean make = false;
- if ((dir.exists () && dir.isDirectory ()) || (make = dir.mkdir ())) {
+ path = System.getProperty ("user.home"); //$NON-NLS-1$
+ File dir = new File (path, SWT_LIB_DIR);
+ if ((dir.exists () && dir.isDirectory ()) || dir.mkdirs ()) {
path = dir.getAbsolutePath ();
- if (make) chmod ("777", path); //$NON-NLS-1$
} else {
- /* fall back to using the tmp directory */
+ /* fall back to using the home dir directory */
if (IS_64) {
fileName1 = mapLibraryName (libName1 + SUFFIX_64);
fileName2 = mapLibraryName (libName2 + SUFFIX_64);
diff --git a/org/eclipse/swt/internal/Lock.java b/org/eclipse/swt/internal/Lock.java
index 7254f52..a1858da 100644
--- a/org/eclipse/swt/internal/Lock.java
+++ b/org/eclipse/swt/internal/Lock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org/eclipse/swt/internal/SWTMessages.properties b/org/eclipse/swt/internal/SWTMessages.properties
index 3a5c957..d212d17 100644
--- a/org/eclipse/swt/internal/SWTMessages.properties
+++ b/org/eclipse/swt/internal/SWTMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2010 IBM Corporation and others.
+# Copyright (c) 2000, 2011 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -83,6 +83,7 @@ SWT_InvalidCert_Connect=Would you like to connect to this site anyways?
SWT_OnBeforeUnload_Message1=Are you sure you want to leave this page?
SWT_OnBeforeUnload_Message2=Click OK to continue, or Cancel to stay on this page.
SWT_ViewCertificate=View Certificate
+SWT_Certificate=Certificate
SWT_Controlled_By=controlled by
SWT_Controller_For=controller for
SWT_Described_By=described by
@@ -98,3 +99,17 @@ SWT_Node_Child_Of=node child of
SWT_Parent_Window_Of=parent window of
SWT_Popup_For=popup for
SWT_Subwindow_Of=subwindow of
+SWT_Continue=Continue
+SWT_IssuedTo=Issued to:\t{0}
+SWT_IssuedFrom=Issued from:\t{0}
+SWT_Issuer=Issuer
+SWT_General=General
+SWT_Details=Details
+SWT_Field=Field
+SWT_Value=Value
+SWT_Version=Version
+SWT_ValidFrom=Valid From
+SWT_ValidTo=Valid To
+SWT_ValidFromTo=Valid from: {0} to: {1}
+SWT_Subject=Subject
+SWT_SerialNumber=Serial Number
\ No newline at end of file
diff --git a/org/eclipse/swt/internal/SWTMessages_ar.properties b/org/eclipse/swt/internal/SWTMessages_ar.properties
index c14fda9..9c486d3 100644
--- a/org/eclipse/swt/internal/SWTMessages_ar.properties
+++ b/org/eclipse/swt/internal/SWTMessages_ar.properties
@@ -22,4 +22,11 @@ SWT_Open=\u0641\u062a\u062d
SWT_Close=\u0627\u063a\u0644\u0627\u0642
SWT_Minimize=\u062a\u0635\u063a\u064a\u0631
SWT_Maximize=\u062a\u0643\u0628\u064a\u0631
-SWT_Restore=\u0627\u0633\u062a\u0639\u0627\u062f\u0629
\ No newline at end of file
+SWT_Restore=\u0627\u0633\u062a\u0639\u0627\u062f\u0629
+SWT_Continue=\u0627\u0633\u062a\u0645\u0631\u0627\u0631
+SWT_General=\u0639\u0627\u0645
+SWT_Details=\u0627\u0644\u062a\u0641\u0627\u0635\u064a\u0644
+SWT_Field=\u0645\u062c\u0627\u0644
+SWT_Value=\u0627\u0644\u0642\u064a\u0645\u0629
+SWT_Version=\u0627\u0644\u0646\u0633\u062e\u0629
+SWT_Subject=\u0627\u0644\u0645\u0648\u0636\u0648\u0639
diff --git a/org/eclipse/swt/internal/SWTMessages_mn.properties b/org/eclipse/swt/internal/SWTMessages_bg.properties
similarity index 56%
copy from org/eclipse/swt/internal/SWTMessages_mn.properties
copy to org/eclipse/swt/internal/SWTMessages_bg.properties
index 7ce97ec..104a0e5 100644
--- a/org/eclipse/swt/internal/SWTMessages_mn.properties
+++ b/org/eclipse/swt/internal/SWTMessages_bg.properties
@@ -1,2 +1,2 @@
# Copyright by many contributors; see http://babel.eclipse.org/
-SWT_Cancel=\u0411\u043e\u043b\u0438\u0445
\ No newline at end of file
+SWT_Version=\u0412\u0435\u0440\u0441\u0438\u044f
diff --git a/org/eclipse/swt/internal/SWTMessages_cs.properties b/org/eclipse/swt/internal/SWTMessages_cs.properties
index f6c9664..bea6ecb 100644
--- a/org/eclipse/swt/internal/SWTMessages_cs.properties
+++ b/org/eclipse/swt/internal/SWTMessages_cs.properties
@@ -26,4 +26,11 @@ SWT_Open=Otev\u0159\u00edt
SWT_Close=Zav\u0159\u00edt
SWT_Minimize=Minimalizovat
SWT_Maximize=Maximalizovat
-SWT_Restore=Obnovit
\ No newline at end of file
+SWT_Restore=Obnovit
+SWT_Continue=Pokra\u010dovat
+SWT_General=Obecn\u00e9
+SWT_Details=Podrobnosti
+SWT_Field=Pole
+SWT_Value=Hodnota
+SWT_Version=Verze
+SWT_Subject=P\u0159edm\u011bt
diff --git a/org/eclipse/swt/internal/SWTMessages_da.properties b/org/eclipse/swt/internal/SWTMessages_da.properties
index e6efe92..e24e158 100644
--- a/org/eclipse/swt/internal/SWTMessages_da.properties
+++ b/org/eclipse/swt/internal/SWTMessages_da.properties
@@ -22,4 +22,11 @@ SWT_Open=\u00c5bn
SWT_Close=Luk
SWT_Minimize=Minim\u00e9r
SWT_Maximize=Maksim\u00e9r
-SWT_Restore=Gendan
\ No newline at end of file
+SWT_Restore=Gendan
+SWT_Continue=Forts\u00e6t
+SWT_General=Generelt
+SWT_Details=Oplysninger
+SWT_Field=Felt
+SWT_Value=V\u00e6rdi
+SWT_Version=Version
+SWT_Subject=Subject
diff --git a/org/eclipse/swt/internal/SWTMessages_de.properties b/org/eclipse/swt/internal/SWTMessages_de.properties
index d2969d0..472cad6 100644
--- a/org/eclipse/swt/internal/SWTMessages_de.properties
+++ b/org/eclipse/swt/internal/SWTMessages_de.properties
@@ -62,4 +62,13 @@ SWT_Download_Location=Speichern von {0} von {1}
SWT_Download_Started=Herunterladen...
SWT_Download_Status=Download: {0,number,integer} KB von {1,number,integer} KB
SWT_Authentication_Required=Authentifizierung erforderlich
-SWT_Enter_Username_and_Password=Benutzernamen und Kennwort f\u00fcr {0} unter {1} eingeben
\ No newline at end of file
+SWT_Enter_Username_and_Password=Benutzernamen und Kennwort f\u00fcr {0} unter {1} eingeben
+SWT_Continue=Weiter
+SWT_General=Allgemein
+SWT_Details=Details
+SWT_Field=Feld
+SWT_Value=Wert
+SWT_Version=Version
+SWT_ValidFrom=G\u00fcltig ab
+SWT_Subject=Subject
+SWT_SerialNumber=Seriennummer
diff --git a/org/eclipse/swt/internal/SWTMessages_el.properties b/org/eclipse/swt/internal/SWTMessages_el.properties
index a14609e..56dd88e 100644
--- a/org/eclipse/swt/internal/SWTMessages_el.properties
+++ b/org/eclipse/swt/internal/SWTMessages_el.properties
@@ -22,4 +22,11 @@ SWT_Open=\u0386\u03bd\u03bf\u03b9\u03b3\u03bc\u03b1
SWT_Close=\u039a\u03bb\u03b5\u03af\u03c3\u03b9\u03bc\u03bf
SWT_Minimize=\u0395\u03bb\u03b1\u03c7\u03b9\u03c3\u03c4\u03bf\u03c0\u03bf\u03af\u03b7\u03c3\u03b7
SWT_Maximize=\u039c\u03b5\u03b3\u03b9\u03c3\u03c4\u03bf\u03c0\u03bf\u03af\u03b7\u03c3\u03b7
-SWT_Restore=\u0395\u03c0\u03b1\u03bd\u03b1\u03c6\u03bf\u03c1\u03ac
\ No newline at end of file
+SWT_Restore=\u0395\u03c0\u03b1\u03bd\u03b1\u03c6\u03bf\u03c1\u03ac
+SWT_Continue=\u03a3\u03c5\u03bd\u03ad\u03c7\u03b9\u03c3\u03b7
+SWT_General=\u0393\u03b5\u03bd\u03b9\u03ba\u03ac
+SWT_Details=\u039b\u03b5\u03c0\u03c4\u03bf\u03bc\u03ad\u03c1\u03b5\u03b9\u03b5\u03c2
+SWT_Field=\u03a0\u03b5\u03b4\u03af\u03bf
+SWT_Value=\u03a4\u03b9\u03bc\u03ae
+SWT_Version=\u0395\u03ba\u03b4\u03bf\u03c7\u03ae
+SWT_Subject=\u0398\u03ad\u03bc\u03b1
diff --git a/org/eclipse/swt/internal/SWTMessages_es.properties b/org/eclipse/swt/internal/SWTMessages_es.properties
index 83c1aa0..e3f6ff9 100644
--- a/org/eclipse/swt/internal/SWTMessages_es.properties
+++ b/org/eclipse/swt/internal/SWTMessages_es.properties
@@ -64,3 +64,11 @@ SWT_Download_Status=Descarga: {0,number,integer} KB de {1,number,integer} KB
SWT_Authentication_Required=Autenticaci\u00f3n requerida
SWT_Enter_Username_and_Password=Introduzca nombre de usuario y contrase\u00f1a para {0} en {1}
SWT_Page_Load_Failed=Carga de p\u00e1gina fall\u00f3 con error: {0}
+SWT_Continue=Continuar
+SWT_General=General
+SWT_Details=Detalles
+SWT_Field=Campo
+SWT_Value=Valor
+SWT_Version=Versi\u00f3n
+SWT_ValidFrom=V\u00e1lido desde
+SWT_Subject=Sujeto
diff --git a/org/eclipse/swt/internal/SWTMessages_et.properties b/org/eclipse/swt/internal/SWTMessages_et.properties
index 6118bc8..da82051 100644
--- a/org/eclipse/swt/internal/SWTMessages_et.properties
+++ b/org/eclipse/swt/internal/SWTMessages_et.properties
@@ -21,3 +21,6 @@ SWT_Minimize=V\u00e4henda
SWT_Maximize=Suurenda
SWT_Restore=Taasta
SWT_Download_Started=Laen alla...
+SWT_General=\u00dcldine
+SWT_Value=V\u00e4\u00e4rtus
+SWT_Version=Versioon
diff --git a/org/eclipse/swt/internal/SWTMessages_fa.properties b/org/eclipse/swt/internal/SWTMessages_fa.properties
new file mode 100644
index 0000000..d70a97b
--- /dev/null
+++ b/org/eclipse/swt/internal/SWTMessages_fa.properties
@@ -0,0 +1,54 @@
+# Copyright by many contributors; see http://babel.eclipse.org/
+SWT_Yes=\u0628\u0644\u0647
+SWT_No=\u062e\u06cc\u0631
+SWT_OK=\u062a\u0623\u06cc\u06cc\u062f
+SWT_Cancel=\u0644\u063a\u0648
+SWT_Abort=\u0631\u0647\u0627\u06a9\u0646
+SWT_Retry=\u0645\u062c\u062f\u062f\u0627 \u062a\u0644\u0627\u0634\u200c\u06a9\u0646
+SWT_Ignore=\u0646\u0627\u062f\u06cc\u062f\u0647\u200c\u0628\u06af\u06cc\u0631
+SWT_Sample=\u0646\u0645\u0648\u0646\u0647
+SWT_A_Sample_Text=\u0645\u062a\u0646 \u0646\u0645\u0648\u0646\u0647
+SWT_Selection=\u0645\u0646\u062a\u062e\u0628
+SWT_Current_Selection=\u0627\u0646\u062a\u062e\u0627\u0628 \u062c\u0627\u0631\u06cc
+SWT_Font=\u0642\u0644\u0645
+SWT_Color=\u0631\u0646\u06af
+SWT_Extended_style=\u0633\u0628\u06a9 \u06af\u0633\u062a\u0631\u062f\u0647
+SWT_Size=\u0633\u0627\u06cc\u0632
+SWT_Style=\u0633\u0628\u06a9
+SWT_Save=\u0630\u062e\u06cc\u0631\u0647\u200c\u06a9\u0631\u062f\u0646
+SWT_Character_set=\u0645\u062c\u0645\u0648\u0639\u0647 \u0646\u0648\u06cc\u0633\u0647
+SWT_ColorDialog_Title=\u0631\u0646\u06af\u200c\u0647\u0627
+SWT_FontDialog_Title=\u0642\u0644\u0645\u200c\u0647\u0627
+SWT_FontSet=\u0645\u062c\u0645\u0648\u0639\u0647 \u0642\u0644\u0645
+SWT_NewFont=\u0642\u0644\u0645 \u062c\u062f\u06cc\u062f
+SWT_Remove=\u062d\u0630\u0641
+SWT_Up=\u0628\u0627\u0644\u0627
+SWT_Down=\u067e\u0627\u0626\u06cc\u0646
+SWT_Charset_Western=\u063a\u0631\u0628\u06cc
+SWT_Charset_EastEuropean=\u0634\u0631\u0642\u06cc
+SWT_Charset_SouthEuropean=\u062c\u0646\u0648\u0628\u06cc
+SWT_Charset_NorthEuropean=\u0634\u0645\u0627\u0644\u06cc
+SWT_Charset_Cyrillic=\u0633\u06cc\u0631\u06cc\u0644\u06cc\u06a9
+SWT_Charset_Arabic=\u0639\u0631\u0628\u06cc
+SWT_Charset_Greek=\u06cc\u0648\u0646\u0627\u0646\u06cc
+SWT_Charset_Hebrew=\u0639\u0628\u0631\u06cc
+SWT_Charset_Turkish=\u062a\u0631\u06a9\u06cc
+SWT_Charset_Nordic=\u0634\u0645\u0627\u0644\u200c\u0627\u0631\u0648\u067e\u0627\u06cc\u06cc
+SWT_Charset_Thai=\u062a\u0627\u06cc\u06cc
+SWT_Charset_BalticRim=\u062d\u0627\u0634\u06cc\u0647\u0654 \u0628\u0627\u0644\u062a\u06cc\u06a9
+SWT_Charset_Celtic=\u0633\u0644\u062a\u06cc
+SWT_Charset_Euro=\u0627\u0631\u0648\u067e\u0627\u06cc\u06cc
+SWT_Charset_Romanian=\u0631\u0648\u0645\u0627\u0646\u06cc\u0627\u06cc\u06cc
+SWT_Charset_SimplifiedChinese=\u0686\u06cc\u0646\u06cc \u0633\u0627\u062f\u0647
+SWT_Charset_TraditionalChinese=\u0686\u06cc\u0646\u06cc \u0633\u0646\u062a\u06cc
+SWT_Charset_Japanese=\u0698\u0627\u067e\u0646\u06cc
+SWT_Charset_Korean=\u06a9\u0631\u0647\u200c\u0627\u06cc
+SWT_Charset_Unicode=\u06cc\u0648\u0646\u06cc\u06a9\u062f
+SWT_Charset_ASCII=\u0627\u0633\u06a9\u06cc
+SWT_Close=\u0628\u0633\u062a\u0646
+SWT_Minimize=\u06a9\u0648\u0686\u06a9 \u06a9\u0631\u062f\u0646
+SWT_Maximize=\u0628\u06cc\u0634\u06cc\u0646\u0647\u200c\u06a9\u0631\u062f\u0646
+SWT_Restore=\u0630\u062e\u06cc\u0631\u0647 \u06a9\u0631\u062f\u0646
+SWT_General=\u0639\u0645\u0648\u0645\u06cc
+SWT_Value=\u0645\u0642\u062f\u0627\u0631
+SWT_Version=\u0646\u0633\u062e\u0647
diff --git a/org/eclipse/swt/internal/SWTMessages_fi.properties b/org/eclipse/swt/internal/SWTMessages_fi.properties
index 796ae74..6cc5ed5 100644
--- a/org/eclipse/swt/internal/SWTMessages_fi.properties
+++ b/org/eclipse/swt/internal/SWTMessages_fi.properties
@@ -22,4 +22,11 @@ SWT_Open=Avaa
SWT_Close=Sulje
SWT_Minimize=Pienenn\u00e4
SWT_Maximize=Suurenna
-SWT_Restore=Palauta
\ No newline at end of file
+SWT_Restore=Palauta
+SWT_Continue=Jatka
+SWT_General=Yleiset
+SWT_Details=Tiedot
+SWT_Field=Kentt\u00e4
+SWT_Value=Arvo
+SWT_Version=Versio
+SWT_Subject=Subject
diff --git a/org/eclipse/swt/internal/SWTMessages_fr.properties b/org/eclipse/swt/internal/SWTMessages_fr.properties
index 1b60f16..ba4aedb 100644
--- a/org/eclipse/swt/internal/SWTMessages_fr.properties
+++ b/org/eclipse/swt/internal/SWTMessages_fr.properties
@@ -62,4 +62,13 @@ SWT_Download_Location=Enregistrement de {0} depuis {1}
SWT_Download_Started=T\u00e9l\u00e9chargement...
SWT_Download_Status=T\u00e9l\u00e9charger\u00a0: {0,number,integer} ko de {1,number,integer} ko
SWT_Authentication_Required=Authentification requise
-SWT_Enter_Username_and_Password=Entrer le nom d''utilisateur et le mot de passe pour {0} au niveau de {1}
\ No newline at end of file
+SWT_Enter_Username_and_Password=Entrer le nom d''utilisateur et le mot de passe pour {0} au niveau de {1}
+SWT_Continue=Continuer
+SWT_General=G\u00e9n\u00e9ral
+SWT_Details=D\u00e9tails
+SWT_Field=Champ
+SWT_Value=Valeur
+SWT_Version=Version
+SWT_ValidFrom=Valide \u00e0 partir du
+SWT_Subject=Sujet
+SWT_SerialNumber=Num\u00e9ro de s\u00e9rie
diff --git a/org/eclipse/swt/internal/SWTMessages_mn.properties b/org/eclipse/swt/internal/SWTMessages_hi.properties
similarity index 60%
copy from org/eclipse/swt/internal/SWTMessages_mn.properties
copy to org/eclipse/swt/internal/SWTMessages_hi.properties
index 7ce97ec..4328fab 100644
--- a/org/eclipse/swt/internal/SWTMessages_mn.properties
+++ b/org/eclipse/swt/internal/SWTMessages_hi.properties
@@ -1,2 +1,2 @@
# Copyright by many contributors; see http://babel.eclipse.org/
-SWT_Cancel=\u0411\u043e\u043b\u0438\u0445
\ No newline at end of file
+SWT_OK=\u0920\u0940\u0915 \u0939\u0948
diff --git a/org/eclipse/swt/internal/SWTMessages_hu.properties b/org/eclipse/swt/internal/SWTMessages_hu.properties
index f2dd2c1..e3dc13d 100644
--- a/org/eclipse/swt/internal/SWTMessages_hu.properties
+++ b/org/eclipse/swt/internal/SWTMessages_hu.properties
@@ -22,4 +22,11 @@ SWT_Open=Megnyit\u00e1s
SWT_Close=Bez\u00e1r\u00e1s
SWT_Minimize=Kis m\u00e9ret
SWT_Maximize=Teljes m\u00e9ret
-SWT_Restore=Vissza\u00e1ll\u00edt\u00e1s
\ No newline at end of file
+SWT_Restore=Vissza\u00e1ll\u00edt\u00e1s
+SWT_Continue=Folytat\u00e1s
+SWT_General=\u00c1ltal\u00e1nos
+SWT_Details=R\u00e9szletek
+SWT_Field=Mez\u0151
+SWT_Value=\u00c9rt\u00e9k
+SWT_Version=Verzi\u00f3
+SWT_Subject=T\u00e1rgy
diff --git a/org/eclipse/swt/internal/SWTMessages_it.properties b/org/eclipse/swt/internal/SWTMessages_it.properties
index bb229e6..c437941 100644
--- a/org/eclipse/swt/internal/SWTMessages_it.properties
+++ b/org/eclipse/swt/internal/SWTMessages_it.properties
@@ -60,4 +60,11 @@ SWT_FileDownload=Download file
SWT_Download_File=Download: {0}
SWT_Download_Location=Salvataggio di {0} da {1}
SWT_Download_Started=Download in corso...
-SWT_Download_Status=Download: {0,number,integer} KB di {1,number,integer} KB
\ No newline at end of file
+SWT_Download_Status=Download: {0,number,integer} KB di {1,number,integer} KB
+SWT_Continue=Continua
+SWT_General=Generale
+SWT_Details=Dettagli
+SWT_Field=Campo
+SWT_Value=Valore
+SWT_Version=Versione
+SWT_Subject=Subject
diff --git a/org/eclipse/swt/internal/SWTMessages_iw.properties b/org/eclipse/swt/internal/SWTMessages_iw.properties
index 0e9d119..b27ccba 100644
--- a/org/eclipse/swt/internal/SWTMessages_iw.properties
+++ b/org/eclipse/swt/internal/SWTMessages_iw.properties
@@ -7,6 +7,8 @@ SWT_Abort=Abort
SWT_Ignore=Ignore
SWT_Selection=Selection
SWT_Font=\u05d2\u05d5\u05e4\u05df
+SWT_Color=\u05e6\u05d1\u05e2
+SWT_Size=\u05d2\u05d5\u05d3\u05dc
SWT_Style=Style
SWT_Save=\u05e9\u05de\u05d9\u05e8\u05d4
SWT_Remove=Remove
@@ -18,4 +20,11 @@ SWT_Open=Open
SWT_Close=\u05e1\u05d2\u05d9\u05e8\u05d4
SWT_Minimize=\u05de\u05d6\u05e2\u05d5\u05e8
SWT_Maximize=\u05d4\u05d2\u05d3\u05dc\u05d4
-SWT_Restore=\u05e9\u05d7\u05d6\u05d5\u05e8
\ No newline at end of file
+SWT_Restore=\u05e9\u05d7\u05d6\u05d5\u05e8
+SWT_Continue=Continue
+SWT_General=General
+SWT_Details=Details
+SWT_Field=Field
+SWT_Value=Value
+SWT_Version=\u05d2\u05e8\u05e1\u05d4
+SWT_Subject=Subject
diff --git a/org/eclipse/swt/internal/SWTMessages_ja.properties b/org/eclipse/swt/internal/SWTMessages_ja.properties
index 3f48738..3dcd6bf 100644
--- a/org/eclipse/swt/internal/SWTMessages_ja.properties
+++ b/org/eclipse/swt/internal/SWTMessages_ja.properties
@@ -62,4 +62,13 @@ SWT_Download_Location={1} \u304b\u3089 {0} \u3092\u4fdd\u5b58\u3057\u3066\u3044\
SWT_Download_Started=\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9...
SWT_Download_Status=\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9 : {0,number,integer} KB / {1,number,integer} KB
SWT_Authentication_Required=\u8a8d\u8a3c\u304c\u5fc5\u8981\u3067\u3059
-SWT_Enter_Username_and_Password={1} \u306b\u304a\u3051\u308b {0} \u306e\u30e6\u30fc\u30b6\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044
\ No newline at end of file
+SWT_Enter_Username_and_Password={1} \u306b\u304a\u3051\u308b {0} \u306e\u30e6\u30fc\u30b6\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044
+SWT_Continue=\u7d99\u7d9a
+SWT_General=\u4e00\u822c
+SWT_Details=\u8a73\u7d30
+SWT_Field=\u30d5\u30a3\u30fc\u30eb\u30c9
+SWT_Value=\u5024
+SWT_Version=\u30d0\u30fc\u30b8\u30e7\u30f3
+SWT_ValidFrom=\u6709\u52b9\u671f\u9650\u306e\u958b\u59cb
+SWT_Subject=\u30b5\u30d6\u30b8\u30a7\u30af\u30c8
+SWT_SerialNumber=\u30b7\u30ea\u30a2\u30eb\u756a\u53f7
diff --git a/org/eclipse/swt/internal/SWTMessages_ko.properties b/org/eclipse/swt/internal/SWTMessages_ko.properties
index 2adca26..574e6ad 100644
--- a/org/eclipse/swt/internal/SWTMessages_ko.properties
+++ b/org/eclipse/swt/internal/SWTMessages_ko.properties
@@ -62,4 +62,13 @@ SWT_Download_Location={1}\uc5d0\uc11c {0} \uc800\uc7a5
SWT_Download_Started=\ub2e4\uc6b4\ub85c\ub4dc \uc911 ...
SWT_Download_Status=\ub2e4\uc6b4\ub85c\ub4dc: {0,number,integer}KB/{1,number,integer}KB
SWT_Authentication_Required=\uc778\uc99d \ud544\uc694
-SWT_Enter_Username_and_Password={1}\uc5d0 {0}\uc758 \uc0ac\uc6a9\uc790 \uc774\ub984\uacfc \uc554\ud638\ub97c \uc785\ub825\ud569\ub2c8\ub2e4.
\ No newline at end of file
+SWT_Enter_Username_and_Password={1}\uc5d0 {0}\uc758 \uc0ac\uc6a9\uc790 \uc774\ub984\uacfc \uc554\ud638\ub97c \uc785\ub825\ud569\ub2c8\ub2e4.
+SWT_Continue=\uacc4\uc18d
+SWT_General=\uc77c\ubc18
+SWT_Details=\uc138\ubd80\uc0ac\ud56d
+SWT_Field=\ud544\ub4dc
+SWT_Value=\uac12
+SWT_Version=\ubc84\uc804
+SWT_ValidFrom=\uc720\ud6a8 \uae30\uac04 \uc2dc\uc791
+SWT_Subject=\uc8fc\uc81c
+SWT_SerialNumber=\uc77c\ub828 \ubc88\ud638
diff --git a/org/eclipse/swt/internal/SWTMessages_mn.properties b/org/eclipse/swt/internal/SWTMessages_mn.properties
index 7ce97ec..14e88df 100644
--- a/org/eclipse/swt/internal/SWTMessages_mn.properties
+++ b/org/eclipse/swt/internal/SWTMessages_mn.properties
@@ -1,2 +1,3 @@
# Copyright by many contributors; see http://babel.eclipse.org/
-SWT_Cancel=\u0411\u043e\u043b\u0438\u0445
\ No newline at end of file
+SWT_Cancel=\u0411\u043e\u043b\u0438\u0445
+SWT_Version=\u0425\u0443\u0432\u0438\u043b\u0431\u0430\u0440
diff --git a/org/eclipse/swt/internal/SWTMessages_nl.properties b/org/eclipse/swt/internal/SWTMessages_nl.properties
index db94758..75dd792 100644
--- a/org/eclipse/swt/internal/SWTMessages_nl.properties
+++ b/org/eclipse/swt/internal/SWTMessages_nl.properties
@@ -22,4 +22,11 @@ SWT_Open=Openen
SWT_Close=Sluiten
SWT_Minimize=Minimaliseren
SWT_Maximize=Maximaliseren
-SWT_Restore=Herstellen
\ No newline at end of file
+SWT_Restore=Herstellen
+SWT_Continue=Doorgaan
+SWT_General=Algemeen
+SWT_Details=Details
+SWT_Field=Veld
+SWT_Value=Waarde
+SWT_Version=Versie
+SWT_Subject=Subject
diff --git a/org/eclipse/swt/internal/SWTMessages_no.properties b/org/eclipse/swt/internal/SWTMessages_no.properties
index 2d1bc5d..746df23 100644
--- a/org/eclipse/swt/internal/SWTMessages_no.properties
+++ b/org/eclipse/swt/internal/SWTMessages_no.properties
@@ -22,4 +22,11 @@ SWT_Open=\u00c5pne
SWT_Close=Lukk
SWT_Minimize=Minimer
SWT_Maximize=Maksimer
-SWT_Restore=Gjenopprett
\ No newline at end of file
+SWT_Restore=Gjenopprett
+SWT_Continue=Fortsett
+SWT_General=Generelt
+SWT_Details=Detaljer
+SWT_Field=Felt
+SWT_Value=Verdi
+SWT_Version=Versjon
+SWT_Subject=Emne
diff --git a/org/eclipse/swt/internal/SWTMessages_pl.properties b/org/eclipse/swt/internal/SWTMessages_pl.properties
index 5f09c29..286bc14 100644
--- a/org/eclipse/swt/internal/SWTMessages_pl.properties
+++ b/org/eclipse/swt/internal/SWTMessages_pl.properties
@@ -39,4 +39,11 @@ SWT_FileDownload=Pobierz plik
SWT_Download_File=Pobierz
SWT_Download_Location=Zapisuj\u0119 {0} z {1}
SWT_Download_Started=Pobieranie...
-SWT_Download_Status=Pobrano: {0,number,integer} KB z {1,number,integer} KB
\ No newline at end of file
+SWT_Download_Status=Pobrano: {0,number,integer} KB z {1,number,integer} KB
+SWT_Continue=Kontynuuj
+SWT_General=Og\u00f3lne
+SWT_Details=Szczeg\u00f3\u0142y
+SWT_Field=Pole
+SWT_Value=Warto\u015b\u0107
+SWT_Version=Wersja
+SWT_Subject=Subject
diff --git a/org/eclipse/swt/internal/SWTMessages_pt.properties b/org/eclipse/swt/internal/SWTMessages_pt.properties
index 6b03c74..58e89c9 100644
--- a/org/eclipse/swt/internal/SWTMessages_pt.properties
+++ b/org/eclipse/swt/internal/SWTMessages_pt.properties
@@ -61,4 +61,11 @@ SWT_Download_Location=Gravando {0} de {1}
SWT_Download_Started=Descarregando...
SWT_Download_Status=Descarregar: {0,number,integer} KB de {1,number,integer} KB
SWT_Authentication_Required=Autentica\u00e7\u00e3o Necess\u00e1ria
-SWT_Enter_Username_and_Password=Insira nome de utilizador e palavra-passe para {0} em {1}
\ No newline at end of file
+SWT_Enter_Username_and_Password=Insira nome de utilizador e palavra-passe para {0} em {1}
+SWT_Continue=Continuar
+SWT_General=Geral
+SWT_Details=Detalhes
+SWT_Field=Campo
+SWT_Value=Valor
+SWT_Version=Vers\u00e3o
+SWT_Subject=Sujeito
diff --git a/org/eclipse/swt/internal/SWTMessages_pt_BR.properties b/org/eclipse/swt/internal/SWTMessages_pt_BR.properties
index e80c352..0cb0bd2 100644
--- a/org/eclipse/swt/internal/SWTMessages_pt_BR.properties
+++ b/org/eclipse/swt/internal/SWTMessages_pt_BR.properties
@@ -22,4 +22,11 @@ SWT_Open=Abrir
SWT_Close=Fechar
SWT_Minimize=Minimizar
SWT_Maximize=Maximizar
-SWT_Restore=Restaurar
\ No newline at end of file
+SWT_Restore=Restaurar
+SWT_Continue=Continuar
+SWT_General=Geral
+SWT_Details=Detalhes
+SWT_Field=Campo
+SWT_Value=Valor
+SWT_Version=Vers\u00e3o
+SWT_Subject=Assunto
diff --git a/org/eclipse/swt/internal/SWTMessages_ro.properties b/org/eclipse/swt/internal/SWTMessages_ro.properties
index 820114f..3535f9c 100644
--- a/org/eclipse/swt/internal/SWTMessages_ro.properties
+++ b/org/eclipse/swt/internal/SWTMessages_ro.properties
@@ -1,5 +1,10 @@
# Copyright by many contributors; see http://babel.eclipse.org/
SWT_Yes=Da
SWT_No=Nu
+SWT_OK=OK
+SWT_Cancel=Anuleaz\u0103
+SWT_Save=Salva
+SWT_Remove=\u015eterge
SWT_Password=Parol\u0103:
-SWT_Close=\u00cenchide
\ No newline at end of file
+SWT_Close=\u00cenchide
+SWT_General=General
diff --git a/org/eclipse/swt/internal/SWTMessages_ru.properties b/org/eclipse/swt/internal/SWTMessages_ru.properties
index 8d056cd..16655dc 100644
--- a/org/eclipse/swt/internal/SWTMessages_ru.properties
+++ b/org/eclipse/swt/internal/SWTMessages_ru.properties
@@ -28,3 +28,11 @@ SWT_Minimize=\u0421\u0432\u0435\u0440\u043d\u0443\u0442\u044c
SWT_Maximize=\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c
SWT_Restore=\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c
SWT_Download_Started=\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430:
+SWT_Continue=\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c
+SWT_General=\u041e\u0431\u0449\u0438\u0435
+SWT_Details=\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f
+SWT_Field=\u041f\u043e\u043b\u0435
+SWT_Value=\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435
+SWT_Version=\u0412\u0435\u0440\u0441\u0438\u044f
+SWT_Subject=\u0421\u0443\u0431\u044a\u0435\u043a\u0442
+SWT_SerialNumber=\u0421\u0435\u0440\u0438\u0439\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440
diff --git a/org/eclipse/swt/internal/SWTMessages_sl.properties b/org/eclipse/swt/internal/SWTMessages_sl.properties
new file mode 100644
index 0000000..aa2e63c
--- /dev/null
+++ b/org/eclipse/swt/internal/SWTMessages_sl.properties
@@ -0,0 +1,65 @@
+# Copyright by many contributors; see http://babel.eclipse.org/
+SWT_Yes=Da
+SWT_No=Ne
+SWT_OK=V redu
+SWT_Cancel=Prekli\u010di
+SWT_Abort=Prekini
+SWT_Retry=Poskusi ponovno
+SWT_Ignore=Prezri
+SWT_Sample=Vzorec
+SWT_A_Sample_Text=Vzor\u010dno besedilo
+SWT_Selection=Izbor
+SWT_Current_Selection=Trenutni izbor
+SWT_Font=Pisava
+SWT_Color=Barva
+SWT_Extended_style=Raz\u0161irjen stil
+SWT_Size=Velikost
+SWT_Style=Stil
+SWT_Save=Shrani
+SWT_Character_set=Nabor znakov
+SWT_ColorDialog_Title=Barve
+SWT_FontDialog_Title=Pisave
+SWT_FontSet=Nabor pisav
+SWT_NewFont=Nova pisava
+SWT_Remove=Odstrani
+SWT_Up=Gor
+SWT_Down=Dol
+SWT_Charset_Western=zahodna
+SWT_Charset_EastEuropean=vzhodna
+SWT_Charset_SouthEuropean=ju\u017ena
+SWT_Charset_NorthEuropean=severna
+SWT_Charset_Cyrillic=cirilica
+SWT_Charset_Arabic=arabska
+SWT_Charset_Greek=gr\u0161ka
+SWT_Charset_Hebrew=hebrejska
+SWT_Charset_Turkish=tur\u0161ka
+SWT_Charset_Nordic=nordijska
+SWT_Charset_Thai=tajska
+SWT_Charset_BalticRim=skandinavska/baltska
+SWT_Charset_Celtic=keltska
+SWT_Charset_Euro=evropska
+SWT_Charset_Romanian=romunska
+SWT_Charset_SimplifiedChinese=poenostavljena kitajska
+SWT_Charset_TraditionalChinese=tradicionalna kitajska
+SWT_Charset_Japanese=japonska
+SWT_Charset_Korean=korejska
+SWT_Charset_Unicode=unikod
+SWT_InputMethods=Na\u010dini vnosa
+SWT_Password=Geslo:
+SWT_Username=Uporabni\u0161ko ime:
+SWT_Switch=Preklopi
+SWT_Press=Pritisni
+SWT_Open=Odpri
+SWT_Close=Zapri
+SWT_Minimize=Minimiziraj
+SWT_Maximize=Maksimiziraj
+SWT_Restore=Obnovi
+SWT_ShowList=Prika\u017ei seznam
+SWT_FileDownload=Prenos datoteke
+SWT_Download_File=Prenos: {0}
+SWT_Download_Location=Shranjujem {0} od {1}
+SWT_Download_Started=Prena\u0161am ...
+SWT_Download_Status=Prenos: {0,number,integer} KB od {1,number,integer} KB
+SWT_Authentication_Required=Zahtevana avtentikacija
+SWT_Enter_Username_and_Password=Vpi\u0161ite uporabni\u0161ko ime in geslo za {0} pri {1}
+SWT_Page_Load_Failed=Nalaganje strani ni uspelo. Napaka: {0}
diff --git a/org/eclipse/swt/internal/SWTMessages_sv.properties b/org/eclipse/swt/internal/SWTMessages_sv.properties
index b251051..bc04ee8 100644
--- a/org/eclipse/swt/internal/SWTMessages_sv.properties
+++ b/org/eclipse/swt/internal/SWTMessages_sv.properties
@@ -22,4 +22,11 @@ SWT_Open=\u00d6ppna
SWT_Close=St\u00e4ng
SWT_Minimize=Minimera
SWT_Maximize=Maximera
-SWT_Restore=\u00c5terst\u00e4ll
\ No newline at end of file
+SWT_Restore=\u00c5terst\u00e4ll
+SWT_Continue=Forts\u00e4tt
+SWT_General=Allm\u00e4nt
+SWT_Details=Detaljer
+SWT_Field=F\u00e4lt
+SWT_Value=V\u00e4rde
+SWT_Version=Version
+SWT_Subject=\u00c4mne
diff --git a/org/eclipse/swt/internal/SWTMessages_tr.properties b/org/eclipse/swt/internal/SWTMessages_tr.properties
index 19ba07c..666ad34 100644
--- a/org/eclipse/swt/internal/SWTMessages_tr.properties
+++ b/org/eclipse/swt/internal/SWTMessages_tr.properties
@@ -64,3 +64,10 @@ SWT_Download_Status=\u0130ndirilen: {0,number,integer} KB / {1,number,integer} K
SWT_Authentication_Required=Kimlik Do\u011frulamas\u0131 Gerekiyor
SWT_Enter_Username_and_Password={1} alan\u0131na {0} i\u00e7in kullan\u0131c\u0131 ad\u0131n\u0131 ve parolas\u0131n\u0131 girini\u015f
SWT_Page_Load_Failed=Sayfa y\u00fcklemesi ba\u015far\u0131s\u0131z oldu: {0}
+SWT_Continue=Devam
+SWT_General=Genel
+SWT_Details=Ayr\u0131nt\u0131lar
+SWT_Field=Alan
+SWT_Value=De\u011fer
+SWT_Version=S\u00fcr\u00fcm
+SWT_Subject=Subject
diff --git a/org/eclipse/swt/internal/SWTMessages_uk.properties b/org/eclipse/swt/internal/SWTMessages_uk.properties
index 0549844..d10afab 100644
--- a/org/eclipse/swt/internal/SWTMessages_uk.properties
+++ b/org/eclipse/swt/internal/SWTMessages_uk.properties
@@ -64,3 +64,6 @@ SWT_Download_Status=\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d
SWT_Authentication_Required=\u041f\u043e\u0442\u0440\u0456\u0431\u043d\u0430 \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0456\u044f
SWT_Enter_Username_and_Password=\u0412\u0432\u0435\u0434\u0456\u0442\u044c \u0456\u043c\''\u044f \u043a\u043e\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0430 \u0442\u0430 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f {0} \u0432 {1}
SWT_Page_Load_Failed=\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0432\u0434\u0430\u043b\u043e \u0437 \u043f\u043e\u043c\u0438\u043b\u043a\u043e\u044e: {0}
+SWT_General=\u0417\u0430\u0433\u0430\u043b\u044c\u043d\u0435
+SWT_Value=\u0417\u043d\u0430\u0447\u0435\u043d\u043d\u044f
+SWT_Version=\u0412\u0435\u0440\u0441\u0456\u044f
diff --git a/org/eclipse/swt/internal/SWTMessages_zh.properties b/org/eclipse/swt/internal/SWTMessages_zh.properties
index 399df80..faf4231 100644
--- a/org/eclipse/swt/internal/SWTMessages_zh.properties
+++ b/org/eclipse/swt/internal/SWTMessages_zh.properties
@@ -63,3 +63,12 @@ SWT_Download_Started=\u6b63\u5728\u4e0b\u8f7d...
SWT_Download_Status=\u4e0b\u8f7d\uff1a{0,number,integer} KB\uff08\u5171 {1,number,integer} KB\uff09
SWT_Authentication_Required=\u9700\u8981\u8ba4\u8bc1
SWT_Enter_Username_and_Password=\u8f93\u5165 {0}\uff08\u4f4d\u4e8e {1}\uff09\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801
+SWT_Continue=\u7ee7\u7eed
+SWT_General=\u5e38\u89c4
+SWT_Details=\u8be6\u7ec6\u4fe1\u606f
+SWT_Field=\u5b57\u6bb5
+SWT_Value=\u503c
+SWT_Version=\u7248\u672c
+SWT_ValidFrom=\u751f\u6548\u65e5\u671f
+SWT_Subject=Subject
+SWT_SerialNumber=\u5e8f\u5217\u53f7
diff --git a/org/eclipse/swt/internal/SWTMessages_zh_TW.properties b/org/eclipse/swt/internal/SWTMessages_zh_TW.properties
index 9ec42cc..05e2d8e 100644
--- a/org/eclipse/swt/internal/SWTMessages_zh_TW.properties
+++ b/org/eclipse/swt/internal/SWTMessages_zh_TW.properties
@@ -61,4 +61,13 @@ SWT_Download_Location=\u5132\u5b58 {1} \u7684 {0}
SWT_Download_Started=\u6b63\u5728\u4e0b\u8f09...
SWT_Download_Status=\u4e0b\u8f09\uff1a{0,number,integer} KB (\u5171 {1,number,integer} KB)
SWT_Authentication_Required=\u9700\u8981\u9451\u5225
-SWT_Enter_Username_and_Password=\u65bc {1} \u8655\u8f38\u5165 {0} \u7684\u4f7f\u7528\u8005\u540d\u7a31\u53ca\u5bc6\u78bc
\ No newline at end of file
+SWT_Enter_Username_and_Password=\u65bc {1} \u8655\u8f38\u5165 {0} \u7684\u4f7f\u7528\u8005\u540d\u7a31\u53ca\u5bc6\u78bc
+SWT_Continue=\u7e7c\u7e8c
+SWT_General=\u4e00\u822c\u4e8b\u9805
+SWT_Details=\u8a73\u7d30\u8cc7\u6599
+SWT_Field=\u6b04\u4f4d
+SWT_Value=\u503c
+SWT_Version=\u7248\u672c
+SWT_ValidFrom=\u751f\u6548\u65e5\u671f
+SWT_Subject=\u4e3b\u984c
+SWT_SerialNumber=\u5e8f\u865f
diff --git a/org/eclipse/swt/internal/accessibility/gtk/ATK.java b/org/eclipse/swt/internal/accessibility/gtk/ATK.java
index a54a31a..d643afc 100644
--- a/org/eclipse/swt/internal/accessibility/gtk/ATK.java
+++ b/org/eclipse/swt/internal/accessibility/gtk/ATK.java
@@ -204,6 +204,8 @@ public static final native int /*long*/ ATK_TYPE_ACTION ();
/** @method flags=const */
public static final native int /*long*/ ATK_TYPE_COMPONENT ();
/** @method flags=const */
+public static final native int /*long*/ ATK_TYPE_EDITABLE_TEXT ();
+/** @method flags=const */
public static final native int /*long*/ ATK_TYPE_HYPERTEXT ();
/** @method flags=const */
public static final native int /*long*/ ATK_TYPE_SELECTION ();
@@ -244,6 +246,15 @@ public static final int /*long*/ ATK_SELECTION_GET_IFACE (int /*long*/ obj) {
lock.unlock();
}
}
+public static final native int /*long*/ _ATK_EDITABLE_TEXT_GET_IFACE (int /*long*/ handle);
+public static final int /*long*/ ATK_EDITABLE_TEXT_GET_IFACE (int /*long*/ handle) {
+ lock.lock();
+ try {
+ return _ATK_EDITABLE_TEXT_GET_IFACE(handle);
+ } finally {
+ lock.unlock();
+ }
+}
public static final native int /*long*/ _ATK_HYPERTEXT_GET_IFACE (int /*long*/ handle);
public static final int /*long*/ ATK_HYPERTEXT_GET_IFACE (int /*long*/ handle) {
lock.lock();
@@ -546,6 +557,7 @@ public static final int /*long*/ call (int /*long*/ function, int /*long*/ arg0,
public static final native int /*long*/ g_strdup (int /*long*/ str);
public static final native void memmove (AtkActionIface dest, int /*long*/ src);
public static final native void memmove (AtkComponentIface dest, int /*long*/ src);
+public static final native void memmove (AtkEditableTextIface dest, int /*long*/ src);
public static final native void memmove (AtkHypertextIface dest, int /*long*/ src);
public static final native void memmove (AtkObjectClass dest, int /*long*/ src);
public static final native void memmove (AtkObjectFactoryClass dest, int /*long*/ src);
@@ -556,6 +568,7 @@ public static final native void memmove (AtkValueIface dest, int /*long*/ src);
public static final native void memmove (GtkAccessible dest, int /*long*/ src);
public static final native void memmove (int /*long*/ dest, AtkActionIface src);
public static final native void memmove (int /*long*/ dest, AtkComponentIface src);
+public static final native void memmove (int /*long*/ dest, AtkEditableTextIface src);
public static final native void memmove (int /*long*/ dest, AtkHypertextIface src);
public static final native void memmove (int /*long*/ dest, AtkObjectClass src);
public static final native void memmove (int /*long*/ dest, AtkObjectFactoryClass src);
diff --git a/org/eclipse/swt/internal/gtk/GObjectClass.java b/org/eclipse/swt/internal/accessibility/gtk/AtkEditableTextIface.java
similarity index 69%
copy from org/eclipse/swt/internal/gtk/GObjectClass.java
copy to org/eclipse/swt/internal/accessibility/gtk/AtkEditableTextIface.java
index 649eba2..f4f7723 100644
--- a/org/eclipse/swt/internal/gtk/GObjectClass.java
+++ b/org/eclipse/swt/internal/accessibility/gtk/AtkEditableTextIface.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2010, 2011 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -12,22 +12,21 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.swt.internal.gtk;
+package org.eclipse.swt.internal.accessibility.gtk;
-
-public class GObjectClass {
- /** @field cast=(GObject *(*)()) */
- public int /*long*/ constructor;
+public class AtkEditableTextIface {
+ /** @field cast=(gboolean (*)()) */
+ public int /*long*/ set_run_attributes;
/** @field cast=(void (*)()) */
- public int /*long*/ set_property;
+ public int /*long*/ set_text_contents;
/** @field cast=(void (*)()) */
- public int /*long*/ get_property;
+ public int /*long*/ insert_text;
/** @field cast=(void (*)()) */
- public int /*long*/ dispose;
+ public int /*long*/ copy_text;
/** @field cast=(void (*)()) */
- public int /*long*/ finalize;
+ public int /*long*/ cut_text;
/** @field cast=(void (*)()) */
- public int /*long*/ dispatch_properties_changed;
+ public int /*long*/ delete_text;
/** @field cast=(void (*)()) */
- public int /*long*/ notify;
+ public int /*long*/ paste_text;
}
diff --git a/org/eclipse/swt/internal/gtk/OS.java b/org/eclipse/swt/internal/gtk/OS.java
index 41ed3fa..9c3db9f 100644
--- a/org/eclipse/swt/internal/gtk/OS.java
+++ b/org/eclipse/swt/internal/gtk/OS.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -311,6 +311,9 @@ public class OS extends C {
public static final int GTK_PRINT_PAGES_ALL = 0;
public static final int GTK_PRINT_PAGES_CURRENT = 1;
public static final int GTK_PRINT_PAGES_RANGES = 2;
+ public static final int GTK_PRINT_DUPLEX_SIMPLEX = 0;
+ public static final int GTK_PRINT_DUPLEX_HORIZONTAL = 1;
+ public static final int GTK_PRINT_DUPLEX_VERTICAL = 2;
public static final int GTK_PROGRESS_CONTINUOUS = 0x0;
public static final int GTK_PROGRESS_DISCRETE = 0x1;
public static final int GTK_PROGRESS_LEFT_TO_RIGHT = 0x0;
@@ -408,7 +411,15 @@ public class OS extends C {
public static final int PANGO_DIRECTION_LTR = 0;
public static final int PANGO_DIRECTION_RTL = 1;
public static final int PANGO_SCALE = 1024;
+ public static final int PANGO_STRETCH_ULTRA_CONDENSED = 0x0;
+ public static final int PANGO_STRETCH_EXTRA_CONDENSED = 0x1;
+ public static final int PANGO_STRETCH_CONDENSED = 0x2;
+ public static final int PANGO_STRETCH_SEMI_CONDENSED = 0x3;
public static final int PANGO_STRETCH_NORMAL = 0x4;
+ public static final int PANGO_STRETCH_SEMI_EXPANDED = 0x5;
+ public static final int PANGO_STRETCH_EXPANDED = 0x6;
+ public static final int PANGO_STRETCH_EXTRA_EXPANDED = 0x7;
+ public static final int PANGO_STRETCH_ULTRA_EXPANDED = 0x8;
public static final int PANGO_STYLE_ITALIC = 0x2;
public static final int PANGO_STYLE_NORMAL = 0x0;
public static final int PANGO_STYLE_OBLIQUE = 0x1;
@@ -418,6 +429,8 @@ public class OS extends C {
public static final int PANGO_UNDERLINE_DOUBLE = 2;
public static final int PANGO_UNDERLINE_LOW = 3;
public static final int PANGO_UNDERLINE_ERROR = 4;
+ public static final int PANGO_VARIANT_NORMAL = 0;
+ public static final int PANGO_VARIANT_SMALL_CAPS = 1;
public static final int PANGO_WEIGHT_BOLD = 0x2bc;
public static final int PANGO_WEIGHT_NORMAL = 0x190;
public static final int PANGO_WRAP_WORD = 0;
@@ -514,6 +527,7 @@ public class OS extends C {
public static final byte[] expander_size = ascii("expander-size");
public static final byte[] fixed_height_mode = ascii("fixed-height-mode");
public static final byte[] focus_line_width = ascii("focus-line-width");
+ public static final byte[] focus_padding = ascii("focus-padding");
public static final byte[] font_desc = ascii("font-desc");
public static final byte[] foreground_gdk = ascii("foreground-gdk");
public static final byte[] grid_line_width = ascii("grid-line-width");
@@ -522,12 +536,17 @@ public class OS extends C {
public static final byte[] gtk_cursor_blink_time = ascii("gtk-cursor-blink-time");
public static final byte[] gtk_double_click_time = ascii("gtk-double-click-time");
public static final byte[] gtk_entry_select_on_focus = ascii("gtk-entry-select-on-focus");
+ public static final byte[] gtk_show_input_method_menu = ascii("gtk-show-input-method-menu");
+ public static final byte[] gtk_menu_bar_accel = ascii("gtk-menu-bar-accel");
public static final byte[] inner_border = ascii("inner-border");
public static final byte[] horizontal_separator = ascii("horizontal-separator");
public static final byte[] inconsistent = ascii("inconsistent");
+ public static final byte[] indicator_size = ascii("indicator-size");
+ public static final byte[] indicator_spacing = ascii("indicator-spacing");
public static final byte[] interior_focus = ascii("interior-focus");
public static final byte[] mode = ascii("mode");
public static final byte[] model = ascii("model");
+ public static final byte[] spacing = ascii("spacing");
public static final byte[] pixbuf = ascii("pixbuf");
public static final byte[] text = ascii("text");
public static final byte[] xalign = ascii("xalign");
@@ -622,6 +641,8 @@ public static final native int /*long*/ localeconv_decimal_point();
*/
public static final native int /*long*/ realpath(byte[] path, byte[] realPath);
+
+
/** Object private fields accessors */
@@ -1287,7 +1308,7 @@ public static final native void memmove(XFocusChangeEvent dest, int /*long*/ src
*/
public static final native void memmove(XVisibilityEvent dest, int /*long*/ src, int /*long*/ size);
-/** @method flags=const*/
+/** @method flags=const */
public static final native int RTLD_GLOBAL();
/** @method flags=const */
public static final native int RTLD_NOW();
@@ -2420,6 +2441,18 @@ public static final void g_list_free_1(int /*long*/ list) {
lock.unlock();
}
}
+/**
+ * @param list cast=(GList *)
+ */
+public static final native int /*long*/ _g_list_last(int /*long*/ list);
+public static final int /*long*/ g_list_last(int /*long*/ list) {
+ lock.lock();
+ try {
+ return _g_list_last(list);
+ } finally {
+ lock.unlock();
+ }
+}
/** @param list cast=(GList *) */
public static final native int _g_list_length(int /*long*/ list);
public static final int g_list_length(int /*long*/ list) {
@@ -2637,6 +2670,20 @@ public static final void g_object_get(int /*long*/ object, byte[] first_property
}
/**
* @param object cast=(GObject *)
+ * @param first_property_name cast=(const gchar *),flags=no_out
+ * @param terminator cast=(const gchar *),flags=sentinel
+ */
+public static final native void _g_object_get(int /*long*/ object, byte[] first_property_name, long[] value, int /*long*/ terminator);
+public static final void g_object_get(int /*long*/ object, byte[] first_property_name, long[] value, int /*long*/ terminator) {
+ lock.lock();
+ try {
+ _g_object_get(object, first_property_name, value, terminator);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param object cast=(GObject *)
* @param quark cast=(GQuark)
*/
public static final native int /*long*/ _g_object_get_qdata(int /*long*/ object, int quark);
@@ -3350,6 +3397,59 @@ public static final int /*long*/ g_utf8_pointer_to_offset(int /*long*/ str, int
}
}
/** @param str cast=(const gchar *) */
+public static final native int /*long*/ _g_utf16_offset_to_pointer(int /*long*/ str, int /*long*/ offset);
+public static final int /*long*/ g_utf16_offset_to_pointer(int /*long*/ str, int /*long*/ offset) {
+ lock.lock();
+ try {
+ return _g_utf16_offset_to_pointer(str, offset);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param str cast=(const gchar *)
+ * @param pos cast=(const gchar *)
+ */
+public static final native int /*long*/ _g_utf16_pointer_to_offset(int /*long*/ str, int /*long*/ pos);
+public static final int /*long*/ g_utf16_pointer_to_offset(int /*long*/ str, int /*long*/ pos) {
+ lock.lock();
+ try {
+ return _g_utf16_pointer_to_offset(str, pos);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @param str cast=(const gchar *) */
+public static final native int /*long*/ _g_utf16_strlen(int /*long*/ str, int /*long*/ max);
+public static final int /*long*/ g_utf16_strlen(int /*long*/ str, int /*long*/ max) {
+ lock.lock();
+ try {
+ return _g_utf16_strlen(str, max);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @param str cast=(const gchar *) */
+public static final native int /*long*/ _g_utf8_offset_to_utf16_offset(int /*long*/ str, int /*long*/ offset);
+public static final int /*long*/ g_utf8_offset_to_utf16_offset(int /*long*/ str, int /*long*/ offset) {
+ lock.lock();
+ try {
+ return _g_utf8_offset_to_utf16_offset(str, offset);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @param str cast=(const gchar *) */
+public static final native int /*long*/ _g_utf16_offset_to_utf8_offset(int /*long*/ str, int /*long*/ offset);
+public static final int /*long*/ g_utf16_offset_to_utf8_offset(int /*long*/ str, int /*long*/ offset) {
+ lock.lock();
+ try {
+ return _g_utf16_offset_to_utf8_offset(str, offset);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @param str cast=(const gchar *) */
public static final native int /*long*/ _g_utf8_strlen(int /*long*/ str, int /*long*/ max);
public static final int /*long*/ g_utf8_strlen(int /*long*/ str, int /*long*/ max) {
lock.lock();
@@ -5033,6 +5133,13 @@ public static final int gdk_text_property_to_utf8_list (int /*long*/ encoding,
lock.unlock();
}
}
+public static final native void gdk_threads_init ();
+public static final native void gdk_threads_enter ();
+public static final native void gdk_threads_leave ();
+/**
+ * @method flags=dynamic
+ */
+public static final native void gdk_threads_set_lock_functions(int /*long*/ enter_fn, int /*long*/ leave_fn);
/**
* @method flags=dynamic
* @param display cast=(GdkDisplay*)
@@ -5304,6 +5411,16 @@ public static final boolean gdk_window_is_visible(int /*long*/ window) {
}
}
/** @param window cast=(GdkWindow *) */
+public static final native boolean _gdk_window_is_viewable (int /*long*/ window);
+public static final boolean gdk_window_is_viewable (int /*long*/ window) {
+ lock.lock();
+ try {
+ return _gdk_window_is_viewable (window);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @param window cast=(GdkWindow *) */
public static final native void _gdk_window_move(int /*long*/ window, int x, int y);
public static final void gdk_window_move(int /*long*/ window, int x, int y) {
lock.lock();
@@ -5598,6 +5715,29 @@ public static final void gdk_window_thaw_updates(int /*long*/ window) {
lock.unlock();
}
}
+public static final native int _gtk_accelerator_get_default_mod_mask();
+public static final int gtk_accelerator_get_default_mod_mask() {
+ lock.lock();
+ try {
+ return _gtk_accelerator_get_default_mod_mask();
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param accelerator cast=(const gchar *)
+ * @param accelerator_key cast=(guint *)
+ * @param accelerator_mods cast=(GdkModifierType *)
+ */
+public static final native void _gtk_accelerator_parse(int /*long*/ accelerator, int [] accelerator_key, int [] accelerator_mods);
+public static final void gtk_accelerator_parse(int /*long*/ accelerator, int [] accelerator_key, int [] accelerator_mods) {
+ lock.lock();
+ try {
+ _gtk_accelerator_parse(accelerator, accelerator_key, accelerator_mods);
+ } finally {
+ lock.unlock();
+ }
+}
public static final native int /*long*/ _gtk_accel_group_new();
public static final int /*long*/ gtk_accel_group_new() {
lock.lock();
@@ -5837,6 +5977,34 @@ public static final void gtk_calendar_select_day(int /*long*/ calendar, int day)
/**
* @method flags=dynamic
* @param calendar cast=(GtkCalendar *)
+ * @param day cast=(guint)
+ */
+public static final native void _gtk_calendar_mark_day(int /*long*/ calendar, int day);
+public static final void gtk_calendar_mark_day(int /*long*/ calendar, int day) {
+ lock.lock();
+ try {
+ _gtk_calendar_mark_day(calendar, day);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @method flags=dynamic
+ * @param calendar cast=(GtkCalendar *)
+ * @param day cast=(guint)
+ */
+public static final native void _gtk_calendar_clear_marks(int /*long*/ calendar);
+public static final void gtk_calendar_clear_marks(int /*long*/ calendar) {
+ lock.lock();
+ try {
+ _gtk_calendar_clear_marks(calendar);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @method flags=dynamic
+ * @param calendar cast=(GtkCalendar *)
* @param flags cast=(GtkCalendarDisplayOptions)
*/
public static final native void _gtk_calendar_set_display_options(int /*long*/ calendar, int flags);
@@ -6059,6 +6227,34 @@ public static final boolean gtk_clipboard_set_with_owner(int /*long*/ clipboard,
}
}
/**
+ * @method flags=dynamic
+ * @param clipboard cast=(GtkClipboard *)
+ * @param targets cast=(const GtkTargetEntry *)
+ * @param n_targets cast=(gint)
+ */
+public static final native void _gtk_clipboard_set_can_store(int /*long*/ clipboard, int /*long*/ targets, int n_targets);
+public static final void gtk_clipboard_set_can_store(int /*long*/ clipboard, int /*long*/ targets, int n_targets) {
+ lock.lock();
+ try {
+ _gtk_clipboard_set_can_store(clipboard, targets, n_targets);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @method flags=dynamic
+ * @param clipboard cast=(GtkClipboard *)
+ */
+public static final native void _gtk_clipboard_store(int /*long*/ clipboard);
+public static final void gtk_clipboard_store(int /*long*/ clipboard) {
+ lock.lock();
+ try {
+ _gtk_clipboard_store(clipboard);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
* @param clipboard cast=(GtkClipboard *)
* @param target cast=(GdkAtom)
*/
@@ -7469,6 +7665,15 @@ public static final int /*long*/ gtk_hseparator_new() {
lock.unlock();
}
}
+public static final native int /*long*/ _gtk_status_icon_position_menu_func();
+public static final int /*long*/ gtk_status_icon_position_menu_func() {
+ lock.lock();
+ try {
+ return _gtk_status_icon_position_menu_func();
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @method flags=dynamic
*/
@@ -9301,6 +9506,26 @@ public static final void gtk_print_settings_set_collate(int /*long*/ settings, b
}
}
/** @method flags=dynamic */
+public static final native int _gtk_print_settings_get_duplex(int /*long*/ settings);
+public static final int gtk_print_settings_get_duplex(int /*long*/ settings) {
+ lock.lock();
+ try {
+ return _gtk_print_settings_get_duplex(settings);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic */
+public static final native void _gtk_print_settings_set_duplex(int /*long*/ settings, int duplex);
+public static final void gtk_print_settings_set_duplex(int /*long*/ settings, int duplex) {
+ lock.lock();
+ try {
+ _gtk_print_settings_set_duplex(settings, duplex);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic */
public static final native int _gtk_print_settings_get_n_copies(int /*long*/ settings);
public static final int gtk_print_settings_get_n_copies(int /*long*/ settings) {
lock.lock();
@@ -9414,6 +9639,16 @@ public static final int /*long*/ gtk_print_unix_dialog_new(byte[] title, int /*l
}
}
/** @method flags=dynamic */
+public static final native void _gtk_print_unix_dialog_set_embed_page_setup(int /*long*/ dialog, boolean embed);
+public static final void gtk_print_unix_dialog_set_embed_page_setup(int /*long*/ dialog, boolean embed) {
+ lock.lock();
+ try {
+ _gtk_print_unix_dialog_set_embed_page_setup(dialog, embed);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic */
public static final native void _gtk_print_unix_dialog_set_page_setup(int /*long*/ dialog, int /*long*/ page_setup);
public static final void gtk_print_unix_dialog_set_page_setup(int /*long*/ dialog, int /*long*/ page_setup) {
lock.lock();
@@ -14401,6 +14636,19 @@ public static final void pango_font_description_set_weight(int /*long*/ desc, in
lock.unlock();
}
}
+/**
+ * @param desc cast=(PangoFontDescription *)
+ * @param variant cast=(PangoVariant)
+ */
+public static final native void _pango_font_description_set_variant(int /*long*/ desc, int variant);
+public static final void pango_font_description_set_variant(int /*long*/ desc, int variant) {
+ lock.lock();
+ try {
+ _pango_font_description_set_variant(desc, variant);
+ } finally {
+ lock.unlock();
+ }
+}
/** @param desc cast=(PangoFontDescription *) */
public static final native int /*long*/ _pango_font_description_to_string(int /*long*/ desc);
public static final int /*long*/ pango_font_description_to_string(int /*long*/ desc) {
diff --git a/org/eclipse/swt/internal/image/JPEGDecoder.java b/org/eclipse/swt/internal/image/JPEGDecoder.java
index 54d6daa..9a94f8e 100644
--- a/org/eclipse/swt/internal/image/JPEGDecoder.java
+++ b/org/eclipse/swt/internal/image/JPEGDecoder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -2300,16 +2300,16 @@ static void jinit_d_coef_controller (jpeg_decompress_struct cinfo, boolean need_
/* Allocate a full-image virtual array for each component, */
/* padded to a multiple of samp_factor DCT blocks in each direction. */
/* Note we ask for a pre-zeroed array. */
- int ci, access_rows;
+ int ci; //, access_rows;
jpeg_component_info compptr;
for (ci = 0; ci < cinfo.num_components; ci++) {
compptr = cinfo.comp_info[ci];
- access_rows = compptr.v_samp_factor;
+ //access_rows = compptr.v_samp_factor;
//#ifdef BLOCK_SMOOTHING_SUPPORTED
/* If block smoothing could be used, need a bigger window */
- if (cinfo.progressive_mode)
- access_rows *= 3;
+ //if (cinfo.progressive_mode)
+ //access_rows *= 3;
//#endif
coef.whole_image[ci] =
new short
@@ -3821,7 +3821,7 @@ static int decompress_smooth_data (jpeg_decompress_struct cinfo, byte[][][] outp
jpeg_d_coef_controller coef = cinfo.coef;
int last_iMCU_row = cinfo.total_iMCU_rows - 1;
int block_num, last_block_column;
- int ci, block_row, block_rows, access_rows;
+ int ci, block_row, block_rows; //, access_rows;
short[][][] buffer;
short[][] buffer_ptr, prev_block_row, next_block_row;
byte[][] output_ptr;
@@ -3862,19 +3862,19 @@ static int decompress_smooth_data (jpeg_decompress_struct cinfo, byte[][][] outp
/* Count non-dummy DCT block rows in this iMCU row. */
if (cinfo.output_iMCU_row < last_iMCU_row) {
block_rows = compptr.v_samp_factor;
- access_rows = block_rows * 2; /* this and next iMCU row */
+ //access_rows = block_rows * 2; /* this and next iMCU row */
last_row = false;
} else {
/* NB: can't use last_row_height here; it is input-side-dependent! */
block_rows = (compptr.height_in_blocks % compptr.v_samp_factor);
if (block_rows == 0) block_rows = compptr.v_samp_factor;
- access_rows = block_rows; /* this iMCU row only */
+ //access_rows = block_rows; /* this iMCU row only */
last_row = true;
}
/* Align the virtual buffer for this component. */
int buffer_offset;
if (cinfo.output_iMCU_row > 0) {
- access_rows += compptr.v_samp_factor; /* prior iMCU row too */
+ //access_rows += compptr.v_samp_factor; /* prior iMCU row too */
buffer = coef.whole_image[ci];
buffer_offset = (cinfo.output_iMCU_row - 1) * compptr.v_samp_factor;
buffer_offset += compptr.v_samp_factor; /* point to current iMCU row */
diff --git a/org/eclipse/swt/internal/mozilla/XPCOM.java b/org/eclipse/swt/internal/mozilla/XPCOM.java
index 79be3c2..3d8d084 100644
--- a/org/eclipse/swt/internal/mozilla/XPCOM.java
+++ b/org/eclipse/swt/internal/mozilla/XPCOM.java
@@ -22,7 +22,7 @@
*
* IBM
* - Binding to permit interfacing between Mozilla and SWT
- * - Copyright (C) 2003, 2006 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2003, 2010 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
package org.eclipse.swt.internal.mozilla;
diff --git a/org/eclipse/swt/internal/mozilla/nsICancelable.java b/org/eclipse/swt/internal/mozilla/init/GREProperty.java
similarity index 62%
copy from org/eclipse/swt/internal/mozilla/nsICancelable.java
copy to org/eclipse/swt/internal/mozilla/init/GREProperty.java
index e20f203..d5935e3 100644
--- a/org/eclipse/swt/internal/mozilla/nsICancelable.java
+++ b/org/eclipse/swt/internal/mozilla/init/GREProperty.java
@@ -22,26 +22,16 @@
*
* IBM
* - Binding to permit interfacing between Mozilla and SWT
- * - Copyright (C) 2003 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2011 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
-package org.eclipse.swt.internal.mozilla;
+package org.eclipse.swt.internal.mozilla.init;
-public class nsICancelable extends nsISupports {
-
- static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 1;
-
- public static final String NS_ICANCELABLE_IID_STR =
- "d94ac0a0-bb18-46b8-844e-84159064b0bd";
-
- public static final nsID NS_ICANCELABLE_IID =
- new nsID(NS_ICANCELABLE_IID_STR);
-
- public nsICancelable(int /*long*/ address) {
- super(address);
- }
-
- public int Cancel(int aReason) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aReason);
- }
+/** @jniclass flags=cpp */
+public class GREProperty {
+ /** @field cast=(const char *) */
+ public int /*long*/ property;
+ /** @field cast=(const char *) */
+ public int /*long*/ value;
+ public static final int sizeof = XPCOMInit.GREProperty_sizeof ();
}
diff --git a/org/eclipse/swt/internal/mozilla/init/GREVersionRange.java b/org/eclipse/swt/internal/mozilla/init/GREVersionRange.java
index da361dd..0ec838b 100644
--- a/org/eclipse/swt/internal/mozilla/init/GREVersionRange.java
+++ b/org/eclipse/swt/internal/mozilla/init/GREVersionRange.java
@@ -1,13 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
*
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by Netscape are Copyright (C) 1998-1999
+ * Netscape Communications Corporation. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * IBM
+ * - Binding to permit interfacing between Mozilla and SWT
+ * - Copyright (C) 2003, 2011 IBM Corp. All Rights Reserved.
+ *
+ * ***** END LICENSE BLOCK ***** */
package org.eclipse.swt.internal.mozilla.init;
/** @jniclass flags=cpp */
diff --git a/org/eclipse/swt/internal/mozilla/init/XPCOMInit.java b/org/eclipse/swt/internal/mozilla/init/XPCOMInit.java
index a746934..d8901f2 100644
--- a/org/eclipse/swt/internal/mozilla/init/XPCOMInit.java
+++ b/org/eclipse/swt/internal/mozilla/init/XPCOMInit.java
@@ -22,7 +22,7 @@
*
* IBM
* - Binding to permit interfacing between Mozilla and SWT
- * - Copyright (C) 2003, 2006 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2003, 2011 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
package org.eclipse.swt.internal.mozilla.init;
@@ -32,7 +32,8 @@ import org.eclipse.swt.internal.Platform;
/** @jniclass flags=cpp */
public class XPCOMInit extends Platform {
public static final int PATH_MAX = 4096;
-
+
+public static final native int GREProperty_sizeof ();
public static final native int GREVersionRange_sizeof ();
/**
@@ -40,8 +41,8 @@ public static final native int GREVersionRange_sizeof ();
* @param properties cast=(const GREProperty *)
* @param buffer cast=(char *)
*/
-public static final native int _GRE_GetGREPathWithProperties (GREVersionRange versions, int versionsLength, int /*long*/ properties, int propertiesLength, int /*long*/ buffer, int buflen);
-public static final int GRE_GetGREPathWithProperties (GREVersionRange versions, int versionsLength, int /*long*/ properties, int propertiesLength, int /*long*/ buffer, int buflen) {
+public static final native int _GRE_GetGREPathWithProperties (GREVersionRange versions, int versionsLength, GREProperty properties, int propertiesLength, int /*long*/ buffer, int buflen);
+public static final int GRE_GetGREPathWithProperties (GREVersionRange versions, int versionsLength, GREProperty properties, int propertiesLength, int /*long*/ buffer, int buflen) {
lock.lock();
try {
return _GRE_GetGREPathWithProperties(versions, versionsLength, properties, propertiesLength, buffer, buflen);
diff --git a/org/eclipse/swt/internal/mozilla/nsDynamicFunctionLoad.java b/org/eclipse/swt/internal/mozilla/nsDynamicFunctionLoad.java
index 7857539..1053001 100644
--- a/org/eclipse/swt/internal/mozilla/nsDynamicFunctionLoad.java
+++ b/org/eclipse/swt/internal/mozilla/nsDynamicFunctionLoad.java
@@ -1,13 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
*
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by Netscape are Copyright (C) 1998-1999
+ * Netscape Communications Corporation. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * IBM
+ * - Binding to permit interfacing between Mozilla and SWT
+ * - Copyright (C) 2003, 2011 IBM Corp. All Rights Reserved.
+ *
+ * ***** END LICENSE BLOCK ***** */
package org.eclipse.swt.internal.mozilla;
public class nsDynamicFunctionLoad {
diff --git a/org/eclipse/swt/internal/mozilla/nsID.java b/org/eclipse/swt/internal/mozilla/nsID.java
index 716aab3..9e2a28b 100644
--- a/org/eclipse/swt/internal/mozilla/nsID.java
+++ b/org/eclipse/swt/internal/mozilla/nsID.java
@@ -22,7 +22,7 @@
*
* IBM
* - Binding to permit interfacing between Mozilla and SWT
- * - Copyright (C) 2003, 2004 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2003, 2010 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
package org.eclipse.swt.internal.mozilla;
@@ -36,6 +36,8 @@ public class nsID {
public byte[] m3 = new byte[8];
public static final int sizeof = 16;
+ static final String zeros = "00000000"; //$NON-NLS-1$
+
public nsID() {
}
@@ -118,4 +120,21 @@ public void Parse(String aIDStr) {
}
}
+static String toHex (int v, int length) {
+ String t = Integer.toHexString (v).toUpperCase ();
+ int tlen = t.length ();
+ if (tlen > length) {
+ t = t.substring (tlen - length);
+ }
+ return zeros.substring (0, Math.max (0, length - tlen)) + t;
+}
+
+public String toString () {
+ return '{' + toHex (m0, 8) + '-' +
+ toHex (m1, 4) + '-' +
+ toHex (m2, 4) + '-' +
+ toHex (m3[0], 2) + toHex (m3[1], 2) + '-' +
+ toHex (m3[2], 2) + toHex (m3[3], 2) + toHex (m3[4], 2) + toHex (m3[5], 2) + toHex (m3[6], 2) + toHex (m3[7], 2) + '}';
+}
+
}
diff --git a/org/eclipse/swt/internal/theme/ButtonDrawData.java b/org/eclipse/swt/internal/theme/ButtonDrawData.java
index a170c1f..eff7bef 100644
--- a/org/eclipse/swt/internal/theme/ButtonDrawData.java
+++ b/org/eclipse/swt/internal/theme/ButtonDrawData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -130,17 +130,19 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
int border_width = OS.gtk_container_get_border_width(buttonHandle);
GtkBorder default_border = new GtkBorder();
- int default_border_ptr = theme.getWidgetProperty(buttonHandle, "default-border");
+ int /*long*/ default_border_ptr = theme.getBorderProperty(buttonHandle, "default-border");
if (default_border_ptr != 0) {
- OS.memmove(default_border, default_border_ptr, GdkRectangle.sizeof);
+ OS.memmove(default_border, default_border_ptr, GtkBorder.sizeof);
+ OS.gtk_border_free(default_border_ptr);
} else {
default_border.left = default_border.right = default_border.top = default_border.bottom = 1;
}
GtkBorder default_outside_border = new GtkBorder();
- int default_outside_border_ptr = theme.getWidgetProperty(buttonHandle, "default-outside-border");
+ int /*long*/ default_outside_border_ptr = theme.getBorderProperty(buttonHandle, "default-outside-border");
if (default_outside_border_ptr != 0) {
- OS.memmove(default_outside_border, default_outside_border_ptr, GdkRectangle.sizeof);
+ OS.memmove(default_outside_border, default_outside_border_ptr, GtkBorder.sizeof);
+ OS.gtk_border_free(default_outside_border_ptr);
} else {
default_outside_border.left = default_outside_border.right = default_outside_border.top = default_outside_border.bottom = 0;
}
diff --git a/org/eclipse/swt/internal/theme/ComboDrawData.java b/org/eclipse/swt/internal/theme/ComboDrawData.java
index 3bab8a1..dbf3b0d 100644
--- a/org/eclipse/swt/internal/theme/ComboDrawData.java
+++ b/org/eclipse/swt/internal/theme/ComboDrawData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -47,10 +47,10 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
int arrow_width = MIN_ARROW_SIZE;
int arrow_height = ARROW_HEIGHT;
int x_border = xthickness + focus_padding;
- int y_border = ythickness + focus_padding;
+ //int y_border = ythickness + focus_padding;
if (interior_focus == 0) {
x_border += focus_line_width;
- y_border += focus_line_width;
+ //y_border += focus_line_width;
}
int arrow_button_width = arrow_width + x_border * 2;
int arrow_button_x = x + width - arrow_button_width;
@@ -106,16 +106,17 @@ int hit(Theme theme, Point position, Rectangle bounds) {
int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width");
int focus_padding = theme.getWidgetProperty(buttonHandle, "focus-padding");
int xthickness = OS.gtk_style_get_xthickness(gtkStyle);
- int ythickness = OS.gtk_style_get_xthickness(gtkStyle);
+// int ythickness = OS.gtk_style_get_xthickness(gtkStyle);
int arrow_width = MIN_ARROW_SIZE;
int x_border = xthickness + focus_padding;
- int y_border = ythickness + focus_padding;
+ //int y_border = ythickness + focus_padding;
if (interior_focus == 0) {
x_border += focus_line_width;
- y_border += focus_line_width;
+ //y_border += focus_line_width;
}
int arrow_button_width = arrow_width + x_border * 2;
int arrow_button_x = bounds.x + bounds.width - arrow_button_width;
+
Rectangle arrowRect = new Rectangle(arrow_button_x, bounds.y, arrow_button_width, bounds.height);
if (arrowRect.contains(position)) return DrawData.COMBO_ARROW;
return DrawData.WIDGET_WHOLE;
diff --git a/org/eclipse/swt/internal/theme/Theme.java b/org/eclipse/swt/internal/theme/Theme.java
index a174a93..72d8175 100644
--- a/org/eclipse/swt/internal/theme/Theme.java
+++ b/org/eclipse/swt/internal/theme/Theme.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -225,6 +225,14 @@ int getWidgetProperty(int /*long*/ handle, String name) {
return result[0];
}
+
+int /*long*/ getBorderProperty(int /*long*/ handle, String name) {
+ byte[] propertyName = Converter.wcsToMbcs(null, name, true);
+ int /*long*/ [] result = new int /*long*/[1];
+ OS.gtk_widget_style_get(handle, propertyName, result, 0);
+ return result[0];
+}
+
void transferClipping(GC gc, int /*long*/ style) {
GCData data = gc.getGCData();
int /*long*/ clipRgn = data.clipRgn;
diff --git a/org/eclipse/swt/internal/webkit/WebKitGTK.java b/org/eclipse/swt/internal/webkit/WebKitGTK.java
index 0b1717e..01bbe98 100644
--- a/org/eclipse/swt/internal/webkit/WebKitGTK.java
+++ b/org/eclipse/swt/internal/webkit/WebKitGTK.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -52,6 +52,7 @@ public class WebKitGTK extends C {
public static final byte[] window_object_cleared = ascii ("window-object-cleared"); // $NON-NLS-1$
/** Properties */
+ public static final byte[] default_encoding = ascii ("default-encoding"); // $NON-NLS-1$
public static final byte[] enable_scripts = ascii ("enable-scripts"); // $NON-NLS-1$
public static final byte[] enable_universal_access_from_file_uris = ascii ("enable-universal-access-from-file-uris"); // $NON-NLS-1$
public static final byte[] height = ascii ("height"); // $NON-NLS-1$
diff --git a/org/eclipse/swt/layout/GridData.java b/org/eclipse/swt/layout/GridData.java
index 3d0bac8..690e58c 100644
--- a/org/eclipse/swt/layout/GridData.java
+++ b/org/eclipse/swt/layout/GridData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org/eclipse/swt/layout/GridLayout.java b/org/eclipse/swt/layout/GridLayout.java
index 2dd1763..af3b97c 100644
--- a/org/eclipse/swt/layout/GridLayout.java
+++ b/org/eclipse/swt/layout/GridLayout.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -137,7 +137,8 @@ public final class GridLayout extends Layout {
public int verticalSpacing = 5;
/**
- * Constructs a new instance of this class.
+ * Constructs a new instance of this class
+ * with a single column.
*/
public GridLayout () {}
diff --git a/org/eclipse/swt/printing/PrintDialog.java b/org/eclipse/swt/printing/PrintDialog.java
index 03cbb14..a317822 100644
--- a/org/eclipse/swt/printing/PrintDialog.java
+++ b/org/eclipse/swt/printing/PrintDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,8 +22,7 @@ import org.eclipse.swt.widgets.*;
* a printer and various print-related parameters
* prior to starting a print job.
* <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#printing">Printing snippets</a>
@@ -312,7 +311,23 @@ public PrinterData open() {
if (printerData.otherData != null) {
Printer.restore(printerData.otherData, settings, page_setup);
}
+
/* Set values of print_settings and page_setup from PrinterData. */
+ String printerName = printerData.name;
+ if (printerName == null && printerData.printToFile) {
+ /* Find the printer name corresponding to the file backend. */
+ int /*long*/ printer = Printer.gtkPrinterFromPrinterData(printerData);
+ if (printer != 0) {
+ PrinterData data = Printer.printerDataFromGtkPrinter(printer);
+ printerName = data.name;
+ OS.g_object_unref(printer);
+ }
+ }
+ if (printerName != null) {
+ byte [] nameBytes = Converter.wcsToMbcs (null, printerName, true);
+ OS.gtk_print_settings_set_printer(settings, nameBytes);
+ }
+
switch (printerData.scope) {
case PrinterData.ALL_PAGES:
OS.gtk_print_settings_set_print_pages(settings, OS.GTK_PRINT_PAGES_ALL);
@@ -329,37 +344,41 @@ public PrinterData open() {
OS.gtk_print_settings_set_print_pages(settings, OS.GTK_PRINT_PAGES_ALL);
break;
}
- if (printerData.fileName != null) {
- //TODO: Should we look at printToFile, or driver/name for "Print to File", or both? (see gtk bug 345590)
- if (printerData.printToFile) {
- byte [] buffer = Converter.wcsToMbcs (null, printerData.fileName, true);
- OS.gtk_print_settings_set(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI, buffer);
+ if ((printerData.printToFile || Printer.GTK_FILE_BACKEND.equals(printerData.driver)) && printerData.fileName != null) {
+ // TODO: GTK_FILE_BACKEND is not GTK API (see gtk bug 345590)
+ byte [] uri = Printer.uriFromFilename(printerData.fileName);
+ if (uri != null) {
+ OS.gtk_print_settings_set(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI, uri);
}
- if (printerData.driver != null && printerData.name != null) {
- if (printerData.driver.equals("GtkPrintBackendFile") && printerData.name.equals("Print to File")) { //$NON-NLS-1$ //$NON-NLS-2$
- byte [] buffer = Converter.wcsToMbcs (null, printerData.fileName, true);
- OS.gtk_print_settings_set(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI, buffer);
- }
- }
- }
- if (printerData.printToFile) {
- byte [] buffer = Converter.wcsToMbcs (null, "Print to File", true); //$NON-NLS-1$
- OS.gtk_print_settings_set_printer(settings, buffer);
}
OS.gtk_print_settings_set_n_copies(settings, printerData.copyCount);
OS.gtk_print_settings_set_collate(settings, printerData.collate);
+ /*
+ * Bug in GTK. The unix dialog gives priority to the value of the non-API
+ * field cups-Duplex in the print_settings (which we preserve in otherData).
+ * The fix is to manually clear cups-Duplex before setting the duplex field.
+ */
+ byte [] keyBuffer = Converter.wcsToMbcs (null, "cups-Duplex", true);
+ OS.gtk_print_settings_set(settings, keyBuffer, (byte[]) null);
+ if (printerData.duplex != SWT.DEFAULT) {
+ int duplex = printerData.duplex == PrinterData.DUPLEX_LONG_EDGE ? OS.GTK_PRINT_DUPLEX_HORIZONTAL
+ : printerData.duplex == PrinterData.DUPLEX_SHORT_EDGE ? OS.GTK_PRINT_DUPLEX_VERTICAL
+ : OS.GTK_PRINT_DUPLEX_SIMPLEX;
+ OS.gtk_print_settings_set_duplex (settings, duplex);
+ }
int orientation = printerData.orientation == PrinterData.LANDSCAPE ? OS.GTK_PAGE_ORIENTATION_LANDSCAPE : OS.GTK_PAGE_ORIENTATION_PORTRAIT;
OS.gtk_print_settings_set_orientation(settings, orientation);
OS.gtk_page_setup_set_orientation(page_setup, orientation);
OS.gtk_print_unix_dialog_set_settings(handle, settings);
OS.gtk_print_unix_dialog_set_page_setup(handle, page_setup);
+ if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
+ OS.gtk_print_unix_dialog_set_embed_page_setup(handle, true);
+ }
OS.g_object_unref(settings);
OS.g_object_unref(page_setup);
- if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) {
- int /*long*/ group = OS.gtk_window_get_group(0);
- OS.gtk_window_group_add_window (group, handle);
- }
+ int /*long*/ group = OS.gtk_window_get_group(0);
+ OS.gtk_window_group_add_window (group, handle);
OS.gtk_window_set_modal(handle, true);
PrinterData data = null;
//TODO: Handle 'Print Preview' (GTK_RESPONSE_APPLY).
@@ -378,6 +397,13 @@ public PrinterData open() {
display.setData (SET_MODAL_DIALOG, this);
}
int response = OS.gtk_dialog_run (handle);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
if (OS.gtk_window_get_modal (handle)) {
display.setData (SET_MODAL_DIALOG, oldModal);
}
@@ -419,7 +445,7 @@ public PrinterData open() {
break;
}
- data.printToFile = data.name.equals("Print to File"); //$NON-NLS-1$
+ data.printToFile = Printer.GTK_FILE_BACKEND.equals(data.driver); // TODO: GTK_FILE_BACKEND is not GTK API (see gtk bug 345590)
if (data.printToFile) {
int /*long*/ address = OS.gtk_print_settings_get(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI);
int length = OS.strlen (address);
@@ -430,6 +456,10 @@ public PrinterData open() {
data.copyCount = OS.gtk_print_settings_get_n_copies(settings);
data.collate = OS.gtk_print_settings_get_collate(settings);
+ int duplex = OS.gtk_print_settings_get_duplex(settings);
+ data.duplex = duplex == OS.GTK_PRINT_DUPLEX_HORIZONTAL ? PrinterData.DUPLEX_LONG_EDGE
+ : duplex == OS.GTK_PRINT_DUPLEX_VERTICAL ? PrinterData.DUPLEX_SHORT_EDGE
+ : PrinterData.DUPLEX_NONE;
data.orientation = OS.gtk_page_setup_get_orientation(page_setup) == OS.GTK_PAGE_ORIENTATION_LANDSCAPE ? PrinterData.LANDSCAPE : PrinterData.PORTRAIT;
/* Save other print_settings data as key/value pairs in otherData. */
diff --git a/org/eclipse/swt/printing/Printer.java b/org/eclipse/swt/printing/Printer.java
index 0812440..0b79f2d 100644
--- a/org/eclipse/swt/printing/Printer.java
+++ b/org/eclipse/swt/printing/Printer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -44,6 +44,8 @@ import org.eclipse.swt.printing.PrinterData;
*/
public final class Printer extends Device {
static PrinterData [] printerList;
+ static int /*long*/ findPrinter;
+ static PrinterData findData;
PrinterData data;
int /*long*/ printer;
@@ -63,9 +65,20 @@ public final class Printer extends Device {
static int start, end;
static final String GTK_LPR_BACKEND = "GtkPrintBackendLpr"; //$NON-NLS-1$
+ static final String GTK_FILE_BACKEND = "GtkPrintBackendFile"; //$NON-NLS-1$
static boolean disablePrinting = System.getProperty("org.eclipse.swt.internal.gtk.disablePrinting") != null; //$NON-NLS-1$
+static void gtk_init() {
+ if (!OS.g_thread_supported ()) {
+ OS.g_thread_init (0);
+ }
+ OS.gtk_set_locale();
+ if (!OS.gtk_init_check (new int /*long*/ [] {0}, null)) {
+ SWT.error (SWT.ERROR_NO_HANDLES, null, " [gtk_init_check() failed]");
+ }
+}
+
/**
* Returns an array of <code>PrinterData</code> objects
* representing all available printers. If there are no
@@ -78,17 +91,18 @@ public static PrinterData[] getPrinterList() {
if (OS.GTK_VERSION < OS.VERSION (2, 10, 0) || disablePrinting) {
return printerList;
}
- if (!OS.g_thread_supported ()) {
- OS.g_thread_init (0);
- }
- OS.gtk_set_locale();
- if (!OS.gtk_init_check (new int /*long*/ [] {0}, null)) {
- SWT.error (SWT.ERROR_NO_HANDLES, null, " [gtk_init_check() failed]");
- }
+ gtk_init();
Callback printerCallback = new Callback(Printer.class, "GtkPrinterFunc_List", 2); //$NON-NLS-1$
int /*long*/ GtkPrinterFunc_List = printerCallback.getAddress();
if (GtkPrinterFunc_List == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
OS.gtk_enumerate_printers(GtkPrinterFunc_List, 0, 0, true);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
printerCallback.dispose ();
return printerList;
}
@@ -121,28 +135,29 @@ static int /*long*/ GtkPrinterFunc_List (int /*long*/ printer, int /*long*/ user
* @since 2.1
*/
public static PrinterData getDefaultPrinterData() {
- printerList = new PrinterData [1];
+ findData = null;
if (OS.GTK_VERSION < OS.VERSION (2, 10, 0) || disablePrinting) {
return null;
}
- if (!OS.g_thread_supported ()) {
- OS.g_thread_init (0);
- }
- OS.gtk_set_locale();
- if (!OS.gtk_init_check (new int /*long*/ [] {0}, null)) {
- SWT.error (SWT.ERROR_NO_HANDLES, null, " [gtk_init_check() failed]");
- }
+ gtk_init();
Callback printerCallback = new Callback(Printer.class, "GtkPrinterFunc_Default", 2); //$NON-NLS-1$
int /*long*/ GtkPrinterFunc_Default = printerCallback.getAddress();
if (GtkPrinterFunc_Default == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
OS.gtk_enumerate_printers(GtkPrinterFunc_Default, 0, 0, true);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
printerCallback.dispose ();
- return printerList[0];
+ return findData;
}
static int /*long*/ GtkPrinterFunc_Default (int /*long*/ printer, int /*long*/ user_data) {
if (OS.gtk_printer_is_default(printer)) {
- printerList[0] = printerDataFromGtkPrinter(printer);
+ findData = printerDataFromGtkPrinter(printer);
return 1;
} else if (OS.GTK_VERSION < OS.VERSION(2, 10, 12) && printerDataFromGtkPrinter(printer).driver.equals (GTK_LPR_BACKEND)) {
return 1;
@@ -150,20 +165,31 @@ static int /*long*/ GtkPrinterFunc_Default (int /*long*/ printer, int /*long*/ u
return 0;
}
-int /*long*/ gtkPrinterFromPrinterData() {
- Callback printerCallback = new Callback(this, "GtkPrinterFunc_FindNamedPrinter", 2); //$NON-NLS-1$
+static int /*long*/ gtkPrinterFromPrinterData(PrinterData data) {
+ gtk_init();
+ Callback printerCallback = new Callback(Printer.class, "GtkPrinterFunc_FindNamedPrinter", 2); //$NON-NLS-1$
int /*long*/ GtkPrinterFunc_FindNamedPrinter = printerCallback.getAddress();
if (GtkPrinterFunc_FindNamedPrinter == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- printer = 0;
+ findPrinter = 0;
+ findData = data;
OS.gtk_enumerate_printers(GtkPrinterFunc_FindNamedPrinter, 0, 0, true);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
printerCallback.dispose ();
- return printer;
+ return findPrinter;
}
-int /*long*/ GtkPrinterFunc_FindNamedPrinter (int /*long*/ printer, int /*long*/ user_data) {
+static int /*long*/ GtkPrinterFunc_FindNamedPrinter (int /*long*/ printer, int /*long*/ user_data) {
PrinterData pd = printerDataFromGtkPrinter(printer);
- if (pd.driver.equals(data.driver) && pd.name.equals(data.name)) {
- this.printer = printer;
+ if ((pd.driver.equals(findData.driver) && pd.name.equals(findData.name))
+ || (pd.driver.equals(GTK_FILE_BACKEND)) && findData.printToFile && findData.driver == null && findData.name == null) {
+ // TODO: GTK_FILE_BACKEND is not GTK API (see gtk bug 345590)
+ findPrinter = printer;
OS.g_object_ref(printer);
return 1;
} else if (OS.GTK_VERSION < OS.VERSION (2, 10, 12) && pd.driver.equals(GTK_LPR_BACKEND)) {
@@ -239,13 +265,45 @@ static void restore(byte [] data, int /*long*/ settings, int /*long*/ page_setup
OS.gtk_paper_size_free(paper_size);
}
+static byte [] uriFromFilename(String filename) {
+ if (filename == null) return null;
+ int length = filename.length();
+ if (length == 0) return null;
+ char[] chars = new char[length];
+ filename.getChars(0, length, chars, 0);
+ int /*long*/[] error = new int /*long*/[1];
+ int /*long*/ utf8Ptr = OS.g_utf16_to_utf8(chars, chars.length, null, null, error);
+ if (error[0] != 0 || utf8Ptr == 0) return null;
+ int /*long*/ localePtr = OS.g_filename_from_utf8(utf8Ptr, -1, null, null, error);
+ OS.g_free(utf8Ptr);
+ if (error[0] != 0 || localePtr == 0) return null;
+ int /*long*/ uriPtr = OS.g_filename_to_uri(localePtr, 0, error);
+ OS.g_free(localePtr);
+ if (error[0] != 0 || uriPtr == 0) return null;
+ length = OS.strlen(uriPtr);
+ byte[] uri = new byte[length + 1];
+ OS.memmove (uri, uriPtr, length);
+ OS.g_free(uriPtr);
+ return uri;
+}
+
static DeviceData checkNull (PrinterData data) {
if (data == null) data = new PrinterData();
if (data.driver == null || data.name == null) {
- PrinterData defaultPrinter = getDefaultPrinterData();
- if (defaultPrinter == null) SWT.error(SWT.ERROR_NO_HANDLES);
- data.driver = defaultPrinter.driver;
- data.name = defaultPrinter.name;
+ PrinterData defaultData = null;
+ if (data.printToFile) {
+ int /*long*/ filePrinter = gtkPrinterFromPrinterData(data);
+ if (filePrinter != 0) {
+ defaultData = printerDataFromGtkPrinter(filePrinter);
+ OS.g_object_unref(filePrinter);
+ }
+ }
+ if (defaultData == null) {
+ defaultData = getDefaultPrinterData();
+ if (defaultData == null) SWT.error(SWT.ERROR_NO_HANDLES);
+ }
+ data.driver = defaultData.driver;
+ data.name = defaultData.name;
}
return data;
}
@@ -257,7 +315,7 @@ static DeviceData checkNull (PrinterData data) {
* </p>
*
* @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES - if there are no valid printers
+ * <li>ERROR_NO_HANDLES - if there is no valid default printer
* </ul>
*
* @see Device#dispose
@@ -352,6 +410,9 @@ public Font getSystemFont () {
if (systemFont != null) return systemFont;
int /*long*/ style = OS.gtk_widget_get_default_style();
int /*long*/ defaultFont = OS.pango_font_description_copy (OS.gtk_style_get_font_desc (style));
+ int size = OS.pango_font_description_get_size(defaultFont);
+ Point dpi = getDPI(), screenDPI = super.getDPI();
+ OS.pango_font_description_set_size(defaultFont, size * dpi.y / screenDPI.y);
return systemFont = Font.gtk_new (this, defaultFont);
}
@@ -387,10 +448,15 @@ public int /*long*/ internal_new_GC(GCData data) {
data.background = getSystemColor (SWT.COLOR_WHITE).handle;
data.foreground = getSystemColor (SWT.COLOR_BLACK).handle;
data.font = getSystemFont ();
- //TODO: We are supposed to return this in pixels, but GTK_UNIT_PIXELS is currently not implemented (gtk bug 346245)
- data.width = (int)OS.gtk_page_setup_get_paper_width (pageSetup, OS.GTK_UNIT_POINTS);
- data.height = (int)OS.gtk_page_setup_get_paper_height (pageSetup, OS.GTK_UNIT_POINTS);
+ Point dpi = getDPI(), screenDPI = getIndependentDPI();
+ data.width = (int)(OS.gtk_page_setup_get_paper_width (pageSetup, OS.GTK_UNIT_POINTS) * dpi.x / screenDPI.x);
+ data.height = (int)(OS.gtk_page_setup_get_paper_height (pageSetup, OS.GTK_UNIT_POINTS) * dpi.y / screenDPI.y);
if (cairo == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ Cairo.cairo_identity_matrix(cairo);
+ double printX = OS.gtk_page_setup_get_left_margin(pageSetup, OS.GTK_UNIT_POINTS);
+ double printY = OS.gtk_page_setup_get_top_margin(pageSetup, OS.GTK_UNIT_POINTS);
+ Cairo.cairo_translate(cairo, printX, printY);
+ Cairo.cairo_scale(cairo, screenDPI.x / (float)dpi.x, screenDPI.y / (float)dpi.y);
data.cairo = cairo;
isGCCreated = true;
}
@@ -591,10 +657,9 @@ public Point getDPI() {
checkDevice();
int resolution = OS.gtk_print_settings_get_resolution(settings);
if (DEBUG) System.out.println("print_settings.resolution=" + resolution);
- //TODO: Return 72 (1/72 inch = 1 point) until gtk bug 346245 is fixed
- //TODO: Fix this: gtk_print_settings_get_resolution returns 0? (see gtk bug 346252)
- /*if (resolution == 0)*/ return new Point(72, 72);
-// return new Point(resolution, resolution);
+ //TODO: use new api for get x resolution and get y resolution
+ if (resolution == 0) return new Point(72, 72);
+ return new Point(resolution, resolution);
}
/**
@@ -614,9 +679,9 @@ public Point getDPI() {
*/
public Rectangle getBounds() {
checkDevice();
- //TODO: We are supposed to return this in pixels, but GTK_UNIT_PIXELS is currently not implemented (gtk bug 346245)
- double width = OS.gtk_page_setup_get_paper_width (pageSetup, OS.GTK_UNIT_POINTS);
- double height = OS.gtk_page_setup_get_paper_height (pageSetup, OS.GTK_UNIT_POINTS);
+ Point dpi = getDPI(), screenDPI = getIndependentDPI();
+ double width = OS.gtk_page_setup_get_paper_width (pageSetup, OS.GTK_UNIT_POINTS) * dpi.x / screenDPI.x;
+ double height = OS.gtk_page_setup_get_paper_height (pageSetup, OS.GTK_UNIT_POINTS) * dpi.y / screenDPI.y;
return new Rectangle(0, 0, (int) width, (int) height);
}
@@ -639,12 +704,16 @@ public Rectangle getBounds() {
*/
public Rectangle getClientArea() {
checkDevice();
- //TODO: We are supposed to return this in pixels, but GTK_UNIT_PIXELS is currently not implemented (gtk bug 346245)
- double width = OS.gtk_page_setup_get_page_width(pageSetup, OS.GTK_UNIT_POINTS);
- double height = OS.gtk_page_setup_get_page_height(pageSetup, OS.GTK_UNIT_POINTS);
+ Point dpi = getDPI(), screenDPI = getIndependentDPI();
+ double width = OS.gtk_page_setup_get_page_width(pageSetup, OS.GTK_UNIT_POINTS) * dpi.x / screenDPI.x;
+ double height = OS.gtk_page_setup_get_page_height(pageSetup, OS.GTK_UNIT_POINTS) * dpi.y / screenDPI.y;
return new Rectangle(0, 0, (int) width, (int) height);
}
+Point getIndependentDPI () {
+ return new Point(72, 72);
+}
+
/**
* Given a <em>client area</em> (as described by the arguments),
* returns a rectangle, relative to the client area's coordinates,
@@ -682,13 +751,13 @@ public Rectangle getClientArea() {
*/
public Rectangle computeTrim(int x, int y, int width, int height) {
checkDevice();
- //TODO: We are supposed to return this in pixels, but GTK_UNIT_PIXELS is currently not implemented (gtk bug 346245)
- double printWidth = OS.gtk_page_setup_get_page_width(pageSetup, OS.GTK_UNIT_POINTS);
- double printHeight = OS.gtk_page_setup_get_page_height(pageSetup, OS.GTK_UNIT_POINTS);
- double paperWidth = OS.gtk_page_setup_get_paper_width (pageSetup, OS.GTK_UNIT_POINTS);
- double paperHeight = OS.gtk_page_setup_get_paper_height (pageSetup, OS.GTK_UNIT_POINTS);
- double printX = -OS.gtk_page_setup_get_left_margin(pageSetup, OS.GTK_UNIT_POINTS);
- double printY = -OS.gtk_page_setup_get_top_margin(pageSetup, OS.GTK_UNIT_POINTS);
+ Point dpi = getDPI(), screenDPI = getIndependentDPI();
+ double printWidth = OS.gtk_page_setup_get_page_width(pageSetup, OS.GTK_UNIT_POINTS) * dpi.x / screenDPI.x;
+ double printHeight = OS.gtk_page_setup_get_page_height(pageSetup, OS.GTK_UNIT_POINTS) * dpi.y / screenDPI.y;
+ double paperWidth = OS.gtk_page_setup_get_paper_width (pageSetup, OS.GTK_UNIT_POINTS) * dpi.x / screenDPI.x;
+ double paperHeight = OS.gtk_page_setup_get_paper_height (pageSetup, OS.GTK_UNIT_POINTS) * dpi.y / screenDPI.y;
+ double printX = -OS.gtk_page_setup_get_left_margin(pageSetup, OS.GTK_UNIT_POINTS) * dpi.x / screenDPI.x;
+ double printY = -OS.gtk_page_setup_get_top_margin(pageSetup, OS.GTK_UNIT_POINTS) * dpi.y / screenDPI.y;
double hTrim = paperWidth - printWidth;
double vTrim = paperHeight - printHeight;
return new Rectangle(x + (int)printX, y + (int)printY, width + (int)hTrim, height + (int)vTrim);
@@ -703,7 +772,7 @@ public Rectangle computeTrim(int x, int y, int width, int height) {
protected void create(DeviceData deviceData) {
this.data = (PrinterData)deviceData;
if (OS.GTK_VERSION < OS.VERSION (2, 10, 0) || disablePrinting) SWT.error(SWT.ERROR_NO_HANDLES);
- printer = gtkPrinterFromPrinterData();
+ printer = gtkPrinterFromPrinterData(data);
if (printer == 0) SWT.error(SWT.ERROR_NO_HANDLES);
}
@@ -720,7 +789,6 @@ protected void create(DeviceData deviceData) {
* @see #create
*/
protected void init() {
- super.init ();
settings = OS.gtk_print_settings_new();
pageSetup = OS.gtk_page_setup_new();
if (data.otherData != null) {
@@ -728,20 +796,37 @@ protected void init() {
}
/* Set values of print_settings and page_setup from PrinterData. */
- //TODO: Should we look at printToFile, or driver/name for "Print to File", or both? (see gtk bug 345590)
if (data.printToFile && data.fileName != null) {
- byte [] buffer = Converter.wcsToMbcs (null, data.fileName, true);
- OS.gtk_print_settings_set(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI, buffer);
- }
- if (data.driver.equals("GtkPrintBackendFile") && data.name.equals("Print to File") && data.fileName != null) { //$NON-NLS-1$ //$NON-NLS-2$
- byte [] buffer = Converter.wcsToMbcs (null, data.fileName, true);
- OS.gtk_print_settings_set(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI, buffer);
+ byte [] uri = uriFromFilename(data.fileName);
+ if (uri != null) {
+ OS.gtk_print_settings_set(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI, uri);
+ }
}
OS.gtk_print_settings_set_n_copies(settings, data.copyCount);
OS.gtk_print_settings_set_collate(settings, data.collate);
+ if (data.duplex != SWT.DEFAULT) {
+ int duplex = data.duplex == PrinterData.DUPLEX_LONG_EDGE ? OS.GTK_PRINT_DUPLEX_HORIZONTAL
+ : data.duplex == PrinterData.DUPLEX_SHORT_EDGE ? OS.GTK_PRINT_DUPLEX_VERTICAL
+ : OS.GTK_PRINT_DUPLEX_SIMPLEX;
+ OS.gtk_print_settings_set_duplex (settings, duplex);
+ /*
+ * Bug in GTK. The cups backend only looks at the value
+ * of the non-API field cups-Duplex in the print_settings.
+ * The fix is to manually set cups-Duplex to Tumble or NoTumble.
+ */
+ String cupsDuplexType = null;
+ if (duplex == OS.GTK_PRINT_DUPLEX_HORIZONTAL) cupsDuplexType = "DuplexNoTumble";
+ else if (duplex == OS.GTK_PRINT_DUPLEX_VERTICAL) cupsDuplexType = "DuplexTumble";
+ if (cupsDuplexType != null) {
+ byte [] keyBuffer = Converter.wcsToMbcs (null, "cups-Duplex", true);
+ byte [] valueBuffer = Converter.wcsToMbcs (null, cupsDuplexType, true);
+ OS.gtk_print_settings_set(settings, keyBuffer, valueBuffer);
+ }
+ }
int orientation = data.orientation == PrinterData.LANDSCAPE ? OS.GTK_PAGE_ORIENTATION_LANDSCAPE : OS.GTK_PAGE_ORIENTATION_PORTRAIT;
OS.gtk_page_setup_set_orientation(pageSetup, orientation);
OS.gtk_print_settings_set_orientation(settings, orientation);
+ super.init ();
}
/**
diff --git a/org/eclipse/swt/printing/PrinterData.java b/org/eclipse/swt/printing/PrinterData.java
index 98fc552..334d7aa 100644
--- a/org/eclipse/swt/printing/PrinterData.java
+++ b/org/eclipse/swt/printing/PrinterData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
package org.eclipse.swt.printing;
+import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
/**
@@ -113,6 +114,30 @@ public final class PrinterData extends DeviceData {
public int orientation = PORTRAIT;
/**
+ * Single-sided or double-sided printing, expressed as one of the
+ * following values:
+ * <dl>
+ * <dt><code>SWT.DEFAULT</code></dt>
+ * <dd>the default duplex value for the printer</dd>
+ * <dt><code>DUPLEX_NONE</code></dt>
+ * <dd>single-sided printing</dd>
+ * <dt><code>DUPLEX_LONG_EDGE</code></dt>
+ * <dd>double-sided printing as if bound on the long edge</dd>
+ * <dt><code>DUPLEX_SHORT_EDGE</code></dt>
+ * <dd>double-sided printing as if bound on the short edge</dd>
+ * </dl>
+ * <p>
+ * The default value is <code>SWT.DEFAULT</code>, meaning do not set a value;
+ * use the printer's default duplex setting.
+ * A printer's default value is typically single-sided,
+ * however it can default to double-sided in order to save paper.
+ * </p>
+ *
+ * @since 3.7
+ */
+ public int duplex = SWT.DEFAULT;
+
+ /**
* <code>scope</code> field value indicating that
* all pages should be printed
*/
@@ -147,6 +172,45 @@ public final class PrinterData extends DeviceData {
*/
public static final int LANDSCAPE = 2;
+ /**
+ * <code>duplex</code> field value indicating
+ * single-sided printing.
+ * <p>
+ * This is also known as simplex printing.
+ * </p>
+ *
+ * @since 3.7
+ */
+ public static final int DUPLEX_NONE = 0;
+
+ /**
+ * <code>duplex</code> field value indicating
+ * double-sided printing for binding on the long edge.
+ * <p>
+ * For portrait orientation, the long edge is vertical.
+ * For landscape orientation, the long edge is horizontal.
+ * </p><p>
+ * This is also known as duplex printing.
+ * </p>
+ *
+ * @since 3.7
+ */
+ public static final int DUPLEX_LONG_EDGE = 1;
+
+ /**
+ * <code>duplex</code> field value indicating
+ * double-sided printing for binding on the short edge.
+ * <p>
+ * For portrait orientation, the short edge is horizontal.
+ * For landscape orientation, the short edge is vertical.
+ * </p><p>
+ * This is also known as duplex tumble printing.
+ * </p>
+ *
+ * @since 3.7
+ */
+ public static final int DUPLEX_SHORT_EDGE = 2;
+
/**
* private, platform-specific data
* On Windows, this contains a copy of the DEVMODE struct
diff --git a/org/eclipse/swt/program/Program.java b/org/eclipse/swt/program/Program.java
index 9d4d4fe..80efc65 100644
--- a/org/eclipse/swt/program/Program.java
+++ b/org/eclipse/swt/program/Program.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -94,34 +94,21 @@ static int getDesktop(final Display display) {
* The workaround is to simply check that the window manager is a
* compliant one (property _NET_SUPPORTING_WM_CHECK) and to attempt to load
* our native library that depends on gnome-vfs.
+ *
+ * Note: GIO is used when available instead of gnome-vfs.
*/
if (desktop == DESKTOP_UNKNOWN) {
byte[] gnomeName = Converter.wcsToMbcs(null, "_NET_SUPPORTING_WM_CHECK", true);
int /*long*/ gnome = OS.XInternAtom(xDisplay, gnomeName, true);
- if (gnome != OS.None && (OS.GTK_VERSION >= OS.VERSION (2, 2, 0)) && gnome_init()) {
- desktop = DESKTOP_GNOME;
- int /*long*/ icon_theme = GNOME.gnome_icon_theme_new();
- display.setData(ICON_THEME_DATA, new LONG(icon_theme));
- display.addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event event) {
- LONG gnomeIconTheme = (LONG)display.getData(ICON_THEME_DATA);
- if (gnomeIconTheme == null) return;
- display.setData(ICON_THEME_DATA, null);
- /*
- * Note. gnome_icon_theme_new uses g_object_new to allocate the
- * data it returns. Use g_object_unref to free the pointer it returns.
- */
- if (gnomeIconTheme.value != 0) OS.g_object_unref(gnomeIconTheme.value);
- }
- });
- /* Check for the existence of libgio libraries */
- byte[] buffer ;
+ if (gnome != OS.None) {
+ /* Check for the existence of libgio libraries first */
+ byte[] buffer;
int flags = OS.RTLD_LAZY;
if (OS.IsAIX) {
- buffer = Converter.wcsToMbcs(null, "libgio-2.0.a(libgio-2.0.so.0)", true);
- flags |= OS.RTLD_MEMBER;
+ buffer = Converter.wcsToMbcs(null, "libgio-2.0.a(libgio-2.0.so.0)", true);
+ flags |= OS.RTLD_MEMBER;
} else if (OS.IsHPUX) {
- buffer = Converter.wcsToMbcs(null, "libgio-2.0.so", true);
+ buffer = Converter.wcsToMbcs(null, "libgio-2.0.so", true);
} else {
buffer = Converter.wcsToMbcs(null, "libgio-2.0.so.0", true);
}
@@ -133,7 +120,24 @@ static int getDesktop(final Display display) {
desktop = DESKTOP_GIO;
}
OS.dlclose(libgio);
- } else {
+ }
+
+ if (desktop == DESKTOP_UNKNOWN && (OS.GTK_VERSION >= OS.VERSION (2, 2, 0)) && gnome_init()) {
+ desktop = DESKTOP_GNOME;
+ int /*long*/ icon_theme = GNOME.gnome_icon_theme_new();
+ display.setData(ICON_THEME_DATA, new LONG(icon_theme));
+ display.addListener(SWT.Dispose, new Listener() {
+ public void handleEvent(Event event) {
+ LONG gnomeIconTheme = (LONG)display.getData(ICON_THEME_DATA);
+ if (gnomeIconTheme == null) return;
+ display.setData(ICON_THEME_DATA, null);
+ /*
+ * Note. gnome_icon_theme_new uses g_object_new to allocate the
+ * data it returns. Use g_object_unref to free the pointer it returns.
+ */
+ if (gnomeIconTheme.value != 0) OS.g_object_unref(gnomeIconTheme.value);
+ }
+ });
/* Check for libgnomevfs-2 version 2.4 */
buffer = Converter.wcsToMbcs(null, "libgnomevfs-2.so.0", true);
int /*long*/ libgnomevfs = OS.dlopen(buffer, OS.RTLD_LAZY);
@@ -974,14 +978,17 @@ boolean gio_execute(String fileName) {
if (application != 0) {
byte[] fileNameBuffer = Converter.wcsToMbcs (null, fileName, true);
int /*long*/ file = 0;
- if (OS.g_app_info_supports_uris (application)) {
- file = OS.g_file_new_for_uri (fileNameBuffer);
- } else {
- file = OS.g_file_new_for_path (fileNameBuffer);
+ if (fileName.length() > 0) {
+ if (OS.g_app_info_supports_uris (application)) {
+ file = OS.g_file_new_for_uri (fileNameBuffer);
+ } else {
+ file = OS.g_file_new_for_path (fileNameBuffer);
+ }
}
- if (file != 0) {
- int /*long*/ list = OS.g_list_append (0, file);
- result = OS.g_app_info_launch (application, list, 0, 0);
+ int /*long*/ list = 0;
+ if (file != 0) list = OS.g_list_append (0, file);
+ result = OS.g_app_info_launch (application, list, 0, 0);
+ if (list != 0) {
OS.g_list_free (list);
OS.g_object_unref (file);
}
diff --git a/org/eclipse/swt/widgets/Button.java b/org/eclipse/swt/widgets/Button.java
index f16b2d4..862ed98 100644
--- a/org/eclipse/swt/widgets/Button.java
+++ b/org/eclipse/swt/widgets/Button.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,8 +36,7 @@ import org.eclipse.swt.events.*;
* Note: Only one of the styles UP, DOWN, LEFT, and RIGHT may be specified
* when the ARROW style is specified.
* </p><p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#button">Button snippets</a>
@@ -52,6 +51,9 @@ public class Button extends Control {
Image image;
String text;
+ static final int INNER_BORDER = 1;
+ static final int DEFAULT_BORDER = 1;
+
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
@@ -109,6 +111,22 @@ static int checkStyle (int style) {
return style;
}
+static GtkBorder getBorder (byte[] border, int /*long*/ handle, int defaultBorder) {
+ GtkBorder gtkBorder = new GtkBorder();
+ int /*long*/ [] borderPtr = new int /*long*/ [1];
+ OS.gtk_widget_style_get (handle, border, borderPtr,0);
+ if (borderPtr[0] != 0) {
+ OS.memmove (gtkBorder, borderPtr[0], GtkBorder.sizeof);
+ OS.gtk_border_free(borderPtr[0]);
+ return gtkBorder;
+ }
+ gtkBorder.left = defaultBorder;
+ gtkBorder.top = defaultBorder;
+ gtkBorder.right = defaultBorder;
+ gtkBorder.bottom = defaultBorder;
+ return gtkBorder;
+}
+
/**
* Adds the listener to the collection of listeners who will
* be notified when the control is selected by the user, by sending
@@ -165,21 +183,68 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
OS.gtk_widget_get_size_request (boxHandle, reqWidth, reqHeight);
OS.gtk_widget_set_size_request (boxHandle, -1, -1);
}
- Point size = computeNativeSize (handle, wHint, hHint, changed);
+ Point size;
+ boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && (OS.GTK_WIDGET_FLAGS (labelHandle) & OS.GTK_VISIBLE) != 0;
+ if (wrap) {
+ int borderWidth = OS.gtk_container_get_border_width (handle);
+ int[] focusWidth = new int[1];
+ OS.gtk_widget_style_get (handle, OS.focus_line_width, focusWidth, 0);
+ int[] focusPadding = new int[1];
+ OS.gtk_widget_style_get (handle, OS.focus_padding, focusPadding, 0);
+ int trimWidth = 2 * (borderWidth + focusWidth [0] + focusPadding [0]), trimHeight = trimWidth;
+ int indicatorHeight = 0;
+ if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
+ int[] indicatorSize = new int[1];
+ OS.gtk_widget_style_get (handle, OS.indicator_size, indicatorSize, 0);
+ int[] indicatorSpacing = new int[1];
+ OS.gtk_widget_style_get (handle, OS.indicator_spacing, indicatorSpacing, 0);
+ indicatorHeight = indicatorSize [0] + 2 * indicatorSpacing [0];
+ trimWidth += indicatorHeight + indicatorSpacing [0];
+ } else {
+ int /*long*/ style = OS.gtk_widget_get_style (handle);
+ trimWidth += OS.gtk_style_get_xthickness (style) * 2;
+ trimHeight += OS.gtk_style_get_ythickness (style) * 2;
+ GtkBorder innerBorder = getBorder (OS.inner_border, handle, INNER_BORDER);
+ trimWidth += innerBorder.left + innerBorder.right;
+ trimHeight += innerBorder.top + innerBorder.bottom;
+ if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_CAN_DEFAULT) != 0) {
+ GtkBorder defaultBorder = getBorder (OS.default_border, handle, DEFAULT_BORDER);
+ trimWidth += defaultBorder.left + defaultBorder.right;
+ trimHeight += defaultBorder.top + defaultBorder.bottom;
+ }
+ }
+ int imageWidth = 0, imageHeight = 0;
+ if (OS.GTK_WIDGET_VISIBLE (imageHandle)) {
+ GtkRequisition requisition = new GtkRequisition ();
+ OS.gtk_widget_size_request (imageHandle, requisition);
+ imageWidth = requisition.width;
+ imageHeight = requisition.height;
+ int [] spacing = new int [1];
+ OS.g_object_get (boxHandle, OS.spacing, spacing, 0);
+ imageWidth += spacing [0];
+ }
+ int /*long*/ labelLayout = OS.gtk_label_get_layout (labelHandle);
+ int pangoWidth = OS.pango_layout_get_width (labelLayout);
+ if (wHint != SWT.DEFAULT) {
+ OS.pango_layout_set_width (labelLayout, Math.max (1, (wHint - imageWidth - trimWidth)) * OS.PANGO_SCALE);
+ } else {
+ OS.pango_layout_set_width (labelLayout, -1);
+ }
+ int [] w = new int [1], h = new int [1];
+ OS.pango_layout_get_size (labelLayout, w, h);
+ OS.pango_layout_set_width (labelLayout, pangoWidth);
+ size = new Point(0, 0);
+ size.x += wHint == SWT.DEFAULT ? OS.PANGO_PIXELS(w [0]) + imageWidth + trimWidth : wHint;
+ size.y += hHint == SWT.DEFAULT ? Math.max(Math.max(imageHeight, indicatorHeight), OS.PANGO_PIXELS(h [0])) + trimHeight : hHint;
+ } else {
+ size = computeNativeSize (handle, wHint, hHint, changed);
+ }
if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
OS.gtk_widget_set_size_request (boxHandle, reqWidth [0], reqHeight [0]);
}
if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_CAN_DEFAULT) != 0) {
- int /*long*/ [] buffer = new int /*long*/ [1];
- GtkBorder border = new GtkBorder ();
- OS.gtk_widget_style_get (handle, OS.default_border, buffer, 0);
- if (buffer[0] != 0) {
- OS.memmove (border, buffer[0], GtkBorder.sizeof);
- } else {
- /* Use the GTK+ default value of 1 for each. */
- border.left = border.right = border.top = border.bottom = 1;
- }
+ GtkBorder border = getBorder (OS.default_border, handle, DEFAULT_BORDER);
if (wHint != SWT.DEFAULT) size.x += border.left + border.right;
if (hHint != SWT.DEFAULT) size.y += border.top + border.bottom;
}
@@ -252,6 +317,12 @@ void createHandle (int index) {
OS.gtk_container_add (handle, boxHandle);
OS.gtk_container_add (boxHandle, imageHandle);
OS.gtk_container_add (boxHandle, labelHandle);
+ if ((style & SWT.WRAP) != 0) {
+ OS.gtk_label_set_line_wrap (labelHandle, true);
+ if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) {
+ OS.gtk_label_set_line_wrap_mode (labelHandle, OS.PANGO_WRAP_WORD_CHAR);
+ }
+ }
}
OS.gtk_container_add (fixedHandle, handle);
@@ -646,6 +717,68 @@ void setBackgroundColor (GdkColor color) {
if (imageHandle != 0) setBackgroundColor(imageHandle, color);
}
+int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
+ /*
+ * Bug in GTK. For some reason, when the label is
+ * wrappable and its container is resized, it does not
+ * cause the label to be wrapped. The fix is to
+ * determine the size that will wrap the label
+ * and expilictly set that size to force the label
+ * to wrap.
+ *
+ * This part of the fix causes the label to be
+ * resized to the preferred size but it still
+ * won't draw properly.
+ */
+ boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && (OS.GTK_WIDGET_FLAGS (labelHandle) & OS.GTK_VISIBLE) != 0;
+ if (wrap) OS.gtk_widget_set_size_request (boxHandle, -1, -1);
+ int result = super.setBounds (x, y, width, height, move, resize);
+ /*
+ * Bug in GTK. For some reason, when the label is
+ * wrappable and its container is resized, it does not
+ * cause the label to be wrapped. The fix is to
+ * determine the size that will wrap the label
+ * and expilictly set that size to force the label
+ * to wrap.
+ *
+ * This part of the fix forces the label to be
+ * resized so that it will draw wrapped.
+ */
+ if (wrap) {
+ int boxWidth = OS.GTK_WIDGET_WIDTH (boxHandle);
+ int boxHeight = OS.GTK_WIDGET_HEIGHT (boxHandle);
+ int /*long*/ labelLayout = OS.gtk_label_get_layout (labelHandle);
+ int pangoWidth = OS.pango_layout_get_width (labelLayout);
+ OS.pango_layout_set_width (labelLayout, -1);
+ int [] w = new int [1], h = new int [1];
+ OS.pango_layout_get_size (labelLayout, w, h);
+ OS.pango_layout_set_width (labelLayout, pangoWidth);
+ int imageWidth = 0;
+ if (OS.GTK_WIDGET_VISIBLE (imageHandle)) {
+ GtkRequisition requisition = new GtkRequisition ();
+ OS.gtk_widget_size_request (imageHandle, requisition);
+ imageWidth = requisition.width;
+ int [] spacing = new int [1];
+ OS.g_object_get (boxHandle, OS.spacing, spacing, 0);
+ imageWidth += spacing [0];
+ }
+ OS.gtk_widget_set_size_request (labelHandle, Math.min(OS.PANGO_PIXELS(w [0]), boxWidth - imageWidth), -1);
+ /*
+ * Bug in GTK. Setting the size request should invalidate the label's
+ * layout, but it does not. The fix is to resize the label directly.
+ */
+ GtkRequisition requisition = new GtkRequisition ();
+ OS.gtk_widget_size_request (boxHandle, requisition);
+ GtkAllocation allocation = new GtkAllocation ();
+ allocation.x = OS.GTK_WIDGET_X (boxHandle);
+ allocation.y = OS.GTK_WIDGET_Y (boxHandle);
+ allocation.width = boxWidth;
+ allocation.height = boxHeight;
+ OS.gtk_widget_size_allocate (boxHandle, allocation);
+ }
+ return result;
+}
+
void setFontDescription (int /*long*/ font) {
super.setFontDescription (font);
if (labelHandle != 0) OS.gtk_widget_modify_font (labelHandle, font);
@@ -734,16 +867,18 @@ public void setImage (Image image) {
_setAlignment (style);
}
-void setOrientation () {
- super.setOrientation ();
- if ((style & SWT.RIGHT_TO_LEFT) != 0) {
- if (boxHandle != 0) OS.gtk_widget_set_direction (boxHandle, OS.GTK_TEXT_DIR_RTL);
- if (labelHandle != 0) OS.gtk_widget_set_direction (labelHandle, OS.GTK_TEXT_DIR_RTL);
- if (imageHandle != 0) OS.gtk_widget_set_direction (imageHandle, OS.GTK_TEXT_DIR_RTL);
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if ((style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
+ int dir = (style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ if (boxHandle != 0) OS.gtk_widget_set_direction (boxHandle, dir);
+ if (labelHandle != 0) OS.gtk_widget_set_direction (labelHandle, dir);
+ if (imageHandle != 0) OS.gtk_widget_set_direction (imageHandle, dir);
if (arrowHandle != 0) {
+ dir = (style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_ARROW_RIGHT : OS.GTK_ARROW_LEFT;
switch (style & (SWT.LEFT | SWT.RIGHT)) {
- case SWT.LEFT: OS.gtk_arrow_set (arrowHandle, OS.GTK_ARROW_RIGHT, OS.GTK_SHADOW_OUT); break;
- case SWT.RIGHT: OS.gtk_arrow_set (arrowHandle, OS.GTK_ARROW_LEFT, OS.GTK_SHADOW_OUT); break;
+ case SWT.LEFT: OS.gtk_arrow_set (arrowHandle, dir, OS.GTK_SHADOW_OUT); break;
+ case SWT.RIGHT: OS.gtk_arrow_set (arrowHandle, dir, OS.GTK_SHADOW_OUT); break;
}
}
}
diff --git a/org/eclipse/swt/widgets/Caret.java b/org/eclipse/swt/widgets/Caret.java
index 8bfa82f..b5034c6 100644
--- a/org/eclipse/swt/widgets/Caret.java
+++ b/org/eclipse/swt/widgets/Caret.java
@@ -25,8 +25,7 @@ import org.eclipse.swt.graphics.*;
* <dd>(none)</dd>
* </dl>
* <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#caret">Caret snippets</a>
diff --git a/org/eclipse/swt/widgets/ColorDialog.java b/org/eclipse/swt/widgets/ColorDialog.java
index 1605c49..0a0c735 100644
--- a/org/eclipse/swt/widgets/ColorDialog.java
+++ b/org/eclipse/swt/widgets/ColorDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,8 +26,7 @@ import org.eclipse.swt.graphics.*;
* <dd>(none)</dd>
* </dl>
* <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample, Dialog tab</a>
@@ -153,6 +152,13 @@ public RGB open () {
hookId = OS.g_signal_add_emission_hook (signalId, 0, display.emissionProc, handle, 0);
}
int response = OS.gtk_dialog_run (handle);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
OS.g_signal_remove_emission_hook (signalId, hookId);
}
diff --git a/org/eclipse/swt/widgets/Combo.java b/org/eclipse/swt/widgets/Combo.java
index 389aa23..0b279c4 100644
--- a/org/eclipse/swt/widgets/Combo.java
+++ b/org/eclipse/swt/widgets/Combo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -571,10 +571,10 @@ boolean filterKey (int keyval, int /*long*/ event) {
}
int /*long*/ findPopupHandle (int /*long*/ oldList) {
- int /*long*/ hdl = 0;
+ int /*long*/ result = 0;
int /*long*/ currentList = OS.gtk_window_list_toplevels();
int /*long*/ oldFromList = oldList;
- int /*long*/ newFromList = currentList;
+ int /*long*/ newFromList = OS.g_list_last(currentList);
boolean isFound;
while (newFromList != 0) {
int /*long*/ newToplevel = OS.g_list_data(newFromList);
@@ -589,14 +589,14 @@ int /*long*/ findPopupHandle (int /*long*/ oldList) {
oldFromList = OS.g_list_next(oldFromList);
}
if (!isFound) {
- hdl = newToplevel;
+ result = newToplevel;
break;
}
- newFromList = OS.g_list_next(newFromList);
+ newFromList = OS.g_list_previous(newFromList);
}
OS.g_list_free(oldList);
OS.g_list_free(currentList);
- return hdl;
+ return result;
}
@@ -808,7 +808,7 @@ public void deselectAll () {
}
}
-boolean dragDetect(int x, int y, boolean filter, boolean[] consume) {
+boolean dragDetect(int x, int y, boolean filter, boolean dragOnTimeout, boolean[] consume) {
if (filter && entryHandle != 0) {
int [] index = new int [1];
int [] trailing = new int [1];
@@ -816,16 +816,18 @@ boolean dragDetect(int x, int y, boolean filter, boolean[] consume) {
OS.pango_layout_xy_to_index (layout, x * OS.PANGO_SCALE, y * OS.PANGO_SCALE, index, trailing);
int /*long*/ ptr = OS.pango_layout_get_text (layout);
int position = (int)/*64*/OS.g_utf8_pointer_to_offset (ptr, ptr + index[0]) + trailing[0];
- Point selection = getSelection ();
- if (selection.x <= position && position < selection.y) {
- if (super.dragDetect (x, y, filter, consume)) {
+ int [] start = new int [1];
+ int [] end = new int [1];
+ OS.gtk_editable_get_selection_bounds (entryHandle, start, end);
+ if (start [0] <= position && position < end [0]) {
+ if (super.dragDetect (x, y, filter, dragOnTimeout, consume)) {
if (consume != null) consume [0] = true;
return true;
}
}
return false;
}
- return super.dragDetect (x, y, filter, consume);
+ return super.dragDetect (x, y, filter, dragOnTimeout, consume);
}
int /*long*/ enterExitHandle () {
@@ -966,8 +968,7 @@ String getNameText () {
* @since 2.1.2
*/
public int getOrientation () {
- checkWidget();
- return style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
+ return super.getOrientation ();
}
/**
@@ -998,7 +999,7 @@ public Point getSelection () {
if (index != -1) length = getItem (index).length ();
} else {
int /*long*/ str = OS.gtk_entry_get_text (entryHandle);
- if (str != 0) length = (int)/*64*/OS.g_utf8_strlen (str, -1);
+ if (str != 0) length = (int)/*64*/OS.g_utf16_strlen (str, -1);
}
return new Point (0, length);
}
@@ -1006,6 +1007,9 @@ public Point getSelection () {
int [] end = new int [1];
if (entryHandle != 0) {
OS.gtk_editable_get_selection_bounds (entryHandle, start, end);
+ int /*long*/ ptr = OS.gtk_entry_get_text (entryHandle);
+ start[0] = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, start[0]);
+ end[0] = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, end[0]);
}
return new Point(start [0], end [0]);
}
@@ -1269,8 +1273,11 @@ int /*long*/ gtk_delete_text (int /*long*/ widget, int /*long*/ start_pos, int /
return 0;
}
if (!hooks (SWT.Verify) && !filters (SWT.Verify)) return 0;
- if (end_pos == -1) end_pos = OS.g_utf8_strlen (OS.gtk_entry_get_text (entryHandle), -1);
- String newText = verifyText ("", (int)/*64*/start_pos, (int)/*64*/end_pos);
+ int /*long*/ ptr = OS.gtk_entry_get_text (entryHandle);
+ if (end_pos == -1) end_pos = OS.g_utf8_strlen (ptr, -1);
+ int start = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, start_pos);
+ int end = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, end_pos);
+ String newText = verifyText ("", start, end);
if (newText == null) {
OS.g_signal_stop_emission_by_name (entryHandle, OS.delete_text);
} else {
@@ -1372,11 +1379,10 @@ int /*long*/ gtk_insert_text (int /*long*/ widget, int /*long*/ new_text, int /*
String oldText = new String (Converter.mbcsToWcs (null, buffer));
int [] pos = new int [1];
OS.memmove (pos, position, 4);
- if (pos [0] == -1) {
- int /*long*/ ptr = OS.gtk_entry_get_text (entryHandle);
- pos [0] = (int)/*64*/OS.g_utf8_strlen (ptr, -1);
- }
- String newText = verifyText (oldText, pos [0], pos [0]);
+ int /*long*/ ptr = OS.gtk_entry_get_text (entryHandle);
+ if (pos [0] == -1) pos [0] = (int)/*64*/OS.g_utf8_strlen (ptr, -1);
+ int start = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, pos [0]);
+ String newText = verifyText (oldText, start, start);
if (newText != oldText) {
int [] newStart = new int [1], newEnd = new int [1];
OS.gtk_editable_get_selection_bounds (entryHandle, newStart, newEnd);
@@ -2050,12 +2056,28 @@ public void setListVisible (boolean visible) {
}
}
-void setOrientation() {
- super.setOrientation();
- if ((style & SWT.RIGHT_TO_LEFT) != 0) {
- if (listHandle != 0) OS.gtk_widget_set_direction (listHandle, OS.GTK_TEXT_DIR_RTL);
- if (entryHandle != 0) OS.gtk_widget_set_direction (entryHandle, OS.GTK_TEXT_DIR_RTL);
- if (cellHandle != 0) OS.gtk_widget_set_direction (cellHandle, OS.GTK_TEXT_DIR_RTL);
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if ((style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
+ int dir = (style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ if (listHandle != 0) OS.gtk_widget_set_direction (listHandle, dir);
+ if (entryHandle != 0) OS.gtk_widget_set_direction (entryHandle, dir);
+ if (cellHandle != 0) OS.gtk_widget_set_direction (cellHandle, dir);
+ if (!create) {
+ if (listHandle != 0) {
+ OS.gtk_widget_set_direction (listHandle, dir);
+ int /*long*/ itemsList = OS.gtk_container_get_children (listHandle);
+ if (itemsList != 0) {
+ int count = OS.g_list_length (itemsList);
+ for (int i=count - 1; i>=0; i--) {
+ int /*long*/ widget = OS.gtk_bin_get_child (OS.g_list_nth_data (itemsList, i));
+ OS.gtk_widget_set_direction (widget, dir);
+ }
+ OS.g_list_free (itemsList);
+ }
+ }
+ if (popupHandle != 0) OS.gtk_container_forall (popupHandle, display.setDirectionProc, dir);
+ }
}
}
@@ -2074,31 +2096,7 @@ void setOrientation() {
* @since 2.1.2
*/
public void setOrientation (int orientation) {
- if (OS.GTK_VERSION >= OS.VERSION (2, 4, 0)) {
- checkWidget();
- int flags = SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT;
- if ((orientation & flags) == 0 || (orientation & flags) == flags) return;
- style &= ~flags;
- style |= orientation & flags;
- int dir = (orientation & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
- OS.gtk_widget_set_direction (fixedHandle, dir);
- OS.gtk_widget_set_direction (handle, dir);
- if (entryHandle != 0) OS.gtk_widget_set_direction (entryHandle, dir);
- if (listHandle != 0) {
- OS.gtk_widget_set_direction (listHandle, dir);
- int /*long*/ itemsList = OS.gtk_container_get_children (listHandle);
- if (itemsList != 0) {
- int count = OS.g_list_length (itemsList);
- for (int i=count - 1; i>=0; i--) {
- int /*long*/ widget = OS.gtk_bin_get_child (OS.g_list_nth_data (itemsList, i));
- OS.gtk_widget_set_direction (widget, dir);
- }
- OS.g_list_free (itemsList);
- }
- }
- if (cellHandle != 0) OS.gtk_widget_set_direction (cellHandle, dir);
- if (popupHandle != 0) OS.gtk_container_forall (popupHandle, display.setDirectionProc, dir);
- }
+ super.setOrientation (orientation);
}
/**
@@ -2122,8 +2120,11 @@ public void setSelection (Point selection) {
if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
if ((style & SWT.READ_ONLY) != 0) return;
if (entryHandle != 0) {
- OS.gtk_editable_set_position (entryHandle, selection.x);
- OS.gtk_editable_select_region (entryHandle, selection.x, selection.y);
+ int /*long*/ ptr = OS.gtk_entry_get_text (entryHandle);
+ int start = (int)/*64*/OS.g_utf16_offset_to_utf8_offset (ptr, selection.x);
+ int end = (int)/*64*/OS.g_utf16_offset_to_utf8_offset (ptr, selection.y);
+ OS.gtk_editable_set_position (entryHandle, start);
+ OS.gtk_editable_select_region (entryHandle, start, end);
}
}
@@ -2178,7 +2179,7 @@ public void setText (String string) {
*/
if (hooks (SWT.Verify) || filters (SWT.Verify)) {
int /*long*/ ptr = OS.gtk_entry_get_text (entryHandle);
- string = verifyText (string, 0, (int)/*64*/OS.g_utf8_strlen (ptr, -1));
+ string = verifyText (string, 0, (int)/*64*/OS.g_utf16_strlen (ptr, -1));
if (string == null) return;
}
byte [] buffer = Converter.wcsToMbcs (null, string, true);
diff --git a/org/eclipse/swt/widgets/Composite.java b/org/eclipse/swt/widgets/Composite.java
index 483032f..4aaf4d3 100644
--- a/org/eclipse/swt/widgets/Composite.java
+++ b/org/eclipse/swt/widgets/Composite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -224,9 +224,9 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
} else {
size = minimumSize (wHint, hHint, changed);
+ if (size.x == 0) size.x = DEFAULT_WIDTH;
+ if (size.y == 0) size.y = DEFAULT_HEIGHT;
}
- if (size.x == 0) size.x = DEFAULT_WIDTH;
- if (size.y == 0) size.y = DEFAULT_HEIGHT;
if (wHint != SWT.DEFAULT) size.x = wHint;
if (hHint != SWT.DEFAULT) size.y = hHint;
Rectangle trim = computeTrim (0, 0, size.x, size.y);
@@ -1197,7 +1197,7 @@ void moveChildren(int oldWidth) {
int x = OS.GTK_WIDGET_X (topHandle);
int y = OS.GTK_WIDGET_Y (topHandle);
int controlWidth = (child.state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
- x = oldWidth - controlWidth - x;
+ if (oldWidth > 0) x = oldWidth - controlWidth - x;
int clientWidth = getClientWidth ();
x = clientWidth - controlWidth - x;
if (child.enableWindow != 0) {
@@ -1226,11 +1226,12 @@ void moveChildren(int oldWidth) {
Point minimumSize (int wHint, int hHint, boolean changed) {
Control [] children = _getChildren ();
+ Rectangle clientArea = getClientArea ();
int width = 0, height = 0;
for (int i=0; i<children.length; i++) {
Rectangle rect = children [i].getBounds ();
- width = Math.max (width, rect.x + rect.width);
- height = Math.max (height, rect.y + rect.height);
+ width = Math.max (width, rect.x - clientArea.x + rect.width);
+ height = Math.max (height, rect.y - clientArea.y + rect.height);
}
return new Point (width, height);
}
@@ -1411,6 +1412,7 @@ public void setLayout (Layout layout) {
* @since 3.1
*/
public void setLayoutDeferred (boolean defer) {
+ checkWidget();
if (!defer) {
if (--layoutCount == 0) {
if ((state & LAYOUT_CHILD) != 0 || (state & LAYOUT_NEEDED) != 0) {
@@ -1422,6 +1424,21 @@ public void setLayoutDeferred (boolean defer) {
}
}
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if (!create) {
+ int flags = SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT;
+ int orientation = style & flags;
+ Control [] children = _getChildren ();
+ for (int i=0; i<children.length; i++) {
+ children[i].setOrientation (orientation);
+ }
+ if (((style & SWT.RIGHT_TO_LEFT) != 0) != ((style & SWT.MIRRORED) != 0)) {
+ moveChildren (-1);
+ }
+ }
+}
+
boolean setScrollBarVisible (ScrollBar bar, boolean visible) {
boolean changed = super.setScrollBarVisible (bar, visible);
if (changed && layout != null) {
diff --git a/org/eclipse/swt/widgets/Control.java b/org/eclipse/swt/widgets/Control.java
index a69add3..c3a9f8a 100644
--- a/org/eclipse/swt/widgets/Control.java
+++ b/org/eclipse/swt/widgets/Control.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -163,6 +163,8 @@ void fixFocus (Control focusControl) {
int /*long*/ focusHandle = shell.vboxHandle;
OS.GTK_WIDGET_SET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS);
OS.gtk_widget_grab_focus (focusHandle);
+ // widget could be disposed at this point
+ if (isDisposed ()) return;
OS.GTK_WIDGET_UNSET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS);
}
@@ -200,6 +202,24 @@ int /*long*/ fontHandle () {
return handle;
}
+/**
+ * Returns the orientation of the receiver, which will be one of the
+ * constants <code>SWT.LEFT_TO_RIGHT</code> or <code>SWT.RIGHT_TO_LEFT</code>.
+ *
+ * @return the orientation style
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.7
+ */
+public int getOrientation () {
+ checkWidget();
+ return style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
+}
+
boolean hasFocus () {
return this == display.getFocusControl();
}
@@ -259,7 +279,14 @@ void hookEvents () {
int paintMask = OS.GDK_EXPOSURE_MASK | OS.GDK_VISIBILITY_NOTIFY_MASK;
OS.gtk_widget_add_events (paintHandle, paintMask);
OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [EXPOSE_EVENT], 0, display.closures [EXPOSE_EVENT_INVERSE], false);
- OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [VISIBILITY_NOTIFY_EVENT], 0, display.closures [VISIBILITY_NOTIFY_EVENT], false);
+ /*
+ * As of GTK 2.17.11, obscured controls no longer send expose
+ * events. It is no longer necessary to track visiblity notify
+ * events.
+ */
+ if (OS.GTK_VERSION < OS.VERSION (2, 17, 11)) {
+ OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [VISIBILITY_NOTIFY_EVENT], 0, display.closures [VISIBILITY_NOTIFY_EVENT], false);
+ }
OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [EXPOSE_EVENT], 0, display.closures [EXPOSE_EVENT], true);
/* Connect the Input Method signals */
@@ -632,8 +659,11 @@ void forceResize () {
/**
* Returns the accessible object for the receiver.
+ * <p>
* If this is the first time this object is requested,
- * then the object is created and returned.
+ * then the object is created and returned. The object
+ * returned by getAccessible() does not need to be disposed.
+ * </p>
*
* @return the accessible object
*
@@ -1383,6 +1413,41 @@ public void addFocusListener(FocusListener listener) {
/**
* Adds the listener to the collection of listeners who will
+ * be notified when gesture events are generated for the control,
+ * by sending it one of the messages defined in the
+ * <code>GestureListener</code> interface.
+ * <p>
+ * NOTE: If <code>setTouchEnabled(true)</code> has previously been
+ * invoked on the receiver then <code>setTouchEnabled(false)</code>
+ * must be invoked on it to specify that gesture events should be
+ * sent instead of touch events.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see GestureListener
+ * @see #removeGestureListener
+ * @see #setTouchEnabled
+ *
+ * @since 3.7
+ */
+public void addGestureListener (GestureListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Gesture, typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
* be notified when help events are generated for the control,
* by sending it one of the messages defined in the
* <code>HelpListener</code> interface.
@@ -1614,6 +1679,40 @@ void addRelation (Control control) {
/**
* Adds the listener to the collection of listeners who will
+ * be notified when touch events occur, by sending it
+ * one of the messages defined in the <code>TouchListener</code>
+ * interface.
+ * <p>
+ * NOTE: You must also call <code>setTouchEnabled(true)</code> to
+ * specify that touch events should be sent, which will cause gesture
+ * events to not be sent.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see TouchListener
+ * @see #removeTouchListener
+ * @see #setTouchEnabled
+ *
+ * @since 3.7
+ */
+public void addTouchListener (TouchListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Touch,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
* be notified when traversal events occur, by sending it
* one of the messages defined in the <code>TraverseListener</code>
* interface.
@@ -1715,6 +1814,31 @@ public void removeFocusListener(FocusListener listener) {
}
/**
* Removes the listener from the collection of listeners who will
+ * be notified when gesture events are generated for the control.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see GestureListener
+ * @see #addGestureListener
+ *
+ * @since 3.7
+ */
+public void removeGestureListener (GestureListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook(SWT.Gesture, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
* be notified when the help events are generated for the control.
*
* @param listener the listener which should no longer be notified
@@ -1924,6 +2048,32 @@ void removeRelation () {
/**
* Removes the listener from the collection of listeners who will
+ * be notified when touch events occur.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see TouchListener
+ * @see #addTouchListener
+ *
+ * @since 3.7
+ */
+public void removeTouchListener(TouchListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Touch, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
* be notified when traversal events occur.
*
* @param listener the listener which should no longer be notified
@@ -2032,11 +2182,11 @@ public boolean dragDetect (MouseEvent event) {
boolean dragDetect (int button, int count, int stateMask, int x, int y) {
if (button != 1 || count != 1) return false;
- if (!dragDetect (x, y, false, null)) return false;
+ if (!dragDetect (x, y, false, true, null)) return false;
return sendDragEvent (button, stateMask, x, y, true);
}
-boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
+boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean [] consume) {
boolean quit = false, dragging = false;
while (!quit) {
int /*long*/ eventPtr = 0;
@@ -2054,7 +2204,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
try {Thread.sleep(50);} catch (Exception ex) {}
}
}
- if (eventPtr == 0) return false;
+ if (eventPtr == 0) return dragOnTimeout;
switch (OS.GDK_EVENT_TYPE (eventPtr)) {
case OS.GDK_MOTION_NOTIFY: {
GdkEventMotion gdkMotionEvent = new GdkEventMotion ();
@@ -2168,6 +2318,8 @@ boolean forceFocus (int /*long*/ focusHandle) {
/* When the control is zero sized it must be realized */
OS.gtk_widget_realize (focusHandle);
OS.gtk_widget_grab_focus (focusHandle);
+ // widget could be disposed at this point
+ if (isDisposed ()) return false;
Shell shell = getShell ();
int /*long*/ shellHandle = shell.shellHandle;
int /*long*/ handle = OS.gtk_window_get_focus (shellHandle);
@@ -2555,6 +2707,32 @@ public String getToolTipText () {
checkWidget();
return toolTipText;
}
+
+/**
+ * Returns <code>true</code> if this control is set to send touch events, or
+ * <code>false</code> if it is set to send gesture events instead. This method
+ * also returns <code>false</code> if a touch-based input device is not detected
+ * (this can be determined with <code>Display#getTouchEnabled()</code>). Use
+ * {@link #setTouchEnabled(boolean)} to switch the events that a control sends
+ * between touch events and gesture events.
+ *
+ * @return <code>true</code> if the control is set to send touch events, or <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setTouchEnabled
+ * @see Display#getTouchEnabled
+ *
+ * @since 3.7
+ */
+public boolean getTouchEnabled() {
+ checkWidget();
+ return false;
+}
+
/**
* Returns <code>true</code> if the receiver is visible, and
* <code>false</code> otherwise.
@@ -2610,7 +2788,7 @@ int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event, bo
if ((state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect)) {
if (gdkEvent.button == 1) {
boolean [] consume = new boolean [1];
- if (dragDetect ((int) gdkEvent.x, (int) gdkEvent.y, true, consume)) {
+ if (dragDetect ((int) gdkEvent.x, (int) gdkEvent.y, true, true, consume)) {
dragging = true;
if (consume [0]) result = 1;
}
@@ -2965,6 +3143,12 @@ int /*long*/ gtk_unrealize (int /*long*/ widget) {
}
int /*long*/ gtk_visibility_notify_event (int /*long*/ widget, int /*long*/ event) {
+ /*
+ * As of GTK 2.17.11, obscured controls no longer send expose
+ * events. It is no longer necessary to track visiblity notify
+ * events.
+ */
+ if (OS.GTK_VERSION >= OS.VERSION (2, 17, 11)) return 0;
GdkEventVisibility gdkEvent = new GdkEventVisibility ();
OS.memmove (gdkEvent, event, GdkEventVisibility.sizeof);
int /*long*/ paintWindow = paintWindow();
@@ -3526,11 +3710,11 @@ void setBackgroundColor (int /*long*/ handle, GdkColor color) {
int flags = OS.gtk_rc_style_get_color_flags (style, index);
if (color != null) {
flags |= OS.GTK_RC_BG;
- pixmapName = "<none>";
+ pixmapName = "<none>"; //$NON-NLS-1$
} else {
flags &= ~OS.GTK_RC_BG;
if (backgroundImage == null && (state & PARENT_BACKGROUND) != 0) {
- pixmapName = "<parent>";
+ pixmapName = "<parent>"; //$NON-NLS-1$
}
}
if (pixmapName != null) {
@@ -3904,14 +4088,41 @@ public void setMenu (Menu menu) {
this.menu = menu;
}
-void setOrientation () {
- if ((style & SWT.RIGHT_TO_LEFT) != 0) {
- if (handle != 0) OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
- if (fixedHandle != 0) OS.gtk_widget_set_direction (fixedHandle, OS.GTK_TEXT_DIR_RTL);
+void setOrientation (boolean create) {
+ if ((style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
+ int dir = (style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ if (handle != 0) OS.gtk_widget_set_direction (handle, dir);
+ if (fixedHandle != 0) OS.gtk_widget_set_direction (fixedHandle, dir);
}
}
/**
+ * Sets the orientation of the receiver, which must be one
+ * of the constants <code>SWT.LEFT_TO_RIGHT</code> or <code>SWT.RIGHT_TO_LEFT</code>.
+ * <p>
+ *
+ * @param orientation new orientation style
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.7
+ */
+public void setOrientation (int orientation) {
+ checkWidget ();
+ if (OS.GTK_VERSION < OS.VERSION (2, 4, 0)) return;
+ int flags = SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT;
+ if ((orientation & flags) == 0 || (orientation & flags) == flags) return;
+ style &= ~flags;
+ style |= orientation & flags;
+ setOrientation (false);
+ style &= ~SWT.MIRRORED;
+ checkMirrored ();
+}
+
+/**
* Changes the parent of the widget to be the one provided if
* the underlying operating system supports this feature.
* Returns <code>true</code> if the parent is successfully changed.
@@ -4004,18 +4215,10 @@ public void setRedraw (boolean redraw) {
if (--drawCount == 0) {
if (redrawWindow != 0) {
int /*long*/ window = paintWindow ();
- /*
- * Bug in GTK. For some reason, the window does not
- * redraw in versions of GTK greater than 2.18. The fix
- * is to hide and show it (without changing the z order).
- */
- boolean fixRedraw = OS.GTK_VERSION >= OS.VERSION (2, 17, 0) && OS.gdk_window_is_visible(window);
- if (fixRedraw) OS.gdk_window_hide(window);
/* Explicitly hiding the window avoids flicker on GTK+ >= 2.6 */
OS.gdk_window_hide (redrawWindow);
OS.gdk_window_destroy (redrawWindow);
OS.gdk_window_set_events (window, OS.gtk_widget_get_events (paintHandle ()));
- if (fixRedraw) OS.gdk_window_show_unraised(window);
redrawWindow = 0;
}
}
@@ -4038,9 +4241,6 @@ public void setRedraw (boolean redraw) {
OS.GDK_BUTTON2_MOTION_MASK | OS.GDK_BUTTON3_MOTION_MASK;
OS.gdk_window_set_events (window, OS.gdk_window_get_events (window) & ~mouseMask);
OS.gdk_window_set_back_pixmap (redrawWindow, 0, false);
- //System.out.println("Redraw " + redrawWindow + " WIndow " + window);
-// OS.gdk_x11_drawable_get_xid(redrawWindow);
-// OS.gdk_x11_drawable_get_xid(window);
OS.gdk_window_show (redrawWindow);
}
}
@@ -4102,6 +4302,26 @@ void setToolTipText (Shell shell, String newString) {
}
/**
+ * Sets whether this control should send touch events (by default controls do not).
+ * Setting this to <code>false</code> causes the receiver to send gesture events
+ * instead. No exception is thrown if a touch-based input device is not
+ * detected (this can be determined with <code>Display#getTouchEnabled()</code>).
+ *
+ * @param enabled the new touch-enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ *
+ * @see Display#getTouchEnabled
+ *
+ * @since 3.7
+ */
+public void setTouchEnabled(boolean enabled) {
+ checkWidget();
+}
+
+/**
* Marks the receiver as visible if the argument is <code>true</code>,
* and marks it invisible otherwise.
* <p>
diff --git a/org/eclipse/swt/widgets/CoolBar.java b/org/eclipse/swt/widgets/CoolBar.java
index 44e878d..a427a10 100644
--- a/org/eclipse/swt/widgets/CoolBar.java
+++ b/org/eclipse/swt/widgets/CoolBar.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1156,6 +1156,19 @@ public void setItemLayout (int[] itemOrder, int[] wrapIndices, Point[] sizes) {
setItemSizes(sizes);
relayout();
}
+public void setOrientation (int orientation) {
+ super.setOrientation(orientation);
+ for (int row = 0; row < items.length; row++) {
+ for (int column = 0; column < items[row].length; column++) {
+ CoolItem item = items[row][column];
+ if (item.arrowImage != null) {
+ item.arrowImage.dispose();
+ item.arrowImage = null;
+ }
+ item.updateChevron();
+ }
+ }
+}
void wrapItems (int maxWidth) {
int itemCount = originalItems.length;
if (itemCount < 2) return;
diff --git a/org/eclipse/swt/widgets/DateTime.java b/org/eclipse/swt/widgets/DateTime.java
index e69a998..948762c 100644
--- a/org/eclipse/swt/widgets/DateTime.java
+++ b/org/eclipse/swt/widgets/DateTime.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,7 @@ import java.util.Calendar;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.accessibility.*;
import org.eclipse.swt.internal.gtk.OS;
/**
@@ -50,10 +51,7 @@ import org.eclipse.swt.internal.gtk.OS;
public class DateTime extends Composite {
int day, month, year, hours, minutes, seconds;
- static final int MIN_YEAR = 1752; // Gregorian switchover in North America: September 19, 1752
- static final int MAX_YEAR = 9999;
-
- /* Emulated DATE and TIME variables */
+ /* Emulated DATE and TIME fields */
Calendar calendar;
DateFormatSymbols formatSymbols;
Button down, up;
@@ -63,12 +61,23 @@ public class DateTime extends Composite {
int[] fieldNames;
int fieldCount, currentField = 0, characterCount = 0;
boolean ignoreVerify = false;
+
+ /* DROP_DOWN calendar fields for DATE */
+ Color fg, bg;
+ boolean hasFocus, monthChanged, calendarDisplayed;
+ int savedYear, savedMonth, savedDay;
+ Shell popupShell;
+ DateTime popupCalendar;
+ Listener popupListener, popupFilter, clickListener;
+
static final String DEFAULT_SHORT_DATE_FORMAT = "MM/YYYY";
static final String DEFAULT_MEDIUM_DATE_FORMAT = "MM/DD/YYYY";
static final String DEFAULT_LONG_DATE_FORMAT = "MM/DD/YYYY";
static final String DEFAULT_SHORT_TIME_FORMAT = "HH:MM AM";
static final String DEFAULT_MEDIUM_TIME_FORMAT = "HH:MM:SS AM";
static final String DEFAULT_LONG_TIME_FORMAT = "HH:MM:SS AM";
+ static final int MIN_YEAR = 1752; // Gregorian switchover in North America: September 19, 1752
+ static final int MAX_YEAR = 9999;
/**
* Constructs a new instance of this class given its parent
@@ -108,38 +117,56 @@ public DateTime (Composite parent, int style) {
super (parent, checkStyle (style));
if ((this.style & SWT.CALENDAR) == 0) {
/* SWT.DATE and SWT.TIME */
- calendar = Calendar.getInstance();
- formatSymbols = new DateFormatSymbols();
- text = new Text(this, SWT.SINGLE);
- /* disable the native drag and drop for the date/time text field */
- OS.gtk_drag_dest_unset(text.handle);
- if ((this.style & SWT.DATE) != 0) {
- setFormat((this.style & SWT.SHORT) != 0 ? DEFAULT_SHORT_DATE_FORMAT : (this.style & SWT.LONG) != 0 ? DEFAULT_LONG_DATE_FORMAT : DEFAULT_MEDIUM_DATE_FORMAT);
- } else { // SWT.TIME
- setFormat((this.style & SWT.SHORT) != 0 ? DEFAULT_SHORT_TIME_FORMAT : (this.style & SWT.LONG) != 0 ? DEFAULT_LONG_TIME_FORMAT : DEFAULT_MEDIUM_TIME_FORMAT);
+ createText((this.style & SWT.DROP_DOWN) != 0);
+ }
+ initAccessible ();
+}
+
+void createText(boolean dropDown) {
+ calendar = Calendar.getInstance();
+ formatSymbols = new DateFormatSymbols();
+ text = new Text(this, SWT.SINGLE);
+ /* disable the native drag and drop for the date/time text field */
+ OS.gtk_drag_dest_unset(text.handle);
+ if ((style & SWT.DATE) != 0) {
+ setFormat((style & SWT.SHORT) != 0 ? DEFAULT_SHORT_DATE_FORMAT : (style & SWT.LONG) != 0 ? DEFAULT_LONG_DATE_FORMAT : DEFAULT_MEDIUM_DATE_FORMAT);
+ } else { /* SWT.TIME */
+ setFormat((style & SWT.SHORT) != 0 ? DEFAULT_SHORT_TIME_FORMAT : (style & SWT.LONG) != 0 ? DEFAULT_LONG_TIME_FORMAT : DEFAULT_MEDIUM_TIME_FORMAT);
+ }
+ text.setText(getFormattedString(style));
+
+ addListener(SWT.Resize, new Listener() {
+ public void handleEvent(Event event) {
+ onResize(event);
}
- text.setText(getFormattedString(this.style));
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- switch(event.type) {
- case SWT.KeyDown: onKeyDown(event); break;
- case SWT.FocusIn: onFocusIn(event); break;
- case SWT.FocusOut: onFocusOut(event); break;
- case SWT.MouseDown: onMouseClick(event); break;
- case SWT.MouseUp: onMouseClick(event); break;
- case SWT.Verify: onVerify(event); break;
- }
+ });
+ Listener listener = new Listener() {
+ public void handleEvent(Event event) {
+ switch(event.type) {
+ case SWT.KeyDown: onTextKeyDown(event); break;
+ case SWT.FocusIn: onTextFocusIn(event); break;
+ case SWT.FocusOut: onTextFocusOut(event); break;
+ case SWT.MouseDown: // Fall through
+ case SWT.MouseUp: onTextMouseClick(event); break;
+ case SWT.MenuDetect: notifyListeners(SWT.MenuDetect, event); break;
+ case SWT.Verify: onTextVerify(event); break;
}
- };
- text.addListener(SWT.KeyDown, listener);
- text.addListener(SWT.FocusIn, listener);
- text.addListener(SWT.FocusOut, listener);
- text.addListener(SWT.MouseDown, listener);
- text.addListener(SWT.MouseUp, listener);
- text.addListener(SWT.Verify, listener);
+ }
+ };
+ int [] listeners = new int [] {SWT.KeyDown, SWT.FocusIn, SWT.FocusOut, SWT.MouseDown, SWT.MouseUp, SWT.MenuDetect, SWT.Verify};
+ for (int i = 0; i < listeners.length; i++) {
+ text.addListener(listeners [i], listener);
+ }
+
+ if ((style & SWT.DATE) != 0 && dropDown) {
+ createDropDownButton();
+ createPopupShell(-1, -1, -1);
+ } else {
up = new Button(this, SWT.ARROW | SWT.UP);
+ OS.GTK_WIDGET_UNSET_FLAGS(up.handle, OS.GTK_CAN_FOCUS);
//up.setToolTipText(SWT.getMessage ("SWT_Up")); //$NON-NLS-1$
down = new Button(this, SWT.ARROW | SWT.DOWN);
+ OS.GTK_WIDGET_UNSET_FLAGS(down.handle, OS.GTK_CAN_FOCUS);
//down.setToolTipText(SWT.getMessage ("SWT_Down")); //$NON-NLS-1$
up.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
@@ -153,12 +180,82 @@ public DateTime (Composite parent, int style) {
text.setFocus();
}
});
- addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event event) {
- onResize(event);
+ }
+}
+
+void createDropDownButton() {
+ down = new Button(this, SWT.ARROW | SWT.DOWN);
+ OS.GTK_WIDGET_UNSET_FLAGS(down.handle, OS.GTK_CAN_FOCUS);
+ down.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ boolean dropped = isDropped();
+ popupCalendar.calendarDisplayed = !dropped;
+ setFocus();
+ dropDownCalendar (!dropped);
+ }
+ });
+
+ popupListener = new Listener () {
+ public void handleEvent (Event event) {
+ if (event.widget == popupShell) {
+ popupShellEvent (event);
+ return;
}
- });
+ if (event.widget == popupCalendar) {
+ popupCalendarEvent (event);
+ return;
+ }
+ if (event.widget == DateTime.this) {
+ onDispose (event);
+ return;
+ }
+ if (event.widget == getShell ()) {
+ getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (isDisposed()) return;
+ handleFocus (SWT.FocusOut);
+ }
+ });
+ }
+ }
+ };
+ popupFilter = new Listener() {
+ public void handleEvent(Event event) {
+ Shell shell = ((Control)event.widget).getShell ();
+ if (shell == DateTime.this.getShell ()) {
+ handleFocus (SWT.FocusOut);
+ }
+ }
+ };
+}
+
+void createPopupShell(int year, int month, int day) {
+ popupShell = new Shell (getShell(), SWT.NO_TRIM | SWT.ON_TOP);
+ popupCalendar = new DateTime (popupShell, SWT.CALENDAR);
+ if (font != null) popupCalendar.setFont (font);
+ if (fg != null) popupCalendar.setForeground (fg);
+ if (bg != null) popupCalendar.setBackground (bg);
+
+ clickListener = new Listener() {
+ public void handleEvent(Event event) {
+ if (event.widget instanceof Control) {
+ Control c = (Control)event.widget;
+ if (c != down && c.getShell() != popupShell)
+ dropDownCalendar(false);
+ }
+ }
+ };
+
+ int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint};
+ for (int i=0; i < listeners.length; i++) {
+ popupShell.addListener (listeners [i], popupListener);
}
+ listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose};
+ for (int i=0; i < listeners.length; i++) {
+ popupCalendar.addListener (listeners [i], popupListener);
+ }
+ addListener(SWT.Dispose, popupListener);
+ if (year != -1) popupCalendar.setDate(year, month, day);
}
static int checkStyle (int style) {
@@ -171,6 +268,7 @@ static int checkStyle (int style) {
*/
style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
style = checkBits (style, SWT.DATE, SWT.TIME, SWT.CALENDAR, 0, 0, 0);
+ if ((style & SWT.DATE) == 0) style &=~ SWT.DROP_DOWN;
return checkBits (style, SWT.MEDIUM, SWT.SHORT, SWT.LONG, 0, 0, 0);
}
@@ -215,16 +313,15 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
int width = 0, height = 0;
if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
if ((style & SWT.CALENDAR) != 0) {
- // TODO: CALENDAR computeSize
- width = 300;
- height = 200;
- } else {
- /* SWT.DATE and SWT.TIME */
+ Point size = computeNativeSize(handle, wHint, hHint, changed);
+ width = size.x;
+ height = size.y;
+ } else { /* SWT.DATE and SWT.TIME */
GC gc = new GC(text);
Point textSize = gc.stringExtent(getComputeSizeString(style));
gc.dispose();
Rectangle trim = text.computeTrim(0, 0, textSize.x, textSize.y);
- Point buttonSize = up.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed);
+ Point buttonSize = down.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed);
width = trim.width + buttonSize.x;
height = Math.max(trim.height, buttonSize.y);
}
@@ -233,9 +330,8 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
if (height == 0) height = DEFAULT_HEIGHT;
if (wHint != SWT.DEFAULT) width = wHint;
if (hHint != SWT.DEFAULT) height = hHint;
- int border = getBorderWidth ();
- width += border * 2; height += border * 2;
- return new Point (width, height);
+ int borderWidth = getBorderWidth ();
+ return new Point (width + 2*borderWidth, height+ 2*borderWidth);
}
void createHandle (int index) {
@@ -282,6 +378,72 @@ void commitCurrentField() {
}
}
+void onDispose (Event event) {
+ if (popupShell != null && !popupShell.isDisposed ()) {
+ popupCalendar.removeListener (SWT.Dispose, popupListener);
+ popupShell.dispose ();
+ }
+ Shell shell = getShell ();
+ shell.removeListener (SWT.Deactivate, popupListener);
+ Display display = getDisplay ();
+ display.removeFilter (SWT.FocusIn, popupFilter);
+ popupShell = null;
+ text = null;
+ popupCalendar = null;
+ down = null;
+ up = null;
+}
+
+void dropDownCalendar(boolean drop) {
+ if (drop == isDropped ()) return;
+ if (!drop) {
+ popupShell.setVisible (false);
+ OS.gtk_calendar_clear_marks(popupCalendar.handle);
+ display.removeFilter(SWT.MouseDown, clickListener);
+ return;
+ }
+ savedYear = getYear ();
+ savedMonth = getMonth ();
+ savedDay = getDay ();
+ if (getShell() != popupShell.getParent ()) {
+ int year = popupCalendar.getYear ();
+ int month = popupCalendar.getMonth ();
+ int day = popupCalendar.getDay ();
+ popupCalendar.removeListener (SWT.Dispose, popupListener);
+ popupShell.dispose();
+ popupShell = null;
+ popupCalendar = null;
+ createPopupShell (year, month, day);
+ }
+ Point dateBounds = getSize ();
+ Point calendarSize = popupCalendar.computeSize (SWT.DEFAULT, SWT.DEFAULT, false);
+ popupCalendar.setBounds (1, 1, Math.max (dateBounds.x - 2, calendarSize.x), calendarSize.y);
+
+ popupCalendar.setDate(savedYear, savedMonth, savedDay);
+ if (savedYear == Calendar.getInstance().get(Calendar.YEAR) && savedMonth == Calendar.getInstance().get(Calendar.MONTH))
+ OS.gtk_calendar_mark_day(popupCalendar.handle, Calendar.getInstance().get(Calendar.DAY_OF_MONTH));
+ Display display = getDisplay ();
+ Rectangle parentRect = display.map (getParent (), null, getBounds ());
+ Rectangle displayRect = getMonitor ().getClientArea ();
+ int width = Math.max (dateBounds.x, calendarSize.x + 2);
+ int height = calendarSize.y + 2;
+ int x = parentRect.x;
+ int y = parentRect.y + dateBounds.y;
+ if (y + height > displayRect.y + displayRect.height) y = parentRect.y - height;
+ if (x + width > displayRect.x + displayRect.width) x = displayRect.x + displayRect.width - calendarSize.x;
+ popupShell.setBounds (x, y, width, height);
+ popupShell.setVisible (true);
+ if (isFocusControl()) {
+ popupCalendar.setFocus ();
+ }
+ display.addFilter(SWT.MouseDown, clickListener);
+}
+
+int /*long*/ focusHandle () {
+ if (text != null) return text.handle;
+ return super.focusHandle ();
+}
+
String formattedStringValue(int fieldName, int value, boolean adjust) {
if (fieldName == Calendar.AM_PM) {
String[] ampm = formatSymbols.getAmPmStrings();
@@ -460,6 +622,44 @@ public int getSeconds () {
}
}
+/*
+ * Returns a textual representation of the receiver,
+ * intended for speaking the text aloud.
+ */
+String getSpokenText () {
+ // TODO: needs more work for locale
+ StringBuffer result = new StringBuffer ();
+ if ((style & SWT.TIME) != 0) {
+ int h = calendar.get(Calendar.HOUR); if (h == 0) h = 12;
+ result.append(h);
+ int m = calendar.get(Calendar.MINUTE);
+ result.append(":" + (m < 10 ? "0" : "") + m);
+ if ((style & SWT.SHORT) == 0) {
+ int s = calendar.get(Calendar.SECOND);
+ result.append(":" + (s < 10 ? "0" : "") + s);
+ }
+ result.append(" " + formatSymbols.getAmPmStrings()[calendar.get(Calendar.AM_PM)]);
+ } else {
+ /* SWT.DATE or SWT.CALENDAR */
+ Calendar cal = calendar;
+ if ((style & SWT.CALENDAR) != 0) {
+ formatSymbols = new DateFormatSymbols();
+ cal = Calendar.getInstance();
+ getDate();
+ cal.set(year, month, day);
+ }
+ if ((style & SWT.SHORT) == 0) {
+ result.append(formatSymbols.getWeekdays()[cal.get(Calendar.DAY_OF_WEEK)] + ", ");
+ }
+ result.append(formatSymbols.getMonths()[cal.get(Calendar.MONTH)] + " ");
+ if ((style & SWT.SHORT) == 0) {
+ result.append(cal.get(Calendar.DAY_OF_MONTH) + ", ");
+ }
+ result.append(cal.get(Calendar.YEAR));
+ }
+ return result.toString();
+}
+
/**
* Returns the receiver's year.
* <p>
@@ -494,10 +694,28 @@ int /*long*/ gtk_day_selected_double_click (int /*long*/ widget) {
}
int /*long*/ gtk_month_changed (int /*long*/ widget) {
+ /*
+ * Feature in GTK. "month-changed" signal is emitted when the
+ * calendar is displayed though the day/month is not changed.
+ * The popup has to remain when the month/year is changed
+ * through the arrow keys, and the popup has to be called-off
+ * only when the day is selected. The fix is to detect the
+ * difference between the user changing the month/year, or
+ * choosing the day.
+ */
+ if (calendarDisplayed) calendarDisplayed = false;
+ else monthChanged = true;
sendSelectionEvent ();
return 0;
}
+boolean hasFocus () {
+ if (super.hasFocus ()) return true;
+ Control focusControl = display.getFocusControl();
+ if (focusControl != null && focusControl == text) return true;
+ return false;
+}
+
void hookEvents () {
super.hookEvents();
if ((style & SWT.CALENDAR) != 0) {
@@ -507,6 +725,82 @@ void hookEvents () {
}
}
+void incrementField(int amount) {
+ int fieldName = fieldNames[currentField];
+ int value = calendar.get(fieldName);
+ if (fieldName == Calendar.HOUR) {
+ int max = calendar.getMaximum(Calendar.HOUR);
+ int min = calendar.getMinimum(Calendar.HOUR);
+ if ((value == max && amount == 1) || (value == min && amount == -1)) {
+ int temp = currentField;
+ currentField = getFieldIndex(Calendar.AM_PM);
+ setTextField(Calendar.AM_PM, (calendar.get(Calendar.AM_PM) + 1) % 2, true, true);
+ currentField = temp;
+ }
+ }
+ setTextField(fieldName, value + amount, true, true);
+}
+
+boolean isDropped () {
+ return popupShell.getVisible ();
+}
+
+public boolean isFocusControl () {
+ checkWidget();
+ if ((style & SWT.DROP_DOWN) != 0 && (text.isFocusControl () || popupShell.isFocusControl () || popupCalendar.isFocusControl())) {
+ return true;
+ }
+ return super.isFocusControl ();
+}
+
+void initAccessible() {
+ Accessible accessible = getAccessible ();
+ accessible.addAccessibleListener (new AccessibleAdapter () {
+ public void getName (AccessibleEvent e) {
+ e.result = getSpokenText ();
+ }
+
+ public void getHelp(AccessibleEvent e) {
+ e.result = getToolTipText ();
+ }
+ });
+
+ accessible.addAccessibleControlListener (new AccessibleControlAdapter () {
+ public void getChildAtPoint (AccessibleControlEvent e) {
+ e.childID = ACC.CHILDID_SELF;
+ }
+
+ public void getLocation (AccessibleControlEvent e) {
+ Rectangle rect = display.map (getParent (), null, getBounds ());
+ e.x = rect.x;
+ e.y = rect.y;
+ e.width = rect.width;
+ e.height = rect.height;
+ }
+
+ public void getChildCount (AccessibleControlEvent e) {
+ e.detail = 0;
+ }
+
+ public void getRole (AccessibleControlEvent e) {
+ e.detail = ((style & SWT.CALENDAR) != 0) ? ACC.ROLE_LABEL : ACC.ROLE_TEXT;
+ }
+
+ public void getState (AccessibleControlEvent e) {
+ e.detail = ACC.STATE_FOCUSABLE;
+ if (hasFocus ()) e.detail |= ACC.STATE_FOCUSED;
+ }
+
+ public void getSelection (AccessibleControlEvent e) {
+ if (hasFocus ()) e.childID = ACC.CHILDID_SELF;
+ }
+
+ public void getFocus (AccessibleControlEvent e) {
+ if (hasFocus ()) e.childID = ACC.CHILDID_SELF;
+ }
+ });
+}
+
boolean isValidTime(int fieldName, int value) {
Calendar validCalendar;
if ((style & SWT.CALENDAR) != 0) {
@@ -528,162 +822,178 @@ boolean isValidDate(int year, int month, int day) {
&& valid.get(Calendar.DAY_OF_MONTH) == day;
}
-void incrementField(int amount) {
- int fieldName = fieldNames[currentField];
- int value = calendar.get(fieldName);
- if (fieldName == Calendar.HOUR) {
- int max = calendar.getMaximum(Calendar.HOUR);
- int min = calendar.getMinimum(Calendar.HOUR);
- if ((value == max && amount == 1) || (value == min && amount == -1)) {
- int temp = currentField;
- currentField = getFieldIndex(Calendar.AM_PM);
- setTextField(Calendar.AM_PM, (calendar.get(Calendar.AM_PM) + 1) % 2, true, true);
- currentField = temp;
- }
- }
- setTextField(fieldName, value + amount, true, true);
-}
-
-void onKeyDown(Event event) {
- int fieldName;
- switch (event.keyCode) {
- case SWT.ARROW_RIGHT:
- case SWT.KEYPAD_DIVIDE:
- // a right arrow or a valid separator navigates to the field on the right, with wraping
- selectField((currentField + 1) % fieldCount);
+void popupCalendarEvent (Event event) {
+ switch (event.type) {
+ case SWT.Dispose:
+ if (popupShell != null && !popupShell.isDisposed () && !isDisposed() && getShell () != popupShell.getParent ()) {
+ int year = popupCalendar.getYear ();
+ int month = popupCalendar.getMonth ();
+ int day = popupCalendar.getDay ();
+ popupShell = null;
+ popupCalendar = null;
+ createPopupShell (year, month, day);
+ }
break;
- case SWT.ARROW_LEFT:
- // navigate to the field on the left, with wrapping
- int index = currentField - 1;
- selectField(index < 0 ? fieldCount - 1 : index);
+ case SWT.FocusIn: {
+ handleFocus (SWT.FocusIn);
break;
- case SWT.ARROW_UP:
- case SWT.KEYPAD_ADD:
- // set the value of the current field to value + 1, with wrapping
- commitCurrentField();
- incrementField(+1);
+ }
+ case SWT.FocusOut: {
+ Point point = down.toControl(getDisplay().getCursorLocation());
+ Point size = down.getSize();
+ Rectangle rect = new Rectangle(0, 0, size.x, size.y);
+ if (rect.contains(point)) {
+ boolean popupShellActivated = getDisplay().getActiveShell() == getShell();
+ if (!popupShellActivated) dropDownCalendar(false);
+ break;
+ }
+ dropDownCalendar(false);
break;
- case SWT.ARROW_DOWN:
- case SWT.KEYPAD_SUBTRACT:
- // set the value of the current field to value - 1, with wrapping
- commitCurrentField();
- incrementField(-1);
+ }
+ case SWT.MouseUp: {
+ if (event.button != 1) return;
+ /*
+ * The drop-down should stay visible when the year/month
+ * is changed.
+ */
+ if (popupCalendar.monthChanged) {
+ popupCalendar.monthChanged = false;
+ OS.gtk_calendar_clear_marks(popupCalendar.handle);
+ } else {
+ dropDownCalendar (false);
+ }
break;
- case SWT.HOME:
- // set the value of the current field to its minimum
- fieldName = fieldNames[currentField];
- setTextField(fieldName, calendar.getActualMinimum(fieldName), true, true);
+ }
+ case SWT.Selection: {
+ int year = popupCalendar.getYear ();
+ int month = popupCalendar.getMonth ();
+ int day = popupCalendar.getDay ();
+ setDate(year, month, day);
+ Event e = new Event ();
+ e.time = event.time;
+ e.stateMask = event.stateMask;
+ e.doit = event.doit;
+ notifyListeners (SWT.Selection, e);
+ event.doit = e.doit;
break;
- case SWT.END:
- // set the value of the current field to its maximum
- fieldName = fieldNames[currentField];
- setTextField(fieldName, calendar.getActualMaximum(fieldName), true, true);
+ }
+ case SWT.Traverse: {
+ switch (event.detail) {
+ case SWT.TRAVERSE_RETURN:
+ case SWT.TRAVERSE_ESCAPE:
+ case SWT.TRAVERSE_ARROW_PREVIOUS:
+ case SWT.TRAVERSE_ARROW_NEXT:
+ event.doit = false;
+ break;
+ case SWT.TRAVERSE_TAB_NEXT:
+ case SWT.TRAVERSE_TAB_PREVIOUS:
+ event.doit = text.traverse(event.detail);
+ event.detail = SWT.TRAVERSE_NONE;
+ if (event.doit) dropDownCalendar (false);
+ return;
+ case SWT.TRAVERSE_PAGE_NEXT:
+ case SWT.TRAVERSE_PAGE_PREVIOUS:
+ return;
+ }
+ Event e = new Event ();
+ e.time = event.time;
+ e.detail = event.detail;
+ e.doit = event.doit;
+ e.character = event.character;
+ e.keyCode = event.keyCode;
+ notifyListeners (SWT.Traverse, e);
+ event.doit = e.doit;
+ event.detail = e.detail;
break;
- case SWT.CR:
- sendSelectionEvent (SWT.DefaultSelection);
+ }
+ case SWT.KeyUp: {
+ Event e = new Event ();
+ e.time = event.time;
+ e.character = event.character;
+ e.keyCode = event.keyCode;
+ e.stateMask = event.stateMask;
+ notifyListeners (SWT.KeyUp, e);
break;
- default:
- switch (event.character) {
- case '/':
- case ':':
- case '-':
- case '.':
- // a valid separator navigates to the field on the right, with wraping
- selectField((currentField + 1) % fieldCount);
- break;
+ }
+ case SWT.KeyDown: {
+ if (event.character == SWT.ESC) {
+ /* Escape key cancels popupCalendar and reverts date */
+ popupCalendar.setDate (savedYear, savedMonth, savedDay);
+ setDate(savedYear, savedMonth, savedDay);
+ dropDownCalendar (false);
}
- }
-}
-
-void onFocusIn(Event event) {
- selectField(currentField);
-}
-
-void onFocusOut(Event event) {
- commitCurrentField();
-}
-
-void onMouseClick(Event event) {
- if (event.button != 1) return;
- Point sel = text.getSelection();
- for (int i = 0; i < fieldCount; i++) {
- if (fieldIndices[i].x <= sel.x && sel.x <= fieldIndices[i].y) {
- selectField(i);
+ if (event.keyCode == SWT.CR || (event.stateMask & SWT.ALT) != 0 && (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN)) {
+ /* Return, Alt+Down, and Alt+Up cancel popupCalendar and select date. */
+ dropDownCalendar (false);
+ }
+ if (event.keyCode == SWT.SPACE) {
+ dropDownCalendar(false);
+ }
+ /* At this point the widget may have been disposed.
+ * If so, do not continue. */
+ if (isDisposed ()) break;
+ Event e = new Event();
+ e.time = event.time;
+ e.character = event.character;
+ e.keyCode = event.keyCode;
+ e.stateMask = event.stateMask;
+ notifyListeners(SWT.KeyDown, e);
break;
}
}
}
-void onResize(Event event) {
- Rectangle rect = getClientArea ();
- int width = rect.width;
- int height = rect.height;
- Point buttonSize = up.computeSize(SWT.DEFAULT, height);
- int buttonHeight = buttonSize.y / 2;
- text.setBounds(0, 0, width - buttonSize.x, height);
- up.setBounds(width - buttonSize.x, 0, buttonSize.x, buttonHeight);
- down.setBounds(width - buttonSize.x, buttonHeight, buttonSize.x, buttonHeight);
-}
-
-void onVerify(Event event) {
- if (ignoreVerify) return;
- event.doit = false;
- int fieldName = fieldNames[currentField];
- int start = fieldIndices[currentField].x;
- int end = fieldIndices[currentField].y;
- int length = end - start;
- String newText = event.text;
- if (fieldName == Calendar.AM_PM) {
- String[] ampm = formatSymbols.getAmPmStrings();
- if (newText.equalsIgnoreCase(ampm[Calendar.AM].substring(0, 1)) || newText.equalsIgnoreCase(ampm[Calendar.AM])) {
- setTextField(fieldName, Calendar.AM, true, false);
- } else if (newText.equalsIgnoreCase(ampm[Calendar.PM].substring(0, 1)) || newText.equalsIgnoreCase(ampm[Calendar.PM])) {
- setTextField(fieldName, Calendar.PM, true, false);
- }
- return;
- }
- if (characterCount > 0) {
- try {
- Integer.parseInt(newText);
- } catch (NumberFormatException ex) {
- return;
+void handleFocus (int type) {
+ if (isDisposed ()) return;
+ switch (type) {
+ case SWT.FocusIn: {
+ if (hasFocus) return;
+ text.selectAll ();
+ hasFocus = true;
+ Shell shell = getShell ();
+ shell.removeListener (SWT.Deactivate, popupListener);
+ shell.addListener (SWT.Deactivate, popupListener);
+ Display display = getDisplay ();
+ display.removeFilter (SWT.FocusIn, popupFilter);
+ display.addFilter (SWT.FocusIn, popupFilter);
+ Event e = new Event ();
+ notifyListeners (SWT.FocusIn, e);
+ break;
}
- String value = text.getText(start, end - 1);
- int s = value.lastIndexOf(' ');
- if (s != -1) value = value.substring(s + 1);
- newText = "" + value + newText;
- }
- int newTextLength = newText.length();
- boolean first = characterCount == 0;
- characterCount = (newTextLength < length) ? newTextLength : 0;
- int max = calendar.getActualMaximum(fieldName);
- int min = calendar.getActualMinimum(fieldName);
- int newValue = unformattedIntValue(fieldName, newText, characterCount == 0, max);
- if (newValue == -1) {
- characterCount = 0;
- return;
- }
- if (first && newValue == 0 && length > 1) {
- setTextField(fieldName, newValue, false, false);
- } else if (min <= newValue && newValue <= max) {
- setTextField(fieldName, newValue, characterCount == 0, characterCount == 0);
- } else {
- if (newTextLength >= length) {
- newText = newText.substring(newTextLength - length + 1);
- newValue = unformattedIntValue(fieldName, newText, characterCount == 0, max);
- if (newValue != -1) {
- characterCount = length - 1;
- if (min <= newValue && newValue <= max) {
- setTextField(fieldName, newValue, characterCount == 0, true);
- }
- }
+ case SWT.FocusOut: {
+ if (!hasFocus) return;
+ Control focusControl = getDisplay ().getFocusControl ();
+ if (focusControl == down || focusControl == popupCalendar || focusControl == text) return;
+ hasFocus = false;
+ Shell shell = getShell ();
+ shell.removeListener(SWT.Deactivate, popupListener);
+ Display display = getDisplay ();
+ display.removeFilter (SWT.FocusIn, popupFilter);
+ display.removeFilter(SWT.MouseDown, clickListener);
+ Event e = new Event ();
+ notifyListeners (SWT.FocusOut, e);
+ break;
}
}
}
-void releaseWidget () {
- super.releaseWidget();
- //TODO: need to do anything here?
+void popupShellEvent(Event event) {
+ switch (event.type) {
+ case SWT.Paint:
+ /* Draw black rectangle around popupCalendar */
+ Rectangle bounds = popupCalendar.getBounds();
+ Color black = getDisplay().getSystemColor(SWT.COLOR_BLACK);
+ event.gc.setForeground(black);
+ event.gc.drawRectangle(0, 0, bounds.width + 1, bounds.height + 1);
+ break;
+ case SWT.Close:
+ event.doit = false;
+ dropDownCalendar (false);
+ break;
+ case SWT.MouseUp:
+ dropDownCalendar (false);
+ break;
+ }
}
/**
@@ -750,26 +1060,37 @@ void sendSelectionEvent () {
}
public void setBackground(Color color) {
- checkWidget();
super.setBackground(color);
+ bg = color;
if (text != null) text.setBackground(color);
+ if (popupCalendar != null) popupCalendar.setBackground(color);
+}
+
+public void setEnabled (boolean enabled){
+ super.setEnabled(enabled);
+ if ((style & SWT.CALENDAR) == 0) {
+ text.setEnabled(enabled);
+ down.setEnabled(enabled);
+ if (up != null) up.setEnabled(enabled);
+ }
}
public void setFont(Font font) {
- checkWidget();
super.setFont(font);
+ this.font = font;
if (text != null) text.setFont(font);
+ if (popupCalendar != null) popupCalendar.setFont(font);
redraw();
}
public void setForeground(Color color) {
- checkWidget();
super.setForeground(color);
+ fg = color;
if (text != null) text.setForeground(color);
+ if (popupCalendar != null) popupCalendar.setForeground(color);
}
-/*public*/ void setFormat(String string) {
- checkWidget();
+void setFormat(String string) {
// TODO: this needs to be locale sensitive
fieldCount = (style & SWT.DATE) != 0 ? ((style & SWT.SHORT) != 0 ? 2 : 3) : ((style & SWT.SHORT) != 0 ? 3 : 4);
fieldIndices = new Point[fieldCount];
@@ -837,13 +1158,13 @@ void setTextField(int fieldName, int value, boolean commit, boolean adjust) {
int prependCount = end - start - buffer.length();
for (int i = 0; i < prependCount; i++) {
switch (fieldName) {
- case Calendar.MINUTE:
- case Calendar.SECOND:
- buffer.insert(0, 0);
- break;
- default:
- buffer.insert(0, ' ');
- break;
+ case Calendar.MINUTE:
+ case Calendar.SECOND:
+ buffer.insert(0, 0);
+ break;
+ default:
+ buffer.insert(0, ' ');
+ break;
}
}
newValue = buffer.toString();
@@ -939,6 +1260,13 @@ public void setHours (int hours) {
}
}
+public void setMenu (Menu menu) {
+ super.setMenu(menu);
+ if (up != null) up.setMenu(menu);
+ if (down != null) down.setMenu(menu);
+ if (text != null) text.setMenu(menu);
+}
+
/**
* Sets the receiver's minutes.
* <p>
@@ -1074,6 +1402,171 @@ public void setYear (int year) {
}
}
+void onTextFocusIn(Event event) {
+ selectField(currentField);
+ if ((style & SWT.DROP_DOWN) == 0) {
+ sendFocusEvent(SWT.FocusIn);
+ } else {
+ handleFocus(SWT.FocusIn);
+ }
+}
+
+void onTextFocusOut(Event event) {
+ commitCurrentField();
+ if ((style & SWT.DROP_DOWN) == 0) {
+ sendFocusEvent(SWT.FocusOut);
+ } else {
+ handleFocus(SWT.FocusOut);
+ }
+}
+
+void onTextKeyDown(Event event) {
+ if ((style & SWT.DROP_DOWN) != 0 && (event.stateMask & SWT.ALT) != 0 && (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN)) {
+ boolean dropped = isDropped ();
+ if (!dropped) {
+ popupCalendar.calendarDisplayed = true;
+ setFocus ();
+ }
+ dropDownCalendar(!dropped);
+ return;
+ }
+ int fieldName;
+ switch (event.keyCode) {
+ case SWT.ARROW_RIGHT:
+ case SWT.KEYPAD_DIVIDE:
+ /* A right arrow or a valid separator navigates to the field on the right, with wraping */
+ selectField((currentField + 1) % fieldCount);
+ sendEvent(SWT.Traverse);
+ break;
+ case SWT.ARROW_LEFT:
+ /* Navigate to the field on the left, with wrapping */
+ int index = currentField - 1;
+ selectField(index < 0 ? fieldCount - 1 : index);
+ sendEvent(SWT.Traverse);
+ break;
+ case SWT.ARROW_UP:
+ case SWT.KEYPAD_ADD:
+ /* Set the value of the current field to value + 1, with wrapping */
+ commitCurrentField();
+ incrementField(+1);
+ break;
+ case SWT.ARROW_DOWN:
+ case SWT.KEYPAD_SUBTRACT:
+ /* Set the value of the current field to value - 1, with wrapping */
+ commitCurrentField();
+ incrementField(-1);
+ break;
+ case SWT.HOME:
+ /* Set the value of the current field to its minimum */
+ fieldName = fieldNames[currentField];
+ setTextField(fieldName, calendar.getActualMinimum(fieldName), true, true);
+ break;
+ case SWT.END:
+ /* Set the value of the current field to its maximum */
+ fieldName = fieldNames[currentField];
+ setTextField(fieldName, calendar.getActualMaximum(fieldName), true, true);
+ break;
+ default:
+ switch (event.character) {
+ case '/':
+ case ':':
+ case '-':
+ case '.':
+ /* A valid separator navigates to the field on the right, with wraping */
+ selectField((currentField + 1) % fieldCount);
+ sendEvent(SWT.Traverse);
+ break;
+ case SWT.CR:
+ /* Enter causes default selection */
+ postEvent (SWT.DefaultSelection);
+ break;
+ }
+ }
+}
+
+void onTextMouseClick(Event event) {
+ if (event.button != 1) return;
+ Point sel = text.getSelection();
+ for (int i = 0; i < fieldCount; i++) {
+ if (sel.x >= fieldIndices[i].x && sel.x <= fieldIndices[i].y) {
+ currentField = i;
+ break;
+ }
+ }
+ selectField(currentField);
+}
+
+void onResize(Event event) {
+ Rectangle rect = getClientArea ();
+ int width = rect.width;
+ int height = rect.height;
+ Point buttonSize = down.computeSize(SWT.DEFAULT, height);
+ text.setBounds(0, 0, width - buttonSize.x, height);
+ if ((style & SWT.DROP_DOWN) != 0) {
+ down.setBounds(width - buttonSize.x, 0, buttonSize.x, height);
+ } else {
+ int buttonHeight = height / 2;
+ up.setBounds(width - buttonSize.x, 0, buttonSize.x, buttonHeight);
+ down.setBounds(width - buttonSize.x, buttonHeight, buttonSize.x, buttonHeight);
+ }
+}
+
+void onTextVerify(Event event) {
+ if (ignoreVerify) return;
+ event.doit = false;
+ int fieldName = fieldNames[currentField];
+ int start = fieldIndices[currentField].x;
+ int end = fieldIndices[currentField].y;
+ int length = end - start;
+ String newText = event.text;
+ if (fieldName == Calendar.AM_PM) {
+ String[] ampm = formatSymbols.getAmPmStrings();
+ if (newText.equalsIgnoreCase(ampm[Calendar.AM].substring(0, 1)) || newText.equalsIgnoreCase(ampm[Calendar.AM])) {
+ setTextField(fieldName, Calendar.AM, true, false);
+ } else if (newText.equalsIgnoreCase(ampm[Calendar.PM].substring(0, 1)) || newText.equalsIgnoreCase(ampm[Calendar.PM])) {
+ setTextField(fieldName, Calendar.PM, true, false);
+ }
+ return;
+ }
+ if (characterCount > 0) {
+ try {
+ Integer.parseInt(newText);
+ } catch (NumberFormatException ex) {
+ return;
+ }
+ String value = text.getText(start, end - 1);
+ int s = value.lastIndexOf(' ');
+ if (s != -1) value = value.substring(s + 1);
+ newText = "" + value + newText;
+ }
+ int newTextLength = newText.length();
+ boolean first = characterCount == 0;
+ characterCount = (newTextLength < length) ? newTextLength : 0;
+ int max = calendar.getActualMaximum(fieldName);
+ int min = calendar.getActualMinimum(fieldName);
+ int newValue = unformattedIntValue(fieldName, newText, characterCount == 0, max);
+ if (newValue == -1) {
+ characterCount = 0;
+ return;
+ }
+ if (first && newValue == 0 && length > 1) {
+ setTextField(fieldName, newValue, false, false);
+ } else if (min <= newValue && newValue <= max) {
+ setTextField(fieldName, newValue, characterCount == 0, characterCount == 0);
+ } else {
+ if (newTextLength >= length) {
+ newText = newText.substring(newTextLength - length + 1);
+ newValue = unformattedIntValue(fieldName, newText, characterCount == 0, max);
+ if (newValue != -1) {
+ characterCount = length - 1;
+ if (min <= newValue && newValue <= max) {
+ setTextField(fieldName, newValue, characterCount == 0, true);
+ }
+ }
+ }
+ }
+}
+
int unformattedIntValue(int fieldName, String newText, boolean adjust, int max) {
int newValue;
try {
@@ -1100,4 +1593,4 @@ void updateControl() {
}
redraw();
}
-}
+}
\ No newline at end of file
diff --git a/org/eclipse/swt/widgets/Decorations.java b/org/eclipse/swt/widgets/Decorations.java
index 2e570bf..97f3422 100644
--- a/org/eclipse/swt/widgets/Decorations.java
+++ b/org/eclipse/swt/widgets/Decorations.java
@@ -694,6 +694,13 @@ public void setMinimized (boolean minimized) {
this.minimized = minimized;
}
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if (!create) {
+ if (menuBar != null) menuBar._setOrientation (style & (SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT));
+ }
+}
+
void setSavedFocus (Control control) {
if (this == control) return;
savedFocus = control;
diff --git a/org/eclipse/swt/widgets/DirectoryDialog.java b/org/eclipse/swt/widgets/DirectoryDialog.java
index 06e08e1..92ac09f 100644
--- a/org/eclipse/swt/widgets/DirectoryDialog.java
+++ b/org/eclipse/swt/widgets/DirectoryDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,8 +25,7 @@ import org.eclipse.swt.internal.gtk.*;
* <dd>(none)</dd>
* </dl>
* <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#directorydialog">DirectoryDialog snippets</a>
@@ -133,6 +132,7 @@ String openChooserDialog () {
} else {
handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, OS.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, 0);
}
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) {
int /*long*/ group = OS.gtk_window_get_group(0);
OS.gtk_window_group_add_window (group, handle);
@@ -188,6 +188,13 @@ String openChooserDialog () {
hookId = OS.g_signal_add_emission_hook (signalId, 0, display.emissionProc, handle, 0);
}
int response = OS.gtk_dialog_run (handle);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
OS.g_signal_remove_emission_hook (signalId, hookId);
}
@@ -276,6 +283,13 @@ String openClassicDialog () {
hookId = OS.g_signal_add_emission_hook (signalId, 0, display.emissionProc, handle, 0);
}
int response = OS.gtk_dialog_run (handle);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
OS.g_signal_remove_emission_hook (signalId, hookId);
}
diff --git a/org/eclipse/swt/widgets/Display.java b/org/eclipse/swt/widgets/Display.java
index d8ca0ab..74d016e 100644
--- a/org/eclipse/swt/widgets/Display.java
+++ b/org/eclipse/swt/widgets/Display.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -167,6 +167,7 @@ public class Display extends Device {
/* System Tray */
Tray tray;
+ TrayItem currentTrayItem;
/* Timers */
int [] timerIds;
@@ -767,6 +768,12 @@ int /*long*/ checkIfEventProc (int /*long*/ display, int /*long*/ xEvent, int /*
int type = OS.X_EVENT_TYPE (xEvent);
switch (type) {
case OS.VisibilityNotify:
+ /*
+ * As of GTK 2.17.11, obscured controls no longer send expose
+ * events. It is no longer necessary to track visiblity notify
+ * events.
+ */
+ if (OS.GTK_VERSION >= OS.VERSION (2, 17, 11)) return 0;
case OS.Expose:
case OS.GraphicsExpose:
break;
@@ -1443,7 +1450,7 @@ int getCaretBlinkTime () {
* over top of, or null if it is not currently over one of the
* controls built by the currently running application.
*
- * @return the control under the cursor
+ * @return the control under the cursor or <code>null</code>
*
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -1646,25 +1653,6 @@ public Object getData () {
return data;
}
-/**
- * Returns a point whose x coordinate is the horizontal
- * dots per inch of the display, and whose y coordinate
- * is the vertical dots per inch of the display.
- *
- * @return the horizontal and vertical DPI
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getDPI () {
- checkDevice ();
- int widthMM = OS.gdk_screen_width_mm ();
- int width = OS.gdk_screen_width ();
- int dpi = Compatibility.round (254 * width, widthMM * 10);
- return new Point (dpi, dpi);
-}
-
int /*long*/ gtk_fixed_get_type () {
return fixed_type;
}
@@ -1702,6 +1690,23 @@ static boolean isValidClass (Class clazz) {
}
/**
+ * Returns the single instance of the application menu bar, or
+ * <code>null</code> if there is no application menu bar for the platform.
+ *
+ * @return the application menu bar, or <code>null</code>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @since 3.7
+ */
+public Menu getMenuBar () {
+ checkDevice ();
+ return null;
+}
+
+/**
* Returns the button dismissal alignment, one of <code>LEFT</code> or <code>RIGHT</code>.
* The button dismissal alignment is the ordering that should be used when positioning the
* default dismissal button for a dialog. For example, in a dialog that contains an OK and
@@ -1754,7 +1759,7 @@ public int getDoubleClickTime () {
* any of the controls built by the currently running
* application.
*
- * @return the control under the cursor
+ * @return the focus control or <code>null</code>
*
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -2199,6 +2204,24 @@ public Image getSystemImage (int id) {
return null;
}
+/**
+ * Returns the single instance of the system-provided menu for the application, or
+ * <code>null</code> on platforms where no menu is provided for the application.
+ *
+ * @return the system menu, or <code>null</code>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @since 3.7
+ */
+public Menu getSystemMenu () {
+ checkDevice();
+ return null;
+}
+
void initializeSystemColors () {
GdkColor gdkColor;
@@ -2355,6 +2378,24 @@ public Thread getThread () {
}
}
+/**
+ * Returns a boolean indicating whether a touch-aware input device is
+ * attached to the system and is ready for use.
+ *
+ * @return <code>true</code> if a touch-aware input device is detected, or <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @since 3.7
+ */
+public boolean getTouchEnabled() {
+ checkDevice();
+ return false;
+}
+
Widget getWidget (int /*long*/ handle) {
if (handle == 0) return null;
if (lastWidget != null && lastHandle == handle) return lastWidget;
@@ -3156,6 +3197,13 @@ public boolean readAndDispatch () {
boolean events = false;
events |= runSettings ();
events |= runPopups ();
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock before calling the function below.
+ */
+ OS.gdk_threads_leave();
events |= OS.g_main_context_iteration (0, false);
if (events) {
runDeferredEvents ();
diff --git a/org/eclipse/swt/widgets/Event.java b/org/eclipse/swt/widgets/Event.java
index d67ea3d..73ddf52 100644
--- a/org/eclipse/swt/widgets/Event.java
+++ b/org/eclipse/swt/widgets/Event.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -215,6 +215,45 @@ public class Event {
*/
public Object data;
+ /**
+ * An array of the touch states for the current touch event.
+ *
+ * @since 3.7
+ */
+ public Touch[] touches;
+
+ /**
+ * If nonzero, a positive value indicates a swipe to the right,
+ * and a negative value indicates a swipe to the left.
+ *
+ * @since 3.7
+ */
+ public int xDirection;
+
+ /**
+ * If nonzero, a positive value indicates a swipe in the up direction,
+ * and a negative value indicates a swipe in the down direction.
+ *
+ * @since 3.7
+ */
+ public int yDirection;
+
+ /**
+ * The change in magnification. This value should be added to the current
+ * scaling of an item to get the new scale factor.
+ *
+ * @since 3.7
+ */
+ public double magnification;
+
+ /**
+ * The number of degrees rotated on the track pad.
+ *
+ * @since 3.7
+ */
+ public double rotation;
+
+
/**
* Gets the bounds.
*
diff --git a/org/eclipse/swt/widgets/ExpandBar.java b/org/eclipse/swt/widgets/ExpandBar.java
index ec6e586..44c5ffc 100644
--- a/org/eclipse/swt/widgets/ExpandBar.java
+++ b/org/eclipse/swt/widgets/ExpandBar.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -651,6 +651,15 @@ void setForegroundColor (GdkColor color) {
}
}
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if (items != null) {
+ for (int i=0; i<items.length; i++) {
+ if (items[i] != null) items[i].setOrientation (create);
+ }
+ }
+}
+
void setScrollbar () {
if (itemCount == 0) return;
if ((style & SWT.V_SCROLL) == 0) return;
diff --git a/org/eclipse/swt/widgets/ExpandItem.java b/org/eclipse/swt/widgets/ExpandItem.java
index e141b60..4ac69e4 100644
--- a/org/eclipse/swt/widgets/ExpandItem.java
+++ b/org/eclipse/swt/widgets/ExpandItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -513,6 +513,8 @@ boolean setFocus () {
if (!OS.gtk_widget_get_child_visible (handle)) return false;
OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS);
OS.gtk_widget_grab_focus (handle);
+ // widget could be disposed at this point
+ if (isDisposed ()) return false;
boolean result = OS.gtk_widget_is_focus (handle);
if (!result) OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_CAN_FOCUS);
return result;
@@ -589,11 +591,12 @@ public void setImage (Image image) {
}
}
-void setOrientation() {
- super.setOrientation ();
- if ((parent.style & SWT.RIGHT_TO_LEFT) != 0) {
- OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
- OS.gtk_container_forall (handle, display.setDirectionProc, OS.GTK_TEXT_DIR_RTL);
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if ((parent.style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
+ int dir = (parent.style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ OS.gtk_widget_set_direction (handle, dir);
+ OS.gtk_container_forall (handle, display.setDirectionProc, dir);
}
}
diff --git a/org/eclipse/swt/widgets/FileDialog.java b/org/eclipse/swt/widgets/FileDialog.java
index 1dd6921..c20f9c5 100644
--- a/org/eclipse/swt/widgets/FileDialog.java
+++ b/org/eclipse/swt/widgets/FileDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,8 +27,7 @@ import org.eclipse.swt.internal.gtk.*;
* <p>
* Note: Only one of the styles SAVE and OPEN may be specified.
* </p><p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#filedialog">FileDialog snippets</a>
@@ -413,6 +412,7 @@ String openChooserDialog () {
} else {
handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, action, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, 0);
}
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
OS.gtk_window_set_modal (handle, true);
if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) {
int /*long*/ group = OS.gtk_window_get_group(0);
@@ -441,6 +441,13 @@ String openChooserDialog () {
hookId = OS.g_signal_add_emission_hook (signalId, 0, display.emissionProc, handle, 0);
}
int response = OS.gtk_dialog_run (handle);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
OS.g_signal_remove_emission_hook (signalId, hookId);
}
@@ -483,6 +490,13 @@ String openClassicDialog () {
hookId = OS.g_signal_add_emission_hook (signalId, 0, display.emissionProc, handle, 0);
}
int response = OS.gtk_dialog_run (handle);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
OS.g_signal_remove_emission_hook (signalId, hookId);
}
diff --git a/org/eclipse/swt/widgets/FontDialog.java b/org/eclipse/swt/widgets/FontDialog.java
index 8ba5db6..8658c40 100644
--- a/org/eclipse/swt/widgets/FontDialog.java
+++ b/org/eclipse/swt/widgets/FontDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,8 +26,7 @@ import org.eclipse.swt.graphics.*;
* <dd>(none)</dd>
* </dl>
* <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample, Dialog tab</a>
@@ -176,6 +175,13 @@ public FontData open () {
hookId = OS.g_signal_add_emission_hook (signalId, 0, display.emissionProc, handle, 0);
}
int response = OS.gtk_dialog_run (handle);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
OS.g_signal_remove_emission_hook (signalId, hookId);
}
diff --git a/org/eclipse/swt/widgets/Group.java b/org/eclipse/swt/widgets/Group.java
index f2b75d0..40e6c20 100644
--- a/org/eclipse/swt/widgets/Group.java
+++ b/org/eclipse/swt/widgets/Group.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -237,10 +237,11 @@ void setForegroundColor (GdkColor color) {
setForegroundColor (labelHandle, color);
}
-void setOrientation () {
- super.setOrientation ();
- if ((style & SWT.RIGHT_TO_LEFT) != 0) {
- OS.gtk_widget_set_direction (labelHandle, OS.GTK_TEXT_DIR_RTL);
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if ((style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
+ int dir = (style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ OS.gtk_widget_set_direction (labelHandle, dir);
}
}
diff --git a/org/eclipse/swt/widgets/IME.java b/org/eclipse/swt/widgets/IME.java
index cc0036e..4a4e2c0 100644
--- a/org/eclipse/swt/widgets/IME.java
+++ b/org/eclipse/swt/widgets/IME.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -309,8 +309,8 @@ int /*long*/ gtk_preedit_changed (int /*long*/ imcontext) {
int [] end = new int [1];
for (int i = 0; i < count; i++) {
OS.pango_attr_iterator_range (iterator, start, end);
- ranges [i * 2] = (int)/*64*/OS.g_utf8_pointer_to_offset (preeditString [0], preeditString [0] + start [0]);
- ranges [i * 2 + 1] = (int)/*64*/OS.g_utf8_pointer_to_offset (preeditString [0], preeditString [0] + end [0]) - 1;
+ ranges [i * 2] = (int)/*64*/OS.g_utf16_pointer_to_offset (preeditString [0], preeditString [0] + start [0]);
+ ranges [i * 2 + 1] = (int)/*64*/OS.g_utf16_pointer_to_offset (preeditString [0], preeditString [0] + end [0]) - 1;
styles [i] = new TextStyle (null, null, null);
int /*long*/ attr = OS.pango_attr_iterator_get (iterator, OS.PANGO_ATTR_FOREGROUND);
if (attr != 0) {
diff --git a/org/eclipse/swt/widgets/Label.java b/org/eclipse/swt/widgets/Label.java
index 7d5b03a..40f1cb9 100644
--- a/org/eclipse/swt/widgets/Label.java
+++ b/org/eclipse/swt/widgets/Label.java
@@ -41,8 +41,7 @@ import org.eclipse.swt.graphics.*;
* SHADOW_NONE is a HINT. Only one of HORIZONTAL and VERTICAL may be specified.
* Only one of CENTER, LEFT and RIGHT may be specified.
* </p><p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#label">Label snippets</a>
@@ -498,11 +497,12 @@ void setForegroundColor (GdkColor color) {
if (imageHandle != 0) setForegroundColor (imageHandle, color);
}
-void setOrientation () {
- super.setOrientation ();
- if ((style & SWT.RIGHT_TO_LEFT) != 0) {
- if (labelHandle != 0) OS.gtk_widget_set_direction (labelHandle, OS.GTK_TEXT_DIR_RTL);
- if (imageHandle != 0) OS.gtk_widget_set_direction (imageHandle, OS.GTK_TEXT_DIR_RTL);
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if ((style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
+ int dir = (style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ if (labelHandle != 0) OS.gtk_widget_set_direction (labelHandle, dir);
+ if (imageHandle != 0) OS.gtk_widget_set_direction (imageHandle, dir);
}
}
diff --git a/org/eclipse/swt/widgets/Link.java b/org/eclipse/swt/widgets/Link.java
index 6495b79..e9321cc 100644
--- a/org/eclipse/swt/widgets/Link.java
+++ b/org/eclipse/swt/widgets/Link.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -148,7 +148,6 @@ void createHandle(int index) {
OS.gtk_fixed_set_has_window (handle, true);
OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS);
layout = new TextLayout (display);
- layout.setOrientation((style & SWT.RIGHT_TO_LEFT) != 0? SWT.RIGHT_TO_LEFT : SWT.LEFT_TO_RIGHT);
linkColor = new Color (display, LINK_FOREGROUND);
disabledColor = new Color (display, LINK_DISABLED_FOREGROUND);
offsets = new Point [0];
@@ -699,6 +698,12 @@ void setFontDescription (int /*long*/ font) {
layout.setFont (Font.gtk_new (display, font));
}
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ layout.setOrientation (style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT));
+ if (!create) redraw (true);
+}
+
/**
* Sets the receiver's text.
* <p>
diff --git a/org/eclipse/swt/widgets/List.java b/org/eclipse/swt/widgets/List.java
index 064475d..3ee619b 100644
--- a/org/eclipse/swt/widgets/List.java
+++ b/org/eclipse/swt/widgets/List.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -368,7 +368,7 @@ public void deselectAll () {
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
}
-boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
+boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean [] consume) {
boolean selected = false;
if (filter) {
int /*long*/ [] path = new int /*long*/ [1];
@@ -382,7 +382,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
return false;
}
}
- boolean dragDetect = super.dragDetect (x, y, filter, consume);
+ boolean dragDetect = super.dragDetect (x, y, filter, false, consume);
if (dragDetect && selected && consume != null) consume [0] = true;
return dragDetect;
}
@@ -719,6 +719,25 @@ int /*long*/ gtk_changed (int /*long*/ widget) {
return 0;
}
+int /*long*/ gtk_event_after (int /*long*/ widget, int /*long*/ gdkEvent) {
+ switch (OS.GDK_EVENT_TYPE (gdkEvent)) {
+ case OS.GDK_EXPOSE: {
+ /*
+ * Bug in GTK. SWT connects the expose-event 'after' the default
+ * handler of the signal. If the tree has no children, then GTK
+ * sends expose signal only 'before' the default signal handler.
+ * The fix is to detect this case in 'event_after' and send the
+ * expose event.
+ */
+ if (OS.gtk_tree_model_iter_n_children (modelHandle, 0) == 0) {
+ gtk_expose_event (widget, gdkEvent);
+ }
+ break;
+ }
+ }
+ return super.gtk_event_after (widget, gdkEvent);
+}
+
int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event) {
int /*long*/ result = super.gtk_button_press_event (widget, event);
if (result != 0) return result;
diff --git a/org/eclipse/swt/widgets/Menu.java b/org/eclipse/swt/widgets/Menu.java
index e585ee1..b69ac67 100644
--- a/org/eclipse/swt/widgets/Menu.java
+++ b/org/eclipse/swt/widgets/Menu.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -210,13 +210,28 @@ void _setVisible (boolean visible) {
}
}
int /*long*/ address = hasLocation ? display.menuPositionProc: 0;
+ int /*long*/ data = 0;
+ if ((OS.GTK_VERSION >= OS.VERSION (2, 10, 0))) {
+ /*
+ * Popup-menu to the status icon should be aligned to
+ * Tray rather than to cursor position. There is a
+ * possibility (unlikely) that TrayItem might have
+ * been disposed in the listener, for which case
+ * the menu should be shown in the cursor position.
+ */
+ TrayItem item = display.currentTrayItem;
+ if (item != null && !item.isDisposed()) {
+ data = item.handle;
+ address = OS.gtk_status_icon_position_menu_func ();
+ }
+ }
/*
* Bug in GTK. The timestamp passed into gtk_menu_popup is used
* to perform an X pointer grab. It cannot be zero, else the grab
* will fail. The fix is to ensure that the timestamp of the last
* event processed is used.
*/
- OS.gtk_menu_popup (handle, 0, 0, address, 0, 0, display.getLastEventTime ());
+ OS.gtk_menu_popup (handle, 0, 0, address, data, 0, display.getLastEventTime ());
} else {
sendEvent (SWT.Hide);
}
@@ -301,9 +316,15 @@ void createHandle (int index) {
}
void createIMMenu (int /*long*/ imHandle) {
- if (this.imHandle == imHandle) return;
- this.imHandle = imHandle;
- if (imHandle == 0) {
+ boolean showInputMethod = false;
+ int /*long*/ settings = OS.gtk_settings_get_default ();
+ if (settings != 0) {
+ int [] buffer = new int [1];
+ OS.g_object_get (settings, OS.gtk_show_input_method_menu, buffer, 0);
+ showInputMethod = buffer[0] != 0;
+ }
+ if (imHandle == 0 || !showInputMethod) {
+ this.imHandle = 0;
if (imItem != 0) {
OS.gtk_widget_destroy (imItem);
imItem = 0;
@@ -313,7 +334,10 @@ void createIMMenu (int /*long*/ imHandle) {
imSeparator = 0;
}
return;
- }
+ }
+ if (this.imHandle == imHandle) return;
+ this.imHandle = imHandle;
+
if (imSeparator == 0) {
imSeparator = OS.gtk_separator_menu_item_new ();
OS.gtk_widget_show (imSeparator);
@@ -501,6 +525,24 @@ String getNameText () {
}
/**
+ * Returns the orientation of the receiver, which will be one of the
+ * constants <code>SWT.LEFT_TO_RIGHT</code> or <code>SWT.RIGHT_TO_LEFT</code>.
+ *
+ * @return the orientation style
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.7
+ */
+public int getOrientation () {
+ checkWidget();
+ return style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
+}
+
+/**
* Returns the receiver's parent, which must be a <code>Decorations</code>.
*
* @return the receiver's parent
@@ -955,10 +997,44 @@ public void setLocation (Point location) {
setLocation (location.x, location.y);
}
-void setOrientation() {
- if ((parent.style & SWT.RIGHT_TO_LEFT) != 0) {
- if (handle != 0) OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
- }
+/**
+ * Sets the orientation of the receiver, which must be one
+ * of the constants <code>SWT.LEFT_TO_RIGHT</code> or <code>SWT.RIGHT_TO_LEFT</code>.
+ * <p>
+ *
+ * @param orientation new orientation style
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.7
+ */
+public void setOrientation (int orientation) {
+ checkWidget ();
+ if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
+ _setOrientation (orientation);
+}
+
+void _setOrientation (int orientation) {
+ if (OS.GTK_VERSION < OS.VERSION (2, 4, 0)) return;
+ int flags = SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT;
+ if ((orientation & flags) == 0 || (orientation & flags) == flags) return;
+ style &= ~flags;
+ style |= orientation & flags;
+ setOrientation (false);
+}
+
+void setOrientation (boolean create) {
+ if ((style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
+ int dir = (style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ if (handle != 0) OS.gtk_widget_set_direction (handle, dir);
+ MenuItem [] items = getItems ();
+ for (int i = 0; i < items.length; i++) {
+ items [i].setOrientation (create);
+ }
+ }
}
/**
diff --git a/org/eclipse/swt/widgets/MenuItem.java b/org/eclipse/swt/widgets/MenuItem.java
index d98c282..8ce0cde 100644
--- a/org/eclipse/swt/widgets/MenuItem.java
+++ b/org/eclipse/swt/widgets/MenuItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -39,7 +39,7 @@ import org.eclipse.swt.events.*;
public class MenuItem extends Item {
Menu parent, menu;
int /*long*/ groupHandle;
- int accelerator;
+ int accelerator, userId;
/**
* Constructs a new instance of this class given its parent
@@ -349,6 +349,23 @@ public boolean getEnabled () {
}
/**
+ * Gets the identifier associated with the receiver.
+ *
+ * @return the receiver's identifier
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.7
+ */
+public int getID () {
+ checkWidget();
+ return userId;
+}
+
+/**
* Returns the receiver's cascade menu if it has one or null
* if it does not. Only <code>CASCADE</code> menu items can have
* a pull down menu. The sequence of key strokes, button presses
@@ -644,6 +661,25 @@ public void setEnabled (boolean enabled) {
}
/**
+ * Sets the identifier associated with the receiver to the argument.
+ *
+ * @param id the new identifier. This must be a non-negative value. System-defined identifiers are negative values.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * <li>ERROR_INVALID_ARGUMENT - if called with an negative-valued argument.</li>
+ * </ul>
+ *
+ * @since 3.7
+ */
+public void setID (int id) {
+ checkWidget();
+ if (id < 0) error(SWT.ERROR_INVALID_ARGUMENT);
+ userId = id;
+}
+
+/**
* Sets the image the receiver will display to the argument.
* <p>
* Note: This operation is a hint and is not supported on
@@ -745,13 +781,14 @@ public void setMenu (Menu menu) {
if (accelGroup != 0) addAccelerators (accelGroup);
}
-void setOrientation() {
- if ((parent.style & SWT.RIGHT_TO_LEFT) != 0) {
- if (handle != 0) {
- OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
- OS.gtk_container_forall (handle, display.setDirectionProc, OS.GTK_TEXT_DIR_RTL);
- }
- }
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if ((parent.style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
+ int dir = (parent.style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ OS.gtk_widget_set_direction (handle, dir);
+ OS.gtk_container_forall (handle, display.setDirectionProc, dir);
+ if (menu != null) menu._setOrientation (parent.style & (SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT));
+ }
}
boolean setRadioSelection (boolean value) {
diff --git a/org/eclipse/swt/widgets/MessageBox.java b/org/eclipse/swt/widgets/MessageBox.java
index 2a74df6..953fe2a 100644
--- a/org/eclipse/swt/widgets/MessageBox.java
+++ b/org/eclipse/swt/widgets/MessageBox.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,8 +31,7 @@ import org.eclipse.swt.internal.gtk.*;
* Note: Only one of the styles ICON_ERROR, ICON_INFORMATION, ICON_QUESTION,
* ICON_WARNING and ICON_WORKING may be specified.
* </p><p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample, Dialog tab</a>
@@ -188,6 +187,13 @@ public int open () {
hookId = OS.g_signal_add_emission_hook (signalId, 0, display.emissionProc, handle, 0);
}
int response = OS.gtk_dialog_run (handle);
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock acquired by the function above.
+ */
+ OS.gdk_threads_leave();
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
OS.g_signal_remove_emission_hook (signalId, hookId);
}
diff --git a/org/eclipse/swt/widgets/ProgressBar.java b/org/eclipse/swt/widgets/ProgressBar.java
index 34f3886..7b4d23e 100644
--- a/org/eclipse/swt/widgets/ProgressBar.java
+++ b/org/eclipse/swt/widgets/ProgressBar.java
@@ -27,8 +27,7 @@ import org.eclipse.swt.internal.gtk.*;
* <p>
* Note: Only one of the styles HORIZONTAL and VERTICAL may be specified.
* </p><p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#progressbar">ProgressBar snippets</a>
diff --git a/org/eclipse/swt/widgets/Sash.java b/org/eclipse/swt/widgets/Sash.java
index b2747da..3b2fe88 100644
--- a/org/eclipse/swt/widgets/Sash.java
+++ b/org/eclipse/swt/widgets/Sash.java
@@ -29,8 +29,7 @@ import org.eclipse.swt.events.*;
* <p>
* Note: Only one of the styles HORIZONTAL and VERTICAL may be specified.
* </p><p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#sash">Sash snippets</a>
diff --git a/org/eclipse/swt/widgets/Scale.java b/org/eclipse/swt/widgets/Scale.java
index 8784f03..fa13766 100644
--- a/org/eclipse/swt/widgets/Scale.java
+++ b/org/eclipse/swt/widgets/Scale.java
@@ -30,8 +30,7 @@ import org.eclipse.swt.events.*;
* Note: Only one of the styles HORIZONTAL and VERTICAL may be specified.
* </p><p>
* <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#scale">Scale snippets</a>
diff --git a/org/eclipse/swt/widgets/ScrollBar.java b/org/eclipse/swt/widgets/ScrollBar.java
index 07580ec..a8e5063 100644
--- a/org/eclipse/swt/widgets/ScrollBar.java
+++ b/org/eclipse/swt/widgets/ScrollBar.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -490,7 +490,6 @@ int /*long*/ gtk_value_changed (int /*long*/ adjustment) {
case OS.GTK_SCROLL_STEP_LEFT:
case OS.GTK_SCROLL_STEP_BACKWARD: event.detail = SWT.ARROW_UP; break;
}
- detail = OS.GTK_SCROLL_NONE;
if (!dragSent) detail = OS.GTK_SCROLL_NONE;
sendSelectionEvent (SWT.Selection, event, false);
parent.updateScrollBarValue (this);
@@ -504,7 +503,7 @@ int /*long*/ gtk_event_after (int /*long*/ widget, int /*long*/ gdkEvent) {
case OS.GDK_BUTTON_RELEASE: {
GdkEventButton gdkEventButton = new GdkEventButton ();
OS.memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
- if (gdkEventButton.button == 1 && detail == SWT.DRAG) {
+ if (gdkEventButton.button == 1 && detail == OS.GTK_SCROLL_JUMP) {
if (!dragSent) {
Event event = new Event ();
event.detail = SWT.DRAG;
@@ -715,12 +714,12 @@ public void setMinimum (int value) {
OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED);
}
-void setOrientation () {
- super.setOrientation ();
- if ((parent.style & SWT.MIRRORED) != 0) {
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if ((parent.style & SWT.MIRRORED) != 0 || !create) {
if ((parent.state & CANVAS) != 0) {
if ((style & SWT.HORIZONTAL) != 0) {
- OS.gtk_range_set_inverted (handle, true);
+ OS.gtk_range_set_inverted (handle, (parent.style & SWT.RIGHT_TO_LEFT) != 0);
}
}
}
diff --git a/org/eclipse/swt/widgets/Scrollable.java b/org/eclipse/swt/widgets/Scrollable.java
index e349be0..8c94163 100644
--- a/org/eclipse/swt/widgets/Scrollable.java
+++ b/org/eclipse/swt/widgets/Scrollable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -142,7 +142,7 @@ ScrollBar createScrollBar (int style) {
bar.handle = OS.GTK_SCROLLED_WINDOW_VSCROLLBAR (scrolledHandle);
bar.adjustmentHandle = OS.gtk_scrolled_window_get_vadjustment (scrolledHandle);
}
- bar.setOrientation();
+ bar.setOrientation (true);
bar.hookEvents ();
bar.register ();
return bar;
@@ -286,13 +286,16 @@ boolean sendLeaveNotify () {
return scrolledHandle != 0;
}
-void setOrientation () {
- super.setOrientation ();
- if ((style & SWT.RIGHT_TO_LEFT) != 0) {
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if ((style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
+ int dir = (style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
if (scrolledHandle != 0) {
- OS.gtk_widget_set_direction (scrolledHandle, OS.GTK_TEXT_DIR_RTL);
+ OS.gtk_widget_set_direction (scrolledHandle, dir);
}
}
+ if (horizontalBar != null) horizontalBar.setOrientation (create);
+ if (verticalBar != null) verticalBar.setOrientation (create);
}
boolean setScrollBarVisible (ScrollBar bar, boolean visible) {
diff --git a/org/eclipse/swt/widgets/Shell.java b/org/eclipse/swt/widgets/Shell.java
index b1d93b6..6c18baf 100644
--- a/org/eclipse/swt/widgets/Shell.java
+++ b/org/eclipse/swt/widgets/Shell.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -107,7 +107,7 @@ import org.eclipse.swt.events.*;
* Note: Only one of the styles APPLICATION_MODAL, MODELESS,
* PRIMARY_MODAL and SYSTEM_MODAL may be specified.
* </p><p>
- * IMPORTANT: This class is not intended to be subclassed.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see Decorations
@@ -115,6 +115,7 @@ import org.eclipse.swt.events.*;
* @see <a href="http://www.eclipse.org/swt/snippets/#shell">Shell snippets</a>
* @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample</a>
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
+ * @noextend This class is not intended to be subclassed by clients.
*/
public class Shell extends Decorations {
int /*long*/ shellHandle, tooltipsHandle, tooltipWindow, group, modalGroup;
@@ -770,6 +771,27 @@ Composite findDeferredControl () {
return layoutCount > 0 ? this : null;
}
+/**
+ * Returns a ToolBar object representing the tool bar that can be shown in the receiver's
+ * trim. This will return <code>null</code> if the platform does not support tool bars that
+ * are not part of the content area of the shell, or if the Shell's style does not support
+ * having a tool bar.
+ * <p>
+ *
+ * @return a ToolBar object representing the Shell's tool bar, or <ocde>null</code>.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.7
+ */
+public ToolBar getToolBar() {
+ checkWidget ();
+ return null;
+}
+
boolean hasBorder () {
return false;
}
@@ -1015,7 +1037,8 @@ Shell getModalShell () {
/**
* Gets the receiver's modified state.
*
- * </ul>
+ * @return <code>true</code> if the receiver is marked as modified, or <code>false</code> otherwise
+ *
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -1046,9 +1069,9 @@ public boolean getVisible () {
/**
* Returns the region that defines the shape of the shell,
- * or null if the shell has the default shape.
+ * or <code>null</code> if the shell has the default shape.
*
- * @return the region that defines the shape of the shell (or null)
+ * @return the region that defines the shape of the shell, or <code>null</code>
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -1320,9 +1343,33 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) {
}
int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) {
- /* Stop menu mnemonics when the shell is disabled */
if (widget == shellHandle) {
- return (state & DISABLED) != 0 ? 1 : 0;
+ /* Stop menu mnemonics when the shell is disabled */
+ if ((state & DISABLED) != 0) return 1;
+
+ if (menuBar != null && !menuBar.isDisposed ()) {
+ Control focusControl = display.getFocusControl ();
+ if (focusControl != null && (focusControl.hooks (SWT.KeyDown) || focusControl.filters (SWT.KeyDown))) {
+ int /*long*/ [] accel = new int /*long*/ [1];
+ int /*long*/ setting = OS.gtk_settings_get_default ();
+ OS.g_object_get (setting, OS.gtk_menu_bar_accel, accel, 0);
+ if (accel [0] != 0) {
+ int [] keyval = new int [1];
+ int [] mods = new int [1];
+ OS.gtk_accelerator_parse (accel [0], keyval, mods);
+ OS.g_free (accel [0]);
+ if (keyval [0] != 0) {
+ GdkEventKey keyEvent = new GdkEventKey ();
+ OS.memmove (keyEvent, event, GdkEventKey.sizeof);
+ int mask = OS.gtk_accelerator_get_default_mod_mask ();
+ if (keyEvent.keyval == keyval [0] && (keyEvent.state & mask) == (mods [0] & mask)) {
+ return focusControl.gtk_key_press_event (focusControl.focusHandle (), event);
+ }
+ }
+ }
+ }
+ }
+ return 0;
}
return super.gtk_key_press_event (widget, event);
}
@@ -1994,6 +2041,13 @@ public void setVisible (boolean visible) {
boolean iconic = false;
Shell shell = parent != null ? parent.getShell() : null;
do {
+ /*
+ * This call to gdk_threads_leave() is a temporary work around
+ * to avoid deadlocks when gdk_threads_init() is called by native
+ * code outside of SWT (i.e AWT, etc). It ensures that the current
+ * thread leaves the GTK lock before calling the function below.
+ */
+ OS.gdk_threads_leave();
OS.g_main_context_iteration (0, false);
if (isDisposed ()) break;
iconic = minimized || (shell != null && shell.minimized);
@@ -2169,13 +2223,24 @@ void updateModal () {
} else {
shell = modal;
}
+ Composite topModalShell = shell;
while (shell != null) {
if ((shell.style & mask) == 0) {
group = shell.getShell ().group;
break;
}
+ topModalShell = shell;
shell = shell.parent;
}
+ /*
+ * If a modal shell doesn't have any parent (or modal shell as it's parent),
+ * then we incorrectly add the modal shell to the default group, due to which
+ * children of that modal shell are not interactive. The fix is to ensure
+ * that whenever there is a modal shell in the hierarchy, then we always
+ * add the modal shell's group to that modal shell and it's modelless children
+ * in a different group.
+ */
+ if (group == 0 && topModalShell != null) group = topModalShell.getShell ().group;
}
if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0) && group == 0) {
/*
diff --git a/org/eclipse/swt/widgets/Slider.java b/org/eclipse/swt/widgets/Slider.java
index 957b792..8b20f25 100644
--- a/org/eclipse/swt/widgets/Slider.java
+++ b/org/eclipse/swt/widgets/Slider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -487,11 +487,11 @@ public void setMinimum (int value) {
OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED);
}
-void setOrientation () {
- super.setOrientation ();
- if ((style & SWT.RIGHT_TO_LEFT) != 0) {
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if ((style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
if ((style & SWT.HORIZONTAL) != 0) {
- OS.gtk_range_set_inverted (handle, true);
+ OS.gtk_range_set_inverted (handle, (style & SWT.RIGHT_TO_LEFT) != 0);
}
}
}
diff --git a/org/eclipse/swt/widgets/Spinner.java b/org/eclipse/swt/widgets/Spinner.java
index d8c0dd1..51315b5 100644
--- a/org/eclipse/swt/widgets/Spinner.java
+++ b/org/eclipse/swt/widgets/Spinner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -647,8 +647,11 @@ int /*long*/ gtk_commit (int /*long*/ imContext, int /*long*/ text) {
int /*long*/ gtk_delete_text (int /*long*/ widget, int /*long*/ start_pos, int /*long*/ end_pos) {
if (!hooks (SWT.Verify) && !filters (SWT.Verify)) return 0;
- if (end_pos == -1) end_pos = OS.g_utf8_strlen (OS.gtk_entry_get_text (handle), -1);
- String newText = verifyText ("", (int)/*64*/start_pos, (int)/*64*/end_pos);
+ int /*long*/ ptr = OS.gtk_entry_get_text (handle);
+ if (end_pos == -1) end_pos = OS.g_utf8_strlen (ptr, -1);
+ int start = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, start_pos);
+ int end = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, end_pos);
+ String newText = verifyText ("", start, end);
if (newText == null) {
OS.g_signal_stop_emission_by_name (handle, OS.delete_text);
} else {
@@ -685,11 +688,10 @@ int /*long*/ gtk_insert_text (int /*long*/ widget, int /*long*/ new_text, int /*
String oldText = new String (Converter.mbcsToWcs (null, buffer));
int [] pos = new int [1];
OS.memmove (pos, position, 4);
- if (pos [0] == -1) {
- int /*long*/ ptr = OS.gtk_entry_get_text (handle);
- pos [0] = (int)/*64*/OS.g_utf8_strlen (ptr, -1);
- }
- String newText = verifyText (oldText, pos [0], pos [0]);
+ int /*long*/ ptr = OS.gtk_entry_get_text (handle);
+ if (pos [0] == -1) pos [0] = (int)/*64*/OS.g_utf8_strlen (ptr, -1);
+ int start = (int)/*64*/OS.g_utf16_pointer_to_offset (ptr, pos [0]);
+ String newText = verifyText (oldText, start, start);
if (newText != oldText) {
int [] newStart = new int [1], newEnd = new int [1];
OS.gtk_editable_get_selection_bounds (handle, newStart, newEnd);
@@ -1089,7 +1091,9 @@ public void setDigits (int value) {
climbRate /= factor;
}
OS.memmove (hAdjustment, adjustment);
+ OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED);
OS.gtk_spin_button_configure (handle, hAdjustment, climbRate, value);
+ OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED);
}
/**
diff --git a/org/eclipse/swt/widgets/Synchronizer.java b/org/eclipse/swt/widgets/Synchronizer.java
index 5bcf914..080871c 100644
--- a/org/eclipse/swt/widgets/Synchronizer.java
+++ b/org/eclipse/swt/widgets/Synchronizer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -44,6 +44,7 @@ public class Synchronizer {
//TEMPORARY CODE
static final boolean IS_CARBON = "carbon".equals (SWT.getPlatform ());
+ static final boolean IS_COCOA = "cocoa".equals (SWT.getPlatform ());
static final boolean IS_GTK = "gtk".equals (SWT.getPlatform ());
/**
@@ -84,7 +85,7 @@ void addLast (RunnableLock lock) {
protected void asyncExec (Runnable runnable) {
if (runnable == null) {
//TEMPORARY CODE
- if (!(IS_CARBON || IS_GTK)) {
+ if (!(IS_CARBON || IS_GTK || IS_COCOA)) {
display.wake ();
return;
}
diff --git a/org/eclipse/swt/widgets/TabFolder.java b/org/eclipse/swt/widgets/TabFolder.java
index 81846bc..e09761c 100644
--- a/org/eclipse/swt/widgets/TabFolder.java
+++ b/org/eclipse/swt/widgets/TabFolder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -637,6 +637,15 @@ void setForegroundColor (GdkColor color) {
}
}
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if (items != null) {
+ for (int i=0; i<items.length; i++) {
+ if (items[i] != null) items[i].setOrientation (create);
+ }
+ }
+}
+
/**
* Selects the item at the given zero-relative index in the receiver.
* If the item at the index was already selected, it remains selected.
diff --git a/org/eclipse/swt/widgets/TabItem.java b/org/eclipse/swt/widgets/TabItem.java
index a19d175..59aea1b 100644
--- a/org/eclipse/swt/widgets/TabItem.java
+++ b/org/eclipse/swt/widgets/TabItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -119,7 +119,7 @@ protected void checkSubclass () {
void createWidget (int index) {
parent.createItem (this, index);
- setOrientation ();
+ setOrientation (true);
hookEvents ();
register ();
text = "";
@@ -313,12 +313,13 @@ public void setImage (Image image) {
}
}
-void setOrientation () {
- if ((parent.style & SWT.RIGHT_TO_LEFT) != 0) {
- if (handle != 0) OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
- if (labelHandle != 0) OS.gtk_widget_set_direction (labelHandle, OS.GTK_TEXT_DIR_RTL);
- if (imageHandle != 0) OS.gtk_widget_set_direction (imageHandle, OS.GTK_TEXT_DIR_RTL);
- if (pageHandle != 0) OS.gtk_widget_set_direction (pageHandle, OS.GTK_TEXT_DIR_RTL);
+void setOrientation (boolean create) {
+ if ((parent.style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
+ int dir = (parent.style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ if (handle != 0) OS.gtk_widget_set_direction (handle, dir);
+ if (labelHandle != 0) OS.gtk_widget_set_direction (labelHandle, dir);
+ if (imageHandle != 0) OS.gtk_widget_set_direction (imageHandle, dir);
+ if (pageHandle != 0) OS.gtk_widget_set_direction (pageHandle, dir);
}
}
diff --git a/org/eclipse/swt/widgets/Table.java b/org/eclipse/swt/widgets/Table.java
index d0dfe65..771173e 100644
--- a/org/eclipse/swt/widgets/Table.java
+++ b/org/eclipse/swt/widgets/Table.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1084,7 +1084,7 @@ void destroyItem (TableItem item) {
if (itemCount == 0) resetCustomDraw ();
}
-boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
+boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean [] consume) {
boolean selected = false;
if (filter) {
int /*long*/ [] path = new int /*long*/ [1];
@@ -1098,7 +1098,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
return false;
}
}
- boolean dragDetect = super.dragDetect (x, y, filter, consume);
+ boolean dragDetect = super.dragDetect (x, y, filter, false, consume);
if (dragDetect && selected && consume != null) consume [0] = true;
return dragDetect;
}
@@ -1933,6 +1933,25 @@ int /*long*/ gtk_changed (int /*long*/ widget) {
return 0;
}
+int /*long*/ gtk_event_after (int /*long*/ widget, int /*long*/ gdkEvent) {
+ switch (OS.GDK_EVENT_TYPE (gdkEvent)) {
+ case OS.GDK_EXPOSE: {
+ /*
+ * Bug in GTK. SWT connects the expose-event 'after' the default
+ * handler of the signal. If the tree has no children, then GTK
+ * sends expose signal only 'before' the default signal handler.
+ * The fix is to detect this case in 'event_after' and send the
+ * expose event.
+ */
+ if (OS.gtk_tree_model_iter_n_children (modelHandle, 0) == 0) {
+ gtk_expose_event (widget, gdkEvent);
+ }
+ break;
+ }
+ }
+ return super.gtk_event_after (widget, gdkEvent);
+}
+
int /*long*/ gtk_expose_event (int /*long*/ widget, int /*long*/ eventPtr) {
if ((state & OBSCURED) != 0) return 0;
if ((state & PARENT_BACKGROUND) != 0 || backgroundImage != null) {
@@ -2529,12 +2548,15 @@ int /*long*/ rendererGetSizeProc (int /*long*/ cell, int /*long*/ widget, int /*
if (!ignoreSize && OS.GTK_IS_CELL_RENDERER_TEXT (cell)) {
int /*long*/ iter = OS.g_object_get_qdata (cell, Display.SWT_OBJECT_INDEX2);
TableItem item = null;
+ boolean isSelected = false;
if (iter != 0) {
int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, iter);
int [] buffer = new int [1];
OS.memmove (buffer, OS.gtk_tree_path_get_indices (path), 4);
int index = buffer [0];
item = _getItem (index);
+ int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
+ isSelected = OS.gtk_tree_selection_path_is_selected (selection, path);
OS.gtk_tree_path_free (path);
}
if (item != null) {
@@ -2567,6 +2589,7 @@ int /*long*/ rendererGetSizeProc (int /*long*/ cell, int /*long*/ widget, int /*
event.gc = gc;
event.width = contentWidth [0];
event.height = contentHeight [0];
+ if (isSelected) event.detail = SWT.SELECTED;
sendEvent (SWT.MeasureItem, event);
gc.dispose ();
contentWidth [0] = event.width - imageWidth;
@@ -3135,6 +3158,16 @@ public void setLinesVisible (boolean show) {
}
}
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ for (int i=0; i<itemCount; i++) {
+ if (items[i] != null) items[i].setOrientation (create);
+ }
+ for (int i=0; i<columnCount; i++) {
+ if (columns[i] != null) columns[i].setOrientation (create);
+ }
+}
+
void setParentBackground () {
ownerDraw = true;
recreateRenderers ();
diff --git a/org/eclipse/swt/widgets/TableColumn.java b/org/eclipse/swt/widgets/TableColumn.java
index e0ab44f..e1a78e1 100644
--- a/org/eclipse/swt/widgets/TableColumn.java
+++ b/org/eclipse/swt/widgets/TableColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -192,7 +192,7 @@ protected void checkSubclass () {
void createWidget (int index) {
parent.createItem (this, index);
- setOrientation ();
+ setOrientation (true);
hookEvents ();
register ();
text = "";
@@ -614,11 +614,12 @@ public void setMoveable (boolean moveable) {
OS.gtk_tree_view_column_set_reorderable (handle, moveable);
}
-void setOrientation() {
- if ((parent.style & SWT.RIGHT_TO_LEFT) != 0) {
+void setOrientation (boolean create) {
+ if ((parent.style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
if (buttonHandle != 0) {
- OS.gtk_widget_set_direction (buttonHandle, OS.GTK_TEXT_DIR_RTL);
- OS.gtk_container_forall (buttonHandle, display.setDirectionProc, OS.GTK_TEXT_DIR_RTL);
+ int dir = (parent.style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ OS.gtk_widget_set_direction (buttonHandle, dir);
+ OS.gtk_container_forall (buttonHandle, display.setDirectionProc, dir);
}
}
}
diff --git a/org/eclipse/swt/widgets/Text.java b/org/eclipse/swt/widgets/Text.java
index c62de00..25c926a 100644
--- a/org/eclipse/swt/widgets/Text.java
+++ b/org/eclipse/swt/widgets/Text.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -495,7 +495,7 @@ void deregister () {
if (imContext != 0) display.removeWidget (imContext);
}
-boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
+boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean [] consume) {
if (filter) {
int start = 0, end = 0;
if ((style & SWT.SINGLE) != 0) {
@@ -529,7 +529,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
position = OS.gtk_text_iter_get_offset (p);
}
if (start <= position && position < end) {
- if (super.dragDetect (x, y, filter, consume)) {
+ if (super.dragDetect (x, y, filter, dragOnTimeout, consume)) {
if (consume != null) consume [0] = true;
return true;
}
@@ -537,7 +537,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
}
return false;
}
- return super.dragDetect (x, y, filter, consume);
+ return super.dragDetect (x, y, filter, dragOnTimeout, consume);
}
int /*long*/ eventWindow () {
@@ -670,12 +670,18 @@ public Point getCaretLocation () {
public int getCaretPosition () {
checkWidget ();
if ((style & SWT.SINGLE) != 0) {
- return OS.gtk_editable_get_position (handle);
+ int /*long*/ ptr = OS.gtk_entry_get_text (handle);
+ return (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, OS.gtk_editable_get_position (handle));
}
byte [] position = new byte [ITER_SIZEOF];
int /*long*/ mark = OS.gtk_text_buffer_get_insert (bufferHandle);
OS.gtk_text_buffer_get_iter_at_mark (bufferHandle, position, mark);
- return OS.gtk_text_iter_get_offset (position);
+ byte [] zero = new byte [ITER_SIZEOF];
+ OS.gtk_text_buffer_get_iter_at_offset(bufferHandle, zero, 0);
+ int /*long*/ ptr = OS.gtk_text_buffer_get_text (bufferHandle, zero, position, true);
+ int result = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, OS.gtk_text_iter_get_offset (position));
+ OS.g_free (ptr);
+ return result;
}
/**
@@ -692,9 +698,15 @@ public int getCharCount () {
checkWidget ();
if ((style & SWT.SINGLE) != 0) {
int /*long*/ ptr = OS.gtk_entry_get_text (handle);
- return (int)/*64*/OS.g_utf8_strlen (ptr, -1);
+ return (int)/*64*/OS.g_utf16_strlen (ptr, -1);
}
- return OS.gtk_text_buffer_get_char_count (bufferHandle);
+ byte [] startIter = new byte [ITER_SIZEOF];
+ byte [] endIter = new byte [ITER_SIZEOF];
+ OS.gtk_text_buffer_get_bounds (bufferHandle, startIter, endIter);
+ int /*long*/ ptr = OS.gtk_text_buffer_get_text (bufferHandle, startIter, endIter, true);
+ int result = (int)/*64*/OS.g_utf16_strlen(ptr, -1);
+ OS.g_free (ptr);
+ return result;
}
/**
@@ -849,8 +861,7 @@ public String getMessage () {
* @since 2.1.2
*/
public int getOrientation () {
- checkWidget();
- return style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
+ return super.getOrientation ();
}
/*public*/ int getPosition (Point point) {
@@ -863,11 +874,15 @@ public int getOrientation () {
int /*long*/ layout = OS.gtk_entry_get_layout (handle);
OS.pango_layout_xy_to_index (layout, point.x * OS.PANGO_SCALE, point.y * OS.PANGO_SCALE, index, trailing);
int /*long*/ ptr = OS.pango_layout_get_text (layout);
- position = (int)/*64*/OS.g_utf8_pointer_to_offset (ptr, ptr + index[0]) + trailing[0];
+ position = (int)/*64*/OS.g_utf16_pointer_to_offset (ptr, ptr + index[0]) + trailing[0];
} else {
byte [] p = new byte [ITER_SIZEOF];
OS.gtk_text_view_get_iter_at_location (handle, p, point.x, point.y);
- position = OS.gtk_text_iter_get_offset (p);
+ byte [] zero = new byte [ITER_SIZEOF];
+ OS.gtk_text_buffer_get_iter_at_offset(bufferHandle, zero, 0);
+ int /*long*/ ptr = OS.gtk_text_buffer_get_text (bufferHandle, zero, p, true);
+ position = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, OS.gtk_text_iter_get_offset (p));
+ OS.g_free (ptr);
}
return position;
}
@@ -896,12 +911,21 @@ public Point getSelection () {
int [] start = new int [1];
int [] end = new int [1];
OS.gtk_editable_get_selection_bounds (handle, start, end);
+ int /*long*/ ptr = OS.gtk_entry_get_text (handle);
+ start[0] = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, start[0]);
+ end[0] = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, end[0]);
return new Point (start [0], end [0]);
}
- byte [] start = new byte [ITER_SIZEOF];
- byte [] end = new byte [ITER_SIZEOF];
- OS.gtk_text_buffer_get_selection_bounds (bufferHandle, start, end);
- return new Point (OS.gtk_text_iter_get_offset (start), OS.gtk_text_iter_get_offset (end));
+ byte [] startIter = new byte [ITER_SIZEOF];
+ byte [] endIter = new byte [ITER_SIZEOF];
+ OS.gtk_text_buffer_get_selection_bounds (bufferHandle, startIter, endIter);
+ byte [] zero = new byte [ITER_SIZEOF];
+ OS.gtk_text_buffer_get_iter_at_offset(bufferHandle, zero, 0);
+ int /*long*/ ptr = OS.gtk_text_buffer_get_text (bufferHandle, zero, endIter, true);
+ int start = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, OS.gtk_text_iter_get_offset (startIter));
+ int end = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, OS.gtk_text_iter_get_offset (endIter));
+ OS.g_free (ptr);
+ return new Point (start, end);
}
/**
@@ -981,22 +1005,7 @@ int getTabWidth (int tabs) {
* </ul>
*/
public String getText () {
- checkWidget ();
- int /*long*/ address;
- if ((style & SWT.SINGLE) != 0) {
- address = OS.gtk_entry_get_text (handle);
- } else {
- byte [] start = new byte [ITER_SIZEOF];
- byte [] end = new byte [ITER_SIZEOF];
- OS.gtk_text_buffer_get_bounds (bufferHandle, start, end);
- address = OS.gtk_text_buffer_get_text (bufferHandle, start, end, true);
- }
- if (address == 0) return "";
- int length = OS.strlen (address);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, address, length);
- if ((style & SWT.MULTI) != 0) OS.g_free (address);
- return new String (Converter.mbcsToWcs (null, buffer));
+ return new String (getTextChars());
}
/**
@@ -1020,27 +1029,54 @@ public String getText () {
public String getText (int start, int end) {
checkWidget ();
if (!(start <= end && 0 <= end)) return "";
+ String str = getText ();
+ int length = str.length ();
+ end = Math.min (end, length - 1);
+ if (start > end) return "";
+ start = Math.max (0, start);
+ /*
+ * NOTE: The current implementation uses substring ()
+ * which can reference a potentially large character
+ * array.
+ */
+ return str.substring (start, end + 1);
+}
+
+/**
+ * Returns the widget's text as a character array.
+ * <p>
+ * The text for a text widget is the characters in the widget, or
+ * a zero-length array if this has never been set.
+ * </p>
+ *
+ * @return a character array that contains the widget's text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setTextChars(char[])
+ *
+ * @since 3.7
+ */
+public char [] getTextChars () {
+ checkWidget ();
int /*long*/ address;
if ((style & SWT.SINGLE) != 0) {
- start = Math.max (0, start);
- address = OS.gtk_editable_get_chars (handle, start, end + 1);
+ address = OS.gtk_entry_get_text (handle);
} else {
- int length = OS.gtk_text_buffer_get_char_count (bufferHandle);
- end = Math.min (end, length - 1);
- if (start > end) return "";
- start = Math.max (0, start);
- byte [] startIter = new byte [ITER_SIZEOF];
- byte [] endIter = new byte [ITER_SIZEOF];
- OS.gtk_text_buffer_get_iter_at_offset (bufferHandle, startIter, start);
- OS.gtk_text_buffer_get_iter_at_offset (bufferHandle, endIter, end + 1);
- address = OS.gtk_text_buffer_get_text (bufferHandle, startIter, endIter, true);
+ byte [] start = new byte [ITER_SIZEOF];
+ byte [] end = new byte [ITER_SIZEOF];
+ OS.gtk_text_buffer_get_bounds (bufferHandle, start, end);
+ address = OS.gtk_text_buffer_get_text (bufferHandle, start, end, true);
}
- if (address == 0) error (SWT.ERROR_CANNOT_GET_TEXT);
+ if (address == 0) return new char[0];
int length = OS.strlen (address);
byte [] buffer = new byte [length];
OS.memmove (buffer, address, length);
- OS.g_free (address);
- return new String (Converter.mbcsToWcs (null, buffer));
+ if ((style & SWT.MULTI) != 0) OS.g_free (address);
+ return Converter.mbcsToWcs (null, buffer);
}
/**
@@ -1170,7 +1206,7 @@ int /*long*/ gtk_changed (int /*long*/ widget) {
if ((style & SWT.SEARCH) != 0) {
if ((style & SWT.ICON_CANCEL) != 0) {
int /*long*/ ptr = OS.gtk_entry_get_text (handle);
- OS.gtk_entry_set_icon_sensitive (handle, OS.GTK_ENTRY_ICON_SECONDARY, OS.g_utf8_strlen (ptr, -1) > 0);
+ OS.gtk_entry_set_icon_sensitive (handle, OS.GTK_ENTRY_ICON_SECONDARY, OS.g_utf16_strlen (ptr, -1) > 0);
}
}
return 0;
@@ -1226,6 +1262,12 @@ int /*long*/ gtk_delete_range (int /*long*/ widget, int /*long*/ iter1, int /*lo
OS.memmove (endIter, iter2, endIter.length);
int start = OS.gtk_text_iter_get_offset (startIter);
int end = OS.gtk_text_iter_get_offset (endIter);
+ byte [] zero = new byte [ITER_SIZEOF];
+ OS.gtk_text_buffer_get_iter_at_offset(bufferHandle, zero, 0);
+ int /*long*/ ptr = OS.gtk_text_buffer_get_text (bufferHandle, zero, endIter, true);
+ start = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, start);
+ end = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, end);
+ OS.g_free (ptr);
String newText = verifyText ("", start, end);
if (newText == null) {
/* Remember the selection when the text was deleted */
@@ -1256,8 +1298,11 @@ int /*long*/ gtk_delete_range (int /*long*/ widget, int /*long*/ iter1, int /*lo
int /*long*/ gtk_delete_text (int /*long*/ widget, int /*long*/ start_pos, int /*long*/ end_pos) {
if (!hooks (SWT.Verify) && !filters (SWT.Verify)) return 0;
- if (end_pos == -1) end_pos = OS.g_utf8_strlen (OS.gtk_entry_get_text (handle), -1);
- String newText = verifyText ("", (int)/*64*/start_pos, (int)/*64*/end_pos);
+ int /*long*/ ptr = OS.gtk_entry_get_text (handle);
+ if (end_pos == -1) end_pos = OS.g_utf8_strlen (ptr, -1);
+ int start = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, start_pos);
+ int end = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, end_pos);
+ String newText = verifyText ("", start, end);
if (newText == null) {
/* Remember the selection when the text was deleted */
int [] newStart = new int [1], newEnd = new int [1];
@@ -1408,10 +1453,8 @@ int /*long*/ gtk_insert_text (int /*long*/ widget, int /*long*/ new_text, int /*
String oldText = new String (Converter.mbcsToWcs (null, buffer));
int [] pos = new int [1];
OS.memmove (pos, position, 4);
- if (pos [0] == -1) {
- int /*long*/ ptr = OS.gtk_entry_get_text (handle);
- pos [0] = (int)/*64*/OS.g_utf8_strlen (ptr, -1);
- }
+ int /*long*/ ptr = OS.gtk_entry_get_text (handle);
+ if (pos [0] == -1) pos [0] = (int)/*64*/OS.g_utf8_strlen (ptr, -1);
/* Use the selection when the text was deleted */
int start = pos [0], end = pos [0];
if (fixStart != -1 && fixEnd != -1) {
@@ -1419,6 +1462,8 @@ int /*long*/ gtk_insert_text (int /*long*/ widget, int /*long*/ new_text, int /*
end = fixEnd;
fixStart = fixEnd = -1;
}
+ start = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, start);
+ end = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, end);
String newText = verifyText (oldText, start, end);
if (newText != oldText) {
int [] newStart = new int [1], newEnd = new int [1];
@@ -1475,6 +1520,12 @@ int /*long*/ gtk_text_buffer_insert_text (int /*long*/ widget, int /*long*/ iter
end = fixEnd;
fixStart = fixEnd = -1;
}
+ byte [] zero = new byte [ITER_SIZEOF];
+ OS.gtk_text_buffer_get_iter_at_offset(bufferHandle, zero, 0);
+ int /*long*/ ptr = OS.gtk_text_buffer_get_text (bufferHandle, zero, position, true);
+ start = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, start);
+ end = (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, end);
+ OS.g_free(ptr);
byte [] buffer = new byte [(int)/*64*/length];
OS.memmove (buffer, text, buffer.length);
String oldText = new String (Converter.mbcsToWcs (null, buffer));
@@ -1895,11 +1946,18 @@ public void setOrientation (int orientation) {
public void setSelection (int start) {
checkWidget ();
if ((style & SWT.SINGLE) != 0) {
+ int /*long*/ ptr = OS.gtk_entry_get_text (handle);
+ start = (int)/*64*/OS.g_utf16_offset_to_utf8_offset (ptr, start);
OS.gtk_editable_set_position (handle, start);
} else {
- byte [] position = new byte [ITER_SIZEOF];
- OS.gtk_text_buffer_get_iter_at_offset (bufferHandle, position, start);
- OS.gtk_text_buffer_place_cursor (bufferHandle, position);
+ byte [] startIter = new byte [ITER_SIZEOF];
+ byte [] endIter = new byte [ITER_SIZEOF];
+ OS.gtk_text_buffer_get_bounds (bufferHandle, startIter, endIter);
+ int /*long*/ ptr = OS.gtk_text_buffer_get_text (bufferHandle, startIter, endIter, true);
+ start = (int)/*64*/OS.g_utf16_offset_to_utf8_offset (ptr, start);
+ OS.g_free (ptr);
+ OS.gtk_text_buffer_get_iter_at_offset (bufferHandle, startIter, start);
+ OS.gtk_text_buffer_place_cursor (bufferHandle, startIter);
int /*long*/ mark = OS.gtk_text_buffer_get_insert (bufferHandle);
OS.gtk_text_view_scroll_mark_onscreen (handle, mark);
}
@@ -1932,12 +1990,20 @@ public void setSelection (int start) {
*/
public void setSelection (int start, int end) {
checkWidget ();
- if ((style & SWT.SINGLE) != 0) {
+ if ((style & SWT.SINGLE) != 0) {
+ int /*long*/ ptr = OS.gtk_entry_get_text (handle);
+ start = (int)/*64*/OS.g_utf16_offset_to_utf8_offset (ptr, start);
+ end = (int)/*64*/OS.g_utf16_offset_to_utf8_offset (ptr, end);
OS.gtk_editable_set_position (handle, start);
OS.gtk_editable_select_region (handle, start, end);
} else {
byte [] startIter = new byte [ITER_SIZEOF];
byte [] endIter = new byte [ITER_SIZEOF];
+ OS.gtk_text_buffer_get_bounds (bufferHandle, startIter, endIter);
+ int /*long*/ ptr = OS.gtk_text_buffer_get_text (bufferHandle, startIter, endIter, true);
+ start = (int)/*64*/OS.g_utf16_offset_to_utf8_offset (ptr, start);
+ end = (int)/*64*/OS.g_utf16_offset_to_utf8_offset (ptr, end);
+ OS.g_free (ptr);
OS.gtk_text_buffer_get_iter_at_offset (bufferHandle, startIter, start);
OS.gtk_text_buffer_get_iter_at_offset (bufferHandle, endIter, end);
int /*long*/ insertMark = OS.gtk_text_buffer_get_insert (bufferHandle);
@@ -2040,8 +2106,50 @@ public void setText (String string) {
string = verifyText (string, 0, getCharCount ());
if (string == null) return;
}
+ char [] text = new char [string.length()];
+ string.getChars(0, text.length, text, 0);
+ setText (text);
+}
+
+/**
+ * Sets the contents of the receiver to the characters in the array. If the receiver
+ * has style <code>SWT.SINGLE</code> and the argument contains multiple lines of text
+ * then the result of this operation is undefined and may vary between platforms.
+ *
+ * @param text a character array that contains the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the array is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getTextChars()
+ *
+ * @since 3.7
+ */
+public void setTextChars (char [] text) {
+ checkWidget ();
+ if (text == null) error (SWT.ERROR_NULL_ARGUMENT);
+ /*
+ * Feature in gtk. When text is set in gtk, separate events are fired for the deletion and
+ * insertion of the text. This is not wrong, but is inconsistent with other platforms. The
+ * fix is to block the firing of these events and fire them ourselves in a consistent manner.
+ */
+ if (hooks (SWT.Verify) || filters (SWT.Verify)) {
+ String string = verifyText (new String(text), 0, getCharCount ());
+ if (string == null) return;
+ text = new char [string.length()];
+ string.getChars (0, text.length, text, 0);
+ }
+ setText (text);
+}
+
+void setText (char [] text) {
if ((style & SWT.SINGLE) != 0) {
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ byte [] buffer = Converter.wcsToMbcs (null, text, true);
OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, DELETE_TEXT);
OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, INSERT_TEXT);
@@ -2050,7 +2158,7 @@ public void setText (String string) {
OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, DELETE_TEXT);
OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, INSERT_TEXT);
} else {
- byte [] buffer = Converter.wcsToMbcs (null, string, false);
+ byte [] buffer = Converter.wcsToMbcs (null, text, false);
byte [] position = new byte [ITER_SIZEOF];
OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, DELETE_RANGE);
@@ -2065,6 +2173,11 @@ public void setText (String string) {
OS.gtk_text_view_scroll_mark_onscreen (handle, mark);
}
sendEvent (SWT.Modify);
+ if ((style & SWT.SEARCH) != 0) {
+ if ((style & SWT.ICON_CANCEL) != 0) {
+ OS.gtk_entry_set_icon_sensitive (handle, OS.GTK_ENTRY_ICON_SECONDARY, true);
+ }
+ }
}
/**
@@ -2175,7 +2288,7 @@ int traversalCode (int key, GdkEventKey event) {
}
String verifyText (String string, int start, int end) {
- if (string.length () == 0 && start == end) return null;
+ if (string != null && string.length () == 0 && start == end) return null;
Event event = new Event ();
event.text = string;
event.start = start;
diff --git a/org/eclipse/swt/widgets/ToolBar.java b/org/eclipse/swt/widgets/ToolBar.java
index a87565f..420ab48 100644
--- a/org/eclipse/swt/widgets/ToolBar.java
+++ b/org/eclipse/swt/widgets/ToolBar.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -532,6 +532,14 @@ void setForegroundColor (GdkColor color) {
}
}
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ ToolItem [] items = _getItems ();
+ for (int i = 0; i < items.length; i++) {
+ items[i].setOrientation (create);
+ }
+}
+
/*public*/ void setTabItemList (ToolItem [] tabList) {
checkWidget ();
if (tabList != null) {
diff --git a/org/eclipse/swt/widgets/ToolItem.java b/org/eclipse/swt/widgets/ToolItem.java
index 4c5c7d9..681e6a5 100644
--- a/org/eclipse/swt/widgets/ToolItem.java
+++ b/org/eclipse/swt/widgets/ToolItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -880,6 +880,8 @@ boolean setFocus () {
if (!OS.gtk_widget_get_child_visible (handle)) return false;
OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS);
OS.gtk_widget_grab_focus (handle);
+ // widget could be disposed at this point
+ if (isDisposed ()) return false;
boolean result = OS.gtk_widget_is_focus (handle);
if (!result) OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_CAN_FOCUS);
return result;
@@ -954,15 +956,16 @@ public void setImage (Image image) {
parent.relayout ();
}
-void setOrientation () {
- if ((parent.style & SWT.RIGHT_TO_LEFT) != 0) {
- if (handle != 0) OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
- if (labelHandle != 0) OS.gtk_widget_set_direction (labelHandle, OS.GTK_TEXT_DIR_RTL);
- if (imageHandle != 0) OS.gtk_widget_set_direction (imageHandle, OS.GTK_TEXT_DIR_RTL);
- if (separatorHandle != 0) OS.gtk_widget_set_direction (separatorHandle, OS.GTK_TEXT_DIR_RTL);
- if (arrowHandle != 0) OS.gtk_widget_set_direction (arrowHandle, OS.GTK_TEXT_DIR_RTL);
- if (boxHandle != 0) OS.gtk_widget_set_direction (boxHandle, OS.GTK_TEXT_DIR_RTL);
- if (arrowBoxHandle != 0) OS.gtk_widget_set_direction (arrowBoxHandle, OS.GTK_TEXT_DIR_RTL);
+void setOrientation (boolean create) {
+ if ((parent.style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
+ int dir = (parent.style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ if (handle != 0) OS.gtk_widget_set_direction (handle, dir);
+ if (labelHandle != 0) OS.gtk_widget_set_direction (labelHandle, dir);
+ if (imageHandle != 0) OS.gtk_widget_set_direction (imageHandle, dir);
+ if (separatorHandle != 0) OS.gtk_widget_set_direction (separatorHandle, dir);
+ if (arrowHandle != 0) OS.gtk_widget_set_direction (arrowHandle, dir);
+ if (boxHandle != 0) OS.gtk_widget_set_direction (boxHandle, dir);
+ if (arrowBoxHandle != 0) OS.gtk_widget_set_direction (arrowBoxHandle, dir);
}
}
@@ -1080,7 +1083,14 @@ void setToolTipText (Shell shell, String newString) {
/**
* Sets the width of the receiver, for <code>SEPARATOR</code> ToolItems.
*
- * @param width the new width
+ * @param width the new width. If the new value is <code>SWT.DEFAULT</code>,
+ * the width is a fixed-width area whose amount is determined by the platform.
+ * If the new value is 0 a vertical or horizontal line will be drawn, depending
+ * on the setting of the corresponding style bit (<code>SWT.VERTICAL</code> or
+ * <code>SWT.HORIZONTAL</code>). If the new value is <code>SWT.SEPARATOR_FILL</code>
+ * a variable-width space is inserted that acts as a spring between the two adjoining
+ * items which will push them out to the extent of the containing ToolBar.
+ *
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
diff --git a/org/eclipse/swt/widgets/ToolTip.java b/org/eclipse/swt/widgets/ToolTip.java
index 34b765f..ebc7219 100644
--- a/org/eclipse/swt/widgets/ToolTip.java
+++ b/org/eclipse/swt/widgets/ToolTip.java
@@ -31,8 +31,7 @@ import org.eclipse.swt.events.*;
* Note: Only one of the styles ICON_ERROR, ICON_INFORMATION,
* and ICON_WARNING may be specified.
* </p><p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#tooltips">Tool Tips snippets</a>
diff --git a/org/eclipse/swt/widgets/Touch.java b/org/eclipse/swt/widgets/Touch.java
new file mode 100644
index 0000000..515c12f
--- /dev/null
+++ b/org/eclipse/swt/widgets/Touch.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.widgets;
+
+/**
+ * Instances of this class are created in response to a
+ * touch-based input device being touched. They are found
+ * in the <code>touches</code> field of an Event or TouchEvent.
+ *
+ * @see org.eclipse.swt.events.TouchEvent
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
+ *
+ * @since 3.7
+ */
+public final class Touch {
+
+ /**
+ * The unique identity of the touch. Use this value to track changes to a touch
+ * during the touch's life. Two touches may have the same identity even if they
+ * come from different sources.
+ */
+ public long id;
+
+ /**
+ * The object representing the input source that generated the touch.
+ */
+ public TouchSource source;
+
+ /**
+ * The state of this touch at the time it was generated. If this field is 0
+ * then the finger is still touching the device but has not moved
+ * since the last <code>TouchEvent</code> was generated.
+ *
+ * @see org.eclipse.swt.SWT#TOUCHSTATE_DOWN
+ * @see org.eclipse.swt.SWT#TOUCHSTATE_MOVE
+ * @see org.eclipse.swt.SWT#TOUCHSTATE_UP
+ */
+ public int state;
+
+ /**
+ * A flag indicating that the touch is the first touch from a previous
+ * state of no touch points. Once designated as such, the touch remains
+ * the primary touch until all fingers are removed from the device.
+ */
+ public boolean primary;
+
+ /**
+ * The x location of the touch in TouchSource coordinates.
+ */
+ public int x;
+
+ /**
+ * The y location of the touch in TouchSource coordinates.
+ */
+ public int y;
+
+/**
+ * Constructs a new touch state from the given inputs.
+ *
+ * @param identity Identity of the touch
+ * @param source Object representing the device that generated the touch
+ * @param state One of the state constants representing the state of this touch
+ * @param primary Whether or not the touch is the primary touch
+ * @param x X location of the touch in screen coordinates
+ * @param y Y location of the touch in screen coordinates
+ */
+Touch (long identity, TouchSource source, int state, boolean primary, int x, int y) {
+ this.id = identity;
+ this.source = source;
+ this.state = state;
+ this.primary = primary;
+ this.x = x;
+ this.y = y;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public String toString() {
+ return "Touch {id=" + id
+ + " source=" + source
+ + " state=" + state
+ + " primary=" + primary
+ + " x=" + x
+ + " y=" + y
+ + "}";
+}
+
+}
diff --git a/org/eclipse/swt/widgets/TouchSource.java b/org/eclipse/swt/widgets/TouchSource.java
new file mode 100644
index 0000000..7caf92a
--- /dev/null
+++ b/org/eclipse/swt/widgets/TouchSource.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.widgets;
+
+
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class represent sources of touch input that generate <code>Touch</code> objects.
+ * They also provide information about the input source, which is important for interpreting the
+ * information in the <code>Touch</code> object.
+ * <p>
+ * Instances of this class can be marked as direct or indirect:
+ * <ul>
+ * <li>When an instance is <em>direct</em>, the touch source is a touch-sensitive digitizer surface such
+ * as a tablet or a touch screen. There is a one-to-one mapping between a touch point and a location in
+ * a window.
+ * </li><li>
+ * When an instance is <em>indirect</em> (more precisely, not direct), the touch source is a track pad or
+ * other device that normally moves the cursor, but is also able to interpret multiple touches on its surface.
+ * In this case there is not a one-to-one mapping between the location of the touch on the device and a
+ * location on the display because the user can remove their finger or stylus and touch another part of
+ * the device and resume what they were doing.
+ * </li>
+ * </ul>
+ *
+ * @see Touch
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
+ *
+ * @since 3.7
+ */
+public final class TouchSource {
+ int /*long*/ handle;
+ boolean direct;
+ Rectangle bounds;
+
+/**
+ * Constructs a new touch source from the given inputs.
+ *
+ * @param direct Is the touch source direct or indirect?
+ * @param height height of the source in pixels.
+ * @param width width of the source in pixels.
+ */
+TouchSource (int /*long*/ handle, boolean direct, Rectangle bounds) {
+ this.handle = handle;
+ this.direct = direct;
+ this.bounds = bounds;
+}
+
+/**
+ * Returns the type of touch input this source generates, <code>true</code> for direct or <code>false</code> for indirect.
+ *
+ * @return <code>true</code> if the input source is direct, or <code>false</code> otherwise
+ */
+public boolean isDirect () {
+ return direct;
+}
+
+/**
+ * Returns the bounding rectangle of the device. For a direct source, this corresponds to the bounds of
+ * the display device in pixels. For an indirect source, this contains the size of the device in pixels.
+ * <p>
+ * Note that the x and y values may not necessarily be 0 if the TouchSource is a direct source.
+ *
+ * @return the bounding rectangle of the input source
+ */
+public Rectangle getBounds () {
+ return new Rectangle (bounds.x, bounds.y, bounds.width, bounds.height);
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public String toString () {
+ return "TouchSource {handle=" + handle + " direct=" + direct + " bounds=" + bounds + "}";
+}
+
+}
\ No newline at end of file
diff --git a/org/eclipse/swt/widgets/TrayItem.java b/org/eclipse/swt/widgets/TrayItem.java
index ca2e9be..b9558a4 100644
--- a/org/eclipse/swt/widgets/TrayItem.java
+++ b/org/eclipse/swt/widgets/TrayItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -329,7 +329,15 @@ int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) {
}
int /*long*/ gtk_status_icon_popup_menu (int /*long*/ widget, int /*long*/ button, int /*long*/ activate_time) {
+ /*
+ * GTK provides a MenuPositionFunc for GtkStatusIcon in order
+ * to set the popup-menu aligned to the tray.
+ */
+ Display display = this.display;
+ display.currentTrayItem = this;
sendEvent (SWT.MenuDetect);
+ if (!isDisposed ()) display.runPopups();
+ display.currentTrayItem = null;
return 0;
}
diff --git a/org/eclipse/swt/widgets/Tree.java b/org/eclipse/swt/widgets/Tree.java
index db619d7..5136227 100644
--- a/org/eclipse/swt/widgets/Tree.java
+++ b/org/eclipse/swt/widgets/Tree.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1108,7 +1108,7 @@ void destroyItem (TreeItem item) {
modelChanged = true;
}
-boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
+boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean [] consume) {
boolean selected = false;
if (filter) {
int /*long*/ [] path = new int /*long*/ [1];
@@ -1122,7 +1122,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
return false;
}
}
- boolean dragDetect = super.dragDetect (x, y, filter, consume);
+ boolean dragDetect = super.dragDetect (x, y, filter, false, consume);
if (dragDetect && selected && consume != null) consume [0] = true;
return dragDetect;
}
@@ -1499,8 +1499,11 @@ public TreeItem getItem (Point point) {
if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
int /*long*/ [] path = new int /*long*/ [1];
OS.gtk_widget_realize (handle);
+ int x = point.x;
+ int y = point.y;
+ if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x;
int /*long*/ [] columnHandle = new int /*long*/ [1];
- if (!OS.gtk_tree_view_get_path_at_pos (handle, point.x, point.y, path, columnHandle, null, null)) return null;
+ if (!OS.gtk_tree_view_get_path_at_pos (handle, x, y, path, columnHandle, null, null)) return null;
if (path [0] == 0) return null;
TreeItem item = null;
int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
@@ -1513,9 +1516,12 @@ public TreeItem getItem (Point point) {
if (OS.GTK_VERSION < OS.VERSION (2, 8, 18)) {
OS.gtk_widget_style_get (handle, OS.expander_size, buffer, 0);
int expanderSize = buffer [0] + TreeItem.EXPANDER_EXTRA_PADDING;
- overExpander = point.x < rect.x + expanderSize;
+ rect.x += expanderSize;
+ }
+ if ((style & SWT.MIRRORED) != 0) {
+ overExpander = x > rect.x + rect.width;
} else {
- overExpander = point.x < rect.x;
+ overExpander = x < rect.x;
}
}
if (!overExpander) {
@@ -1931,6 +1937,25 @@ int /*long*/ gtk_changed (int /*long*/ widget) {
return 0;
}
+int /*long*/ gtk_event_after (int /*long*/ widget, int /*long*/ gdkEvent) {
+ switch (OS.GDK_EVENT_TYPE (gdkEvent)) {
+ case OS.GDK_EXPOSE: {
+ /*
+ * Bug in GTK. SWT connects the expose-event 'after' the default
+ * handler of the signal. If the tree has no children, then GTK
+ * sends expose signal only 'before' the default signal handler.
+ * The fix is to detect this case in 'event_after' and send the
+ * expose event.
+ */
+ if (OS.gtk_tree_model_iter_n_children (modelHandle, 0) == 0) {
+ gtk_expose_event (widget, gdkEvent);
+ }
+ break;
+ }
+ }
+ return super.gtk_event_after (widget, gdkEvent);
+}
+
int /*long*/ gtk_expand_collapse_cursor_row (int /*long*/ widget, int /*long*/ logical, int /*long*/ expand, int /*long*/ open_all) {
// FIXME - this flag is never cleared. It should be cleared when the expand all operation completes.
if (expand != 0 && open_all != 0) expandAll = true;
@@ -2564,6 +2589,12 @@ int /*long*/ rendererGetSizeProc (int /*long*/ cell, int /*long*/ widget, int /*
event.gc = gc;
event.width = contentWidth [0];
event.height = contentHeight [0];
+ int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, iter);
+ int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
+ if (OS.gtk_tree_selection_path_is_selected (selection, path)) {
+ event.detail = SWT.SELECTED;
+ }
+ OS.gtk_tree_path_free (path);
sendEvent (SWT.MeasureItem, event);
gc.dispose ();
contentWidth [0] = event.width - imageWidth;
@@ -3063,6 +3094,20 @@ public void setLinesVisible (boolean show) {
}
}
+void setOrientation (boolean create) {
+ super.setOrientation (create);
+ if (items != null) {
+ for (int i=0; i<items.length; i++) {
+ if (items[i] != null) items[i].setOrientation (create);
+ }
+ }
+ if (columns != null) {
+ for (int i=0; i<columns.length; i++) {
+ if (columns[i] != null) columns[i].setOrientation (create);
+ }
+ }
+}
+
void setParentBackground () {
ownerDraw = true;
recreateRenderers ();
diff --git a/org/eclipse/swt/widgets/TreeColumn.java b/org/eclipse/swt/widgets/TreeColumn.java
index 115c7f8..8e835e8 100644
--- a/org/eclipse/swt/widgets/TreeColumn.java
+++ b/org/eclipse/swt/widgets/TreeColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -194,7 +194,7 @@ protected void checkSubclass () {
void createWidget (int index) {
parent.createItem (this, index);
- setOrientation ();
+ setOrientation (true);
hookEvents ();
register ();
text = "";
@@ -592,11 +592,12 @@ public void setMoveable (boolean moveable) {
OS.gtk_tree_view_column_set_reorderable (handle, moveable);
}
-void setOrientation() {
- if ((parent.style & SWT.RIGHT_TO_LEFT) != 0) {
+void setOrientation (boolean create) {
+ if ((parent.style & SWT.RIGHT_TO_LEFT) != 0 || !create) {
if (buttonHandle != 0) {
- OS.gtk_widget_set_direction (buttonHandle, OS.GTK_TEXT_DIR_RTL);
- OS.gtk_container_forall (buttonHandle, display.setDirectionProc, OS.GTK_TEXT_DIR_RTL);
+ int dir = (parent.style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ OS.gtk_widget_set_direction (buttonHandle, dir);
+ OS.gtk_container_forall (buttonHandle, display.setDirectionProc, dir);
}
}
}
diff --git a/org/eclipse/swt/widgets/TypedListener.java b/org/eclipse/swt/widgets/TypedListener.java
index db4fb1d..354be9d 100644
--- a/org/eclipse/swt/widgets/TypedListener.java
+++ b/org/eclipse/swt/widgets/TypedListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -143,6 +143,12 @@ public void handleEvent (Event e) {
((FocusListener) eventListener).focusLost(new FocusEvent(e));
break;
}
+ case SWT.Gesture: {
+ GestureEvent event = new GestureEvent(e);
+ ((GestureListener)eventListener).gesture(event);
+ e.doit = event.doit;
+ break;
+ }
case SWT.Help: {
((HelpListener) eventListener).helpRequested (new HelpEvent (e));
break;
@@ -241,6 +247,10 @@ public void handleEvent (Event e) {
((MenuListener) eventListener).menuShown(new MenuEvent(e));
break;
}
+ case SWT.Touch: {
+ ((TouchListener)eventListener).touch(new TouchEvent(e));
+ break;
+ }
case SWT.Traverse: {
/* Fields set by Control */
TraverseEvent event = new TraverseEvent (e);
diff --git a/org/eclipse/swt/widgets/Widget.java b/org/eclipse/swt/widgets/Widget.java
index 48e0601..6285902 100644
--- a/org/eclipse/swt/widgets/Widget.java
+++ b/org/eclipse/swt/widgets/Widget.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -410,7 +410,7 @@ void createHandle (int index) {
void createWidget (int index) {
createHandle (index);
- setOrientation ();
+ setOrientation (true);
hookEvents ();
register ();
}
@@ -1287,7 +1287,7 @@ void sendEvent (int eventType, Event event, boolean send) {
boolean sendKeyEvent (int type, GdkEventKey keyEvent) {
int length = keyEvent.length;
- if (keyEvent.string == 0 || OS.g_utf8_strlen (keyEvent.string, length) <= 1) {
+ if (keyEvent.string == 0 || OS.g_utf16_strlen (keyEvent.string, length) <= 1) {
Event event = new Event ();
event.time = keyEvent.time;
if (!setKeyState (event, keyEvent)) return true;
@@ -1550,7 +1550,7 @@ boolean setInputState (Event event, int state) {
}
boolean setKeyState (Event event, GdkEventKey keyEvent) {
- if (keyEvent.string != 0 && OS.g_utf8_strlen (keyEvent.string, keyEvent.length) > 1) return false;
+ if (keyEvent.string != 0 && OS.g_utf16_strlen (keyEvent.string, keyEvent.length) > 1) return false;
boolean isNull = false;
event.keyCode = Display.translateKey (keyEvent.keyval);
switch (keyEvent.keyval) {
@@ -1633,7 +1633,7 @@ void setLocationState (Event event, GdkEventKey keyEvent) {
}
}
-void setOrientation () {
+void setOrientation (boolean create) {
}
boolean setTabGroupFocus (boolean next) {
diff --git a/os.c b/os.c
index 04527a3..b852989 100644
--- a/os.c
+++ b/os.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -3343,6 +3343,18 @@ JNIEXPORT void JNICALL OS_NATIVE(_1g_1list_1free_11)
}
#endif
+#ifndef NO__1g_1list_1last
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1list_1last)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1list_1last_FUNC);
+ rc = (jintLong)g_list_last((GList *)arg0);
+ OS_NATIVE_EXIT(env, that, _1g_1list_1last_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1g_1list_1length
JNIEXPORT jint JNICALL OS_NATIVE(_1g_1list_1length)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -3669,20 +3681,59 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1malloc)
}
#endif
-#ifndef NO__1g_1object_1get
-JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1get)
- (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintArray arg2, jintLong arg3)
+#if (!defined(NO__1g_1object_1get__I_3B_3II) && !defined(JNI64)) || (!defined(NO__1g_1object_1get__J_3B_3IJ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1get__I_3B_3II)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintArray arg2, jintLong arg3)
+#else
+JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1get__J_3B_3IJ)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintArray arg2, jintLong arg3)
+#endif
{
jbyte *lparg1=NULL;
jint *lparg2=NULL;
- OS_NATIVE_ENTER(env, that, _1g_1object_1get_FUNC);
+#ifndef JNI64
+ OS_NATIVE_ENTER(env, that, _1g_1object_1get__I_3B_3II_FUNC);
+#else
+ OS_NATIVE_ENTER(env, that, _1g_1object_1get__J_3B_3IJ_FUNC);
+#endif
if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
g_object_get((GObject *)arg0, (const gchar *)lparg1, lparg2, (const gchar *)NULL);
fail:
if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, JNI_ABORT);
- OS_NATIVE_EXIT(env, that, _1g_1object_1get_FUNC);
+#ifndef JNI64
+ OS_NATIVE_EXIT(env, that, _1g_1object_1get__I_3B_3II_FUNC);
+#else
+ OS_NATIVE_EXIT(env, that, _1g_1object_1get__J_3B_3IJ_FUNC);
+#endif
+}
+#endif
+
+#if (!defined(NO__1g_1object_1get__I_3B_3JI) && !defined(JNI64)) || (!defined(NO__1g_1object_1get__J_3B_3JJ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1get__I_3B_3JI)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jlongArray arg2, jintLong arg3)
+#else
+JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1get__J_3B_3JJ)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jlongArray arg2, jintLong arg3)
+#endif
+{
+ jbyte *lparg1=NULL;
+ jlong *lparg2=NULL;
+#ifndef JNI64
+ OS_NATIVE_ENTER(env, that, _1g_1object_1get__I_3B_3JI_FUNC);
+#else
+ OS_NATIVE_ENTER(env, that, _1g_1object_1get__J_3B_3JJ_FUNC);
+#endif
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetLongArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ g_object_get((GObject *)arg0, (const gchar *)lparg1, lparg2, (const gchar *)NULL);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseLongArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, JNI_ABORT);
+#ifndef JNI64
+ OS_NATIVE_EXIT(env, that, _1g_1object_1get__I_3B_3JI_FUNC);
+#else
+ OS_NATIVE_EXIT(env, that, _1g_1object_1get__J_3B_3JJ_FUNC);
+#endif
}
#endif
@@ -4507,6 +4558,54 @@ fail:
}
#endif
+#ifndef NO__1g_1utf16_1offset_1to_1pointer
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1utf16_1offset_1to_1pointer)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1utf16_1offset_1to_1pointer_FUNC);
+ rc = (jintLong)g_utf16_offset_to_pointer((const gchar *)arg0, arg1);
+ OS_NATIVE_EXIT(env, that, _1g_1utf16_1offset_1to_1pointer_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1g_1utf16_1offset_1to_1utf8_1offset
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1utf16_1offset_1to_1utf8_1offset)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1utf16_1offset_1to_1utf8_1offset_FUNC);
+ rc = (jintLong)g_utf16_offset_to_utf8_offset((const gchar *)arg0, arg1);
+ OS_NATIVE_EXIT(env, that, _1g_1utf16_1offset_1to_1utf8_1offset_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1g_1utf16_1pointer_1to_1offset
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1utf16_1pointer_1to_1offset)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1utf16_1pointer_1to_1offset_FUNC);
+ rc = (jintLong)g_utf16_pointer_to_offset((const gchar *)arg0, (const gchar *)arg1);
+ OS_NATIVE_EXIT(env, that, _1g_1utf16_1pointer_1to_1offset_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1g_1utf16_1strlen
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1utf16_1strlen)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1utf16_1strlen_FUNC);
+ rc = (jintLong)g_utf16_strlen((const gchar *)arg0, arg1);
+ OS_NATIVE_EXIT(env, that, _1g_1utf16_1strlen_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1g_1utf16_1to_1utf8
JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1utf16_1to_1utf8)
(JNIEnv *env, jclass that, jcharArray arg0, jintLong arg1, jintLongArray arg2, jintLongArray arg3, jintLongArray arg4)
@@ -4564,6 +4663,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1utf8_1offset_1to_1pointer)
}
#endif
+#ifndef NO__1g_1utf8_1offset_1to_1utf16_1offset
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1utf8_1offset_1to_1utf16_1offset)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1utf8_1offset_1to_1utf16_1offset_FUNC);
+ rc = (jintLong)g_utf8_offset_to_utf16_offset((const gchar *)arg0, arg1);
+ OS_NATIVE_EXIT(env, that, _1g_1utf8_1offset_1to_1utf16_1offset_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1g_1utf8_1pointer_1to_1offset
JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1utf8_1pointer_1to_1offset)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
@@ -6851,6 +6962,18 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1window_1invalidate_1region)
}
#endif
+#ifndef NO__1gdk_1window_1is_1viewable
+JNIEXPORT jboolean JNICALL OS_NATIVE(_1gdk_1window_1is_1viewable)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jboolean rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gdk_1window_1is_1viewable_FUNC);
+ rc = (jboolean)gdk_window_is_viewable((GdkWindow *)arg0);
+ OS_NATIVE_EXIT(env, that, _1gdk_1window_1is_1viewable_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1window_1is_1visible
JNIEXPORT jboolean JNICALL OS_NATIVE(_1gdk_1window_1is_1visible)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -7298,6 +7421,35 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1accel_1label_1set_1accel_1widget)
}
#endif
+#ifndef NO__1gtk_1accelerator_1get_1default_1mod_1mask
+JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1accelerator_1get_1default_1mod_1mask)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1accelerator_1get_1default_1mod_1mask_FUNC);
+ rc = (jint)gtk_accelerator_get_default_mod_mask();
+ OS_NATIVE_EXIT(env, that, _1gtk_1accelerator_1get_1default_1mod_1mask_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1gtk_1accelerator_1parse
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1accelerator_1parse)
+ (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2)
+{
+ jint *lparg1=NULL;
+ jint *lparg2=NULL;
+ OS_NATIVE_ENTER(env, that, _1gtk_1accelerator_1parse_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ gtk_accelerator_parse((const gchar *)arg0, (guint *)lparg1, (GdkModifierType *)lparg2);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
+ OS_NATIVE_EXIT(env, that, _1gtk_1accelerator_1parse_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1adjustment_1changed
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1adjustment_1changed)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -7448,6 +7600,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1button_1set_1relief)
}
#endif
+#ifndef NO__1gtk_1calendar_1clear_1marks
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1calendar_1clear_1marks)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1calendar_1clear_1marks_FUNC);
+/*
+ gtk_calendar_clear_marks((GtkCalendar *)arg0);
+*/
+ {
+ LOAD_FUNCTION(fp, gtk_calendar_clear_marks)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkCalendar *))fp)((GtkCalendar *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1calendar_1clear_1marks_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1calendar_1display_1options
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1calendar_1display_1options)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
@@ -7494,6 +7664,24 @@ fail:
}
#endif
+#ifndef NO__1gtk_1calendar_1mark_1day
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1calendar_1mark_1day)
+ (JNIEnv *env, jclass that, jintLong arg0, jint arg1)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1calendar_1mark_1day_FUNC);
+/*
+ gtk_calendar_mark_day((GtkCalendar *)arg0, (guint)arg1);
+*/
+ {
+ LOAD_FUNCTION(fp, gtk_calendar_mark_day)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkCalendar *, guint))fp)((GtkCalendar *)arg0, (guint)arg1);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1calendar_1mark_1day_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1calendar_1new
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1calendar_1new)
(JNIEnv *env, jclass that)
@@ -7752,6 +7940,24 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1clipboard_1get)
}
#endif
+#ifndef NO__1gtk_1clipboard_1set_1can_1store
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1clipboard_1set_1can_1store)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1clipboard_1set_1can_1store_FUNC);
+/*
+ gtk_clipboard_set_can_store((GtkClipboard *)arg0, (const GtkTargetEntry *)arg1, (gint)arg2);
+*/
+ {
+ LOAD_FUNCTION(fp, gtk_clipboard_set_can_store)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkClipboard *, const GtkTargetEntry *, gint))fp)((GtkClipboard *)arg0, (const GtkTargetEntry *)arg1, (gint)arg2);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1clipboard_1set_1can_1store_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1clipboard_1set_1with_1data
JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1clipboard_1set_1with_1data)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jintLong arg4, jintLong arg5)
@@ -7776,6 +7982,24 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1clipboard_1set_1with_1owner)
}
#endif
+#ifndef NO__1gtk_1clipboard_1store
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1clipboard_1store)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1clipboard_1store_FUNC);
+/*
+ gtk_clipboard_store((GtkClipboard *)arg0);
+*/
+ {
+ LOAD_FUNCTION(fp, gtk_clipboard_store)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkClipboard *))fp)((GtkClipboard *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1clipboard_1store_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1clipboard_1wait_1for_1contents
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1clipboard_1wait_1for_1contents)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
@@ -11822,6 +12046,26 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1print_1settings_1get_1collate)
}
#endif
+#ifndef NO__1gtk_1print_1settings_1get_1duplex
+JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1print_1settings_1get_1duplex)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1print_1settings_1get_1duplex_FUNC);
+/*
+ rc = (jint)gtk_print_settings_get_duplex(arg0);
+*/
+ {
+ LOAD_FUNCTION(fp, gtk_print_settings_get_duplex)
+ if (fp) {
+ rc = (jint)((jint (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1print_1settings_1get_1duplex_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gtk_1print_1settings_1get_1n_1copies
JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1print_1settings_1get_1n_1copies)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -12049,6 +12293,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1print_1settings_1set_1collate)
}
#endif
+#ifndef NO__1gtk_1print_1settings_1set_1duplex
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1print_1settings_1set_1duplex)
+ (JNIEnv *env, jclass that, jintLong arg0, jint arg1)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1print_1settings_1set_1duplex_FUNC);
+/*
+ gtk_print_settings_set_duplex(arg0, arg1);
+*/
+ {
+ LOAD_FUNCTION(fp, gtk_print_settings_set_duplex)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jint))fp)(arg0, arg1);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1print_1settings_1set_1duplex_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1print_1settings_1set_1n_1copies
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1print_1settings_1set_1n_1copies)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
@@ -12269,6 +12531,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1print_1unix_1dialog_1set_1current_1page)
}
#endif
+#ifndef NO__1gtk_1print_1unix_1dialog_1set_1embed_1page_1setup
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1print_1unix_1dialog_1set_1embed_1page_1setup)
+ (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1print_1unix_1dialog_1set_1embed_1page_1setup_FUNC);
+/*
+ gtk_print_unix_dialog_set_embed_page_setup(arg0, arg1);
+*/
+ {
+ LOAD_FUNCTION(fp, gtk_print_unix_dialog_set_embed_page_setup)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jboolean))fp)(arg0, arg1);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1print_1unix_1dialog_1set_1embed_1page_1setup_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1print_1unix_1dialog_1set_1manual_1capabilities
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1print_1unix_1dialog_1set_1manual_1capabilities)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
@@ -13013,6 +13293,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1status_1icon_1new)
}
#endif
+#ifndef NO__1gtk_1status_1icon_1position_1menu_1func
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1status_1icon_1position_1menu_1func)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1status_1icon_1position_1menu_1func_FUNC);
+ rc = (jintLong)gtk_status_icon_position_menu_func();
+ OS_NATIVE_EXIT(env, that, _1gtk_1status_1icon_1position_1menu_1func_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gtk_1status_1icon_1set_1from_1pixbuf
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1status_1icon_1set_1from_1pixbuf)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
@@ -17513,6 +17805,16 @@ JNIEXPORT void JNICALL OS_NATIVE(_1pango_1font_1description_1set_1style)
}
#endif
+#ifndef NO__1pango_1font_1description_1set_1variant
+JNIEXPORT void JNICALL OS_NATIVE(_1pango_1font_1description_1set_1variant)
+ (JNIEnv *env, jclass that, jintLong arg0, jint arg1)
+{
+ OS_NATIVE_ENTER(env, that, _1pango_1font_1description_1set_1variant_FUNC);
+ pango_font_description_set_variant((PangoFontDescription *)arg0, (PangoVariant)arg1);
+ OS_NATIVE_EXIT(env, that, _1pango_1font_1description_1set_1variant_FUNC);
+}
+#endif
+
#ifndef NO__1pango_1font_1description_1set_1weight
JNIEXPORT void JNICALL OS_NATIVE(_1pango_1font_1description_1set_1weight)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
@@ -18401,6 +18703,54 @@ JNIEXPORT void JNICALL OS_NATIVE(g_1value_1unset)
}
#endif
+#ifndef NO_gdk_1threads_1enter
+JNIEXPORT void JNICALL OS_NATIVE(gdk_1threads_1enter)
+ (JNIEnv *env, jclass that)
+{
+ OS_NATIVE_ENTER(env, that, gdk_1threads_1enter_FUNC);
+ gdk_threads_enter();
+ OS_NATIVE_EXIT(env, that, gdk_1threads_1enter_FUNC);
+}
+#endif
+
+#ifndef NO_gdk_1threads_1init
+JNIEXPORT void JNICALL OS_NATIVE(gdk_1threads_1init)
+ (JNIEnv *env, jclass that)
+{
+ OS_NATIVE_ENTER(env, that, gdk_1threads_1init_FUNC);
+ gdk_threads_init();
+ OS_NATIVE_EXIT(env, that, gdk_1threads_1init_FUNC);
+}
+#endif
+
+#ifndef NO_gdk_1threads_1leave
+JNIEXPORT void JNICALL OS_NATIVE(gdk_1threads_1leave)
+ (JNIEnv *env, jclass that)
+{
+ OS_NATIVE_ENTER(env, that, gdk_1threads_1leave_FUNC);
+ gdk_threads_leave();
+ OS_NATIVE_EXIT(env, that, gdk_1threads_1leave_FUNC);
+}
+#endif
+
+#ifndef NO_gdk_1threads_1set_1lock_1functions
+JNIEXPORT void JNICALL OS_NATIVE(gdk_1threads_1set_1lock_1functions)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ OS_NATIVE_ENTER(env, that, gdk_1threads_1set_1lock_1functions_FUNC);
+/*
+ gdk_threads_set_lock_functions(arg0, arg1);
+*/
+ {
+ LOAD_FUNCTION(fp, gdk_threads_set_lock_functions)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, gdk_1threads_1set_1lock_1functions_FUNC);
+}
+#endif
+
#ifndef NO_localeconv_1decimal_1point
JNIEXPORT jintLong JNICALL OS_NATIVE(localeconv_1decimal_1point)
(JNIEnv *env, jclass that)
diff --git a/os_custom.c b/os_custom.c
index 704af6c..c964103 100644
--- a/os_custom.c
+++ b/os_custom.c
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved.
+* Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -118,3 +118,72 @@ fail:
}
#endif
+glong g_utf16_strlen(const gchar *str, glong max) {
+ const gchar *s = str;
+ guchar ch;
+ glong offset = 0;
+ if (!s || max == 0) return 0;
+ if (max < 0) {
+ while (*s) {
+ if (0xf0 <= *(guchar*)s && *(guchar*)s <= 0xfd) offset++;
+ s = g_utf8_next_char (s);
+ offset++;
+ }
+
+ } else {
+ while (*s) {
+ ch = *(guchar*)s;
+ s = g_utf8_next_char (s);
+ if (s - str > max) break;
+ if (0xf0 <= ch && ch <= 0xfd) offset++;
+ offset++;
+ }
+ }
+ return offset;
+}
+
+glong g_utf16_pointer_to_offset(const gchar *str, const gchar * pos) {
+ const gchar *s = str;
+ glong offset = 0;
+ if (!s || !pos) return 0;
+ while (s < pos && *s) {
+ if (0xf0 <= *(guchar*)s && *(guchar*)s <= 0xfd) offset++;
+ s = g_utf8_next_char (s);
+ offset++;
+ }
+ return offset;
+}
+
+gchar* g_utf16_offset_to_pointer(const gchar* str, glong offset) {
+ const gchar *s = str;
+ if (!s) return 0;
+ while (offset-- > 0 && *s) {
+ if (0xf0 <= *(guchar*)s && *(guchar*)s <= 0xfd) offset--;
+ s = g_utf8_next_char (s);
+ }
+ return (gchar *)s;
+}
+
+glong g_utf16_offset_to_utf8_offset(const gchar* str, glong offset) {
+ glong r = 0;
+ const gchar *s = str;
+ if (!s) return 0;
+ while (offset-- > 0 && *s) {
+ if (0xf0 <= *(guchar*)s && *(guchar*)s <= 0xfd) offset--;
+ s = g_utf8_next_char (s);
+ r++;
+ }
+ return r;
+}
+
+glong g_utf8_offset_to_utf16_offset(const gchar* str, glong offset) {
+ glong r = 0;
+ const gchar *s = str;
+ if (!s) return 0;
+ while (offset-- > 0 && *s) {
+ if (0xf0 <= *(guchar*)s && *(guchar*)s <= 0xfd) r++;
+ s = g_utf8_next_char (s);
+ r++;
+ }
+ return r;
+}
diff --git a/os_custom.h b/os_custom.h
index 1f2b7de..ecf7d7b 100644
--- a/os_custom.h
+++ b/os_custom.h
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved.
+* Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -68,8 +68,12 @@
#define gtk_calendar_get_date_LIB LIB_GTK
#define gtk_calendar_new_LIB LIB_GTK
#define gtk_calendar_select_day_LIB LIB_GTK
+#define gtk_calendar_mark_day_LIB LIB_GTK
+#define gtk_calendar_clear_marks_LIB LIB_GTK
#define gtk_calendar_select_month_LIB LIB_GTK
#define gtk_calendar_set_display_options_LIB LIB_GTK
+#define gtk_clipboard_store_LIB LIB_GTK
+#define gtk_clipboard_set_can_store_LIB LIB_GTK
#define gtk_cell_layout_set_attributes_LIB LIB_GTK
#define gtk_cell_layout_clear_LIB LIB_GTK
#define gtk_cell_layout_pack_start_LIB LIB_GTK
@@ -145,6 +149,7 @@
#define gtk_status_icon_set_from_pixbuf_LIB LIB_GTK
#define gtk_status_icon_set_visible_LIB LIB_GTK
#define gtk_status_icon_set_tooltip_LIB LIB_GTK
+#define gtk_status_icon_position_menu_LIB LIB_GTK
#define gtk_window_get_group_LIB LIB_GTK
#define gtk_window_get_opacity_LIB LIB_GTK
#define gdk_window_restack_LIB LIB_GDK
@@ -156,6 +161,7 @@
#define gtk_widget_set_tooltip_text_LIB LIB_GTK
#define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK
#define gdk_x11_screen_lookup_visual_LIB LIB_GDK
+#define gdk_threads_set_lock_functions_LIB LIB_GDK
#define atk_object_add_relationship_LIB LIB_ATK
#define atk_object_remove_relationship_LIB LIB_ATK
@@ -217,6 +223,7 @@
#define gtk_print_settings_foreach_LIB LIB_GTK
#define gtk_print_settings_get_LIB LIB_GTK
#define gtk_print_settings_get_collate_LIB LIB_GTK
+#define gtk_print_settings_get_duplex_LIB LIB_GTK
#define gtk_print_settings_get_n_copies_LIB LIB_GTK
#define gtk_print_settings_get_orientation_LIB LIB_GTK
#define gtk_print_settings_get_page_ranges_LIB LIB_GTK
@@ -228,6 +235,7 @@
#define gtk_print_settings_new_LIB LIB_GTK
#define gtk_print_settings_set_LIB LIB_GTK
#define gtk_print_settings_set_collate_LIB LIB_GTK
+#define gtk_print_settings_set_duplex_LIB LIB_GTK
#define gtk_print_settings_set_n_copies_LIB LIB_GTK
#define gtk_print_settings_set_orientation_LIB LIB_GTK
#define gtk_print_settings_set_page_ranges_LIB LIB_GTK
@@ -240,6 +248,7 @@
#define gtk_print_unix_dialog_new_LIB LIB_GTK
#define gtk_print_unix_dialog_set_current_page_LIB LIB_GTK
#define gtk_print_unix_dialog_set_manual_capabilities_LIB LIB_GTK
+#define gtk_print_unix_dialog_set_embed_page_setup_LIB LIB_GTK
#define gtk_print_unix_dialog_set_page_setup_LIB LIB_GTK
#define gtk_print_unix_dialog_set_settings_LIB LIB_GTK
#define gtk_printer_get_backend_LIB LIB_GTK
@@ -343,3 +352,12 @@
#define gtk_style_get_white_gc(arg0, arg1) *arg1 = (arg0)->white_gc
#define localeconv_decimal_point() localeconv()->decimal_point
+#define gtk_status_icon_position_menu_func() 0; \
+LOAD_FUNCTION(fp, gtk_status_icon_position_menu) \
+rc = (jintLong)fp;
+
+glong g_utf16_pointer_to_offset(const gchar*, const gchar*);
+gchar* g_utf16_offset_to_pointer(const gchar*, glong);
+glong g_utf16_strlen(const gchar*, glong max);
+glong g_utf16_offset_to_utf8_offset(const gchar*, glong);
+glong g_utf8_offset_to_utf16_offset(const gchar*, glong);
diff --git a/os_stats.c b/os_stats.c
index 9e17829..a835169 100644
--- a/os_stats.c
+++ b/os_stats.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -18,8 +18,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1370;
-int OS_nativeFunctionCallCount[1370];
+int OS_nativeFunctionCount = 1393;
+int OS_nativeFunctionCallCount[1393];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -265,6 +265,7 @@ char * OS_nativeFunctionNames[] = {
"_1g_1list_1data",
"_1g_1list_1free",
"_1g_1list_1free_11",
+ "_1g_1list_1last",
"_1g_1list_1length",
"_1g_1list_1next",
"_1g_1list_1nth",
@@ -290,7 +291,16 @@ char * OS_nativeFunctionNames[] = {
"_1g_1main_1context_1query",
"_1g_1main_1context_1release",
"_1g_1malloc",
- "_1g_1object_1get",
+#ifndef JNI64
+ "_1g_1object_1get__I_3B_3II",
+#else
+ "_1g_1object_1get__J_3B_3IJ",
+#endif
+#ifndef JNI64
+ "_1g_1object_1get__I_3B_3JI",
+#else
+ "_1g_1object_1get__J_3B_3JJ",
+#endif
"_1g_1object_1get_1qdata",
"_1g_1object_1new",
"_1g_1object_1notify",
@@ -389,8 +399,13 @@ char * OS_nativeFunctionNames[] = {
"_1g_1type_1parent",
"_1g_1type_1query",
"_1g_1type_1register_1static",
+ "_1g_1utf16_1offset_1to_1pointer",
+ "_1g_1utf16_1offset_1to_1utf8_1offset",
+ "_1g_1utf16_1pointer_1to_1offset",
+ "_1g_1utf16_1strlen",
"_1g_1utf16_1to_1utf8",
"_1g_1utf8_1offset_1to_1pointer",
+ "_1g_1utf8_1offset_1to_1utf16_1offset",
"_1g_1utf8_1pointer_1to_1offset",
"_1g_1utf8_1strlen",
#ifndef JNI64
@@ -556,6 +571,7 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1window_1hide",
"_1gdk_1window_1invalidate_1rect",
"_1gdk_1window_1invalidate_1region",
+ "_1gdk_1window_1is_1viewable",
"_1gdk_1window_1is_1visible",
"_1gdk_1window_1lookup",
"_1gdk_1window_1lower",
@@ -594,6 +610,8 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1accel_1group_1new",
"_1gtk_1accel_1groups_1activate",
"_1gtk_1accel_1label_1set_1accel_1widget",
+ "_1gtk_1accelerator_1get_1default_1mod_1mask",
+ "_1gtk_1accelerator_1parse",
"_1gtk_1adjustment_1changed",
"_1gtk_1adjustment_1new",
"_1gtk_1adjustment_1set_1value",
@@ -608,8 +626,10 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1button_1get_1relief",
"_1gtk_1button_1new",
"_1gtk_1button_1set_1relief",
+ "_1gtk_1calendar_1clear_1marks",
"_1gtk_1calendar_1display_1options",
"_1gtk_1calendar_1get_1date",
+ "_1gtk_1calendar_1mark_1day",
"_1gtk_1calendar_1new",
"_1gtk_1calendar_1select_1day",
"_1gtk_1calendar_1select_1month",
@@ -628,8 +648,10 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1check_1version",
"_1gtk_1clipboard_1clear",
"_1gtk_1clipboard_1get",
+ "_1gtk_1clipboard_1set_1can_1store",
"_1gtk_1clipboard_1set_1with_1data",
"_1gtk_1clipboard_1set_1with_1owner",
+ "_1gtk_1clipboard_1store",
"_1gtk_1clipboard_1wait_1for_1contents",
"_1gtk_1color_1selection_1dialog_1new",
"_1gtk_1color_1selection_1get_1current_1color",
@@ -930,6 +952,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1print_1settings_1foreach",
"_1gtk_1print_1settings_1get",
"_1gtk_1print_1settings_1get_1collate",
+ "_1gtk_1print_1settings_1get_1duplex",
"_1gtk_1print_1settings_1get_1n_1copies",
"_1gtk_1print_1settings_1get_1orientation",
"_1gtk_1print_1settings_1get_1page_1ranges",
@@ -941,6 +964,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1print_1settings_1new",
"_1gtk_1print_1settings_1set",
"_1gtk_1print_1settings_1set_1collate",
+ "_1gtk_1print_1settings_1set_1duplex",
"_1gtk_1print_1settings_1set_1n_1copies",
"_1gtk_1print_1settings_1set_1orientation",
"_1gtk_1print_1settings_1set_1page_1ranges",
@@ -952,6 +976,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1print_1unix_1dialog_1get_1settings",
"_1gtk_1print_1unix_1dialog_1new",
"_1gtk_1print_1unix_1dialog_1set_1current_1page",
+ "_1gtk_1print_1unix_1dialog_1set_1embed_1page_1setup",
"_1gtk_1print_1unix_1dialog_1set_1manual_1capabilities",
"_1gtk_1print_1unix_1dialog_1set_1page_1setup",
"_1gtk_1print_1unix_1dialog_1set_1settings",
@@ -1011,6 +1036,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1status_1icon_1get_1geometry",
"_1gtk_1status_1icon_1get_1visible",
"_1gtk_1status_1icon_1new",
+ "_1gtk_1status_1icon_1position_1menu_1func",
"_1gtk_1status_1icon_1set_1from_1pixbuf",
"_1gtk_1status_1icon_1set_1tooltip",
"_1gtk_1status_1icon_1set_1visible",
@@ -1407,6 +1433,7 @@ char * OS_nativeFunctionNames[] = {
"_1pango_1font_1description_1set_1size",
"_1pango_1font_1description_1set_1stretch",
"_1pango_1font_1description_1set_1style",
+ "_1pango_1font_1description_1set_1variant",
"_1pango_1font_1description_1set_1weight",
"_1pango_1font_1description_1to_1string",
"_1pango_1font_1face_1describe",
@@ -1476,6 +1503,10 @@ char * OS_nativeFunctionNames[] = {
"g_1value_1set_1int",
"g_1value_1set_1int64",
"g_1value_1unset",
+ "gdk_1threads_1enter",
+ "gdk_1threads_1init",
+ "gdk_1threads_1leave",
+ "gdk_1threads_1set_1lock_1functions",
"localeconv_1decimal_1point",
#ifndef JNI64
"memmove__ILorg_eclipse_swt_internal_gtk_GInterfaceInfo_2I",
diff --git a/os_stats.h b/os_stats.h
index 6901aa2..4f42ff4 100644
--- a/os_stats.h
+++ b/os_stats.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -273,6 +273,7 @@ typedef enum {
_1g_1list_1data_FUNC,
_1g_1list_1free_FUNC,
_1g_1list_1free_11_FUNC,
+ _1g_1list_1last_FUNC,
_1g_1list_1length_FUNC,
_1g_1list_1next_FUNC,
_1g_1list_1nth_FUNC,
@@ -298,7 +299,16 @@ typedef enum {
_1g_1main_1context_1query_FUNC,
_1g_1main_1context_1release_FUNC,
_1g_1malloc_FUNC,
- _1g_1object_1get_FUNC,
+#ifndef JNI64
+ _1g_1object_1get__I_3B_3II_FUNC,
+#else
+ _1g_1object_1get__J_3B_3IJ_FUNC,
+#endif
+#ifndef JNI64
+ _1g_1object_1get__I_3B_3JI_FUNC,
+#else
+ _1g_1object_1get__J_3B_3JJ_FUNC,
+#endif
_1g_1object_1get_1qdata_FUNC,
_1g_1object_1new_FUNC,
_1g_1object_1notify_FUNC,
@@ -397,8 +407,13 @@ typedef enum {
_1g_1type_1parent_FUNC,
_1g_1type_1query_FUNC,
_1g_1type_1register_1static_FUNC,
+ _1g_1utf16_1offset_1to_1pointer_FUNC,
+ _1g_1utf16_1offset_1to_1utf8_1offset_FUNC,
+ _1g_1utf16_1pointer_1to_1offset_FUNC,
+ _1g_1utf16_1strlen_FUNC,
_1g_1utf16_1to_1utf8_FUNC,
_1g_1utf8_1offset_1to_1pointer_FUNC,
+ _1g_1utf8_1offset_1to_1utf16_1offset_FUNC,
_1g_1utf8_1pointer_1to_1offset_FUNC,
_1g_1utf8_1strlen_FUNC,
#ifndef JNI64
@@ -564,6 +579,7 @@ typedef enum {
_1gdk_1window_1hide_FUNC,
_1gdk_1window_1invalidate_1rect_FUNC,
_1gdk_1window_1invalidate_1region_FUNC,
+ _1gdk_1window_1is_1viewable_FUNC,
_1gdk_1window_1is_1visible_FUNC,
_1gdk_1window_1lookup_FUNC,
_1gdk_1window_1lower_FUNC,
@@ -602,6 +618,8 @@ typedef enum {
_1gtk_1accel_1group_1new_FUNC,
_1gtk_1accel_1groups_1activate_FUNC,
_1gtk_1accel_1label_1set_1accel_1widget_FUNC,
+ _1gtk_1accelerator_1get_1default_1mod_1mask_FUNC,
+ _1gtk_1accelerator_1parse_FUNC,
_1gtk_1adjustment_1changed_FUNC,
_1gtk_1adjustment_1new_FUNC,
_1gtk_1adjustment_1set_1value_FUNC,
@@ -616,8 +634,10 @@ typedef enum {
_1gtk_1button_1get_1relief_FUNC,
_1gtk_1button_1new_FUNC,
_1gtk_1button_1set_1relief_FUNC,
+ _1gtk_1calendar_1clear_1marks_FUNC,
_1gtk_1calendar_1display_1options_FUNC,
_1gtk_1calendar_1get_1date_FUNC,
+ _1gtk_1calendar_1mark_1day_FUNC,
_1gtk_1calendar_1new_FUNC,
_1gtk_1calendar_1select_1day_FUNC,
_1gtk_1calendar_1select_1month_FUNC,
@@ -636,8 +656,10 @@ typedef enum {
_1gtk_1check_1version_FUNC,
_1gtk_1clipboard_1clear_FUNC,
_1gtk_1clipboard_1get_FUNC,
+ _1gtk_1clipboard_1set_1can_1store_FUNC,
_1gtk_1clipboard_1set_1with_1data_FUNC,
_1gtk_1clipboard_1set_1with_1owner_FUNC,
+ _1gtk_1clipboard_1store_FUNC,
_1gtk_1clipboard_1wait_1for_1contents_FUNC,
_1gtk_1color_1selection_1dialog_1new_FUNC,
_1gtk_1color_1selection_1get_1current_1color_FUNC,
@@ -938,6 +960,7 @@ typedef enum {
_1gtk_1print_1settings_1foreach_FUNC,
_1gtk_1print_1settings_1get_FUNC,
_1gtk_1print_1settings_1get_1collate_FUNC,
+ _1gtk_1print_1settings_1get_1duplex_FUNC,
_1gtk_1print_1settings_1get_1n_1copies_FUNC,
_1gtk_1print_1settings_1get_1orientation_FUNC,
_1gtk_1print_1settings_1get_1page_1ranges_FUNC,
@@ -949,6 +972,7 @@ typedef enum {
_1gtk_1print_1settings_1new_FUNC,
_1gtk_1print_1settings_1set_FUNC,
_1gtk_1print_1settings_1set_1collate_FUNC,
+ _1gtk_1print_1settings_1set_1duplex_FUNC,
_1gtk_1print_1settings_1set_1n_1copies_FUNC,
_1gtk_1print_1settings_1set_1orientation_FUNC,
_1gtk_1print_1settings_1set_1page_1ranges_FUNC,
@@ -960,6 +984,7 @@ typedef enum {
_1gtk_1print_1unix_1dialog_1get_1settings_FUNC,
_1gtk_1print_1unix_1dialog_1new_FUNC,
_1gtk_1print_1unix_1dialog_1set_1current_1page_FUNC,
+ _1gtk_1print_1unix_1dialog_1set_1embed_1page_1setup_FUNC,
_1gtk_1print_1unix_1dialog_1set_1manual_1capabilities_FUNC,
_1gtk_1print_1unix_1dialog_1set_1page_1setup_FUNC,
_1gtk_1print_1unix_1dialog_1set_1settings_FUNC,
@@ -1019,6 +1044,7 @@ typedef enum {
_1gtk_1status_1icon_1get_1geometry_FUNC,
_1gtk_1status_1icon_1get_1visible_FUNC,
_1gtk_1status_1icon_1new_FUNC,
+ _1gtk_1status_1icon_1position_1menu_1func_FUNC,
_1gtk_1status_1icon_1set_1from_1pixbuf_FUNC,
_1gtk_1status_1icon_1set_1tooltip_FUNC,
_1gtk_1status_1icon_1set_1visible_FUNC,
@@ -1415,6 +1441,7 @@ typedef enum {
_1pango_1font_1description_1set_1size_FUNC,
_1pango_1font_1description_1set_1stretch_FUNC,
_1pango_1font_1description_1set_1style_FUNC,
+ _1pango_1font_1description_1set_1variant_FUNC,
_1pango_1font_1description_1set_1weight_FUNC,
_1pango_1font_1description_1to_1string_FUNC,
_1pango_1font_1face_1describe_FUNC,
@@ -1484,6 +1511,10 @@ typedef enum {
g_1value_1set_1int_FUNC,
g_1value_1set_1int64_FUNC,
g_1value_1unset_FUNC,
+ gdk_1threads_1enter_FUNC,
+ gdk_1threads_1init_FUNC,
+ gdk_1threads_1leave_FUNC,
+ gdk_1threads_1set_1lock_1functions_FUNC,
localeconv_1decimal_1point_FUNC,
#ifndef JNI64
memmove__ILorg_eclipse_swt_internal_gtk_GInterfaceInfo_2I_FUNC,
diff --git a/swt.h b/swt.h
index 55756a6..67b75b6 100644
--- a/swt.h
+++ b/swt.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/version.txt b/version.txt
index 2e1a874..9c3c4c6 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-version 3.659
\ No newline at end of file
+version 3.735
\ No newline at end of file
diff --git a/webkitgtk.h b/webkitgtk.h
index 05b9a2e..90685cf 100644
--- a/webkitgtk.h
+++ b/webkitgtk.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2009, 2011 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -31,4 +31,9 @@
#include <webkit/webkitwebpolicydecision.h>
#include <webkit/webkitwebsettings.h>
#include <webkit/webkitwebview.h>
+
+#if WEBKIT_CHECK_VERSION(1,4,0)
+#include <webkit/webkitglobals.h>
+#endif
+
#endif /* INC_webkitgtk_H */
diff --git a/xpcom_custom.cpp b/xpcom_custom.cpp
index 32741cf..78e2a00 100644
--- a/xpcom_custom.cpp
+++ b/xpcom_custom.cpp
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/xpcom_custom.h b/xpcom_custom.h
index 21bc338..5bfb56e 100644
--- a/xpcom_custom.h
+++ b/xpcom_custom.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/xpcominit.cpp b/xpcominit.cpp
index 45b342c..ac77109 100644
--- a/xpcominit.cpp
+++ b/xpcominit.cpp
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,19 @@
#define XPCOMInit_NATIVE(func) Java_org_eclipse_swt_internal_mozilla_init_XPCOMInit_##func
+#ifndef NO_GREProperty_1sizeof
+extern "C" JNIEXPORT jint JNICALL XPCOMInit_NATIVE(GREProperty_1sizeof)(JNIEnv *env, jclass that);
+JNIEXPORT jint JNICALL XPCOMInit_NATIVE(GREProperty_1sizeof)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ XPCOMInit_NATIVE_ENTER(env, that, GREProperty_1sizeof_FUNC);
+ rc = (jint)GREProperty_sizeof();
+ XPCOMInit_NATIVE_EXIT(env, that, GREProperty_1sizeof_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_GREVersionRange_1sizeof
extern "C" JNIEXPORT jint JNICALL XPCOMInit_NATIVE(GREVersionRange_1sizeof)(JNIEnv *env, jclass that);
JNIEXPORT jint JNICALL XPCOMInit_NATIVE(GREVersionRange_1sizeof)
@@ -29,16 +42,19 @@ JNIEXPORT jint JNICALL XPCOMInit_NATIVE(GREVersionRange_1sizeof)
#endif
#ifndef NO__1GRE_1GetGREPathWithProperties
-extern "C" JNIEXPORT jint JNICALL XPCOMInit_NATIVE(_1GRE_1GetGREPathWithProperties)(JNIEnv *env, jclass that, jobject arg0, jint arg1, jintLong arg2, jint arg3, jintLong arg4, jint arg5);
+extern "C" JNIEXPORT jint JNICALL XPCOMInit_NATIVE(_1GRE_1GetGREPathWithProperties)(JNIEnv *env, jclass that, jobject arg0, jint arg1, jobject arg2, jint arg3, jintLong arg4, jint arg5);
JNIEXPORT jint JNICALL XPCOMInit_NATIVE(_1GRE_1GetGREPathWithProperties)
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jintLong arg2, jint arg3, jintLong arg4, jint arg5)
+ (JNIEnv *env, jclass that, jobject arg0, jint arg1, jobject arg2, jint arg3, jintLong arg4, jint arg5)
{
GREVersionRange _arg0, *lparg0=NULL;
+ GREProperty _arg2, *lparg2=NULL;
jint rc = 0;
XPCOMInit_NATIVE_ENTER(env, that, _1GRE_1GetGREPathWithProperties_FUNC);
if (arg0) if ((lparg0 = getGREVersionRangeFields(env, arg0, &_arg0)) == NULL) goto fail;
- rc = (jint)GRE_GetGREPathWithProperties((const GREVersionRange *)lparg0, arg1, (const GREProperty *)arg2, arg3, (char *)arg4, arg5);
+ if (arg2) if ((lparg2 = getGREPropertyFields(env, arg2, &_arg2)) == NULL) goto fail;
+ rc = (jint)GRE_GetGREPathWithProperties((const GREVersionRange *)lparg0, arg1, (const GREProperty *)lparg2, arg3, (char *)arg4, arg5);
fail:
+ if (arg2 && lparg2) setGREPropertyFields(env, arg2, lparg2);
if (arg0 && lparg0) setGREVersionRangeFields(env, arg0, lparg0);
XPCOMInit_NATIVE_EXIT(env, that, _1GRE_1GetGREPathWithProperties_FUNC);
return rc;
diff --git a/xpcominit_stats.cpp b/xpcominit_stats.cpp
index 687a29a..84eb84c 100644
--- a/xpcominit_stats.cpp
+++ b/xpcominit_stats.cpp
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,9 +14,10 @@
#ifdef NATIVE_STATS
-int XPCOMInit_nativeFunctionCount = 4;
-int XPCOMInit_nativeFunctionCallCount[4];
+int XPCOMInit_nativeFunctionCount = 5;
+int XPCOMInit_nativeFunctionCallCount[5];
char * XPCOMInit_nativeFunctionNames[] = {
+ "GREProperty_1sizeof",
"GREVersionRange_1sizeof",
"_1GRE_1GetGREPathWithProperties",
"_1XPCOMGlueShutdown",
diff --git a/xpcominit_stats.h b/xpcominit_stats.h
index 048e3d7..20a17e9 100644
--- a/xpcominit_stats.h
+++ b/xpcominit_stats.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,6 +25,7 @@ extern char* XPCOMInit_nativeFunctionNames[];
#endif
typedef enum {
+ GREProperty_1sizeof_FUNC,
GREVersionRange_1sizeof_FUNC,
_1GRE_1GetGREPathWithProperties_FUNC,
_1XPCOMGlueShutdown_FUNC,
diff --git a/xpcominit_structs.cpp b/xpcominit_structs.cpp
index e9edfd6..31dff97 100644
--- a/xpcominit_structs.cpp
+++ b/xpcominit_structs.cpp
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,40 @@
#include "swt.h"
#include "xpcominit_structs.h"
+#ifndef NO_GREProperty
+typedef struct GREProperty_FID_CACHE {
+ int cached;
+ jclass clazz;
+ jfieldID property, value;
+} GREProperty_FID_CACHE;
+
+GREProperty_FID_CACHE GREPropertyFc;
+
+void cacheGREPropertyFields(JNIEnv *env, jobject lpObject)
+{
+ if (GREPropertyFc.cached) return;
+ GREPropertyFc.clazz = env->GetObjectClass(lpObject);
+ GREPropertyFc.property = env->GetFieldID(GREPropertyFc.clazz, "property", I_J);
+ GREPropertyFc.value = env->GetFieldID(GREPropertyFc.clazz, "value", I_J);
+ GREPropertyFc.cached = 1;
+}
+
+GREProperty *getGREPropertyFields(JNIEnv *env, jobject lpObject, GREProperty *lpStruct)
+{
+ if (!GREPropertyFc.cached) cacheGREPropertyFields(env, lpObject);
+ lpStruct->property = (const char *)env->GetIntLongField(lpObject, GREPropertyFc.property);
+ lpStruct->value = (const char *)env->GetIntLongField(lpObject, GREPropertyFc.value);
+ return lpStruct;
+}
+
+void setGREPropertyFields(JNIEnv *env, jobject lpObject, GREProperty *lpStruct)
+{
+ if (!GREPropertyFc.cached) cacheGREPropertyFields(env, lpObject);
+ env->SetIntLongField(lpObject, GREPropertyFc.property, (jintLong)lpStruct->property);
+ env->SetIntLongField(lpObject, GREPropertyFc.value, (jintLong)lpStruct->value);
+}
+#endif
+
#ifndef NO_GREVersionRange
typedef struct GREVersionRange_FID_CACHE {
int cached;
diff --git a/xpcominit_structs.h b/xpcominit_structs.h
index 096a9da..1918384 100644
--- a/xpcominit_structs.h
+++ b/xpcominit_structs.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,18 @@
#include "xpcominit.h"
+#ifndef NO_GREProperty
+void cacheGREPropertyFields(JNIEnv *env, jobject lpObject);
+GREProperty *getGREPropertyFields(JNIEnv *env, jobject lpObject, GREProperty *lpStruct);
+void setGREPropertyFields(JNIEnv *env, jobject lpObject, GREProperty *lpStruct);
+#define GREProperty_sizeof() sizeof(GREProperty)
+#else
+#define cacheGREPropertyFields(a,b)
+#define getGREPropertyFields(a,b,c) NULL
+#define setGREPropertyFields(a,b,c)
+#define GREProperty_sizeof() 0
+#endif
+
#ifndef NO_GREVersionRange
void cacheGREVersionRangeFields(JNIEnv *env, jobject lpObject);
GREVersionRange *getGREVersionRangeFields(JNIEnv *env, jobject lpObject, GREVersionRange *lpStruct);
hooks/post-receive
--
Debian packaging for swt-gtk.
More information about the pkg-java-commits
mailing list