My group does use the 'punishment' method. Because we're sick individuals. But it's actually kind of funny as most of us are good pals.
Each player has a wooden ruler nearby. Yeah, that's right. If the player to your right isn't doing what he should be doing, you whack him on the knuckles. That'll get his attention. Of course, if you fail to perform this action while everyone else can clearly see that the person needs it, well.. .the player to -your- left will whack -you- until you get with the program.
Like I said, we're all pals so this works for us. New players are brought in knowingly -- told that we like to take our game seriously and try to stay into it for the duration. As another poster here said: We play for fun, if you want to do something else, do something else. But don't come to my table and make us wait on you.
Prior to the now-incredibly-funny ruler method (I, myself, have been rulered 2 times) I've handled this situation differently from different groups. The one I prefer is the gentle approach: If you aren't paying attention, you don't matter. By way of explanation:
We had a game once in a homebrew setting using a low-magic, somewhat Conan-like modification to the d20 rules. This was before there was an OGL Conan, of course. Throughout an entire combat session one player, we shall call him Bob, just refused to pay attention to what was going on. As the GM, I took note of this because it was hampering the fun everyone else was having.
When it came time to high-tail it, Bob was still not paying attention. He said nothing - was just doing his own thing. A few minutes later I was narrating the introduction to a new city the players were entering, letting them know where everything was. Bob finally looks up and says: "So we're in like a big city type place now?"
My response:
"No Bob. They are in a city-type place. You, however, weren't moving or speaking. The other characters assumed you were dead and left you behind. Considering they left you with the sand demons, I'm guessing you'll need to work up a new character. But we can run the 10 sand demons vs. Bob The Unattentive combat encounter first, if you like."
He got the message. He did roll up a new character. And strangely - become a better player. Honestly, I just think the character he made didn't turn out to his liking, which left him disinterested. He liked his new character, and made sure from them on to pipe in with "I'm going too!" whenever the party fled. It become quite the hilarious running joke that Bob wasn't getting left behind.