Actually I'm wondering whether we really should add a return value there. If rect is not fullscreen the indices should be set to -1, and would be different if it is.
If data->is_fullscreen I would expect that either one of current_state.rect or rects.visible to be a fullscreen rect. Do you know which one is not and why it causes some problems?