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.
Yes. But I think having a return value would be more intuitive.
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?
current_state.rect might not be fullscreen because sometimes the WM might not respect the fullscreen request.