summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed <ggayed>2009-10-07 19:15:49 +0000
committerGrant Gayed <ggayed>2009-10-07 19:15:49 +0000
commit9d31ee781ab8c04ca493da29096b179f089dbd69 (patch)
treef0ec5983863aa1fd918d09d5915514d7593dc0a3
parent61b9d3697936acb5d154af196984adb254e3c577 (diff)
downloadeclipse.platform.swt-9d31ee781ab8c04ca493da29096b179f089dbd69.tar.gz
eclipse.platform.swt-9d31ee781ab8c04ca493da29096b179f089dbd69.tar.xz
eclipse.platform.swt-9d31ee781ab8c04ca493da29096b179f089dbd69.zip
264398 - Arrow_Down does not scroll after tabbing into Browser
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java128
2 files changed, 68 insertions, 65 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
index f191c60776..6f6496d0a2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
@@ -78,6 +78,7 @@ public class OleClientSite extends Composite {
private int aspect; // the display aspect of the embedded object, e.g., DvaspectContent or DvaspectIcon
private int type; // Indicates the type of client that can be supported inside this container
private boolean isStatic; // Indicates item's display is static, i.e., a bitmap, metafile, etc.
+ boolean isActivated;
private RECT borderWidths = new RECT();
private RECT indent = new RECT();
@@ -131,6 +132,8 @@ protected OleClientSite(Composite parent, int style) {
case SWT.Paint: onPaint(e); break;
case SWT.Traverse: onTraverse(e); break;
case SWT.KeyDown: /* required for traversal */ break;
+ case SWT.Activate: isActivated = true; break;
+ case SWT.Deactivate: isActivated = false; break;
default :
OLE.error(SWT.ERROR_NOT_IMPLEMENTED);
}
@@ -145,6 +148,8 @@ protected OleClientSite(Composite parent, int style) {
addListener(SWT.Paint, listener);
addListener(SWT.Traverse, listener);
addListener(SWT.KeyDown, listener);
+ addListener(SWT.Activate, listener);
+ addListener(SWT.Deactivate, listener);
}
/**
* Create an OleClientSite child widget using the OLE Document type associated with the
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java
index 3290cdb0f3..5bb981ef62 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java
@@ -64,6 +64,10 @@ public class OleControlSite extends OleClientSite
private Font font;
+ // work around for IE destroying the caret
+ static int SWT_RESTORECARET;
+
+ static final String SHELL_PROG_ID = "Shell.Explorer"; //$NON-NLS-1$
/**
* Create an OleControlSite child widget using the OLE Document type associated with the
@@ -652,71 +656,65 @@ private int OnControlInfoChanged() {
}
return COM.S_OK;
}
-
-// The following is intentionally commented, it's not believed that
-// OLEIVERB_UIACTIVATE and UIDeactivate should be invoked for every
-// received focusIn and focusOut, respectively.
-//
-//void onFocusIn(Event e) {
-// String progID = getProgramID();
-// if (progID == null) return;
-// if (!progID.startsWith("Shell.Explorer")) {
-// super.onFocusIn(e);
-// return;
-// }
-// if (objIOleInPlaceObject == null) return;
-// doVerb(OLE.OLEIVERB_UIACTIVATE);
-// if (isFocusControl()) return;
-// int /*long*/[] phwnd = new int /*long*/[1];
-// objIOleInPlaceObject.GetWindow(phwnd);
-// if (phwnd[0] == 0) return;
-// OS.SetFocus(phwnd[0]);
-//}
-//void onFocusOut(Event e) {
-// if (objIOleInPlaceObject == null) return;
-// String progID = getProgramID();
-// if (progID == null) return;
-// if (!progID.startsWith("Shell.Explorer")) {
-// super.onFocusOut(e);
-// return;
-// }
-// /*
-// * Bug in Windows. When IE7 loses focus and UIDeactivate()
-// * is called, IE destroys the caret even though it is
-// * no longer owned by IE. If focus has moved to a control
-// * that shows a caret then the caret disappears. The fix
-// * is to detect this case and restore the caret.
-// */
-// int threadId = OS.GetCurrentThreadId();
-// GUITHREADINFO lpgui1 = new GUITHREADINFO();
-// lpgui1.cbSize = GUITHREADINFO.sizeof;
-// OS.GetGUIThreadInfo(threadId, lpgui1);
-// objIOleInPlaceObject.UIDeactivate();
-// if (lpgui1.hwndCaret != 0) {
-// GUITHREADINFO lpgui2 = new GUITHREADINFO();
-// lpgui2.cbSize = GUITHREADINFO.sizeof;
-// OS.GetGUIThreadInfo(threadId, lpgui2);
-// if (lpgui2.hwndCaret == 0 && lpgui1.hwndCaret == OS.GetFocus()) {
-// if (SWT_RESTORECARET == 0) {
-// SWT_RESTORECARET = OS.RegisterWindowMessage (new TCHAR (0, "SWT_RESTORECARET", true));
-// }
-// /*
-// * If the caret was not restored by SWT, put it back using
-// * the information from GUITHREADINFO. Note that this will
-// * not be correct when the caret has a bitmap. There is no
-// * API to query the bitmap that the caret is using.
-// */
-// if (OS.SendMessage (lpgui1.hwndCaret, SWT_RESTORECARET, 0, 0) == 0) {
-// int width = lpgui1.right - lpgui1.left;
-// int height = lpgui1.bottom - lpgui1.top;
-// OS.CreateCaret (lpgui1.hwndCaret, 0, width, height);
-// OS.SetCaretPos (lpgui1.left, lpgui1.top);
-// OS.ShowCaret (lpgui1.hwndCaret);
-// }
-// }
-// }
-//}
-
+void onFocusIn(Event e) {
+ String progID = getProgramID();
+ if (progID == null) return;
+ if (!progID.startsWith(SHELL_PROG_ID)) {
+ super.onFocusIn(e);
+ return;
+ }
+ if (objIOleInPlaceObject == null) return;
+ if (!isActivated) doVerb(OLE.OLEIVERB_UIACTIVATE);
+ if (isFocusControl()) return;
+ int /*long*/[] phwnd = new int /*long*/[1];
+ objIOleInPlaceObject.GetWindow(phwnd);
+ if (phwnd[0] == 0) return;
+ OS.SetFocus(phwnd[0]);
+}
+void onFocusOut(Event e) {
+ if (objIOleInPlaceObject == null) return;
+ String progID = getProgramID();
+ if (progID == null) return;
+ if (!progID.startsWith(SHELL_PROG_ID)) {
+ super.onFocusOut(e);
+ return;
+ }
+ /*
+ * Bug in Windows. When IE7 loses focus and UIDeactivate()
+ * is called, IE destroys the caret even though it is
+ * no longer owned by IE. If focus has moved to a control
+ * that shows a caret then the caret disappears. The fix
+ * is to detect this case and restore the caret.
+ */
+ int threadId = OS.GetCurrentThreadId();
+ GUITHREADINFO lpgui1 = new GUITHREADINFO();
+ lpgui1.cbSize = GUITHREADINFO.sizeof;
+ OS.GetGUIThreadInfo(threadId, lpgui1);
+ objIOleInPlaceObject.UIDeactivate();
+ if (lpgui1.hwndCaret != 0) {
+ GUITHREADINFO lpgui2 = new GUITHREADINFO();
+ lpgui2.cbSize = GUITHREADINFO.sizeof;
+ OS.GetGUIThreadInfo(threadId, lpgui2);
+ if (lpgui2.hwndCaret == 0 && lpgui1.hwndCaret == OS.GetFocus()) {
+ if (SWT_RESTORECARET == 0) {
+ SWT_RESTORECARET = OS.RegisterWindowMessage (new TCHAR (0, "SWT_RESTORECARET", true));
+ }
+ /*
+ * If the caret was not restored by SWT, put it back using
+ * the information from GUITHREADINFO. Note that this will
+ * not be correct when the caret has a bitmap. There is no
+ * API to query the bitmap that the caret is using.
+ */
+ if (OS.SendMessage (lpgui1.hwndCaret, SWT_RESTORECARET, 0, 0) == 0) {
+ int width = lpgui1.right - lpgui1.left;
+ int height = lpgui1.bottom - lpgui1.top;
+ OS.CreateCaret (lpgui1.hwndCaret, 0, width, height);
+ OS.SetCaretPos (lpgui1.left, lpgui1.top);
+ OS.ShowCaret (lpgui1.hwndCaret);
+ }
+ }
+ }
+}
private int OnFocus(int fGotFocus) {
return COM.S_OK;
}