Apple Magic Mouse

Hello, there.

Does SDL2 support the Apple Magic Mouse? In particular, the one, two, three finger gestures. Admittedly, I haven’t done much research by digging through the code other than a quick grep for the obvious keywords, but I did notice that the tests/testgesture.c binary did pick up my MacBook Air’s trackpad with excellent resolution. I also noticed that SDL2 does detect & use the mouse’s support for X & Y wheel axis.

I am curious if anybody else out there thinks that this may be a worthwhile endeavor? I might very well feel up to the task of seriously looking into what it would take to implement a suitable API and submit a patch.

In closing, I always thought that the Magic Mouse shows some interesting potential; I could see it being a nice mouse for certain video games, or even perhaps graphics/video work? I dunno, just thinking out loud here.

With all that said, I don’t see it ever replacing my 10-button mouse for any serious, day to day work :wink:

Cheers,
Jeff

It oughtta work much the same. Apple uses the same API for the Magic
Mouse as they do for their trackpads. I found the Magic Mouse didn’t
fit my hand very well. When Apple started making gestures part of
the OS, I went with the Magic Trackpad and have been happy with it.
I don’t use a mouse anymore unless I need to plug in my trusty
Diamondback for gaming.

JosephOn Wed, Jan 29, 2014 at 07:44:56AM -0600, Jeffrey Carpenter wrote:

Hello, there.

Does SDL2 support the Apple Magic Mouse? In particular, the one, two, three finger gestures. Admittedly, I haven’t done much research by digging through the code other than a quick grep for the obvious keywords, but I did notice that the tests/testgesture.c binary did pick up my MacBook Air’s trackpad with excellent resolution. I also noticed that SDL2 does detect & use the mouse’s support for X & Y wheel axis.

I am curious if anybody else out there thinks that this may be a worthwhile endeavor? I might very well feel up to the task of seriously looking into what it would take to implement a suitable API and submit a patch.

In closing, I always thought that the Magic Mouse shows some interesting potential; I could see it being a nice mouse for certain video games, or even perhaps graphics/video work? I dunno, just thinking out loud here.

With all that said, I don’t see it ever replacing my 10-button mouse for any serious, day to day work :wink:

Cheers,
Jeff


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

It oughtta work much the same. Apple uses the same API for the Magic Mouse as they do for their trackpads.

I was thinking the same thing – imaginably, not a difficult thing to implement. Not sure about Windows API, if there even is one, but I’m not concerned about that for the time being.

I found the Magic Mouse didn’t fit my hand very well.

I feel the same way. Definitely a significant part of why I can’t use it 24/7.

When Apple started making gestures part of the OS, I went with the Magic Trackpad and have been happy with it. I don’t use a mouse anymore unless I need to plug in my trusty Diamondback for gaming.

I was once tempted to pick up a Magic Trackpad, I’m glad that you reminded me! :slight_smile: The Magic Trackpad is detected as a notebook-style trackpad, aye? I’m guessing that SDL2 treats it the same as a trackpad then?

Joseph

Hello, there.

Does SDL2 support the Apple Magic Mouse? In particular, the one, two, three finger gestures. Admittedly, I haven’t done much research by digging through the code other than a quick grep for the obvious keywords, but I did notice that the tests/testgesture.c binary did pick up my MacBook Air’s trackpad with excellent resolution. I also noticed that SDL2 does detect & use the mouse’s support for X & Y wheel axis.

I am curious if anybody else out there thinks that this may be a worthwhile endeavor? I might very well feel up to the task of seriously looking into what it would take to implement a suitable API and submit a patch.

In closing, I always thought that the Magic Mouse shows some interesting potential; I could see it being a nice mouse for certain video games, or even perhaps graphics/video work? I dunno, just thinking out loud here.

With all that said, I don’t see it ever replacing my 10-button mouse for any serious, day to day work :wink:

Cheers,
Jeff


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Jeffrey Carpenter
<@Jeffrey_Carpenter>On 2014/01/ 29, at 14:41, T. Joseph Carter wrote:

