diff options
author | Szymon Ptaszkiewicz | 2016-01-08 11:08:15 +0000 |
---|---|---|
committer | Szymon Ptaszkiewicz | 2016-01-08 11:13:04 +0000 |
commit | 0b700b7ca1dea12e333edd1751c1ab862467b3c5 (patch) | |
tree | baeb844b7082b016ba2e22ac59c25284c30bb89b /bundles/org.eclipse.swt/Eclipse SWT OLE Win32 | |
parent | 275af7160460a6a51aad40d17dc2458b3b09944d (diff) | |
download | eclipse.platform.swt-0b700b7ca1dea12e333edd1751c1ab862467b3c5.tar.gz eclipse.platform.swt-0b700b7ca1dea12e333edd1751c1ab862467b3c5.tar.xz eclipse.platform.swt-0b700b7ca1dea12e333edd1751c1ab862467b3c5.zip |
Bug 482308 - [win32] Main Menu not refreshed after deactivating Word editor
Change-Id: I753211b54964c471c6db81fa1a0a7a493f891169
Signed-off-by: Szymon Ptaszkiewicz <szymon.ptaszkiewicz@pl.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT OLE Win32')
2 files changed, 33 insertions, 6 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 a949c99139..1caf1f9102 100644 --- 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -122,13 +122,26 @@ protected OleClientSite(Composite parent, int style) { isStatic = false; listener = new Listener() { + private int nestedFocusEvents = 0; public void handleEvent(Event e) { switch (e.type) { case SWT.Resize : case SWT.Move : onResize(e); break; case SWT.Dispose : onDispose(e); break; - case SWT.FocusIn: onFocusIn(e); break; - case SWT.FocusOut: onFocusOut(e); break; + case SWT.FocusIn: + nestedFocusEvents++; + onFocusIn(e); + nestedFocusEvents--; + if (nestedFocusEvents == 0) + frame.onFocusIn(e); + break; + case SWT.FocusOut: + nestedFocusEvents++; + onFocusOut(e); + nestedFocusEvents--; + if (nestedFocusEvents == 0) + frame.onFocusOut(e); + break; case SWT.Paint: onPaint(e); break; case SWT.Traverse: onTraverse(e); break; case SWT.KeyDown: /* required for traversal */ break; diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java index 1b86c2fae2..5160578a67 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -59,6 +59,10 @@ final public class OleFrame extends Composite private Listener listener; + private long /*int*/ shellHandle; + private long /*int*/ oldMenuHandle; + private long /*int*/ newMenuHandle; + private static String CHECK_FOCUS = "OLE_CHECK_FOCUS"; //$NON-NLS-1$ private static String HHOOK = "OLE_HHOOK"; //$NON-NLS-1$ private static String HHOOKMSG = "OLE_HHOOK_MSG"; //$NON-NLS-1$ @@ -591,6 +595,15 @@ private void onDispose(Event e) { removeListener(SWT.Resize, listener); removeListener(SWT.Move, listener); } +void onFocusIn(Event e) { + if (OS.GetMenu(shellHandle) != newMenuHandle) + OS.SetMenu(shellHandle, newMenuHandle); +} +void onFocusOut(Event e) { + Control control = getDisplay().getFocusControl(); + if (OS.GetMenu(shellHandle) != oldMenuHandle && control != null && control.handle != shellHandle) + OS.SetMenu(shellHandle, oldMenuHandle); +} private void onResize(Event e) { if (objIOleInPlaceActiveObject != null) { RECT lpRect = new RECT(); @@ -783,8 +796,9 @@ private int SetMenu(long /*int*/ hmenuShared, long /*int*/ holemenu, long /*int* } if (hmenuShared == 0) return COM.E_FAIL; - OS.SetMenu(handle, hmenuShared); - OS.DrawMenuBar(handle); + shellHandle = handle; + oldMenuHandle = menubar.handle; + newMenuHandle = hmenuShared; return COM.OleSetMenuDescriptor(holemenu, handle, hwndActiveObject, iOleInPlaceFrame.getAddress(), inPlaceActiveObject); } |