Re: RFC: Model-View-Controller



hi Federico;

On 17 November 2011 18:50, Federico Mena Quintero <federico gnome org> wrote:
> On Fri, 2011-11-11 at 15:55 +0100, Benjamin Otte wrote:
> [Talking about GtkButton]
>> And it'd have those "Controllers":
>> (- Hover)
>> - Click
>> - Activate
>> (- Focus)
>> - KeyPress/Release
> Think of an app that lets you select graphical objects and move them by
> dragging.  How would you implement something that needs both clicks
> (quick press/release with no movement) and drags (long
> press-move-release)?  Do you need to somehow tie together a
> ClickController and a DragController, or do you have a generic
> PressMoveReleaseController, on top of which you implement the other two?

no, there's no base class, and there's no need for one.

ClickAction and DragAction (and basically all event-related code in
Clutter) do not use grabs: they use the capture phase of the event
delivery cycle, and they will not stop the event propagation, so you
can assign them both. the capture phase is far less destructive of
event handling in complex scenarios than a X11 grab; gtk+ should get a
::captured-event signal as well in the near future.

DragAction also uses the drag-threshold setting, so it will be able to
detect a drag after a certain amount of space has been covered by the
pointer with the BUTTON1 mask set.

Lucas used ClickAction and DragAction inside his Board project, to be
able to interact with the items on the board, as well as repositioning
them around.

aside from ClickAction and DragAction, Clutter also has a
GestureAction that allows you to implement gesture recognisers, and
cancel gestures in progress to pass the control flow to the next
action; these gestures will be used more as soon as the multi-touch
support in X11 lands, so we can have a common implementation across
OSX, X11, and Wayland.

ciao,
 Emmanuele.

-- 
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi/


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