Minimal example of weird pointer behaviour

Can anyone with a Windows 2000 box to hand confirm the weird pointer behaviour
I’ve seen? This short test program demonstrates it (you man need to change
the #include or WinMain declaration, I just picked the first set of options
taht worked with my cross-compiler setup):

#include “SDL/SDL.h”

int WinMain(int argc, char **argv)
{
int quit = 0;
SDL_Init(SDL_INIT_EVERYTHING);

SDL_SetVideoMode(640, 480, 16, SDL_FULLSCREEN);
while (!quit)
{
    SDL_Event event;
    
    while (SDL_PollEvent(&event))
    {
        switch (event.type)
        {
            case SDL_MOUSEBUTTONDOWN:
            	quit = 1;
        }
    }
}

}

Now for me the mouse pointer stays stuck to one side of the screen, and as I
drag the mouse across the desk, there’s about a 1cm distance corresponding to
the length of the screen, and then it’s stuck to the other side. This
happens in both X and Y directions.

Anyone know why this happens, or what to do about it? Experiements will
continue apace.–
Matthew > http://www.soup-kitchen.net/
> ICQ 19482073

[snip]

Now for me the mouse pointer stays stuck to one side of the screen, and as
I drag the mouse across the desk, there’s about a 1cm distance
corresponding to the length of the screen, and then it’s stuck to the other
side. This happens in both X and Y directions.

Anyone know why this happens, or what to do about it? Experiements will
continue apace.

Okay so I’ve no idea why it happens, I’m just concerned about how to fix it.
I’ve not programmed to the Win32 API directly, nor DirectInput, so my
experiments so far have been pretty random: I’ve tried telling DirectInput to
use background mode access to the mouse, which results in two pointers, one
of which moves at about 2/3rds the speed of the normal one, and seems to
dictate the X,Y position. The most successful experiment involved not
telling DirectInput to even claim the mouse at all (just deleted the struct
pointing it at handle_mouse) which got me a pointer which moved perfectly,
but wouldn’t disppear and didn’t respond to clicks properly.

Any idea what the right combination of hacks might be?

cheers,On Tuesday 10 September 2002 12:50, Matthew Bloch wrote:


Matthew > http://www.soup-kitchen.net/
> ICQ 19482073

Can anyone with a Windows 2000 box to hand confirm the weird pointer behaviour
I’ve seen? This short test program demonstrates it (you man need to change
the #include or WinMain declaration, I just picked the first set of options
taht worked with my cross-compiler setup):

#include “SDL/SDL.h”

int WinMain(int argc, char **argv)

I don’t know if this is your problem, but you need to declare main() this way:
int main(int argc, char *argv[])

This does affect the initialization of DirectInput, so give it a try and let
me know if that fixes your problems.

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

The effect that program demonstrates is the same as one that occurs in the
game, which is just a Ruby script. The Ruby interpreter starts up with plain
old main() and SDL_Initialize is called from the RUDL library, so I presume
this is the ‘legit’ way to start up, though obviously that doesn’t link with
SDL_main (though maybe it should…?).

Anyhow even if I change that WinMain to the usual unix main() function
signature, and use this to compile the program:

/usr/local/cross-tools/bin/i386-mingw32msvc-gcc -mwindows
-o testmouse.exe testmouse.c
/usr/local/cross-tools/i386-mingw32msvc/bin/sdl-config --cflags --libs

It still shows the same effect. It ‘feels’ like Windows 2000 is passing
multiplied-up values to handle_mouse, and that xrel and yrel are being
calculated incorrectly. Without some deeper DirectInput knowledge I’m not
sure how this is happening though; if nobody knows why, looks like I’ll have
to acquire myself some in the next 48 hrs :-)On Tuesday 10 September 2002 17:54, Sam Lantinga wrote:

Can anyone with a Windows 2000 box to hand confirm the weird pointer
behaviour I’ve seen? This short test program demonstrates it (you man
need to change the #include or WinMain declaration, I just picked the
first set of options taht worked with my cross-compiler setup):

#include “SDL/SDL.h”

int WinMain(int argc, char **argv)

