Mouse not working with recent msys2?

Discussion of development and patch submission.
Post Reply
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

Mouse not working with recent msys2?

Post by JosepMa »

Hello.

It's been a while since I last tried to build pcem ( my last compile of v17 is from june 2021), and this week I thought about testing how is the project going.

As I say in the subject, I am using MSYS2 on windows. I updated it (pacman -Syu and all that), and ended with a GCC 11.3 and wxwidgets 3.0.5.

I followed the updated instructions on the [Sep 2020 ed.] PCem MSYS2 build guide (with wxWidgets) thread (last post) and quickly had my new pcem ready to rock (or so I thought).
[Edit: x86 release build. I also tried x86 debug, x64 release and even a clang64 release that segfaults on running. Possibly related to the dynarec problems, since it ignore the -O0 optimizer pragma]

I ran it, saw the new preferences dialog and launched to windows, just to realize that I couldn't move the mouse (well.. almost).
Tried a different machine, on MS-DOS, and the same.
Tried yet another machine (The other two emulated a PS-2 mouse and now I tried with a serial one), and exactly the same problem.

The mouse works. Both buttons work, but the cursor does not move. Sometimes when moving it fast it jumps to another place.

I tried to understand the problem, so I modified mouse/mouse_ps2.c to add some logging and I got the log below:
What can be seen is that it is receiving some values, and next it receives the same values inverted. So the mouse goes back to the position where it was.
In fact, I was able to see this behavior on Windows:
I clicked the left button as if I wanted to drag/select on the desktop, and I could see that sometimes it tried to draw the dots that represent the rectangle of the selection, but quickly it returned to the original position.

What could be the reason of this? Is it a bug on wxwidgets?
Or are we using it in a legacy way that is going to stop working?
I'm quite confused about why it would do this.

Code: Select all

good, we have a new value
good, we have a mouse_scan
mouse_x:56 mouse_y:20, mouse_z:0
Final values for mouse: x:56 y:20, z:0 and for packet: 8, 56, 20

onesec
good, we have a new value
good, we have a mouse_scan
mouse_x:-8 mouse_y:1, mouse_z:0
Final values for mouse: x:-8 y:1, z:0 and for packet: 24, 248, 1

good, we have a new value
good, we have a mouse_scan
mouse_x:8 mouse_y:-1, mouse_z:0
Final values for mouse: x:8 y:-1, z:0 and for packet: 40, 8, 255

good, we have a new value
good, we have a mouse_scan
mouse_x:16 mouse_y:2, mouse_z:0
Final values for mouse: x:16 y:2, z:0 and for packet: 8, 16, 2

good, we have a new value
good, we have a mouse_scan
mouse_x:-16 mouse_y:-2, mouse_z:0
Final values for mouse: x:-16 y:-2, z:0 and for packet: 56, 240, 254

onesec
good, we have a new value
good, we have a mouse_scan
mouse_x:-2 mouse_y:-1, mouse_z:0
Final values for mouse: x:-2 y:-1, z:0 and for packet: 56, 254, 255

good, we have a new value
good, we have a mouse_scan
mouse_x:2 mouse_y:1, mouse_z:0
Final values for mouse: x:2 y:1, z:0 and for packet: 8, 2, 1

onesec
onesec
good, we have a new value
good, we have a mouse_scan
mouse_x:-9 mouse_y:-5, mouse_z:0
Final values for mouse: x:-9 y:-5, z:0 and for packet: 56, 247, 251

good, we have a new value
good, we have a mouse_scan
mouse_x:9 mouse_y:5, mouse_z:0
Final values for mouse: x:9 y:5, z:0 and for packet: 8, 9, 5

onesec
good, we have a new value
good, we have a mouse_scan
mouse_x:-11 mouse_y:-2, mouse_z:0
Final values for mouse: x:-11 y:-2, z:0 and for packet: 56, 245, 254

good, we have a new value
good, we have a mouse_scan
mouse_x:11 mouse_y:2, mouse_z:0
Final values for mouse: x:11 y:2, z:0 and for packet: 8, 11, 2

onesec
onesec
good, we have a new value
good, we have a mouse_scan
mouse_x:82 mouse_y:10, mouse_z:0
Final values for mouse: x:82 y:10, z:0 and for packet: 8, 82, 10

good, we have a new value
good, we have a mouse_scan
mouse_x:-82 mouse_y:-10, mouse_z:0
Final values for mouse: x:-82 y:-10, z:0 and for packet: 56, 174, 246

good, we have a new value
good, we have a mouse_scan
mouse_x:-10 mouse_y:42, mouse_z:0
Final values for mouse: x:-10 y:42, z:0 and for packet: 24, 246, 42

good, we have a new value
good, we have a mouse_scan
mouse_x:8 mouse_y:-7, mouse_z:0
Final values for mouse: x:8 y:-7, z:0 and for packet: 40, 8, 249

good, we have a new value
good, we have a mouse_scan
mouse_x:2 mouse_y:-35, mouse_z:0
Final values for mouse: x:2 y:-35, z:0 and for packet: 40, 2, 221

onesec
onesec
onesec
good, we have a new value
good, we have a mouse_scan
mouse_x:0 mouse_y:1, mouse_z:0
Final values for mouse: x:0 y:1, z:0 and for packet: 8, 0, 1

good, we have a new value
good, we have a mouse_scan
mouse_x:0 mouse_y:-1, mouse_z:0
Final values for mouse: x:0 y:-1, z:0 and for packet: 40, 0, 255
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

Re: Mouse not working with recent msys2?

Post by JosepMa »

As I reported on the Pcem Issue on Github https://github.com/sarah-walker-pcem/pcem/issues/139
the problem is found, and is a PCem bug, caused by a change in behaviour of the method SDL_WarpMouseInWindow, which was documented to have this behaviour. (i.e. cause a mouse move event)
Post Reply