Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!rochester!kodak!ispd-newsserver!ism.isc.com!b1!ico!auto-trol!marbru From: marbru@auto-trol.com (Martin Brunecky) Newsgroups: comp.windows.x Subject: Re: How to simulate mouse events from a data tablet Message-ID: <1991May31.163832.22933@auto-trol.com> Date: 31 May 91 16:38:32 GMT References: <1991May30.191703.11099@engage.pko.dec.com> Sender: news@auto-trol.com Distribution: usa Organization: Auto-trol Technology Corporation Lines: 39 Nntp-Posting-Host: server_1-gw In article <1991May30.191703.11099@engage.pko.dec.com> davis@3d.enet.dec.com (Peter Davis) writes: > >> Can you elaborate on why you have to XGrabPointer ? (I don't, and have >> no problems I can see - so far). > >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). Which means you have to properly simulate all enter/leave events. No thanx, I am giving up on that one -). > >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. > ....Window wins[...] - stack of windows containing the pointer /* find the window which wants our event, give up on don't propagate */ for ( --iw; iw >= 0; --iw) { XWindowAttributes attr; if ( XGetWindowAttributes ( dpy, wins[iw], &attr )) { if (attr.all_event_masks & mask ) break; if (attr.map_state != IsViewable ) continue; if (attr.do_not_propagate_mask & mask ) return(FALSE); } } -- =*= Opinions presented here are solely of my own and not those of Auto-trol =*= Martin Brunecky marbru%auto-trol@sunpeaks.central.sun.com (303) 252-2499 (better avoid: marbru@auto-trol.COM ) Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404