p_davis@epik.enet.dec.com (Peter Davis) (12/07/90)
I'd like to be able to use a tablet with a pressure-sensitive stylus in place of a mouse on my workstation. Somebody told me that the easiest way to do this was to write a driver which packages up the tablet input in the form of a mouse event, and then sends that packet to the Xserver. I want to event to propagate through all the layers of server, window manager, toolkit, etc. so that the tablet behaves normally for other windows, menus, etc. Can anyone tell me: - how to send an event packet to the server, so that it will propagate through all the other layers? I know XSendEvent will send it to another window, but that's not the same. - if I can cram the stylus pressure into the high two bytes of the 'state' field in the motion event structure? The Xlib manual shows this field as being unsigned int, and the most of the low order 16 bits are defined as various button and modifier key masks. Can I I use the high 16 bits for pressure? My goal is to have the tablet and stylus behave just like a mouse for all unwitting applications, but to make it possible for my applications to look for the pressure information in the event structure, and use that. Thanks for any and all help. -pd
mouse@LARRY.MCRCIM.MCGILL.EDU (12/10/90)
> I'd like to be able to use a tablet with a pressure-sensitive stylus > in place of a mouse on my workstation. It will be difficult to do this with X. How do you propose to implement WarpPointer requests? Some mysterious force from the workstation grabs the stylus and shoves it over to where it's been warped to? I suppose if you're willing to yank the pointer back to where the stylus really is when a client warps it away, you could do this, but it seems contrary to the spirit of XWarpPointer() to do that. Not that that makes it illegal. > My goal is to have the tablet and stylus behave just like a mouse for > all unwitting applications, but to make it possible for my > applications to look for the pressure information in the event > structure, and use that. You're going to have to define a new event type. The current event structure does not have anywhere to put this information. You say > [Can I] cram the stylus pressure into the high two bytes of the > 'state' field in the motion event structure? The Xlib manual shows > this field as being unsigned int, and the most of the low order 16 > bits are defined as various button and modifier key masks. Can I I > use the high 16 bits for pressure? but the protocol uses a 16-bit field for this (check out the encoding in Appendix B). Expanding it by two more bytes would be an incompatible change and therefore is highly unlikely to happen. Your best bet, I would say, is to implement it as an extension. If no real pointer device is available, you could have it front for one, more or less ignoring warps (more precisely, warping right back again), but I'd consider that as a sort of desperation move. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu
janssen@parc.xerox.com (Bill Janssen) (12/11/90)
In article <9012091744.AA15646@Larry.McRCIM.McGill.EDU> mouse@LARRY.MCRCIM.MCGILL.EDU writes:
If no
real pointer device is available, you could have it front for one, more
or less ignoring warps (more precisely, warping right back again), but
I'd consider that as a sort of desperation move.
Actually, having done just this with an absolute-position device, it works
quite well.
Bill
--
Bill Janssen janssen@parc.xerox.com (415) 494-4763
Xerox Palo Alto Research Center
3333 Coyote Hill Road, Palo Alto, California 94304