Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Ptaszkiewicz2016-01-08 11:08:15 +0000
committerNiraj Modi2016-01-21 09:55:52 +0000
commit7c3e16019a79e799e1aa1193580a7f617375dd94 (patch)
tree0b4c15518f6ae3105b6525d8f79d745837df6144
parent01d16957b2ba3bcb4a6d7b7b1054c1cbaa4afc69 (diff)
downloadeclipse.platform.swt-7c3e16019a79e799e1aa1193580a7f617375dd94.tar.gz
eclipse.platform.swt-7c3e16019a79e799e1aa1193580a7f617375dd94.tar.xz
eclipse.platform.swt-7c3e16019a79e799e1aa1193580a7f617375dd94.zip
Bug 482308 - [win32] Main Menu not refreshed after deactivating Word
editor Change-Id: I0d268ac91e0317c6eabc5bf0b0334009582b5ea5 Signed-off-by: Szymon Ptaszkiewicz <szymon.ptaszkiewicz@pl.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java20
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 3ddae69d34..46bb95225c 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 63441880b2..de3fdd9559 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$
@@ -575,6 +579,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();
@@ -767,8 +780,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);
}

Back to the top