tags:

views:

25

answers:

2

How to get top-level window position relative to root window (i.e. whole screen) using plain ol' xlib (or brand new XCB)?

+2  A: 

Use XTranslateCoordinates (or xcb equivalent) to translate 0,0 on the window to root window coordinates.

Havoc P
A: 

Using Xlib:

XWindowAttributes xwa;
XGetWindowAttributes(display, window, &xwa);
printf("%d %d\n", xwa.x, xwa.y);

There are also lots of other informations that come with XWindowAttributes. See here.

André Wagner