Re: events for no-window widgets



On Wed, 2010-09-22 at 02:11 -0400, Havoc Pennington wrote:

> During capture, a signal like ::event-captured seems logical.
> 
> During bubble, a signal like ::event seems logical. Unfortunately that
> signal already exists but its GdkEvent is window-relative to the
> original event window, rather than widget-relative to the widget
> currently getting bubbled through.
> 
> Possible solutions include:
>  - add a new signal ::event-bubbled with the widget-relative events.
>  - break ::event to be widget-relative, but in my initial
> experimentation this looked like it'd be pretty disruptive even within
> GTK
>  - gtk_widget_class_set_widget_relative_events() toggles what kind of
> coords each subclass receives to ::event
>  - leave event->x, event->y window-relative and add new GdkEvent
> fields for the widget-relative

another possible solution is to detail the ::event-bubbled
and ::event-captured with the event type, e.g.:

  ::event-bubbled:button-press
  ::event-captured:key-release
  ...

callbacks interested in all events just use ::event-bubbled.

con: it's slightly longer to use, but it makes conceptually sense to
detail the signal name, since something like ::button-press-event is
currently just emitted prior to ::event.

con: the overriding of the default handler gets harder - you get to
override a single signal.

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]