Merge "Check for window visibility instead of layer" into main