Bug 49806 - Problems with Alt as compose character on Mac
Problems with Alt as compose character on Mac
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: -- Other --
4.x
Macintosh Mac OS X
: P2 (vote)
: 4.x
Assigned To: _ tboudreau
issues@editor
: API, API_REVIEW_FAST, RELNOTE
: 49295 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-10-01 16:18 UTC by _ tboudreau
Modified: 2007-11-05 13:44 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Patch to enable full keyboard use on mac (27.26 KB, patch)
2004-10-01 16:43 UTC, _ tboudreau
Details | Diff
Alt -> Control on mac patches w/ wildcard and tests (85.25 KB, patch)
2004-10-02 17:04 UTC, _ tboudreau
Details | Diff
Final diff that was committed (91.59 KB, patch)
2004-10-09 14:07 UTC, _ tboudreau
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2004-10-01 16:18:21 UTC
Some work has already gone into fixing this, but there is no 
issue to track it.

Apple employs the Alt key as an alternate Shift key for entering 
international characters on non-US keyboards.  This is a 
particular problem for french and norwegian locales, where it is 
impossible to enter [ ] { or } characters by default, because Alt 
key combinations are suppressed.

We've fixed the brackets, but the problem remains for other 
combinations.

A long-term solution would be to use a similar system as we did 
with remapping Ctrl and Command - provide a "wildcard" 
character in keyboard mapping definitions, which will map on 
the mac to Ctrl (since Ctrl bindings are mostly already remapped 
to Command), and map to Alt for the rest of the world.

Note that there is potential for collision, and the complexity of 
the code to handle key bindings will grow exponentially with 
each such wildcard added (we already check all possible 
permutations of keystrokes registered with the D wildcard for 
Ctrl/Command; a second wildcard will square the number of 
permutations that need to be checked).