On Wed, Jan 29, 2014 at 07:44:56AM -0600, Jeffrey Carpenter wrote:

It oughtta work much the same. Apple uses the same API for the Magic Mouse as they do for their trackpads.

I was thinking the same thing – imaginably, not a difficult thing to implement. Not sure about Windows API, if there even is one, but I’m not concerned about that for the time being.

I couldn’t even guess about Windows. I doubt there’s really a
gesture API. More that the standard gestures are coded into the
trackpad driver.

I found the Magic Mouse didn’t fit my hand very well.

I feel the same way. Definitely a significant part of why I can’t use it 24/7.

An advantage of the trackpad is that it doesn’t have to fit your
hand. :slight_smile:

When Apple started making gestures part of the OS, I went with the Magic Trackpad and have been happy with it. I don’t use a mouse anymore unless I need to plug in my trusty Diamondback for gaming.

I was once tempted to pick up a Magic Trackpad, I’m glad that you reminded me! :slight_smile: The Magic Trackpad is detected as a notebook-style trackpad, aye? I’m guessing that SDL2 treats it the same as a trackpad then?

Behaves just like the Macbook’s trackpad and appears to be a standard
mouse unless you do something fancier with it.

JosephOn Wed, Jan 29, 2014 at 04:03:53PM -0600, Jeffrey Carpenter wrote:

It oughtta work much the same. Apple uses the same API for the Magic Mouse as they do for their trackpads.

I was thinking the same thing – imaginably, not a difficult thing to implement. Not sure about Windows API, if there even is one, but I’m not concerned about that for the time being.

I couldn’t even guess about Windows. I doubt there’s really a gesture API. More that the standard gestures are coded into the trackpad driver.

All the better for me :slight_smile: I’m not much of a fan of Windows. The gestures being built into the driver makes sense. Now that you mention it, I have noticed before when using the Magic Mouse on Windows 7, not even the touch-wheel gesture works with whatever Windows chooses to install by default. This supports the logic of the gestures being built into the driver.

I found the Magic Mouse didn’t fit my hand very well.

I feel the same way. Definitely a significant part of why I can’t use it 24/7.

An advantage of the trackpad is that it doesn’t have to fit your hand. :slight_smile:

Indeed.

When Apple started making gestures part of the OS, I went with the Magic Trackpad and have been happy with it. I don’t use a mouse anymore unless I need to plug in my trusty Diamondback for gaming.

I was once tempted to pick up a Magic Trackpad, I’m glad that you reminded me! :slight_smile: The Magic Trackpad is detected as a notebook-style trackpad, aye? I’m guessing that SDL2 treats it the same as a trackpad then?

Behaves just like the Macbook’s trackpad and appears to be a standard mouse unless you do something fancier with it.

I think that you may have just convinced me to accept things as is and go out and purchase a Magic Trackpad instead :slight_smile: Heheh, thanks for the info!

Joseph


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Cheers!
Jeff <@Jeffrey_Carpenter>On 2014/01/ 29, at 16:27, T. Joseph Carter wrote:

On Wed, Jan 29, 2014 at 04:03:53PM -0600, Jeffrey Carpenter wrote:

Behaves just like the Macbook’s trackpad and appears to be a standard
mouse unless you do something fancier with it.

Yes, both the trackpad and Magic Mouse conform to Apple’s standard mouse API.

However, the multitouch gestures are an additional API introduced in
Cocoa which I’m going to guess SDL has not added support for (yet),
but I haven’t verified.

The multitouch APIs are similar to what is on iOS, however there are
some key differences, the major conceptual one is that the coordinate
system is not tied to the display.

I haven’t seen many uses of the Mac multitouch in games. If I’m
remembering correctly, when Angry Birds first debuted on Mac, the
obvious cry from users was to support a gesture for pulling back the
sling shot. This is actually an interesting example of how the
coordinate system is not tied to the display as well. No matter where
your mouse pointer is on the screen, the expectation is where ever you
make the gesture on the pad, the sling shot should be pulled back.

