[comp.windows.x] Quick 'n dirty use of mouse question

markus@etn-rad.UUCP (Markus Richardson) (04/23/88)

I am attempting to port an application that previously ran on an 
ansi/vt100-based terminal.  I realize it is not an elegant solution, never-
theless, I have no problem invoking it under xterm for the time being.  NOW MY
DILEMMA: this application uses both the cursor keys and the mouse to move the 
selector for the light-bar menu around.  The application reads the operator 
input from stdin which works fine for all cases except the mouse.  Is there a 
way (short of using XEvents) to "read" the mouse "directly" without contending 
with XEvents and such?

I know I should request input from the XEventQ which is the proper and 
consistent way to handle both keyboard and mouse, but I'm looking for a
interim solution.  Later when I get the time I shall convert the whole
mess to XEvent-driven processing (Gee I`ve heard that line before :-).

Could it be the XQueryMouse and/or XQueryMouseButtons routines will do 
what I want?  The problem I have is that they require an argument of
the current window which I do not have and (I believe) could only get
via invoking XCreateWindow or XCreateTerm which I do not want to do unless
there is no other way.

Please excuse my ignorance of X and/or my ramblings about the problem.  I am
using X10.4 on an 80386-based ISC UNIX V.3 via a Microfield T8 display card
(I don't think any of that matters anyhow).  Please e-mail me any help/info
you can share.  Thanks in advance.


-- 

        Markus N. Richardson
        Research and Development
        Eaton Corporation IMSD
        Westlake Village, CA 91359
        
        { voder,ihnp4,trwrb,scgvaxd,jplgodo }!wlbr!etn-rad!markus
          wlbr!etn-rad!markus@etn-wlv.eaton.com

ogata@LEVIATHAN.CS.UMD.EDU (Jeff Ogata) (04/24/88)

Try XQueryMouse (RootWindow,&x,&y,&subw).  This might work.  Then again,
I've never tried it.

Another thing that works well for mouse stuff is an XGrabMouse, and a loop
to swallow up all the XEvents from the mouse.  XGrabMouse prevents mouse
events from going to other clients.  Of course, this requires that you
use some XEvent stuff.  Life.

- Jeff Ogata
ogata@brillig.umd.edu