Tap MacOS trackpad

Hello everyone, I’m using monogame for a long time in Windows but now I migrated to MacOS, and my code:
‘mouse.LeftButton == ButtonState.Pressed’ only is executed when I click the trackpad and not when I tap it.

My MacOS is configured to “Tap to click - Tap with one finger”.
Someone knows How I could fix it? Is it possible?

Thanks.
(Sorry if I’m using a wrong section or this question is already answered I didn’t found nothing)

Hey! Welcome to the forum!

Don’t worry, this forum is for anything MG related really :slight_smile: Especially troubleshooting! It’s great that you searched before posting.

I don’t have a clue how to fix your issue though :sweat_smile:

I have same problems. MonoGame 3.6.

Sometimes on trackpad-Tap state of left mouse button changed on ‘Pressed’ state, but it’s very unstable (1 of 10 taps) in other cases in update method we get always ‘Released’ mouse state like we don’t Tap ever.

Looks like MonoGame not catch very fast clicks (Tap-s).

Guys help, Any solutions?

I find this code in GameWindow.cs

	public override void MouseDown (NSEvent theEvent)
	{
		PointF loc = theEvent.LocationInWindow;
		UpdateMousePosition (loc);
		switch (theEvent.Type) {
		case NSEventType.LeftMouseDown:
			MouseState.LeftButton = ButtonState.Pressed;
			break;
		}
	}

	public override void MouseUp (NSEvent theEvent)
	{
		PointF loc = theEvent.LocationInWindow;
		UpdateMousePosition (loc);
		switch (theEvent.Type) {

		case NSEventType.LeftMouseUp:
			MouseState.LeftButton = ButtonState.Released;
			break;
		}
	}

Look on this part. If NSEventType changed very fast from LeftMouseDown to LeftMouseUp (in our case it’s trackpad touch), then in Update method we not catch this situation. And in update method we miss that Mouse state recently changed.

May be we can store PreviousLeftButtonState in Mouse.GetState? In this situation we will know that mouse change state.

I’m running into this as well. I find if I repeatedly tap the track pad it will eventually register, but it’s rather annoying.

I can make pullrequest that fix this issue, with this method:
bool TryGetPreviousLocation(out PointF p);
Or more usable:
bool TryGetPreviousMouseState(out MouseState state);

but it’s solution extend XNA mouse api. It’s ok?