XWarpPointer seems doesn't work properly.
Asano, Yasushi
yasushi.asano at jp.fujitsu.com
Tue Jan 22 16:46:48 PST 2013
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-only-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
}
return 0;
}
----------------------------------------------------------------------------------------------
I added these keyboard shortcuts to .twmrc.
~/.twmrc
------------------------------------------
RandomPlacement
"F1" = : all : f.exec "xterm &"
"F2" = : all : f.fullzoom
"F3" = : all : f.raiselower
"F4" = : all : f.focus
"F5" = : all : f.showiconmgr
"F6" = : all : f.warptoiconmgr ""
"F7" = : all : f.downiconmgr
"F8" = : all : f.hideiconmgr
"F9" = : all : f.iconify
"F10" = : all : f.delete
"F11" = : all : f.quit
"F12" = : all : f.exec "exec kterm &"
"F12" = m : all : f.startwm "wmaker"
"Tab" = m : all : f.raiselower
"Return" = s : all : f.fullzoom
------------------------------------------
More information about the xorg
mailing list