Re: ToggleButton seems to suppress pointer-motion-mask events



(Bit of old stuff, I've been away ...)

muppet <scott asofyet org> writes:

Solution:  Don't put the DrawingArea inside a ToggleButton.

Yep.

When you gtk_widget_add() the DrawingArea to the ToggleButton, you  
make the DrawingArea's GdkWindow a child of the ToggleButton's  
GdkWindow.

Nosing around with xwininfo suggests that doesn't happen, instead the
GdkWindow "event_window" gets plonked on top of any child widget's
GdkWindow.  So the original posted code is helped for me for instance by

    $draw->window->raise;

after the show_all.  Though breaking the button's press action ...

That means that the ToggleButton's GdkWindow gets first  
crack at all the events.

For what it's worth, I believe it's the other way around, the sub-window
gets first go.

Normally, all you put inside a toggle button  
are no-window widgets, like GtkLabel or GtkImage, so this isn't a  
problem.

Looks like the InputOnly event_window in the button lets children
drawing in their own windows still work, but no interaction.  I suppose
it makes sense to have the button handle events and just have the
children do drawing, even if it's not quite obvious.



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