Origin of polishing knuckles on lapels

I’m talking about curling up your hand into a flattened-out fist and brushing the outermost knuckle joints on our own lapels in a somatic expression of some auto-congratulatory ritual.

What the heck does it mean?

Polishing apples?
Shining up fingernails?
Polishing medals?

Shining up fingernails. Only big-shot men get manicures, so only they would find any use in buffing the shine.

Buffing your finger nails. The full gesture should start with breathing on your nails, as if your breath will condense on them.

Basically you are preening and saying, ain’t I just great?

huff buff