[Fwd: CapsLock and mol]

Bertin Jean-Charles mol-general@lists.maconlinux.org
01 Jul 2003 16:35:13 +0200


--=-i3B+3zmR7zF/Pw1CofX1
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

-----Forwarded Message-----
From: Bertin Jean-Charles <jc.bertin@free.fr>
To: samuel@ibrium.se
Subject: CapsLock and mol
Date: 23 Jun 2003 15:01:58 +0200

Hi, I'm a coworker of BenH, and have a problem with capslock on
PowerBook G4 667 (model: PowerBook3,3) running Linux 2.4.21-ben1, XFree
4.3: i have  to press capslock two times to get it work correctly... I
looked at keycodes.c and saw you have special code for capslock.
I don't know if I'm right but i correct my problem with the patch in
attachment. Maybe the problem is rather in x11 keyboard management or
elsewhere.

-- 
Jean-Charles Bertin


--=-i3B+3zmR7zF/Pw1CofX1
Content-Disposition: attachment; filename=keycodes.c.diff
Content-Type: text/plain; name=keycodes.c.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

===== src/drivers/keycodes.c 1.15 vs edited =====
--- 1.15/src/drivers/keycodes.c	Wed Jun 11 08:08:09 2003
+++ edited/src/drivers/keycodes.c	Fri Jun 20 04:46:29 2003
@@ -34,6 +34,7 @@
 
 #define USE_LINUX_KEYCODES_RES		"use_linux_keycodes"
 #define SHOW_KEY_TRANS_RES		"show_key_trans"
+#define NEWSTYLE_CAPSLOCK_RES		"new_style_capslock"
 
 
 static char *key_res_names[ NUM_KEYCODE_TABLES ] = {
@@ -75,6 +76,7 @@
 
 static int	initialized;
 static int	verbose_key_trans;
+static int	newstyle_capslock;
 
 
 int
@@ -296,15 +298,15 @@
 	if( handle_mol_keycomb(code, is_keypress) )
 		return;
 
+	if( !gPE.adb_key_event )
+		return;
+
 	/* simulate old-style caps lock */
-	if( code == KEY_CAPSLOCK ) {
+	if( !newstyle_capslock && code == KEY_CAPSLOCK ) {
 		if( !is_keypress )
 			return;
 		is_keypress = !(b & *p);
 	}
-
-	if( !gPE.adb_key_event )
-		return;
 	
 	if( is_keypress && !(b & *p) ) {
 		if( !gPE.adb_key_event(code, keycode) )
@@ -491,7 +493,8 @@
 
 	_uses_linux_keycodes = 1;
 	verbose_key_trans = get_bool_res( SHOW_KEY_TRANS_RES ) == 1;
-	
+	newstyle_capslock = get_bool_res( NEWSTYLE_CAPSLOCK_RES ) == 1;
+
 	if( !get_bool_res( USE_LINUX_KEYCODES_RES ) )
 		_uses_linux_keycodes = 0;
 	else if( (f=fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes", "r")) ) {

--=-i3B+3zmR7zF/Pw1CofX1--