My exact requirement is to bring a background window into focus and then getting its x,y coordinates and finally I will set the cursor position to these x,y locations,
I may be wrong, but IIRC this is against the ICCCM conventions. I leave you to check this.
The intuition is that focus management is the responsability of the window manager, not of any application.
Never forget that with Unix, any well behaved application should work with any kind of window managers, and there are lots of them, all (supposedly) respecting the ICCCM & others conventions.
Don't forget the X11 motto: provide mechanism, not policy.
So I tend to believe that your requirement is impossible with Unix. I leave you to check the details by reading the many required pages....
Basile Starynkevitch (France)