Hi,

I could track this down to this obscure code in TerminalParser_Linux.m plenty of explaination, still it wont help to understand what is going on.

<code cut>

What my change in back did was to set the AltGr key as the second Alternate key for GNUstep. Something that should be valid when done by a user in the defaults setting. It now turns out that this did break some obscure feature in Terminal. I call this feature obscure as it isn't even documented in the setting panel that not selecting command-as-meta will result in right alt (or in my case AltGr) being used as meta. I would expect that Esc is used as meta, but this may be mapped to double Esc, which is why another meta key seems to be needed.

Before I revert my change I really would like to know which other key I should map to Alternate on a German keyboard. What are other people out there using?

What do you think of the attached patch? I added a new option. Do you think it is correct? Since I generally do not use meta, could you please test it when using meta and alt? For me, it re-enables the usage of AltGr correctly.

Riccardo
? Terminal.app
? metakey.patch
? obj
Index: TerminalParser_Linux.m
===================================================================
RCS file: /sources/gap/gap/system-apps/Terminal/TerminalParser_Linux.m,v
retrieving revision 1.8
diff -u -r1.8 TerminalParser_Linux.m
--- TerminalParser_Linux.m	17 Nov 2010 22:42:46 -0000	1.8
+++ TerminalParser_Linux.m	25 Nov 2011 09:14:10 -0000
@@ -1342,6 +1342,7 @@
 
 	{
 		BOOL commandAsMeta=[TerminalViewKeyboardPrefs commandAsMeta];
+		BOOL altIsNotMeta =[TerminalViewKeyboardPrefs altIsNotMeta];
 
 		/*
 		Thanks to different keyboard layouts and dumb default key handling
@@ -1356,11 +1357,15 @@
 		left alt to be meta, and, if right alt is AltGr, right alt not to be
 		meta. Thus, when command-as-meta option is active, we intercept
 		command presses and treat them as meta, and we ignore alternate.
+
+		Since Nov. 2011 GNUstep behaviour changed by default to consider AltGr
+		as Alt.
+		altIsNotMeta is needed to keep Alt as Alt and not as Meta.
 		
 		*/
 
 		if ((commandAsMeta && (mask&NSCommandKeyMask)) ||
-		    (!commandAsMeta && (mask&NSAlternateKeyMask)))
+		    (!commandAsMeta && !altIsNotMeta && (mask&NSAlternateKeyMask)))
 		{
 			NSDebugLLog(@"key",@"  meta");
 			[ts ts_sendCString: "\e"];
Index: TerminalViewPrefs.h
===================================================================
RCS file: /sources/gap/gap/system-apps/Terminal/TerminalViewPrefs.h,v
retrieving revision 1.2
diff -u -r1.2 TerminalViewPrefs.h
--- TerminalViewPrefs.h	5 Aug 2009 17:51:00 -0000	1.2
+++ TerminalViewPrefs.h	25 Nov 2011 09:14:10 -0000
@@ -1,5 +1,6 @@
 /*
 copyright 2002, 2003 Alexander Malmberg <[email protected]>
+          2009-2011 GNUstep Application Project (Riccardo Mottola)
 
 This file is a part of Terminal.app. Terminal.app is free software; you
 can redistribute it and/or modify it under the terms of the GNU General
@@ -72,9 +73,11 @@
 
 	NSButton *b_commandAsMeta;
 	NSButton *b_doubleEscape;
+	NSButton *b_altIsNotMeta;
 }
 
 +(BOOL) commandAsMeta;
++(BOOL) altIsNotMeta;
 +(BOOL) doubleEscape;
 
 @end
Index: TerminalViewPrefs.m
===================================================================
RCS file: /sources/gap/gap/system-apps/Terminal/TerminalViewPrefs.m,v
retrieving revision 1.8
diff -u -r1.8 TerminalViewPrefs.m
--- TerminalViewPrefs.m	17 Nov 2010 23:26:57 -0000	1.8
+++ TerminalViewPrefs.m	25 Nov 2011 09:14:10 -0000
@@ -1,7 +1,7 @@
 /*
 copyright 2002, 2003 Alexander Malmberg <[email protected]>
 
-2009-2010 GAP Project
+2009-2011 GAP Project
 
 This file is a part of Terminal.app. Terminal.app is free software; you
 can redistribute it and/or modify it under the terms of the GNU General
@@ -635,10 +635,11 @@
 
 
 static NSString
-	*CommandAsMetaKey=@"CommandAsMeta",
-	*DoubleEscapeKey=@"DoubleEscape";
+         *CommandAsMetaKey=@"CommandAsMeta",
+         *DoubleEscapeKey=@"DoubleEscape",
+         *AltIsNotMetaKey=@"AltIsNotMeta";
 
-static BOOL commandAsMeta,doubleEscape;
+static BOOL commandAsMeta,doubleEscape, altIsNotMeta;
 
 @implementation TerminalViewKeyboardPrefs
 
@@ -649,6 +650,7 @@
 
 	commandAsMeta=[ud boolForKey: CommandAsMetaKey];
 	doubleEscape=[ud boolForKey: DoubleEscapeKey];
+	altIsNotMeta=[ud boolForKey: AltIsNotMetaKey];
 }
 
 +(BOOL) commandAsMeta
@@ -661,6 +663,11 @@
 	return doubleEscape;
 }
 
++(BOOL) altIsNotMeta
+{
+  return altIsNotMeta;
+}
+
 
 -(void) save
 {
@@ -677,12 +684,20 @@
 	else
 		doubleEscape=NO;
 	[ud setBool: doubleEscape forKey: DoubleEscapeKey];
+
+	if ([b_altIsNotMeta state])
+		altIsNotMeta=YES;
+	else
+		altIsNotMeta=NO;
+	[ud setBool: altIsNotMeta forKey: AltIsNotMetaKey];
+
 }
 
 -(void) revert
 {
 	[b_commandAsMeta setState: commandAsMeta];
 	[b_doubleEscape setState: doubleEscape];
+	[b_altIsNotMeta setState: altIsNotMeta];
 }
 
 
@@ -724,6 +739,18 @@
 			[top addView: b enablingYResizing: YES];
 			DESTROY(b);
 
+			b=b_altIsNotMeta=[[NSButton alloc] init];
+			[b setAutoresizingMask: NSViewMinYMargin|NSViewMaxYMargin|NSViewWidthSizable];
+			[b setTitle:
+				_(@"Treat the Alt key as Alt and not Meta.\n"
+				  @"Useful if command is used as Meta\n"
+				  @"And the keyboard has AltGr and not right Alt\n")];
+			[b setButtonType: NSSwitchButton];
+			[b sizeToFit];
+			[top addView: b enablingYResizing: YES];
+			DESTROY(b);
+
+
 			[top addSeparator];
 
 			b=b_doubleEscape=[[NSButton alloc] init];
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to