summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org
diff options
context:
space:
mode:
authorDuong Nguyen <dnguyen>2008-10-29 21:22:22 +0000
committerDuong Nguyen <dnguyen>2008-10-29 21:22:22 +0000
commit999226f6bfe889d48d5a85f5b6b8da5198f84a27 (patch)
tree7f76992083b68cef851345f0024bcc116676c46f /bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org
parent6a6df6cffde4492bff18a5288fe746a25d2b63eb (diff)
downloadeclipse.platform.swt-999226f6bfe889d48d5a85f5b6b8da5198f84a27.tar.gz
eclipse.platform.swt-999226f6bfe889d48d5a85f5b6b8da5198f84a27.tar.xz
eclipse.platform.swt-999226f6bfe889d48d5a85f5b6b8da5198f84a27.zip
Bug 237102 - [OLE] OleControlSite with Excel.Sheet renders deactivated view improperly
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java78
1 files changed, 43 insertions, 35 deletions
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 def385e3dc..b1888c972e 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
@@ -657,6 +657,12 @@ private int OnControlInfoChanged() {
return COM.S_OK;
}
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;
doVerb(OLE.OLEIVERB_UIACTIVATE);
if (isFocusControl()) return;
@@ -666,43 +672,45 @@ void onFocusIn(Event e) {
OS.SetFocus(phwnd[0]);
}
void onFocusOut(Event e) {
- if (objIOleInPlaceObject != null) {
- String progID = getProgramID();
- if (progID != null && progID.startsWith(SHELL_PROG_ID)) {
+ 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));
+ }
/*
- * 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.
+ * 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.
*/
- 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);
- }
- }
+ 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);
}
}
}