Before I go into detail with attempting to aswer this question, I want to direct people to a post by Rabbi Gil Student on his blog regarding this topic here. Once that is read I want to add and question a few things that were not brought up in his post or any of the comments that I was able to read. First thing that I want to point out is that the Gemara here in Eruvin is one that is never or rarely mentioned regarding hats on shabbos. The Gemara always quoted is the one that is in Meseches Shabbos about wearing a hat. I attended an interesting shiur on Shavous on this issue but the Maagid Shiur used the hat issue for an introduction as to whether or not you can use an umbrella on Shabbos.
Getting back to the Gemara in Eruvin, Rashi comments that the hat should be tight fitting so it should not blow off. If the brim is a tefach or larger it is easy for the wind to blow it off of someones head. In one of the popular commentaries for Meseches Eruvin, Perush Chai, the author draws out a decriptive picture of the hats in question and how to wear them properly. In the picture, the brim of the hat is tied down with string around the guys chin as per Rashis explanation. This makes sense to me but apparantly people do not hold by this. In one of the comments on Hirhurim someone mentions the button and elastic string that goes around the black hat. This was originally used to attach to a jacket (hence the slit on the collar of suit jackets) to prevent them from falling off or blowing away. I was told but i have not seen this personally that Rav Shachter Shlita from YU does have a type of string attached to his hat to follow according to what Rashi says explaining the Gemara.
I will continue on my next post on this issue regarding what the Shulchan Aruch says with Mishna Berura's explanation and quoting of the Magen Avraham