Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!nntpd.lkg.dec.com!engage!3d.enet.dec.com!davis From: davis@3d.enet.dec.com (Peter Davis) Newsgroups: comp.windows.x Subject: Re: How to simulate mouse events from a data tablet Message-ID: <1991May30.191703.11099@engage.pko.dec.com> Date: 30 May 91 19:07:18 GMT Sender: newsdaemon@engage.pko.dec.com (USENET News Daemon) Distribution: usa Organization: Digital Equipment Corporation Lines: 49 In article <1991May30.022513.15790@auto-trol.com>, marbru@auto-trol.com (Martin Brunecky) writes... > Can you elaborate on why you have to XGrabPointer ? (I don't, and have > no problems I can see - so far). I had thought that I needed to have the pointer grabbed in order to be able to move it anywhere on the screen. I've since gone back and tested and found this is not the case, so you don't really need to grab the pointer, except... XWarpPointer generates it's own motion events. However, the key/button mask in those events is that of the "real" pointing device, rather than the "fake" device you're simulating. So, to get the events to have the correct key/button mask, I think you have to grab the pointer, move it, and then explicitly send events to the affected window(s). > Plus, I also found I have to look at what events those windows are > interested in. The "propagate" mechanism did not work for me, so I am > looking for the "topmost" window containing the pointer AND interested > in a particular event. Yeah, I probably should do that too. I don't think there's any trivial way to determine which window should get the events. Nothing I've tried seems to work for window manager decoration. > I found I can easily send a button event. The problems arise when the > client receiving this button event either: > - assumes a passive grab > - grabs the button explicitly. > > For example, trying to resize window from a "simulated" mouse under > most widnow managers won't work - those guys grab the "real" mouse > button - which is not depressed. > Grabbing the pointer for motions might help, but I am worried it will > confuse other things .... If the window manager grabs the "real" mouse, that shouldn't precluded its getting synthetic events from your input device. The problem may be related to the button state mask, as I mentioned earlier. It may also be that the window manager is explicitly ignoring events which have the send_event flag set to true, but that would be really nasty. So far, I think it's mainly a problem of figuring out which window to send to. Any suggestions, comments, etc. are welcome. If you're interested in exchanging code to have a look at what each other is doing, it might save us both some time. Send me some mail if interested. Thanks. -pd