summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2011-03-07 16:34:43 +0000
committerSilenio Quarti <silenio>2011-03-07 16:34:43 +0000
commitc39c3e64f43d91fee0d586305de520da9ab1bea8 (patch)
treeb6569e10f2bbd36c3f3766663efb68bfeeb06c3a /bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
parent6f349c6ed1746550029bfbdeb220dfb88e980a72 (diff)
downloadeclipse.platform.swt-c39c3e64f43d91fee0d586305de520da9ab1bea8.tar.gz
eclipse.platform.swt-c39c3e64f43d91fee0d586305de520da9ab1bea8.tar.xz
eclipse.platform.swt-c39c3e64f43d91fee0d586305de520da9ab1bea8.zip
Bug 339116 - SWT.Hide not sent properly for menus
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java47
1 files changed, 11 insertions, 36 deletions
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 335581eada..0e24851293 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
@@ -4593,6 +4593,7 @@ int /*long*/ windowProc (int /*long*/ hwnd, int msg, int /*long*/ wParam, int /*
case OS.WM_TIMER: result = WM_TIMER (wParam, lParam); break;
case OS.WM_TOUCH: result = WM_TOUCH (wParam, lParam); break;
case OS.WM_UNDO: result = WM_UNDO (wParam, lParam); break;
+ case OS.WM_UNINITMENUPOPUP: result = WM_UNINITMENUPOPUP (wParam, lParam); break;
case OS.WM_UPDATEUISTATE: result = WM_UPDATEUISTATE (wParam, lParam); break;
case OS.WM_VSCROLL: result = WM_VSCROLL (wParam, lParam); break;
case OS.WM_WINDOWPOSCHANGED: result = WM_WINDOWPOSCHANGED (wParam, lParam); break;
@@ -4799,6 +4800,16 @@ LRESULT WM_IME_ENDCOMPOSITION (int /*long*/ wParam, int /*long*/ lParam) {
return null;
}
+LRESULT WM_UNINITMENUPOPUP (int /*long*/ wParam, int /*long*/ lParam) {
+ Menu hiddenMenu = menuShell ().findMenu (wParam);
+ if (hiddenMenu != null) {
+ Shell shell = getShell ();
+ hiddenMenu.sendEvent (SWT.Hide);
+ if (hiddenMenu == shell.activeMenu) shell.activeMenu = null;
+ }
+ return null;
+}
+
LRESULT WM_INITMENUPOPUP (int /*long*/ wParam, int /*long*/ lParam) {
/* Ignore WM_INITMENUPOPUP for an accelerator */
@@ -4981,42 +4992,6 @@ LRESULT WM_MENUSELECT (int /*long*/ wParam, int /*long*/ lParam) {
int id = OS.LOWORD (wParam);
item = display.getMenuItem (id);
}
- Menu oldMenu = shell.activeMenu;
- if (oldMenu != null) {
- Menu ancestor = oldMenu;
- while (ancestor != null && ancestor != newMenu) {
- ancestor = ancestor.getParentMenu ();
- }
- if (ancestor == newMenu) {
- ancestor = oldMenu;
- while (ancestor != newMenu) {
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the hide
- * event or the item about to be armed. If this
- * happens, stop searching up the ancestor list
- * because there is no longer a link to follow.
- */
- ancestor.sendEvent (SWT.Hide);
- if (ancestor.isDisposed ()) break;
- ancestor = ancestor.getParentMenu ();
- if (ancestor == null) break;
- }
- /*
- * The shell and/or the item could be disposed when
- * processing hide events from above. If this happens,
- * ensure that the shell is not accessed and that no
- * arm event is sent to the item.
- */
- if (!shell.isDisposed ()) {
- if (newMenu != null && newMenu.isDisposed ()) {
- newMenu = null;
- }
- shell.activeMenu = newMenu;
- }
- if (item != null && item.isDisposed ()) item = null;
- }
- }
}
if (item != null) item.sendEvent (SWT.Arm);
}