Funny how documentation is always the trailing bit. ;-)
This is looking very nice. Thanks for all your work on this!
A couple (easy) comments:
Just delete the stuff you're deleting, don't comment it out. Git remembers what was there before, and it just makes your diffs longer. I know it's useful while you're developing.
I'm acutely aware that I'm the guy who called for the optional behavior -- but the more I think about it, the more I think the default should be the behavior you propose. It is a very good idea.
On that subject, the name "SELECT_SIMPLE" seems prejudiced by the old behavior and otherwise devoid of meaning. What do you think of SELECT_OK_SELECTED ?
When you define MAX_WINDOW_NAME_LENGTH, I think the value is arbitrary, just long enough to distinguish between valid and invalid strings in reasonable time. Perhaps include a comment to that effect so that future readers don't pause to wonder on the significance of that number.
Personal tick: Functions are most readable below ten or so lines. By the time I can't see the whole function in my editor, I have more trouble understanding as I read. In that light, and without remarking on other examples of such, perhaps find_window_name() could easily be broken into a helper function or two (with local linkage), such as a
compare_window_name_function window_name_matcher(size_t& compare_length).