Ok, we have 2 hat placements: same color next to each other, or same color across.
If same color across (assume black hat asked first):
The only way to be the first person and know your hat is to see 2 of the same color and the red hat.
First person (sees white, white, black): IDK
Second (bbw): IDK
Third (wwb): Knows that the black hat across from him didn't see a red hat on his head, Black
Fourth (bbw): Same as third, but White
First (wwb): Knows that he has black or red. Second's answer doesn't help (could see wbr), neither does third (could see wwr). Fourth's though indicates that his color is the same as the guy's across, so Black
Second (bbw): can use same logic as first and go White
And the colors sitting next to each other (go order BBWW):
First (wwb): IDK
Second (wwb): Sees the same WW that first did, knows he's not R, so Black
Third (bbw): Sees the same WB that first did, IDK
Fourth (bbw): Sees the same BB that third did, knows he's not R, so White
First (wwb): knows second could have seen red or black and gotten his hat, knows it doesn't matter for third, but knows fourth had to see some dupe. Since first already sees the ww dupe, he knows his hat is Black
Third (bbw): uses same logic as first to get his hat as White
For the sake of completeness, lets' go with a variant of scenario 2 (order BWWB):
First (wwb): IDK
Second (bbw): IDK
Third (bbw): Sees the same BB that second did, know's he's not R, so White
Fourth (wwb): Sees the same WW that first did, know's he's not R, so Black
First (wwb): Knows that both second and third saw BWX, and both of them see BWX, and the second one knows something the first doesn't, which is that both of them see a pair. They are white, so he is Black
Second (bbw): Same as first, White