Re: [AD] Touchpad gestures

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sat, 2010-02-20 at 00:38 -0500, Evert Glebbeek wrote:
> On 17 Feb 2010, at 18:33 , Peter Wang wrote:
> > We'll have too many buttons and axes, won't we?  I think we should add a
> > new event type, e.g. ALLEGRO_EVENT_GESTURE with a field that specifies
> > the type of gesture, and a field (fields?) to indicate the degree of the
> > gesture.
> > 
> > How do the current mouse events work with multi-touch?  Perhaps we need
> > a field in ALLEGRO_MOUSE_EVENT to tell apart the different fingers?
> 
> Attached is a preliminary patch for OS X.
> I'm re-using the event source from the display, which I guess is not
> what we want in the end. I'm not sure what a proper event source would
> be; perhaps just an abstract "gesture" event source.

Maybe we should do something like:

int n = al_get_num_input_devices()

ALLEGRO_INPUT_DEVICE *device = al_install_input_device(i)

ALLEGRO_EVENT_SOURCE events = al_get_input_event_source(device)

enum al_get_input_device_type()
// returns MOUSE, JOYSTICK, KEYBOARD, ...

char const *al_get_input_device_name(ALLEGRO_INPUT_DEVICE) 
// could say something like: "mouse", "macbook touchpad", "wacom tablet"

Also, about al_install_mouse/al_install_keyboard/al_install_joystick -
the only use I can see is that on the iphone port, al_install_joystick
enables the accelerometer which supposedly uses up a bit of battery. On
all other platforms merely installing the driver takes no time or
resources so it seems unnecessary to have the user call them explicitly.

And the accelerometers could easily be solved with something platform
specific and outside the API like:

al_set_config_value(sysconf, "iphone", "accelerometers", "off")

Anyway, didn't really think this through, but I somehow remember back
when we removed ALLEGRO_KEYBOARD and ALLEGRO_MOUSE we already said that
we may want them back... ALLEGRO_INPUT_DEVICE basically would do that...

> The current implementation has a few flaws. First of all, it generates
> a flood of tiny rotations and zoom factors that nee to be added,
> respectively multiplied together to get the total rotation angle and
> zoom factor. It is possible to trigger on the end of a gesture and
> send the total information at that point. On the other hand, that
> probably means having to release the trackpad in order to see the
> effect of the gesture that was just made, which is probably not what
> we want either.

Mapping the underlying OSX events to A5 events 1:1 does sound like the
best idea to me.

-- 
Elias Pschernig <elias.pschernig@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/