Re: Keyboard problem in Aterm (fixed)

Christian B. Wiik (christbw@tihlde.org)
10 May 1999 11:14:25 +0200


[Coplan <coplan@thunder.ocis.temple.edu>]
| Perhaps the patch can be submitted to the submission directory of
| ftp.afterstep.org so that future developments could take advantage of
| this?

ftp.afterstep.org didn't answer so here goes:

87a88,91
> 
> static unsigned int ModNumLockMask;
> void get_ourmods(void);
> 
1110a1115
>     get_ourmods();
1310a1316
> 
1314,1315c1320,1321
<     if (numlock_state || (ev->xkey.state & Mod5Mask)) {
< 	numlock_state = (ev->xkey.state & Mod5Mask);	/* numlock toggle */
---
> 		if (numlock_state || (ev->xkey.state & ModNumLockMask)) {
> 	numlock_state = (ev->xkey.state & ModNumLockMask);	/* numlock toggle */
1522c1528,1529
< 		if ((PrivateModes && PrivMode_aplKP) ? !shft : shft) {
---
> 		if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
> 
3566a3574,3615
> 
> 
> /*
>  * Probe the modifier keymap to get the Meta (Alt) and Num_Lock settings
>  * Use resource ``modifier'' to override the modifier
>  */
> /* INTPROTO */
> void
> get_ourmods(void)
> {
> 	int             i, j, k, m;
> 	int             got_numlock;
> 	XModifierKeymap *map;
> 	KeyCode        *kc;
> 	unsigned int    modmasks[] =
> 	{Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask};
> 
> 	map = XGetModifierMapping(Xdisplay);
> 	kc = map->modifiermap;
> 	got_numlock = m = 0;
> 	for (i = 3; i < 8; i++) {
> 		k = i * map->max_keypermod;
> 		for (j = 0; j < map->max_keypermod; j++, k++) {
> 			if (kc[k] == 0)
> 				break;
> 			switch (XKeycodeToKeysym(Xdisplay, kc[k], 0)) {
> 				case XK_Num_Lock:
> 					if (!got_numlock) {
> 						ModNumLockMask = modmasks[i - 3];
> 						got_numlock = 1;
> 					}
> 					break;
> 				default:
> 					break;
> 			}
> 		}
> 		if (got_numlock)
> 			break;
> 	}
> 	XFreeModifiermap(map);
> }
> 

--
   WWW:   http://www.afterstep.org/
   FTP:   ftp://ftp.afterstep.org/
   MAIL:  http://www.calderasystems.com/linuxcenter/forums/afterstep.html