Re: Using gtk_widget_set_extension_events() for a button?

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?

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?

> (Generally, catching ::button-press-event on a widget like GtkButton
> is discouraged, since by doing that you are assuming you know exactly
> how GtkButton is going to handle button presses and safely override it.)

You are right: I didn't know this. I tried to use g_signal_connect_after() but then my callback was no longer called because the button-press-event signal was already handled by the default callback...

Thanks for your help,


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