I don’t know if this is your problem, but you need to declare main() this
way: int main(int argc, char *argv[])


Matthew > http://www.soup-kitchen.net/
> ICQ 19482073

Hi,

your minimal example works fine on my win2k box. I had to change
WinMain() to main() (and add a return 0;) to get it to compile and
link.

What version of SDL are you using?

cheers,
John.> ----- Original Message -----

From: mattbee-sdl@soup-kitchen.net (Matthew Bloch)
To:
Sent: Tuesday, September 10, 2002 7:35 PM
Subject: Re: [SDL] Minimal example of weird pointer behaviour

On Tuesday 10 September 2002 17:54, Sam Lantinga wrote:

Can anyone with a Windows 2000 box to hand confirm the weird pointer
behaviour I’ve seen? This short test program demonstrates it (you man
need to change the #include or WinMain declaration, I just picked the
first set of options taht worked with my cross-compiler setup):

#include “SDL/SDL.h”

int WinMain(int argc, char **argv)

I don’t know if this is your problem, but you need to declare main()
this

way: int main(int argc, char *argv[])

The effect that program demonstrates is the same as one that occurs in the
game, which is just a Ruby script. The Ruby interpreter starts up with
plain
old main() and SDL_Initialize is called from the RUDL library, so I
presume
this is the ‘legit’ way to start up, though obviously that doesn’t link
with
SDL_main (though maybe it should…?).

Anyhow even if I change that WinMain to the usual unix main() function
signature, and use this to compile the program:

/usr/local/cross-tools/bin/i386-mingw32msvc-gcc -mwindows
-o testmouse.exe testmouse.c
/usr/local/cross-tools/i386-mingw32msvc/bin/sdl-config --cflags --libs

It still shows the same effect. It ‘feels’ like Windows 2000 is passing
multiplied-up values to handle_mouse, and that xrel and yrel are being
calculated incorrectly. Without some deeper DirectInput knowledge I’m not
sure how this is happening though; if nobody knows why, looks like I’ll
have
to acquire myself some in the next 48 hrs :slight_smile:


Matthew > http://www.soup-kitchen.net/
> ICQ 19482073


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

Yes.

Actually the problem is most accurately demonstrated by VNC (which is how I
normally use the PC, at least with x2vnc). If I open an xvncviewer window
onto the PC while watching the monitor, I can see just how small a wiggle I
need to make on the virtual screen to make the pointer on the real screen
zoom from one corner to another (about the middle 1/5th in both X & Y
directions).On Wednesday 11 September 2002 00:16, Sam Lantinga wrote:

Can anyone with a Windows 2000 box to hand confirm the weird pointer
behaviour I’ve seen?

I tried your program without any problems on Windows 2000.
Does the problem happen with CVS SDL?
http://www.libsdl.org/cvs.php


Matthew > http://www.soup-kitchen.net/
> ICQ 19482073

More on this problem:

If I hack SDL_dx5events.c and divide xrel and yrel by 16 for every input
message in handle_mouse, the mouse movement appears to scale sensibly but
suffers from a buffering problem: there appears to be a buffer of mouse
movements an one is popped off the top every time I move the mouse.
Unfortunately this buffer appears to be permanently a few movements behind,
so the mouse has an irritating lag on it. I’ve tried raising INPUT_QSIZE to
512 but that doens’t make any difference.On Wednesday 11 September 2002 02:40, Matthew Bloch wrote:

On Wednesday 11 September 2002 00:16, Sam Lantinga wrote:

Can anyone with a Windows 2000 box to hand confirm the weird pointer
behaviour I’ve seen?

I tried your program without any problems on Windows 2000.
Does the problem happen with CVS SDL?
http://www.libsdl.org/cvs.php

Yes.

Actually the problem is most accurately demonstrated by VNC (which is how I
normally use the PC, at least with x2vnc). If I open an xvncviewer window
onto the PC while watching the monitor, I can see just how small a wiggle I
need to make on the virtual screen to make the pointer on the real screen
zoom from one corner to another (about the middle 1/5th in both X & Y
directions).


Matthew > http://www.soup-kitchen.net/
> ICQ 19482073