XWarpPointer seems doesn't work properly.

Asano, Yasushi yasushi.asano at jp.fujitsu.com
Wed Jan 23 16:09:51 PST 2013


> -----Original Message-----
> From: xorg-bounces+yasushi.asano=jp.fujitsu.com at lists.x.org
> [mailto:xorg-bounces+yasushi.asano=jp.fujitsu.com at lists.x.org] On
> Behalf Of Peter Hutterer
> Sent: Wednesday, January 23, 2013 4:19 PM
> To: Asano, Yasushi/浅野 恭史
> Cc: xorg at lists.x.org
> Subject: Re: XWarpPointer seems doesn't work properly.
> 
> On Wed, Jan 23, 2013 at 12:46:48AM +0000, Asano, Yasushi wrote:
> > Hello,
> > I have a problem with XWarpPointer. It seems doesn't work properly.
> > After startx, I don't move the mouse. and then I run a program which
> should move the mouse pointer around the screen (in absolute coordinates)
> as below WITHOUT moving the mouse cursor.
> > (I use keyboard shortcut to run program.)
> > However, visual mouse cursor jumped to a single position (x=0,y=0) on
> the screen and stay there permanently until the program is finished.
> >
> > The program seems work properly judging from message as below. but
> visual mouse cursor is locked to a same position (x=0, y=0) on the screen.
> >
> > XWarpPointer(): x=   0, y=   0
> > XWarpPointer(): x= 100, y= 100
> > XWarpPointer(): x= 200, y= 200
> > XWarpPointer(): x= 300, y= 300
> > XWarpPointer(): x= 400, y= 400
> > XWarpPointer(): x= 500, y= 500
> > XWarpPointer(): x= 600, y= 600
> > XWarpPointer(): x= 700, y= 700
> >
> > If I move the mouse cursor before I run the program, XWarpPointer works.
> visual mouse cursor move correctly.
> > What is causing the XWarpPointer to only run once? Is it some kind of
> X11 feature to protect the user from the application?
> >
> > I'm running into an issue on xorg-server 1.8.2 and libX11 1.3.1.
> > However, I could see a same problem with xorg on Fedora17(xorg-server
> 1.12.0 and libX11 1.4.99).
> > Could you please suggest me how can I solve this problem?
> >
> > Lastly, I found similar problem on website.
> >
> http://stackoverflow.com/questions/5848909/why-does-xwarppointer-onl
> y-work-once-while-in-a-loop
> > but It seems this issue has not yet been solved.
> >
> > Thank you for your time and assistance regarding this matter.
> >
> --------------------------------------------------------------------
> --------------------------
> > #include <stdio.h>
> > #include <unistd.h>
> > #include <X11/X.h>
> > #include <X11/Xlib.h>
> > #include <X11/Xutil.h>
> >
> > int main(int argc, char *argv[]){
> > 	//Get system window
> > 	Display *dpy;
> > 	Window root_window;
> > 	int x,y;
> >
> > 	dpy = XOpenDisplay(0);
> > 	root_window = XRootWindow(dpy, 0);
> > 	XSelectInput(dpy, root_window, KeyReleaseMask);
> >
> > 	for (x=0,y=0; y<768; x+=100,y+=100) {
> > 		sleep(1);
> > 		printf("XWarpPointer(): x=%5d, y=%5d\n", x, y);
> > 		XWarpPointer(dpy, None, root_window, 0, 0, 0, 0, x, y);
> > 		XFlush(dpy);
> >                //XSync(dpy, False); <-- no difference
> 
> XSync is good to force the server to process the request, otherwise
> multiple
> XWarpPointer requests may be stuck in Xlib's output queue and never reach
> the server. It does not, however, make a difference here as you're already
> calling XFlush(). And passing true/false merely decides whether events
> are discarded, but doesn't affect the server's processing.
> 
> having said this, it appears to work fine on current git and I tried 1.12.0
> as well where this works and I can see the pointer moving across the
> screen.
> 
> fwiw, this isn't an issue of whether it runs once, if anything the pointer
> update on the screen is incorrect. you can verify this by running xev,
> you
> should see the events with the right coordinates even if the visible
> pointer
> doesn't update. But then again, it seems to work just fine here.
> 
> Cheers,
>    Peter

Thank you so much for your prompt reply.
I tried xorg on Fedora17(xorg-server 1.12.0 and libX11 1.4.99) again and get the same inconsistent behaviour.
After I do startx and run the program, very occasionally it all works correctly, with the pointer visually jumping (0,0) to (100,100) to (200,200) etc. 
However, mostly when I run the program, the pointer stays in one place and only sometimes jumps to the coordinate I specified. 
Even if I change my "sleep" value to TEN SECONDS. I still get the same erratic display behaviour.
I checked in xev and the coordinates are changing correctly, but the displayed position does not jump as it should.
If possible please could you check again in your environment just to be sure? 
I can't figure out why I get this strange behaviour.. 
Do you have any theories?




More information about the xorg mailing list