C++/Shell Integration
Peter Hutterer
peter.hutterer at who-t.net
Mon May 17 23:56:04 PDT 2010
On Tue, May 18, 2010 at 08:06:45AM +0200, Eirik Byrkjeflot Anonsen wrote:
> Dirk Wallenstein <halsmit at t-online.de> writes:
>
> > On Sat, May 15, 2010 at 11:41:45PM +0100, Mubarak Aguye wrote:
> >> Hi. I was wondering if there is a way of determining the title of the
> >> current active window, and its x-y coordinates from within a C++
> >> application, or even a standard Linux shell.
> >
> > For the shell, you could use 'xwininfo'.
> > For C++, you would use XWindowAttributes and Properties.
> > http://www.x.org/docs/X11/xlib.pdf (Chapter 3)
> > http://tronche.com/gui/x/xlib/window-information/
>
> And "the currently active window", assuming you mean the window that is
> currently set up to receive key events from the primary keyboard, is
> probably the window you get from XGetInputFocus(). (If you mean
> something else by "currently active window", you'll probably have to ask
> your window manager somehow.)
yeah, X has different concepts of active windows. for the server, the
active window is whichever one is underneath the pointer or the one that has
the input focus (or one of the input foci with XI2).
what users generally understand as active window is implemented by the
window manager and may or may not be the same as the X server's window. You
could have a WM that has a window activated and in the foreground although
the input focus is still in some other window.
Cheers,
Peter
More information about the xorg
mailing list