The GtkOverlay
widget has a special set_overlay_pass_through
method to pass inputs through to underlying overlays. I want to use this feature to overlay a GtkDrawingArea
over the UI to add drawings. Unfortunately, it does not work for me, no input events are passed through.
Im using msys2
and gtkmm
.
This is my code:
Gtk::DrawingArea drawingArea;
Gtk::Fixed nodeBox; //filled with several widgets
Gtk::Overlay overlay;
overlay.add_overlay(nodeBox);
overlay.add_overlay(drawingArea);
overlay.set_overlay_pass_through(drawingArea,true);
window.add(overlay);
When I change the order of the two add_overlay
calls, the inputs events work normally, but the widget of nodeBox
hide the drawing area.
DrawingArea captures events because it has Gdk::Window.
Compare with Misc:
For
set_overlay_pass_through
to work you need to use Label, Arrow, Image or manually set Gdk::Window to pass events:Note that you still need to call
set_overlay_pass_through
and widget must be realized.