Long term, we may want to redesign the whole actions 
registration system (and get it unified with the editor's), rather 
than add further complexity to the current, already creaky 
system.  We need better handling of locale, platform and window 
manager specific special cases for key binding handling.


In the meantime, I will attach the patch I am about to commit for 
4.0.  It is a major piece of ugly hackery, nothing to be proud of, 
but it will solve the immediate problem - letting users type 
normally on the mac.  Given that menu accelerators and such 
hardcode use of Alt, it would be too far reaching a change to do 
anything else for 4.0.  What the patch does:

 - Add an action to the AppleMenu module which sets a system 
property which, if set, will globally swap Ctrl and Alt.  The action 
can be triggered by pressing command-shift-backslash.

 - Patch the core windows key processor to change the modifiers 
on entered keystrokes before any are modified, for everything 
but arrows, ctrl and space

 - Add special handling for GotoAction, which maps to Ctrl-G on 
all platforms, and is in conflict with this patch

None of this is pretty, but it does work.
Comment 1 _ tboudreau 2004-10-01 16:43:18 UTC
Created attachment 17979 [details]
Patch to enable full keyboard use on mac
Comment 2 _ tboudreau 2004-10-01 17:35:08 UTC
Swap ctrl/alt for mac implemented.  -> Enhancement

Checking in core/src/org/netbeans/core/ShortcutsPanel.java;
/cvs/core/src/org/netbeans/core/ShortcutsPanel.java,v  <--  ShortcutsPanel.java
new revision: 1.23; previous revision: 1.22
done
Processing log script arguments...
More commits to come...
Checking in core/ui/src/org/netbeans/core/ui/resources/layer.xml;
/cvs/core/ui/src/org/netbeans/core/ui/resources/layer.xml,v  <--  layer.xml
new revision: 1.76; previous revision: 1.75
done
Processing log script arguments...
More commits to come...
Checking in core/windows/src/org/netbeans/core/windows/
ShortcutAndMenuKeyEventProcessor.java;
/cvs/core/windows/src/org/netbeans/core/windows/
ShortcutAndMenuKeyEventProcessor.java,v  <--  ShortcutAndMenuKeyEventProcessor.java
new revision: 1.8; previous revision: 1.7
done
Processing log script arguments...
More commits to come...
Checking in editor/libsrc/org/netbeans/editor/BaseKit.java;
/cvs/editor/libsrc/org/netbeans/editor/BaseKit.java,v  <--  BaseKit.java
new revision: 1.119; previous revision: 1.118
done
Processing log script arguments...
More commits to come...
Checking in editor/libsrc/org/netbeans/editor/ext/ExtKit.java;
/cvs/editor/libsrc/org/netbeans/editor/ext/ExtKit.java,v  <--  ExtKit.java
new revision: 1.51; previous revision: 1.50
done
Checking in editor/libsrc/org/netbeans/editor/ext/ExtSettingsDefaults.java;
/cvs/editor/libsrc/org/netbeans/editor/ext/ExtSettingsDefaults.java,v  <--  
ExtSettingsDefaults.java
new revision: 1.36; previous revision: 1.35
done
Processing log script arguments...
More commits to come...
Checking in editor/src/org/netbeans/modules/editor/resources/XMLs/
DefaultGlobalKeyBindings.xml;
/cvs/editor/src/org/netbeans/modules/editor/resources/XMLs/
DefaultGlobalKeyBindings.xml,v  <--  DefaultGlobalKeyBindings.xml
new revision: 1.12; previous revision: 1.11
done
Processing log script arguments...
More commits to come...
Checking in ide/applemenu/src/org/netbeans/modules/applemenu/Bundle.properties;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/Bundle.properties,v  <--  
Bundle.properties
new revision: 1.2; previous revision: 1.1
done
Checking in ide/applemenu/src/org/netbeans/modules/applemenu/
DefaultGlobalKeyBindings.xml;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/
DefaultGlobalKeyBindings.xml,v  <--  DefaultGlobalKeyBindings.xml
new revision: 1.2; previous revision: 1.1
done
RCS file: /cvs/ide/applemenu/src/org/netbeans/modules/applemenu/
SwapCtrlAltAction.java,v
done
Checking in ide/applemenu/src/org/netbeans/modules/applemenu/
SwapCtrlAltAction.java;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/SwapCtrlAltAction.java,v  
<--  SwapCtrlAltAction.java
initial revision: 1.1
done
Checking in ide/applemenu/src/org/netbeans/modules/applemenu/layer.xml;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/layer.xml,v  <--  layer.xml
new revision: 1.3; previous revision: 1.2
done
Processing log script arguments...
More commits to come...
Checking in openide/io/src/org/openide/windows/InputOutput.java;
/cvs/openide/io/src/org/openide/windows/InputOutput.java,v  <--  InputOutput.java
new revision: 1.8; previous revision: 1.7
done
Checking in openide/io/src/org/openide/windows/OutputWriter.java;
/cvs/openide/io/src/org/openide/windows/OutputWriter.java,v  <--  OutputWriter.java
new revision: 1.4; previous revision: 1.3
done
Processing log script arguments...
Comment 3 _ tboudreau 2004-10-02 15:56:57 UTC
Okay, I'll attach patches which fix this properly - they do the following:

 - Revert the much more ugly workaround currently in place
 - Introduce a second "wildcard" key definition - if you specify "O" in a key string, it will 
map to Control on mac, Alt on everything else
 - Modify all of the Alt bindings in layer files to use O instead of A (except for cursor 
control keys which should stay the same)
 - Modify shortcuts and keybindings editors to check for the additional permutations
 - Include additional unit tests for the new functionality
 - Modifies MenuBar and MenuBar$LazyMenu and ShortcutKeyAndEventProcessor to treat 
Control as the accelerator to activate menus on Mac - so, for example, to get to the File 
menu, you press Ctrl-F, not Alt-F

Given that it wasn't a problem for reviewing the C -> D change for mapping to Command 
on Mac, Control elsewhere, this shouldn't be a big review issue.  
Comment 4 _ tboudreau 2004-10-02 17:04:04 UTC
Created attachment 17992 [details]
Alt -> Control on mac patches w/ wildcard and tests
Comment 5 _ tboudreau 2004-10-02 17:04:46 UTC
-> TASK
Comment 6 Jaroslav Tulach 2004-10-06 08:14:31 UTC
A comment to this test: Better change the signature of getPermutation
method to take Utilities.OS_XXX as argument and then test the expected
results on mac and on unix, etc. Otherwise we cannot test the whole
functionality or other computer than mac.


+    public void testPermutationsContainConvertedAltWildcard () {
+        System.out.println("testPermutationsContainConvertedWildcard");
+        String cmdChar = (Utilities.getOperatingSystem() &
Utilities.OS_MAC) != 0
+            ? "M" : "C";        
+        
+        String altKey = Utilities.getOperatingSystem() ==
Utilities.OS_MAC ?
+            "C" : "A"; //NOI18N        
+        
+        String[] s = ShortcutsFolder.getPermutations("DO-F5");
+        HashSet set = new HashSet (Arrays.asList(s));
+        set.add ("DO-F5"); //Permutations will not contain the passed
value
+        
+        String[] permutations = new String[] {
+            "OD-F5", 
+            "O" + cmdChar + "-F5", 
+            "DO-F5", 
+            "D-O-F5",
+            "O-D-F5", 
+            altKey + "-D-F5", 
+            altKey + "-" + cmdChar + "-F5", 
+            altKey + "D-F5",
+        };
+        
+        for (int i=0; i < permutations.length; i++) {
+            assertTrue ("Permutation of D"+ altKey + "-F5 not
generated:" 
+                + permutations[i] + "; (generated:" + set + ")",
+                set.contains(permutations[i]));
+        }
+    } 
Comment 7 Jaroslav Tulach 2004-10-06 08:18:42 UTC
Also, do not forget to change documentation and arch*.xml
Comment 8 _ tboudreau 2004-10-07 17:02:26 UTC
Okay.  Folks, since it's late in the release cycle, I would like to commit this change this 
week.

Any objections if I do it tomorrow?
Comment 9 _ tboudreau 2004-10-09 14:06:44 UTC
Checking in core/compiler/src/org/netbeans/core/compiler/resources/layer.xml;
/cvs/core/compiler/src/org/netbeans/core/compiler/resources/layer.xml,v  <--  
layer.xml
new revision: 1.11; previous revision: 1.10
done
Processing log script arguments...
More commits to come...
Checking in core/src/org/netbeans/core/ShortcutsFolder.java;
/cvs/core/src/org/netbeans/core/ShortcutsFolder.java,v  <--  ShortcutsFolder.java
new revision: 1.22; previous revision: 1.21
done
Checking in core/src/org/netbeans/core/ShortcutsPanel.java;
/cvs/core/src/org/netbeans/core/ShortcutsPanel.java,v  <--  ShortcutsPanel.java
new revision: 1.24; previous revision: 1.23
done
Processing log script arguments...
More commits to come...
Checking in core/test/unit/src/org/netbeans/core/ShortcutsFolderTest.java;
/cvs/core/test/unit/src/org/netbeans/core/ShortcutsFolderTest.java,v  <--  
ShortcutsFolderTest.java
new revision: 1.6; previous revision: 1.5
done
Processing log script arguments...
More commits to come...
Checking in core/ui/src/org/netbeans/core/ui/resources/layer.xml;
/cvs/core/ui/src/org/netbeans/core/ui/resources/layer.xml,v  <--  layer.xml
new revision: 1.79; previous revision: 1.78
done
Processing log script arguments...
More commits to come...
Checking in core/windows/src/org/netbeans/core/windows/
ShortcutAndMenuKeyEventProcessor.java;
/cvs/core/windows/src/org/netbeans/core/windows/
ShortcutAndMenuKeyEventProcessor.java,v  <--  ShortcutAndMenuKeyEventProcessor.java
new revision: 1.10; previous revision: 1.9
done
Processing log script arguments...
More commits to come...
Checking in debuggercore/src/org/netbeans/modules/debugger/resources/mf-layer.xml;
/cvs/debuggercore/src/org/netbeans/modules/debugger/resources/mf-layer.xml,v  <--  
mf-layer.xml
new revision: 1.69; previous revision: 1.68
done
Processing log script arguments...
More commits to come...
Checking in debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/resources/mf-
layer.xml;
/cvs/debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/resources/mf-
layer.xml,v  <--  mf-layer.xml
new revision: 1.24; previous revision: 1.23
done
Processing log script arguments...
More commits to come...
Checking in editor/libsrc/org/netbeans/editor/BaseKit.java;
/cvs/editor/libsrc/org/netbeans/editor/BaseKit.java,v  <--  BaseKit.java
new revision: 1.121; previous revision: 1.120
done
Checking in editor/libsrc/org/netbeans/editor/SettingsDefaults.java;
/cvs/editor/libsrc/org/netbeans/editor/SettingsDefaults.java,v  <--  SettingsDefaults.java
new revision: 1.40; previous revision: 1.39
done
Processing log script arguments...
More commits to come...
Checking in editor/libsrc/org/netbeans/editor/ext/ExtKit.java;
/cvs/editor/libsrc/org/netbeans/editor/ext/ExtKit.java,v  <--  ExtKit.java
new revision: 1.54; previous revision: 1.53
done
Checking in editor/libsrc/org/netbeans/editor/ext/ExtSettingsDefaults.java;
/cvs/editor/libsrc/org/netbeans/editor/ext/ExtSettingsDefaults.java,v  <--  
ExtSettingsDefaults.java
new revision: 1.37; previous revision: 1.36
done
Processing log script arguments...
More commits to come...
Checking in editor/src/org/netbeans/modules/editor/java/NbJavaSettingsInitializer.java;
/cvs/editor/src/org/netbeans/modules/editor/java/NbJavaSettingsInitializer.java,v  <--  
NbJavaSettingsInitializer.java
new revision: 1.33; previous revision: 1.32
done
Processing log script arguments...
More commits to come...
Checking in editor/src/org/netbeans/modules/editor/options/
KeyBindingsMIMEOptionFile.java;
/cvs/editor/src/org/netbeans/modules/editor/options/KeyBindingsMIMEOptionFile.java,v  
<--  KeyBindingsMIMEOptionFile.java
new revision: 1.10; previous revision: 1.9
done
Processing log script arguments...
More commits to come...
Checking in editor/src/org/netbeans/modules/editor/resources/layer.xml;
/cvs/editor/src/org/netbeans/modules/editor/resources/layer.xml,v  <--  layer.xml
new revision: 1.60; previous revision: 1.59
done
Processing log script arguments...
More commits to come...
Checking in editor/src/org/netbeans/modules/editor/resources/XMLs/
DefaultGlobalKeyBindings.xml;
/cvs/editor/src/org/netbeans/modules/editor/resources/XMLs/
DefaultGlobalKeyBindings.xml,v  <--  DefaultGlobalKeyBindings.xml
new revision: 1.13; previous revision: 1.12
done
Checking in editor/src/org/netbeans/modules/editor/resources/XMLs/
DefaultKeyBindings.xml;
/cvs/editor/src/org/netbeans/modules/editor/resources/XMLs/DefaultKeyBindings.xml,v  
<--  DefaultKeyBindings.xml
new revision: 1.13; previous revision: 1.12
done
Processing log script arguments...
More commits to come...
Checking in form/src/org/netbeans/modules/form/resources/layer.xml;
/cvs/form/src/org/netbeans/modules/form/resources/layer.xml,v  <--  layer.xml
new revision: 1.79; previous revision: 1.78
done
Processing log script arguments...
More commits to come...
Checking in ide/applemenu/src/org/netbeans/modules/applemenu/Bundle.properties;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/Bundle.properties,v  <--  
Bundle.properties
new revision: 1.3; previous revision: 1.2
done
Checking in ide/applemenu/src/org/netbeans/modules/applemenu/
DefaultGlobalKeyBindings.xml;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/
DefaultGlobalKeyBindings.xml,v  <--  DefaultGlobalKeyBindings.xml
new revision: 1.3; previous revision: 1.2
done
RCS file: /cvs/ide/applemenu/src/org/netbeans/modules/applemenu/
DefaultKeyBindings.xml,v
done
Checking in ide/applemenu/src/org/netbeans/modules/applemenu/
DefaultKeyBindings.xml;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/DefaultKeyBindings.xml,v  
<--  DefaultKeyBindings.xml
initial revision: 1.1
done
Removing ide/applemenu/src/org/netbeans/modules/applemenu/SwapCtrlAltAction.java;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/SwapCtrlAltAction.java,v  
<--  SwapCtrlAltAction.java
new revision: delete; previous revision: 1.1
done
Checking in ide/applemenu/src/org/netbeans/modules/applemenu/layer.xml;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/layer.xml,v  <--  layer.xml
new revision: 1.4; previous revision: 1.3
done
Processing log script arguments...
More commits to come...
Checking in junit/src/org/netbeans/modules/junit/resources/layer.xml;
/cvs/junit/src/org/netbeans/modules/junit/resources/layer.xml,v  <--  layer.xml
new revision: 1.24; previous revision: 1.23
done
Processing log script arguments...
More commits to come...
Checking in openide/loaders/src/org/openide/awt/MenuBar.java;
/cvs/openide/loaders/src/org/openide/awt/MenuBar.java,v  <--  MenuBar.java
new revision: 1.9; previous revision: 1.8
done
Processing log script arguments...
More commits to come...
Checking in openide/src/org/openide/util/Utilities.java;
/cvs/openide/src/org/openide/util/Utilities.java,v  <--  Utilities.java
new revision: 1.145; previous revision: 1.144
done
Processing log script arguments...
More commits to come...
Checking in projects/projectui/src/org/netbeans/modules/project/ui/resources/
layer.xml;
/cvs/projects/projectui/src/org/netbeans/modules/project/ui/resources/layer.xml,v  <--  
layer.xml
new revision: 1.40; previous revision: 1.39
done
Processing log script arguments...
More commits to come...
Checking in refactoring/src/org/netbeans/modules/refactoring/resources/mf-layer.xml;
/cvs/refactoring/src/org/netbeans/modules/refactoring/resources/mf-layer.xml,v  <--  
mf-layer.xml
new revision: 1.14; previous revision: 1.13
done
Processing log script arguments...
More commits to come...
Checking in tasklist/compiler/src/org/netbeans/modules/tasklist/compiler/mf-layer.xml;
/cvs/tasklist/compiler/src/org/netbeans/modules/tasklist/compiler/mf-layer.xml,v  <--  
mf-layer.xml
new revision: 1.22; previous revision: 1.21
done
Processing log script arguments...
More commits to come...
Checking in utilities/project/src/org/netbeans/modules/search/project/layer.xml;
/cvs/utilities/project/src/org/netbeans/modules/search/project/layer.xml,v  <--  
layer.xml
new revision: 1.4; previous revision: 1.3
done
Processing log script arguments...
More commits to come...
Checking in xml/tools/src/org/netbeans/modules/xml/tools/resources/mf-layer.xml;
/cvs/xml/tools/src/org/netbeans/modules/xml/tools/resources/mf-layer.xml,v  <--  
mf-layer.xml
new revision: 1.24; previous revision: 1.23
done
Processing log script arguments...
More commits to come...
Checking in xml/xsl/src/org/netbeans/modules/xsl/resources/mf-layer.xml;
/cvs/xml/xsl/src/org/netbeans/modules/xsl/resources/mf-layer.xml,v  <--  mf-
layer.xml
new revision: 1.13; previous revision: 1.12
done
Processing log script arguments...
Mailing the commit message to cvs@utilities.netbeans.org, cvs@projects.netbeans.org, 
cvs@ide.netbeans.org, cvs@refactoring.netbeans.org, cvs@openide.netbeans.org, 
cvs@tasklist.netbeans.org, cvs@core.netbeans.org, cvs@debuggerjpda.netbeans.org, 
cvs@junit.netbeans.org, cvs@form.netbeans.org, cvs@debuggercore.netbeans.org, 
cvs@xml.netbeans.org, cvs@editor.netbeans.org (from tboudreau@netbeans.org)
Comment 10 _ tboudreau 2004-10-09 14:07:30 UTC
Created attachment 18180 [details]
Final diff that was committed
Comment 11 Jaroslav Tulach 2004-10-11 08:25:27 UTC
Where is the documentation, where is increment of API changes? This is
not implemented, this is pretty incomplete!
Comment 12 _ tboudreau 2004-10-11 14:57:44 UTC
Actually, I was trying to figure out *where* to put documentation of this.  There is 
documentation in Utilities.stringToKey().  Suggestions?
Comment 13 Jaroslav Tulach 2004-10-13 13:32:37 UTC
Good place is
http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/actions/doc-files/api.html#keymap
but there is link to Utilities, so that is probably ok.
Comment 14 Miloslav Metelka 2004-10-19 14:49:49 UTC
*** Issue 49295 has been marked as a duplicate of this issue. ***


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo