Re: Multitouch review 2: press-and-hold



Excerpts from Bastien Nocera's message of mié feb 01 12:23:52 +0100 2012:
> On Tue, 2012-01-31 at 19:18 -0500, Matthias Clasen wrote:
> > API:
> > 
> > GtkWidget::press-and-hold
> > GTK_PRESS_AND_HOLD_{QUERY,TRIGGER,CANCEL}
> > GTK_STYLE_CLASS_PRESS_AND_HOLD style class
> > GtkSettings::gtk-press-and-hold-timeout setting
> > 
> > This feature has a long history going back to 2005 and Hildon [1][2].
> > 
> > The way it works is that  ::press-and-hold is emitted upon button
> > press (only button 1), scroll or touch events with an action of
> > GTK_PRESS_AND_HOLD_QUERY. Widgets have to opt-in to press-and-hold by
> > handling that and returning TRUE. GTK+ then plays the press-and-hold
> > animation (which is adapted to whether you are using a tiny cursor or
> > a fat thumb). If you hold still until the time determined by
> > gtk-press-and-hold-timeout has passed, ::press-and-hold is emitted
> > again with the TRIGGER action, and widgets are expected to handle that
> > by doing whatever action they want to tie to long presses. If the
> > press-and-hold is canceled because the pointer was moved (beyond the
> > drag threshold), ::press-and-hold is emitted with the CANCEL action.
> > If the widget goes away while the press-and-hold animation is running,
> > it gets removed and cleaned up.
> > 
> > One interesting aspect here is that ::press-and-hold is emitted on the
> > target widget of the event before the capture phase. There is a
> > comment in the code that explains that this is 'so a parent capturing
> > events doesn't delay nor prevent a child from doing the press-and-hold
> > action'.
> > 
> > Questions, comments:
> 
> I still think that the press and hold animation has no place here. Apart
> from Windows, I've not seen any touch or stylus devices use this, and I
> seriously doubt its usefulness (versus it looking tacky, out of place,
> etc.).

IIRC, animation will only work if GtkSettings:gtk-enable-animations is TRUE.

> Can we please get the code writers' reasoning behind having this
> animation?

I think it gives good feedback that something is going to happen, and
when.

> What do the designers think? Should it be something the theme
> chooses to implement (so that the Windows theme would use the Windows
> animation for that for example)?

Yes I think I added a style class for press and hold animation, so
it's themable. 

> Cheers
> 
-- 
Carlos Garcia Campos
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462

Attachment: signature.asc
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]