Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS: The mouse wheel needs several clicks to select prev/next weapon. #379

Open
Velociraptor555 opened this Issue Sep 4, 2018 · 22 comments

Comments

Projects
None yet
5 participants
@Velociraptor555
Copy link

Velociraptor555 commented Sep 4, 2018

The problem has been around for some time, I always pull the latest version from git and compile it prior to start the game. I used the latest macOS (High Sierra), Xcode and command line tools.

It is really hard to play the game that way. I've compiled the latest git revision to a 64 bit Windows binary: No problem on changing weapons with the mouse wheel there.

It would be nice if there was a fix soon.

@ensiform

This comment has been minimized.

Copy link

ensiform commented Sep 4, 2018

What version of sdl is being used do you know off hand?

@Velociraptor555

This comment has been minimized.

Copy link
Author

Velociraptor555 commented Sep 5, 2018

otool -L ioquake3 | grep -i sdl

yields

@executable_path/libSDL2-2.0.0.dylib (compatibility version 9.0.0, current version 9.0.0)

@ensiform

This comment has been minimized.

Copy link

ensiform commented Sep 5, 2018

I don't think that tells the version compiled. It's always called 2.0.0 regardless on Mac.

@Velociraptor555

This comment has been minimized.

Copy link
Author

Velociraptor555 commented Sep 6, 2018

port list installed | grep -i sdl

outputs

libsdl @1.2.15 devel/libsdl
libsdl2 @2.0.8 devel/libsdl2

@ensiform

This comment has been minimized.

Copy link

ensiform commented Sep 6, 2018

So the only two possibilities I can think of at the moment is incorrect handling of the mouse wheel in the ioquake3 translator code for SDL or it could be an actual SDL bug.

@mcaldas

This comment has been minimized.

Copy link

mcaldas commented Sep 6, 2018

I am having this issue too, on mac with latest build. Any idea how to fix it?

@zturtleman

This comment has been minimized.

Copy link
Member

zturtleman commented Sep 6, 2018

To help diagnose whether this is an issue in ioquake3 or SDL, edit code/sdl/sdl_input.c to add this Com_Printf message and then recompile ioquake3 and check if each scroll click prints one message to the console.

static void IN_ProcessEvents( void )
{
...
			case SDL_MOUSEWHEEL:
				// new debug message
				Com_Printf( "Mouse wheel event: x: %d, y: %d\n", e.wheel.x, e.wheel.y );

				if( e.wheel.y > 0 )
				{
					Com_QueueEvent( in_eventTime, SE_KEY, K_MWHEELUP, qtrue, 0, NULL );
					Com_QueueEvent( in_eventTime, SE_KEY, K_MWHEELUP, qfalse, 0, NULL );
				}
				else if( e.wheel.y < 0 )
				{
					Com_QueueEvent( in_eventTime, SE_KEY, K_MWHEELDOWN, qtrue, 0, NULL );
					Com_QueueEvent( in_eventTime, SE_KEY, K_MWHEELDOWN, qfalse, 0, NULL );
				}
				break;
@Velociraptor555

This comment has been minimized.

Copy link
Author

Velociraptor555 commented Sep 7, 2018

Result with instrumented IN_ProcessEvents(void):

  1. After start up, every wheel "klick" prints a line to console, but doesn't change weapon.
  2. After a very fast wheel move, console lines stick in the same way as the weapon change, one console line only after fast wheel rotation with several clicks.

I guess 1. is the relevant outcome for further investigating, but 2. indicates a general event handling problem, might be related to sticky wheel reaction in 1. or not.

@zturtleman

This comment has been minimized.

Copy link
Member

zturtleman commented Sep 13, 2018

e.wheel.x and e.wheel.y are both 0 for slow single scroll so ioquake3 doesn't create a K_MWHEELUP or K_MWHEELDOWN event. This is why it doesn't change weapons. It seems to be an SDL2 issue.

@zturtleman

This comment has been minimized.

Copy link
Member

zturtleman commented Sep 13, 2018

I built the latest SDL and it fixes the issue. e.wheel.y is never 0 for vertical scrolling. So this should be fixed in ioquake3 after updating to the yet-to-be-released SDL 2.0.9.

@Velociraptor555

This comment has been minimized.

Copy link
Author

Velociraptor555 commented Sep 18, 2018

The linked libSDL patch looks promising, I will test it immediately upon availability in MacPorts and report the result here.

@Velociraptor555

This comment has been minimized.

Copy link
Author

Velociraptor555 commented Oct 2, 2018

Today I've compiled libSDL2 using the head revision of the Mercurial repository and linked it against ioquake3: Issue fixed.

@mcaldas

This comment has been minimized.

Copy link

mcaldas commented Oct 2, 2018

@Velociraptor555 could u help with some info on how to do it?

@Velociraptor555

This comment has been minimized.

Copy link
Author

Velociraptor555 commented Oct 2, 2018

Clone ioquake3 from git-repo.
Clone libSDL2 from hg-repo.
Configure/build libSDL2 locally.
Replace libSDL2-2.0.0.dylib and libSDL2main.a in ioq3/code/libs/macosx with the new ones.
Build/install ioquake3 as usual.

@mcaldas

This comment has been minimized.

Copy link

mcaldas commented Oct 2, 2018

Ok, so i didnt manage to build SDL...
And shouldnt this be closed once is fixed in ioq3?

@ensiform

This comment has been minimized.

Copy link

ensiform commented Oct 3, 2018

Well its more of an SDL bug, so I would say leave it open until 2.0.9 becomes final I guess? Its in pre-release now afaik.

@zturtleman

This comment has been minimized.

Copy link
Member

zturtleman commented Oct 3, 2018

Yeah, could leave the issue open until ioq3 updates to SDL 2.0.9.

@zturtleman zturtleman reopened this Oct 3, 2018

@Velociraptor555

This comment has been minimized.

Copy link
Author

Velociraptor555 commented Oct 4, 2018

I've committed libSDL2 #12274 binaries to make things simpler for the time till official libSDL2 release, that's why I closed issue #379. But unfortunately I'm not allowed to git-push on the ioq3 repo.

@mcaldas

This comment has been minimized.

Copy link

mcaldas commented Oct 5, 2018

Maybe u can create a PR with the files?

@andreagiavatto

This comment has been minimized.

Copy link

andreagiavatto commented Nov 4, 2018

SDL 2.0.9 is now out :)

@Velociraptor555

This comment has been minimized.

Copy link
Author

Velociraptor555 commented Nov 5, 2018

Not in ioq3/code/libs/macosx:

git log libSDL2-2.0.0.dylib
commit 5bf60a9
Author: MAN-AT-ARMS M4N4T4RMS@gmail.com
Date: Sat Apr 14 18:49:28 2018 -0400

Update SDL2 to 2.0.8
@ensiform

This comment has been minimized.

Copy link

ensiform commented Nov 5, 2018

Nobody said it was in ioq3 yet. You can still replace it with your own or prebuilt version on the site. I don't think 209 changes anything major that it can't just be dropped in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.