On Tue, 18 Jun 2019 19:46:25 +0200, Mike Wey wrote:

On 18-06-2019 13:07, Alex X wrote:

I have a main container and some child widgets. When I click on the widgets they do their thing(either I've added ButtonPress events or they have their own such as GtkTextEntry).

I have a lot of children(essentially acting as buttons or text input elements).

I do not want any of them to respond in any way when I click while holding ctrl(well, I do want the parent to get the event so I can do something with it).

Is there way to prevent them from doing so without overriding the click handlers?

It seems the handlers bubble up from children by default...

I've tried reading this but I'm unsure how to proceed:

"For other events, in the first phase (the “capture” phase) the event is delivered to each widget from the top-most (for example, the top-level GtkWindow or grab widget) down to the target GtkWidget. Gestures that are attached with GTKPHASECAPTURE get a chance to react to the event."

There is also the main event handler where I might be able to get things done but I have no idea how to interface to it.

Any idea with this one?


Key events bubble from the child to the parent, and other events from
the parent to the child.

One option would be to change to change the event mask of the child
widgets with get/setEvents[1] which is a bitmask of the GdkEventMask

[1] https://api.gtkd.org/gtk.Widget.Widget.setEvents.html
[2] https://api.gtkd.org/gdk.c.types.GdkEventMask.html

I couldn't get any of that to work ;/ (seems the events only really work for windows). I went ahead and added handlers for each widget. So everything is working as expected now.