I'm trying to get rid of selected_window, with an intent to completely cleanup corner cases where FRAME_SELECTED_WINDOW (selected_frame) is not the same as selected_window and avoid redundant synchronization of them. Comments are welcome. Dmitry