Newsgroups: comp.windows.x
Path: cantaloupe.srv.cs.cmu.edu!das-news.harvard.edu!noc.near.net!howland.reston.ans.net!usc!sdd.hp.com!hpscit.sc.hp.com!cupnews0.cup.hp.com!hppad.waterloo.hp.com!lapp
From: lapp@waterloo.hp.com (David Lapp)
Subject: Re: NumLock masking? interference with Meta/Compose/ExtendChar, ...
Sender: news@waterloo.hp.com (NetNews)
Message-ID: <C5xvr4.20p@waterloo.hp.com>
Date: Fri, 23 Apr 1993 13:49:52 GMT
References: <9304221531.AA21890@blue.arbortext.com>
Nntp-Posting-Host: hppadan.waterloo.hp.com
Organization: HP Panacom Div Waterloo ON Canada
X-Newsreader: TIN [version 1.1 PL8.9]
Lines: 34

Ralph Seguin (rps@arbortext.COM) wrote:
: > My question is this:  Is there a means of determining what the state
: > of CapsLock and/or NumLock is?

: Alright.  Ignore this.  I have delved a bit deeper (XKeyEvent) and
: found what I was looking for.

: ev->state   has a bunch of masks to check against (LockMask is the one
: for CapsLock).  Unfortunately, it appears that the NumLock mask varies
: from server to server.  How does one tell what mask is numlock and
: which are for Meta (Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask).
: eg, SGI's vendor server has Mod2Mask being NumLock, whereas Solaris
: 1.0.1 OpenWindows 3.0 has Mod3Mask for NumLock.  Is there an
: unambiguous means of determining NumLock's mask at runtime for any
: given server?  Sorry for the wasted bandwidth and my appalling ignorance.

You'll have to check the keysym(s) on each of the keys for each
modifier. The one with NumLock in its mapping is the modifier
you want. A bit ugly perhaps but I think its currently the only
way to do this (and it does have some precedent as keysyms are 
used to differentiate CapsLock from ShiftLock for the Lock
modifier).

I don't know of an accepted strategy for handling ambiguous
assignments either. (ie. what if NumLock is mapped for more then
one modifier). I suppose first found is as good as any.

X doesn't handle locking modifiers that well. 

Hope that helps,

Dave Lapp

Standard Disclaimer etc...
