Called when a window gains the keyboard focus.
This helps maintain active-canvas and active-canvas. It also calls the canvas's edit's on-set-focus or the canvas's pasteboard's on-set-focus method.