Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
801 stars 62 forks source link

Mouse speed + double click annoyance in Linux #389

Open Gerwin2k opened 2 years ago

Gerwin2k commented 2 years ago

I can compare two builds of Shockolate: WIN32 and Linux 64. Somehow no problems with WIN32 in this regard, but the Linux 64 version has an annoyance with the mouse control, two things:

1 - Mouse double click is not working comfortably, often the double click is not registered as such. I fixed it by increasing the time window in which the second click can be registered to make for a double click: src\GameSrc\input.c line 1147:

-   uiDoubleClickTime = 45;
+   uiDoubleClickTime = 90; 

2 - Mouse cursor speed (sensitivity?) is more then halved when in the 3D game, compared to the main menu or options menu. I found a way to maintain full cursor speed with the modification below. Setting RelativeMouseMode to False before the check for it. But since I do not know exactly what it implies, I do not dare to call it a proper fix: src\Libraries\INPUT\Source\sdl_events.c line 692:

       case SDL_MOUSEMOTION: {
+           SDL_SetRelativeMouseMode(SDL_FALSE); // added line
icosahedral-dragon commented 2 years ago

@Gerwin2k re your point 2: I see it as somewhat less than halved when running fullscreen. It seems to have to do with the way SDL does mouse coordinate scaling when using a logical renderer window. The absolute coordinates and relative motion values are scaled independently, and rounding errors mean that the relative motion is not necessarily equal to the change in absolute coordinates. A workaround would be to lose the 'if' clause altogether and always to use the supplied x and y coordinates directly, although that might break mouselook if the "real" mouse pointer goes outside the window.