diff options
author | Lakshmi Shanmugam <lshanmugam> | 2011-02-16 06:21:59 +0000 |
---|---|---|
committer | Lakshmi Shanmugam <lshanmugam> | 2011-02-16 06:21:59 +0000 |
commit | 3e1b012af2b4ba818ce575f06ca138619a0a2859 (patch) | |
tree | ed160d3360f839e2c255a805a1bbeed799c260f9 | |
parent | 145fdebb45aad978ce9a722d4be1d0c5932642e0 (diff) | |
download | eclipse.platform.swt-3e1b012af2b4ba818ce575f06ca138619a0a2859.tar.gz eclipse.platform.swt-3e1b012af2b4ba818ce575f06ca138619a0a2859.tar.xz eclipse.platform.swt-3e1b012af2b4ba818ce575f06ca138619a0a2859.zip |
Bug 335134 - CCombo: floating list pop-up on ALT+TAB
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java index 8768f44df6..9fbb3e078f 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java @@ -470,9 +470,9 @@ void createPopup(String[] items, int selectionIndex) { if (foreground != null) list.setForeground (foreground); if (background != null) list.setBackground (background); - int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate}; + int [] popupEvents = {SWT.Close, SWT.Paint}; for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener); - int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose}; + int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose}; for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener); if (items != null) list.setItems (items); @@ -1077,6 +1077,30 @@ void listEvent (Event event) { handleFocus (SWT.FocusIn); break; } + case SWT.FocusOut: { + /* + * Behavior in Windows, GTK & Cocoa: When the arrow button is pressed + * with the popup list visible, the following events are received- + * popup control receives a deactivate event, + * list receives focus lost event, and then + * arrow button receives a selection event. + * If we hide the popup in the focus out event, the selection event will + * show it again. To prevent the popup from showing again, we will detect + * this case and let the selection event of the arrow button hide the popup. + */ + if (!"carbon".equals(SWT.getPlatform())) { + Point point = arrow.toControl(getDisplay().getCursorLocation()); + Point size = arrow.getSize(); + Rectangle rect = new Rectangle(0, 0, size.x, size.y); + if (rect.contains(point)) { + boolean comboShellActivated = getDisplay ().getActiveShell () == getShell (); + if (!comboShellActivated) dropDown (false); + break; + } + } + dropDown (false); + break; + } case SWT.MouseUp: { if (event.button != 1) return; dropDown (false); @@ -1197,25 +1221,6 @@ void popupEvent(Event event) { event.doit = false; dropDown (false); break; - case SWT.Deactivate: - /* - * Bug in GTK. When the arrow button is pressed the popup control receives a - * deactivate event and then the arrow button receives a selection event. If - * we hide the popup in the deactivate event, the selection event will show - * it again. To prevent the popup from showing again, we will let the selection - * event of the arrow button hide the popup. - * In Windows, hiding the popup during the deactivate causes the deactivate - * to be called twice and the selection event to be disappear. - */ - if (!"carbon".equals(SWT.getPlatform())) { - Point point = arrow.toControl(getDisplay().getCursorLocation()); - Point size = arrow.getSize(); - Rectangle rect = new Rectangle(0, 0, size.x, size.y); - if (!rect.contains(point)) dropDown (false); - } else { - dropDown(false); - } - break; } } public void redraw () { |