As for the Magic Mouse, I haven’t looked at multitouch gestures on Mac
in a few years, but I think the Magic Mouse was kind of nerfed in some
ways compared to the trackpad, though I can’t remember the details.
But I think I concluded that most gesture support through the public
APIs for Magic Mouse wasn’t helpful. The trackpad is a lot better.

As for SDL desktop/gesture support, I think it is doable (if it hasn’t
been done already). A new event type may need to be introduced
(probably borrow a lot from the mobile side). End developers who want
to support it would probably need to explicitly handle the events. End
developers may need to handle disambiguation cases about mouse wheel
scroll vs. two-finger scrolling if you get events for both.

-Eric–
Beginning iPhone Games Development

SDL?s Cocoa video backend does have support for Cocoa?s touch events, and using the trackpad does trigger SDL?s finger events.
Using my Macbook Pro?s trackpad, SDL recognizes all ten of my fingers if I place them all there at once.

Apple?s higher level gesture stuff (swiping, magnifying, etc.) isn?t used though, but SDL?s generic multi-touch gesture events are triggered since they sit on top of the finger events.

Personally I?ve encountered some issues where SDL thinks my fingers are still on the trackpad after I remove them - this seems to happen when I trigger one of Apple?s built-in gestures.On Jan 29, 2014, at 9:04 PM, Eric Wing wrote:

However, the multitouch gestures are an additional API introduced in
Cocoa which I’m going to guess SDL has not added support for (yet),
but I haven’t verified.

-Eric

Beginning iPhone Games Development
Learn how to program games for iOS


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL’s Cocoa video backend does have support for Cocoa’s touch events, and
using the trackpad does trigger SDL’s finger events.
Using my Macbook Pro’s trackpad, SDL recognizes all ten of my fingers if I
place them all there at once.

Cool!

Apple’s higher level gesture stuff (swiping, magnifying, etc.) isn’t used
though, but SDL’s generic multi-touch gesture events are triggered since
they sit on top of the finger events.

Personally I’ve encountered some issues where SDL thinks my fingers are
still on the trackpad after I remove them - this seems to happen when I
trigger one of Apple’s built-in gestures.

Hmmm. Without knowing anything about the implementation, my first
guess is that this type of situation (a higher level gesture is
detected overriding the lower-level touch api) should trigger a
touchesCancelled event and this might not be handled. SDL needs to
pass this event and I would expect you need to handle this in your
code. I think once a touch is cancelled, you won’t get the
ended/stopped event, which might represent your fingers are still on
the trackpad if you don’t notice the cancelled event. I don’t remember
if there is a way to disable higher-level events from being triggered.

-EricOn 1/29/14, Alex Szpakowski wrote:

Beginning iPhone Games Development

touchesCancelled is handled by SDL (by triggering an SDL_FINGERUP event for every cancelled touch).
There was a related bug (which did get patched) where touchesCancelled wasn?t handled correctly which caused SDL?s touch fingers to get ?stuck? when command-tabbing away, but fixing that didn?t fix the gesture issue unfortunately.

The cocoa-specific touch/finger event code is here: https://hg.libsdl.org/SDL/file/tip/src/video/cocoa/SDL_cocoawindow.m#l676On Jan 29, 2014, at 10:32 PM, Eric Wing wrote:

Hmmm. Without knowing anything about the implementation, my first
guess is that this type of situation (a higher level gesture is
detected overriding the lower-level touch api) should trigger a
touchesCancelled event and this might not be handled. SDL needs to
pass this event and I would expect you need to handle this in your
code. I think once a touch is cancelled, you won’t get the
ended/stopped event, which might represent your fingers are still on
the trackpad if you don’t notice the cancelled event. I don’t remember
if there is a way to disable higher-level events from being triggered.

-Eric

Beginning iPhone Games Development
Learn how to program games for iOS


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org