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

Bug 316329

Summary: Need SWT to provide an API to allow F10 to be overridden
Product: [Eclipse Project] Platform Reporter: Raji Akella <raji>
Component: SWTAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: eclipse.felipe, Mike_Wilson, mukund, pwebster, remy.suen, Silenio_Quarti, sujithjob
Version: 4.0   
Target Milestone: 3.7 M2   
Hardware: PC   
OS: Windows XP   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=309286
Whiteboard:
Attachments:
Description Flags
patch for Linux
none
patch for gtk none

Description Raji Akella CLA 2010-06-09 11:33:31 EDT
Build Identifier: 3.7

Please see bugzilla https://bugs.eclipse.org/bugs/show_bug.cgi?id=309286

Reproducible: Always
Comment 1 Silenio Quarti CLA 2010-08-06 17:24:35 EDT
Please see

https://bugs.eclipse.org/bugs/show_bug.cgi?id=309286#c8

We believe there is no bug here. I am to bind F10 to content assist in 3.6 for example.
Comment 2 Silenio Quarti CLA 2010-08-10 14:27:39 EDT
Closing bug as INVALID.
Comment 3 Paul Webster CLA 2010-08-11 13:43:14 EDT
With items under the File menu, I no longer get *any* key events.

PW
Comment 4 Paul Webster CLA 2010-08-11 13:44:05 EDT
I added the following to the snippet:

Menu file = new Menu(item);
item.setMenu(file);
new MenuItem(file, SWT.PUSH).setText("One");
new MenuItem(file, SWT.PUSH).setText("Two");
new MenuItem(file, SWT.PUSH).setText("Three");

My tests run on linux.

PW
Comment 5 Felipe Heidrich CLA 2010-08-12 11:14:57 EDT
Okay, I have some code in Linux that allows us to process the event before the OS.

But in the Mac I'm afraid the same can't be done. The OS has a default keybinding for F10. The only way (AFAIK) for an application to see a key down is:
System-Preferences->Keyboard->Keyboard shortcuts->Expose & Spaces
Reassign the keybinding of "Application windows" from F10 to something else.

You can do the same on Linux, not sure if there is a nice UI to do so, but you can reassign the shortcut for the menubar using the command line:

gconftool-2 --type string --set  '/desktop/gnome/interface/menubar_accel' 'F11'

(Instead of 'F11' you can pass use an empty string to remove the shortcut)

After doing this, the application will start to receive F10 key down events.
Comment 6 Felipe Heidrich CLA 2010-09-03 09:29:05 EDT
Created attachment 178142 [details]
patch for Linux

note: i have already released all the required native methods
Comment 7 Felipe Heidrich CLA 2010-09-03 16:06:52 EDT
Created attachment 178199 [details]
patch for gtk
Comment 8 Felipe Heidrich CLA 2010-09-03 16:08:33 EDT
Patch for GTK released.

Nothing to do for Cocoa (user has to change the property in the System preferences, otherwise the system consumes the key before it gets to SWT).

Works on windows.

closing as fixed.