x11: Add more checks to set_stage_foreign()
x11: Add more checks to set_stage_foreign()

Check all the pre-requisites to avoid segfaults later on.

jigpu/clutter,djdeath/clutter,heysion/clutter-clone,djdeath/clutter-android,djdeath/clutter-multithreaded,collects/clutter,kerrickstaley/clutter-vala,Distrotech/clutter,Distrotech/clutter,djdeath/clutter-multithreaded,ebassi/clutter,djdeath/clutter-android,djdeath/clutter-multithreaded,kerrickstaley/clutter-vala,nobled/clutter,rkudiyarov/clutter_osx,ebassi/clutter,jigpu/clutter,ebassi/clutter,heysion/clutter-clone,jigpu/clutter,jigpu/clutter,ebassi/clutter,GNOME/clutter,spatulasnout/clutter,heysion/clutter-clone,GNOME/clutter,nobled/clutter,djdeath/clutter,heysion/clutter-clone,djdeath/clutter,Distrotech/clutter,rkudiyarov/clutter_osx,spatulasnout/clutter,GNOME/clutter,kerrickstaley/clutter-vala,jigpu/clutter,djdeath/clutter,nobled/clutter,djdeath/clutter-android,djdeath/clutter-android,collects/clutter,jigpu/clutter,Distrotech/clutter,kerrickstaley/clutter-vala,Distrotech/clutter,collects/clutter,GNOME/clutter,dlespiau/clutter,rkudiyarov/clutter_osx,spatulasnout/clutter,collects/clutter,heysion/clutter-clone,spatulasnout/clutter,djdeath/clutter,GNOME/clutter,dlespiau/clutter,spatulasnout/clutter,djdeath/clutter,ebassi/clutter,dlespiau/clutter,collects/clutter,djdeath/clutter-multithreaded,rkudiyarov/clutter_osx,Distrotech/clutter,djdeath/clutter-android