summaryrefslogtreecommitdiffstats
path: root/bundles
diff options
context:
space:
mode:
authorSteve Northover <steve>2001-11-12 19:30:24 +0000
committerSteve Northover <steve>2001-11-12 19:30:24 +0000
commit893e08083a3a4983e56c9ca08144681568140061 (patch)
tree21b198dcbe5c7b55ea4d3a1b1e46a6286e5f4674 /bundles
parentfad88b21def05a66d8895a006e5b263380117619 (diff)
downloadeclipse.platform.swt-893e08083a3a4983e56c9ca08144681568140061.tar.gz
eclipse.platform.swt-893e08083a3a4983e56c9ca08144681568140061.tar.xz
eclipse.platform.swt-893e08083a3a4983e56c9ca08144681568140061.zip
*** empty log message ***
Diffstat (limited to 'bundles')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java20
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java19
3 files changed, 41 insertions, 19 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java
index 20d64172ca..55fd89ed2f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java
@@ -268,17 +268,17 @@ public Control [] getTabList () {
Control [] children = _getChildren ();
for (int i=0; i<children.length; i++) {
Control control = children [i];
- int [] argList = new int [] {OS.XmNnavigationType, 0};
- OS.XtGetValues (control.handle, argList, argList.length / 2);
- if (argList [1] == OS.XmEXCLUSIVE_TAB_GROUP) count++;
+ int type = control.getNavigationType ();
+ if (type == OS.XmEXCLUSIVE_TAB_GROUP) {
+ count++;
+ }
}
int index = 0;
Control [] tabList = new Control [count];
for (int i=0; i<children.length; i++) {
Control control = children [i];
- int [] argList = new int [] {OS.XmNnavigationType, 0};
- OS.XtGetValues (control.handle, argList, argList.length / 2);
- if (argList [1] == OS.XmEXCLUSIVE_TAB_GROUP) {
+ int type = control.getNavigationType ();
+ if (type == OS.XmEXCLUSIVE_TAB_GROUP) {
tabList [index++] = control;
}
}
@@ -573,13 +573,11 @@ public void setTabList (Control [] tabList) {
}
if (control != this) error (SWT.ERROR_INVALID_PARENT);
}
- int [] argList1 = new int [] {OS.XmNnavigationType, OS.XmTAB_GROUP};
Control [] children = _getChildren ();
for (int i=0; i<children.length; i++) {
Control control = children [i];
- OS.XtSetValues (control.handle, argList1, argList1.length / 2);
+ control.setNavigationType (OS.XmTAB_GROUP);
}
- int [] argList2 = new int [] {OS.XmNnavigationType, OS.XmEXCLUSIVE_TAB_GROUP};
for (int i=0; i<tabList.length; i++) {
/*
* Set the XmNnavigationType twice, once to clear the
@@ -588,8 +586,8 @@ public void setTabList (Control [] tabList) {
* same and does not change the tab order.
*/
Control control = tabList [i];
- OS.XtSetValues (control.handle, argList1, argList1.length / 2);
- OS.XtSetValues (control.handle, argList2, argList2.length / 2);
+ control.setNavigationType (OS.XmTAB_GROUP);
+ control.setNavigationType (OS.XmEXCLUSIVE_TAB_GROUP);
}
}
int traversalCode () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java
index 9edf568e92..ae4cb07108 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java
@@ -433,11 +433,8 @@ void createWidget (int index) {
* created. Unless explicitly changed, the overridded traversal
* order is the same as the default.
*/
- int [] argList1 = new int [] {OS.XmNnavigationType, 0};
- OS.XtGetValues (handle, argList1, argList1.length / 2);
- if (argList1 [1] == OS.XmTAB_GROUP) {
- int [] argList2 = new int [] {OS.XmNnavigationType, OS.XmEXCLUSIVE_TAB_GROUP};
- OS.XtSetValues (handle, argList2, argList2.length / 2);
+ if (getNavigationType () == OS.XmTAB_GROUP) {
+ setNavigationType (OS.XmEXCLUSIVE_TAB_GROUP);
}
}
int defaultBackground () {
@@ -770,6 +767,11 @@ public Menu getMenu () {
checkWidget();
return menu;
}
+int getNavigationType () {
+ int [] argList = {OS.XmNnavigationType, 0};
+ OS.XtSetValues (handle, argList, argList.length / 2);
+ return argList [1];
+}
/**
* Returns the receiver's parent, which must be a <code>Composite</code>
* or null when the receiver is a shell that was created with null or
@@ -2126,6 +2128,11 @@ public void setMenu (Menu menu) {
this.menu = menu;
}
+void setNavigationType (int type) {
+ int [] argList = {OS.XmNnavigationType, type};
+ OS.XtSetValues (handle, argList, argList.length / 2);
+}
+
/**
* Changes the parent of the widget to be the one provided if
* the underlying operating system supports this feature.
@@ -2457,9 +2464,7 @@ boolean translateTraversal (int key, XKeyEvent xEvent) {
}
int traversalCode () {
int code = SWT.TRAVERSE_ESCAPE | SWT.TRAVERSE_RETURN;
- int [] argList = {OS.XmNnavigationType, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- if (argList [1] == OS.XmNONE) {
+ if (getNavigationType () == OS.XmNONE) {
code |= SWT.TRAVERSE_ARROW_NEXT | SWT.TRAVERSE_ARROW_PREVIOUS;
} else {
code |= SWT.TRAVERSE_TAB_NEXT | SWT.TRAVERSE_TAB_PREVIOUS;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java
index 5c199627c9..a9124eff7f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java
@@ -573,6 +573,25 @@ int getLineNumber (int position) {
}
return count;
}
+int getNavigationType () {
+ /*
+ * Bug in Motif. On Solaris only, the implementation
+ * of XtGetValues for XmText does not check for a zero
+ * pointer in the arg list and GP's. The fix is to
+ * allocate and free memory for the arg list value.
+ */
+ if ((style & SWT.SINGLE) != 0) {
+ return super.getNavigationType ();
+ }
+ int ptr = OS.XtMalloc (4);
+ if (ptr == 0) return OS.XmNONE;
+ int [] argList = {OS.XmNnavigationType, ptr};
+ OS.XtGetValues (handle, argList, argList.length / 2);
+ int [] buffer = new int [1];
+ OS.memmove (buffer, ptr, 4);
+ OS.XtFree (ptr);
+ return buffer [0];
+}
/**
* Gets the position of the selected text.
* <p>