#315645; supporting tap-and-hold



Hello,

On devices with a touch screen, a way to popup context menus (for
example) is to hold down the stylus and not move it for a short while.
This tap-and-hold operation could then open a popup menu.

This method is used on the Maemo platform and we have been discussing
a possible implementation for gtk+ in #315645.

As Ross says in that bug, there are two ways of implementing this:
  - load a GTK+ module at run time;
  - add this functionality to GtkWidget.

I would propose to add this functionality directly to GtkWidget.  The
feature would only be turned on if the touchscreen mode has been
turned on.

Other points:

  - The original proposal in the bug report suggests to have the tap-n-hold
    operation generate a right click (button3 press).  I don't think we should
    hardcode this behaviour, since it will probably break a bunch of apps.
    IMHO it would be much better to have a tap-and-hold signal for this,
    also since most apps will want to handle tap-n-hold "clicks"
    differently anyway.

    Same story for having tap-n-hold automatically pop up menus.  Maybe
    we want to execute a different action.

  - It is probably a good idea to give feedback to the user when holding
    down the stylus at some place.  Maemo currently does this using an
    animation at the place where the stylus has been put down.  If we
    decide to provide an animation as feedback to the user we also need
    a way to query a certain position to see if it will "respond" to the
    tap-n-hold signal.  This way we avoid the scenario where an animation
    is shown and after that nothing happens.

    I am wondering whether we should provide a default animation in
    the icon theme and different icon themes can provide different
    animations.  Another option would be to add a function like:

  void gtk_widget_set_tap_and_hold_animation (GtkWidget *widget,
                                              GdkPixbufAnimation *ani);

  - Of course we should make the hold time configurable.

  - In the bug report, Mitch pointed out that we can probably implement
    everything nicely by just adding a single signal to GtkWidget (we
    only have 3 placeholders left though, and only 2 after the new
    tooltips code hit CVS ...):

  typedef enum {
    GTK_WIDGET_TAP_AND_HOLD_QUERY,
    GTK_WIDGET_TAP_AND_HOLD_TRIGGER,
    GTK_WIDGET_TAP_AND_HOLD_CANCEL
  } GtkWidgetTapAndHoldAction;

  gboolean GtkWidget::tap-and-hold (GtkWidget                 *widget,
                                    GtkWidgetTapAndHoldAction  action,
                                    gint                       x,
                                    gint                       y);



Thoughts, suggestions?  As always, once we agree on a nice API and
behaviour, I will write up an implementation :).



thanks,

-kris.



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