When the paperplane window is open, we want the animate work procedure to update the 3D scene continuously. If the user iconifies the window, it would be wasteful to continue animating a no longer visible scene. To avoid wasting resources rendering to an unmapped window, paperplane installs an event handler called map_state_changed for the top-level widget to notice UnmapNotify and MapNotify events. The handler makes sure the work procedure is removed or added to reflect the map state of the window.