Project: Eclipse_Platform_UI
Bug 377769 Stray part menu shown after dismissing part's context menu
Reported: 2012-04-26 10:16:30 | Status: verified fixed

I've sometimes encountered a case where, after having dismissed a context menu, a new menu pops up corresponding to the part's menu (e.g., with "Close"). I rarely see this in my outer, but often see it in an inner. Steps: 1. With multiple monitors, place a window out of the main window 2. Right-click in a part to bring up its context menu 3. Either choose an item in the context menu or hit escape to dismiss 4. See the part's tab menu appear. Placing a breakpoint in StackRenderer#hookControllerLogic()'s menu-detect code (line 914 - 933) shows that the check code for the click occurring in the tab's client area is using the absolute X,Y rather than the relative X,Y: // If click happened in empty area, still show the menu if (eventTabItem == null) { Rectangle clientArea = ctf.getClientArea(); if (!clientArea.contains(e.x, e.y)) { eventTabItem = ctf.getSelection(); } } When testing, I see: absolutePoint = Point {492, -1038} (from e.x, e.y) relativePoint = Point {107, 162} CTF clientArea = Rectangle {10, 50, 234, 624} Changing the check to '!clientArea.contains(relativePoint)' prevents the stray menus. But I'm puzzled why this problem isn't happening in our outers.

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java