The "selfie pics" by the president at the Mandela funeral is just another adolescent tactic. From this president we have become accustomed to it. He is a narcissist and we shouldn't be surprised, that even at a funeral, it's still all about him.
The handshake with Castro was not handled properly. I understand that in this context, the handshake may have been the proper etiquette. If it was unavoidable, it should have been quick and matter of fact. It should not have seemed as if he was greeting an old friend. This president has no idea how Americans feel about his antics. Most Americans, even his supporters I think, have no love for Castro and would not approve of the president's friendly manner towards the tyrant.