Dock component windows with double click on titlebar

Double-click a component window's titlebar to dock the component to its
most recent location.
I also updated the code to attach/detatch event listeners dynamically
instead of checking a variable.