TR: X11 window can't follow the mouse

Dear list members!

I try to move the X11 window according to the mouse motion but the window
can’t catch up:

SDL_MOUSEMOTION:
if (mouseButtonPressed) {
x += event.motion.xrel;
y += event.motion.yrel;
wmInfo.info.x11.lock_func();
XMoveWindow(wmInfo.info.x11.display, wmInfo.info.x11.wmwindow, x, y);
wmInfo.info.x11.unlock_func();
}

Any ideas?

Thanks,
Michael

Michael Reimpell wrote:

I try to move the X11 window according to the mouse motion but the window
can’t catch up:

x += event.motion.xrel;
y += event.motion.yrel;

You might try setting the position directly, instead of adding small
amounts at each update. In general, you should try doing things in a way
that gives a correct result even with a very low updaterate.

Regards,
\Mikkel Gjoel

You might try setting the position directly, instead of adding small
amounts at each update. In general, you should try doing things in a way
that gives a correct result even with a very low updaterate.

Thanks, this works:

    case SDL_MOUSEMOTION:
      if (mouseButtonPressed) {          
        x += event.motion.x-mouseXButton;
        y += event.motion.y-mouseYButton;
      }
      break;
    case SDL_MOUSEBUTTONDOWN:
      mouseButtonPressed = true;
      mouseXButton = event.button.x;
      mouseYButton = event.button.y;
      break;

Kind regards,
Michael

You may want to print out the value of event.motion.x and event.motion.y,
You will find that they are 1,-1 or 0. I recently made this same oversight.
Hope that helps,
Jason.> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org]On Behalf Of
Michael Reimpell
Sent: Friday, October 24, 2003 3:10 AM
To: sdl at libsdl.org
Subject: [SDL] TR: X11 window can’t follow the mouse

Dear list members!

I try to move the X11 window according to the mouse motion but the window
can’t catch up:

SDL_MOUSEMOTION:
if (mouseButtonPressed) {
x += event.motion.xrel;
y += event.motion.yrel;
wmInfo.info.x11.lock_func();
XMoveWindow(wmInfo.info.x11.display, wmInfo.info.x11.wmwindow, x, y);
wmInfo.info.x11.unlock_func();
}

Any ideas?

Thanks,
Michael


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl