summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine <torres>2001-09-14 18:45:44 +0000
committerVeronika Irvine <torres>2001-09-14 18:45:44 +0000
commitb7ed75a0ec108f50d94e56dde8af895828f9f6a6 (patch)
tree50dc0e5206b97ee97c0da6528895a730d2b2acbf
parent72f73318c5711896c5365f8b95372300980c5b89 (diff)
downloadeclipse.platform.swt-b7ed75a0ec108f50d94e56dde8af895828f9f6a6.tar.gz
eclipse.platform.swt-b7ed75a0ec108f50d94e56dde8af895828f9f6a6.tar.xz
eclipse.platform.swt-b7ed75a0ec108f50d94e56dde8af895828f9f6a6.zip
*** empty log message ***
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java66
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java42
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java5
-rw-r--r--bundles/org.eclipse.swt/plugin.properties1
-rwxr-xr-xbundles/org.eclipse.swt/plugin.xml2
10 files changed, 129 insertions, 37 deletions
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 70f7b949e2..66942bf1ae 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
@@ -1184,6 +1184,7 @@ int processModify (int callData) {
}
int processMouseDown (int callData) {
Display display = getDisplay ();
+ Shell shell = getShell ();
display.hideToolTip ();
XButtonEvent xEvent = new XButtonEvent ();
OS.memmove (xEvent, callData, XButtonEvent.sizeof);
@@ -1203,6 +1204,16 @@ int processMouseDown (int callData) {
}
display.lastTime = eventTime == 0 ? 1 : eventTime;
display.lastButton = eventButton;
+
+ /*
+ * It is possible that the shell may be
+ * disposed at this point. If this happens
+ * don't send the activate and deactivate
+ * events.
+ */
+ if (!shell.isDisposed ()) {
+ shell.setActiveControl (this);
+ }
return 0;
}
int processMouseEnter (int callData) {
@@ -1312,46 +1323,39 @@ int processSetFocus (int callData) {
/* Process the focus change for the widget */
switch (xEvent.type) {
case OS.FocusIn: {
+ Shell shell = getShell ();
processFocusIn ();
// widget could be disposed at this point
- if (handle == 0) return 0;
- int index = 0;
- Shell shell = getShell ();
- Control [] focusIn = getPath ();
- Control lastFocus = shell.lastFocus;
- if (lastFocus != null) {
- if (!lastFocus.isDisposed ()) {
- Control [] focusOut = lastFocus.getPath ();
- int length = Math.min (focusIn.length, focusOut.length);
- while (index < length) {
- if (focusIn [index] != focusOut [index]) break;
- index++;
- }
- for (int i=focusOut.length-1; i>=index; --i) {
- focusOut [i].sendEvent (SWT.Deactivate);
- }
- }
- shell.lastFocus = null;
- }
- for (int i=focusIn.length-1; i>=index; --i) {
- focusIn [i].sendEvent (SWT.Activate);
+
+ /*
+ * It is possible that the shell may be
+ * disposed at this point. If this happens
+ * don't send the activate and deactivate
+ * events.
+ */
+ if (!shell.isDisposed ()) {
+ shell.setActiveControl (this);
}
break;
}
case OS.FocusOut: {
- processFocusOut ();
- // widget could be disposed at this point
- if (handle == 0) return 0;
Shell shell = getShell ();
- shell.lastFocus = this;
Display display = getDisplay ();
- Control focusControl = display.getFocusControl ();
- if (focusControl == null || shell != focusControl.getShell ()) {
- Control [] focusOut = getPath ();
- for (int i=focusOut.length-1; i>=0; --i) {
- focusOut [i].sendEvent (SWT.Deactivate);
+
+ processFocusOut ();
+ // widget could be disposed at this point
+
+ /*
+ * It is possible that the shell may be
+ * disposed at this point. If this happens
+ * don't send the activate and deactivate
+ * events.
+ */
+ if (!shell.isDisposed ()) {
+ Control control = display.getFocusControl ();
+ if (control == null || shell != control.getShell () ) {
+ shell.setActiveControl (null);
}
- shell.lastFocus = null;
}
break;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
index 04909c7658..1dfb6793ae 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
@@ -235,6 +235,7 @@ void manageChildren () {
OS.XtManageChild (handle);
}
int processMouseDown (int callData) {
+ Shell shell = parent.getShell();
XButtonEvent xEvent = new XButtonEvent ();
OS.memmove (xEvent, callData, XButtonEvent.sizeof);
if (getGrabberArea().contains(xEvent.x, xEvent.y)) {
@@ -242,6 +243,15 @@ int processMouseDown (int callData) {
mouseXOffset = xEvent.x;
parent.setCursor(parent.dragCursor);
}
+ /*
+ * It is possible that the shell may be
+ * disposed at this point. If this happens
+ * don't send the activate and deactivate
+ * events.
+ */
+ if (!shell.isDisposed()) {
+ shell.setActiveControl(parent);
+ }
return 0;
}
int processMouseExit (int callData) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java
index a3704d6339..835ab4a329 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java
@@ -88,7 +88,7 @@ public /*final*/ class Shell extends Decorations {
int shellHandle;
boolean reparented, realized;
int oldX, oldY, oldWidth, oldHeight;
- Control lastFocus;
+ Control lastActive;
static final byte [] WM_DETELE_WINDOW = Converter.wcsToMbcs(null, "WM_DELETE_WINDOW\0");
/**
@@ -850,7 +850,7 @@ void releaseWidget () {
releaseShells ();
super.releaseWidget ();
display = null;
- lastFocus = null;
+ lastActive = null;
}
/**
* Removes the listener from the collection of listeners who will
@@ -889,6 +889,44 @@ void saveBounds () {
oldX = root_x [0] - trimWidth; oldY = root_y [0] - trimHeight;
oldWidth = argList [1]; oldHeight = argList [3];
}
+
+void setActiveControl (Control control) {
+ if (control != null && control.isDisposed ()) control = null;
+ if (lastActive != null && lastActive.isDisposed ()) lastActive = null;
+ if (lastActive == control) return;
+
+ /*
+ * Compute the list of controls to be activated and
+ * deactivated by finding the first common parent
+ * control.
+ */
+ Control [] activate = (control == null) ? new Control[0] : control.getPath ();
+ Control [] deactivate = (lastActive == null) ? new Control[0] : lastActive.getPath ();
+ lastActive = control;
+ int index = 0, length = Math.min (activate.length, deactivate.length);
+ while (index < length) {
+ if (activate [index] != deactivate [index]) break;
+ index++;
+ }
+
+ /*
+ * It is possible (but unlikely), that application
+ * code could have destroyed some of the widgets. If
+ * this happens, keep processing those widgets that
+ * are not disposed.
+ */
+ for (int i=deactivate.length-1; i>=index; --i) {
+ if (!deactivate [i].isDisposed ()) {
+ deactivate [i].sendEvent (SWT.Deactivate);
+ }
+ }
+ for (int i=activate.length-1; i>=index; --i) {
+ if (!activate [i].isDisposed ()) {
+ activate [i].sendEvent (SWT.Activate);
+ }
+ }
+}
+
public void setBounds (int x, int y, int width, int height) {
checkWidget();
/*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java
index 0b4aba90e7..2f68ad1868 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java
@@ -706,6 +706,7 @@ void setDrawPressed (boolean value) {
}
int processMouseDown (int callData) {
Display display = getDisplay ();
+// Shell shell = parent.getShell ();
display.hideToolTip ();
XButtonEvent xEvent = new XButtonEvent ();
OS.memmove (xEvent, callData, XButtonEvent.sizeof);
@@ -730,6 +731,15 @@ int processMouseDown (int callData) {
OS.memmove (callData, xEvent, XButtonEvent.sizeof);
parent.processMouseDown (callData);
+ /*
+ * It is possible that the shell may be
+ * disposed at this point. If this happens
+ * don't send the activate and deactivate
+ * events.
+ */
+// if (!shell.isDisposed()) {
+// shell.setActiveControl (parent);
+// }
return 0;
}
int processMouseEnter (int callData) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
index a896720699..feb9e57ed9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
@@ -314,7 +314,9 @@ boolean setTabGroupFocus () {
if (!isVisible ()) return false;
if (isTabItem ()) return setTabItemFocus ();
Control [] children = _getChildren ();
- if (children.length == 0) return setTabItemFocus ();
+ if (children.length == 0) {
+ return (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) && setTabItemFocus ();
+ }
for (int i=0; i<children.length; i++) {
Control child = children [i];
if (child.isVisible () && child.setRadioFocus ()) return true;
@@ -371,7 +373,7 @@ LRESULT WM_GETDLGCODE (int wParam, int lParam) {
if (result != null) return result;
if ((state & CANVAS) != 0) {
if ((style & SWT.NO_FOCUS) != 0) return new LRESULT (OS.DLGC_STATIC);
- if (hooks (SWT.KeyDown)) {
+ if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
int flags = OS.DLGC_WANTALLKEYS | OS.DLGC_WANTARROWS | OS.DLGC_WANTTAB;
return new LRESULT (flags);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index 7f7562ae98..51b83372ab 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
@@ -2033,6 +2033,11 @@ boolean setTabGroupFocus () {
}
boolean setTabItemFocus () {
+ Control [] path = getPath ();
+ for (int i=0; i<path.length; i++) {
+ Point size = path [i].getSize ();
+ if (size.x == 0 || size.y == 0) return false;
+ }
return setFocus ();
}
@@ -2473,6 +2478,7 @@ int windowProc (int msg, int wParam, int lParam) {
case OS.WM_MOUSEHOVER: result = WM_MOUSEHOVER (wParam, lParam); break;
case OS.WM_MOUSELEAVE: result = WM_MOUSELEAVE (wParam, lParam); break;
case OS.WM_MOUSEMOVE: result = WM_MOUSEMOVE (wParam, lParam); break;
+ case OS.WM_MOUSEWHEEL: result = WM_MOUSEWHEEL (wParam, lParam); break;
case OS.WM_MOVE: result = WM_MOVE (wParam, lParam); break;
case OS.WM_NCACTIVATE: result = WM_NCACTIVATE (wParam, lParam); break;
case OS.WM_NCCALCSIZE: result = WM_NCCALCSIZE (wParam, lParam); break;
@@ -2500,7 +2506,6 @@ int windowProc (int msg, int wParam, int lParam) {
case OS.WM_UNDO: result = WM_UNDO (wParam, lParam); break;
case OS.WM_VSCROLL: result = WM_VSCROLL (wParam, lParam); break;
case OS.WM_WINDOWPOSCHANGING: result = WM_WINDOWPOSCHANGING (wParam, lParam); break;
- case OS.WM_MOUSEWHEEL: return OS.DefWindowProc(handle, msg, wParam, lParam);
}
if (result != null) return result.value;
return callWindowProc (msg, wParam, lParam);
@@ -3266,6 +3271,18 @@ LRESULT WM_MOUSEMOVE (int wParam, int lParam) {
return null;
}
+LRESULT WM_MOUSEWHEEL (int wParam, int lParam) {
+ /*
+ * Feature in Windows. If the WM_MOUSEWHEEL is handled by
+ * the control, it may not send WM_VSCROLL and WM_HSCROLL
+ * messages. The fix is to intercept the WM_MOUSEWHEEL message
+ * and call the DefWindowProc which will convert the message to
+ * send the appropriate WM_HSCROLL or WM_VSCROLL message.
+ */
+ int code = OS.DefWindowProc (handle, OS.WM_MOUSEWHEEL, wParam, lParam);
+ return new LRESULT (code);
+}
+
LRESULT WM_MOVE (int wParam, int lParam) {
sendEvent (SWT.Move);
// widget could be disposed at this point
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index 7a4c65c4db..9103ae6cd4 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -1756,6 +1756,11 @@ public void setSelection (TableItem [] items) {
}
}
+boolean setTabGroupFocus () {
+ if (super.setTabGroupFocus()) return true;
+ return setTabItemFocus();
+}
+
/**
* Selects the item at the given zero-relative index in the receiver.
* The current selected is first cleared, then the new item is selected.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
index e61124cf96..3ee33a81ca 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
@@ -974,6 +974,11 @@ public void setSelection (TreeItem [] items) {
OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc);
}
+boolean setTabGroupFocus () {
+ if (super.setTabGroupFocus()) return true;
+ return setTabItemFocus();
+}
+
/**
* Shows the item. If the item is already showing in the receiver,
* this method simply returns. Otherwise, the items are scrolled
diff --git a/bundles/org.eclipse.swt/plugin.properties b/bundles/org.eclipse.swt/plugin.properties
new file mode 100644
index 0000000000..c1cf580601
--- /dev/null
+++ b/bundles/org.eclipse.swt/plugin.properties
@@ -0,0 +1 @@
+pluginName = Standard Widget Toolkit \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/plugin.xml b/bundles/org.eclipse.swt/plugin.xml
index 9cfd17e9f5..73524c9eea 100755
--- a/bundles/org.eclipse.swt/plugin.xml
+++ b/bundles/org.eclipse.swt/plugin.xml
@@ -2,7 +2,7 @@
<!-- File written by PDE 1.0 -->
<plugin
id="org.eclipse.swt"
- name="SWT"
+ name="%pluginName"
version="2.0"
provider-name="Object Technology International, Inc.">