There is no "simple code example" for what you want. You can easily use
Fl_Tabs to create a simple MDI system (each tab can contain one
document), but dragging windows around and "docking" is not a simple
task. That's why I wrote that there is no "simple" example.
However, there have been at least two discussions (or issues) on GitHub
[1] recently (say: in the last two or three months) about
implementations of draggable and dockable windows. You may take a look
at that to get an impression how complicated all this is, particularly
Wayland support because Wayland hides window coordinates...
Warning: this is all work in progress!
See also examples/draggable-group.cxx in the FLTK sources.
[1] https;//
github.com/fltk/fltk -> Discussions or Issues