Re: button-press-event only called if gtk_drag_source_set was used?



On Tue, Mar 07, 2006 at 10:39:25PM +0100, Norbert Fabritius wrote:
> I want to catch a mouse-click on my widget, so I connected with the
> 'button-press-event' signal.

Depending on how much the widget is `your', either add
GDK_BUTTON_PRESS_MASK in widget's realize method:

    ...
    attributes.event_mask = gtk_widget_get_events(widget)
                            | GDK_BUTTON_PRESS_MASK
                            ...

or use gtk_widget_add_events() to add it to make the widget
receive this type of event.

> However, it seems that it only gets called
> if my widget used the 'gtk_drag_source_set()' function before. Why is
> that?

gtk_drag_source_set() has to set the event when it is unset
(DnD could not work if the widget did not receive button
press events).  So, this is a side effect.

Yeti


--
That's enough.



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