Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335134

Summary: [Custom Widgets] CCombo: floating list pop-up on ALT+TAB
Product: [Eclipse Project] Platform Reporter: Elias Volanakis <elias>
Component: SWTAssignee: Lakshmi P Shanmugam <lshanmug>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: carolynmacleod4
Version: 3.7   
Target Milestone: 3.7 M6   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
Screenshot
none
Snippet
none
patch
none
patch2 none

Description Elias Volanakis CLA 2011-01-23 15:27:39 EST
Created attachment 187387 [details]
Screenshot

To reproduce:

1. Find a CCombo
2. Open list pop-up by clicking on the CCombo
3. Press ALT+TAB

Result: pop-up floats in the air
Expected: list pop-up should dissappear

See attached snippet / screenshot.
Comment 1 Elias Volanakis CLA 2011-01-23 15:28:42 EST
Created attachment 187388 [details]
Snippet

Snippet to reproduce issue
Comment 2 Lakshmi P Shanmugam CLA 2011-01-24 02:07:39 EST
This happens when the cursor is on the arrow button when user does Alt+TAB. In this case the dropdown(false) is not being called. When the cursor is anywhere else (other than on the arrow button) Alt+TAB works fine.
Comment 3 Lakshmi P Shanmugam CLA 2011-02-03 15:03:28 EST
Created attachment 188269 [details]
patch

When we get Deactivate event on the pop-up shell, we try to find out if the deactivate happened by clicking on the arrow button. We check if the cursor position is on the arrow button, if so we assume that the user clicked the arrow button and don't call dropdown(false) in this case. But, this assumption fails when the cursor is on the arrow button when deactivate happens with Alt+TAB.

The patch, adds an additional check to see if the activated shell is the Combo shell to make sure that the arrow button was pressed.

Carolyn, can you please review the patch? I have tested the patch on Windows, GTK and Cocoa.
Comment 4 Carolyn MacLeod CLA 2011-02-08 17:09:50 EST
CCombo is wild - I'm glad you tested it on all 3 platforms.  :)

Why did you need to async?

Should cocoa be added to the if (!"carbon".equals(SWT.getPlatform()))?
i.e. is the code inside the 'if' needed for cocoa also? When that code was written, we did not have the cocoa platform.

There still seems to be something a bit strange (on Windows, anyhow). If I type ALT+TAB to go to another application, and then type ALT+TAB to come back, nothing seems to have keyboard focus.
Comment 5 Lakshmi P Shanmugam CLA 2011-02-14 01:50:50 EST
Created attachment 188871 [details]
patch2
Comment 6 Lakshmi P Shanmugam CLA 2011-02-14 02:10:22 EST
(In reply to comment #4)

Hi Carolyn,
Thanks for the review.

> Why did you need to async?
I used async so that the I can get the next active shell (getDisplay.getActiveShell()) after the deactivate event completes. The active shell is required to determine if the arrow button was clicked.
In the new patch, I have moved the dropdown(false) logic from popuplist's deactivate event to list's focus out event. Now I can get the active shell without using asyncExec().

> Should cocoa be added to the if (!"carbon".equals(SWT.getPlatform()))?
> i.e. is the code inside the 'if' needed for cocoa also? When that code was
> written, we did not have the cocoa platform.
Cocoa behaves same as gtk and windows, hence cocoa shouldn't be added in the above check.

> There still seems to be something a bit strange (on Windows, anyhow). If I type
> ALT+TAB to go to another application, and then type ALT+TAB to come back,
> nothing seems to have keyboard focus.
This was happening only in Windows. Moving the dropdown logic to list's focus out fixed the problem.

Please review the modified patch. Thanks!
Comment 7 Carolyn MacLeod CLA 2011-02-15 11:39:42 EST
Looks good, Lakshmi! Go ahead and commit.
Thanks for updating the comment - it was getting old and confusing.  :)
Comment 8 Lakshmi P Shanmugam CLA 2011-02-16 01:27:02 EST
Thanks for the review, Carolyn!
Fixed in HEAD > 20110216