SDL 1.2.14+ DirectInput issue with 9x


#1

For the last few months (off and on) I’ve been working on attempting to identify an issue that has prevented DirectInput from functioning correctly with SDL since this commit:

Issues:

WINDIB
MOUSE WORKS FINE

DIRECTINPUT
Mouse cursor when dragged over window in non-relative mode will be stuck in the window unless the mouse is dragged enough to finally leave it. Mouse works fine in relative mode.

The other issue is that when the program (in this case DOSBox but also applies to the SDL test) is quit then the cursor is frozen on the desktop.

FIXES
I’ve put the old SDL 1.2.13 code into SDL 1.2.15 by performing the bare minimum to get SDL 1.2.15 to work and this works but I wanted to know what was wrong with the current code…

With the help of gandhig on the Vogons forum we looked at it and he identified:

"The closest I got to a workaround to the erratic mouse movement issue with ‘directx’ driver is by modding the code from line nos. 324 to 327 of SDL_dx5events.c(just expanding the ‘trap’ rectangle slightly):

CODE: SELECT ALL
Line No:324: trap.left = cursor.x - 1;
Line No:325: trap.top = cursor.y - 1;
Line No:326: trap.right = cursor.x + 2;
Line No:327: trap.bottom = cursor.y + 2;

‘Mouse stuck on exit’ issue resolved by adding ‘ClipCursor(NULL)’ in DX5_DestroyWindow function after line no. 990 of SDL_dx5events.c
CODE: SELECT ALL
Line No:990: DX5_DInputQuit(this);
Line No:991: ClipCursor(NULL); /* free the stuck cursor while exiting in Win9X(windowed & grab mode = off) /
Line No:992: /
Destroy our window *" "

I’ve added on the above by adding the static int IS9xme() so that the above code only executes on 9x.

I was wondering if this is the best way to fix this and if not if what can be done to fix it further?

If this is the best way to fix this how can this code be added to the SDL 1.2 branch?

See this post for the diff I created with the current code:
https://www.vogons.org/viewtopic.php?f=31&t=55706&p=669666#p669666

I didn’t create a ticket yet for this because I wasn’t sure if anyone cared…