Re: Using gtk_widget_set_extension_events() for a button?



On Fri, 2003-10-17 at 17:20, David Bourguignon wrote:
> Owen Taylor wrote:
>  >
>  > Not all widgets honor gtk_widget_set_extension_events(). If you look at
>  > the code for gtk_widget_realize(), you'll see how it is handled there.
>  > This default realize() handler is inherited by GtkDrawingArea, but most
>  > widgets aren't going to do anything with it.
> 
> Indeed, it is more complicated than what I expected... :-) Registering extension 
> events seems impossible for most specialized widgets, such as buttons. However, 
> with the advent of the tablet as a de facto interface for many applications (in 
> tablet PCs for example), it could be interesting to consider extension events on 
> the same level as core pointer events, so that extension events would be enabled 
> by default for all widgets. Do you know if this kind of features are already 
> being considered for future gtk releases?

No, I haven't really considered such a thing; the XInput extension has
various quirks that would make me a bit nervous about always handling
events through XInput. (Though making --with-xinput=xfree the default on
Linux and similar *would* likely be a good idea.) Also, the problem of
configuring the devices on a desktop-wide level would have to be solved.

Note that handling *core* button-press-events on GtkButton also isn't
supported. Basically, the standard GTK+ widgets have standard GTK+
event interpretations. Changing those event interpretations to make
events from different devices do different things doesn't really 
fit in the GTK+ model. 

> Right now, if I understand correctly, I only have one option to know what device 
> pressed a button: derive a new class of button from the drawing area widget. Is 
> that correct?

I don't think that would guarantee you any more future compatibility
than the simpler hack of calling gdk_input_set_extension_events() on
button->event_window in a ::realize signal handler.

(There is no magic about derivation; if you are messing with the
internal details of the widget, you are messing with the internal
details of the widget, whether you are deriving or just connecting
signal handlers.)

I wouldn't guarantee absolutely that either will continue working
forever, but they should be pretty safe for the next few years.

Regards,
						Owen





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