X.Org crash when trying to use XWarpPointer

Alan Coopersmith Alan.Coopersmith at Sun.COM
Wed Jun 24 07:10:37 PDT 2009


BlackLight wrote:
> I get a problem on the university computer when I try to move the
> cursor position using XWarpPointer. I should use it to move the cursor
> when the object identified as a "face" moves. This is the method I
> use:
> 
> int setPointerPos (int x, int y)  {
>        Display *disp;
>        Window root;
>        Window father, child;
>        int screen;
>        int width = 1024; int height = 768;
> 
>        if (!(disp = XOpenDisplay(NULL)))
>                return -1;
> 
>        screen = DefaultScreen(disp);
>        root = RootWindow(disp,screen);
> 
>        if (!XWarpPointer(disp, father, child, 0, 0, width, height, x, y))
>                return -1;
> 
>        XCloseDisplay(disp);
>        return 0;
> }

father & child are never initialized in this code.

> and this is the problem I get when a face is detected and I try to
> move the cursor:
> 
> The program 'Smart detection' received an X Window System error.
> This probably reflects a bug in the program.
> The error was 'BadWindow (invalid Window parameter)'.
>  (Details: serial 7 error_code 3 request_code 41 minor_code 0)

man XWarpPointer says:
DIAGNOSTICS
     BadWindow A value for a Window argument does not name a
               defined Window.

The Window arguments are the ones you've failed to initialize - "father"
and "child" in your code.

-- 
	-Alan Coopersmith-           alan.coopersmith at sun.com
	 Sun Microsystems, Inc. - X Window System Engineering




More information about the xorg mailing list