This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[jtiller@sjm.com: Patch submission for AltGr handling]


Any thoughts on this patch?  I hate adding YA CYGWIN environment
variable option but I don't see any other way to do this.

Hmm.  Could we just gate this behavior on the loaded code page
or something?  Could we make it automatic?

cgf

----- Forwarded message from Jason Tiller <jtiller@sjm.com> -----

From: Jason Tiller <jtiller@sjm.com>
To: <cygwin@cygwin.com>
Subject: Patch submission for AltGr handling
Date: Tue, 27 Feb 2001 14:25:55 -0800 (Pacific Standard Time)

Hello, Everyone, :)

Per the instructions on http://www.cygwin.com/contrib.html, here is
the patch and ChangeLog entry for my minor changes to allow the user
to configure the right-side <alt> key (AltGr) to generate
Meta-prefixed characters as opposed to high-bit characters.  This is
accomplished by a new CYGWIN environment variable option:
'right_alt_meta'.  With this specified, AltGr generates Meta.  The
default case or with 'noright_alt_meta' specified is to ignore AltGr
in the console handler.

I chose to submit this here because the page indicated that small
patches could be sent to the user list.  I would be willing to submit
text for the FAQ and/or User Guide if either of those documents had a
section on the CYGWIN variable.

Here are the diffs:

--- environ.cc.orig	Mon Jan 29 18:36:10 2001
+++ environ.cc	Mon Feb 26 22:44:40 2001
@@ -33,6 +33,7 @@ extern BOOL allow_smbntsec;
 extern BOOL strip_title_path;
 extern DWORD chunksize;
 BOOL reset_com = TRUE;
+extern BOOL meta_mask;
 static BOOL envcache = TRUE;

 static char **lastenviron = NULL;
@@ -451,6 +452,7 @@ struct parse_thing
   {"ntsec", {&allow_ntsec}, justset, NULL, {{FALSE}, {TRUE}}},
   {"smbntsec", {&allow_smbntsec}, justset, NULL, {{FALSE}, {TRUE}}},
   {"reset_com", {&reset_com}, justset, NULL, {{FALSE}, {TRUE}}},
+  {"right_alt_meta", {&meta_mask}, justset, NULL, {{LEFT_ALT_PRESSED}, {LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED}}},
   {"strip_title", {&strip_title_path}, justset, NULL, {{FALSE}, {TRUE}}},
   {"title", {&display_title}, justset, NULL, {{FALSE}, {TRUE}}},
   {"tty", {NULL}, set_process_state, NULL, {{0}, {PID_USETTY}}},


--- fhandler_console.cc.orig	Mon Jan 29 18:36:12 2001
+++ fhandler_console.cc	Mon Feb 26 22:44:40 2001
@@ -50,6 +50,11 @@ const char * get_nonascii_key (INPUT_REC

 static BOOL use_mouse = FALSE;

+// This is a constant set by the user via CYGWIN=.  It is set to a
+// mask which we apply against characters coming from the console to
+// determine it they should be prefixed by META (\033).
+int meta_mask = LEFT_ALT_PRESSED;
+
 static tty_min NO_COPY *shared_console_info = NULL;

 /* Allocate and initialize the shared record for the current console.
@@ -220,7 +225,7 @@ fhandler_console::read (void *pv, size_t
 		 converting a CTRL-U. */
 	      if ((unsigned char)ich > 0x7f && current_codepage == ansi_cp)
 		OemToCharBuff (tmp + 1, tmp + 1, 1);
-	      if (!(input_rec.Event.KeyEvent.dwControlKeyState & LEFT_ALT_PRESSED))
+	      if (!(input_rec.Event.KeyEvent.dwControlKeyState & meta_mask))
 		toadd = tmp + 1;
 	      else
 		{


Here is the ChangeLog:

Tue Feb 27 14:22:10 2001  Jason Tiller <jdtiller@best.com>

	* environ.cc: Add extern link to to keyboard meta key mask
	global variable.
	Add "right_alt_meta" CYGWIN environment option to 'struct
	parse_thing known[]' array.  User sets "right_alt_meta" to use
	the right <alt> key (AltGr) as Meta, not as a modifier.
	* fhandler_console.cc: Add global variable 'meta_mask'.
	(fhandler_console::read): Use new meta_mask variable to test
	input keystrokes for Meta instead of just LEFT_ALT_PRESSED.


Thank you for considering this patch.  I hope others can get some use
out of it.

---Jason Tiller
jdtiller@best.com
Sonos


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

----- End forwarded message -----

-- 
cgf@cygnus.com                        Red Hat, Inc.
http://sources.redhat.com/            http://www.redhat.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]