How to get properties of existing windows?
I would like to query the properties of existing windows, i.e. those
that were not created by me. In particular, I would like to know
their dimensions and their titles (or some other means of identifying
them). It seems like this should be straightforward, but I haven't
been able to figure it out. Any help is much appreciated!
Re: How to get properties of existing windows?
Ishmael wrote:[color=blue]
> I would like to query the properties of existing windows, i.e. those
> that were not created by me. In particular, I would like to know
> their dimensions and their titles (or some other means of identifying
> them). It seems like this should be straightforward, but I haven't
> been able to figure it out. Any help is much appreciated!
>[/color]
Look at the source for xwininfo utility (a Google search should bring
hits that include the source code).
Jim Lahue
Re: How to get properties of existing windows?
"Ishmael" <stahl.karl@gmail.com> wrote in message
news:1172085082.715578.113410@v45g2000cwv.googlegroups.com...[color=blue]
>I would like to query the properties of existing windows, i.e. those
> that were not created by me. In particular, I would like to know
> their dimensions and their titles (or some other means of identifying
> them). It seems like this should be straightforward, but I haven't
> been able to figure it out. Any help is much appreciated!
>[/color]
In general, this cannot be done.
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Aero Stability and Controls Computing
Re: How to get properties of existing windows?
Thank you both for responding.
The 'xwininfo' function seems very promising, but unfortunately it
does not report the actual edges of the window (it excludes the
borders and the title bar, which is precisely the information I would
like to include).
As to the impossibility of doing this at all, I very much doubt that
is the case. After all, the operating system has to know where to
draw the window. Alas, extracting this information from Motif, X,
draphics drivers, etc. has eluded me so far.
Please let me know if you have any other ideas.
Re: How to get properties of existing windows?
"Ishmael" <stahl.karl@gmail.com> wrote in message
news:1172116992.401075.85860@v45g2000cwv.googlegroups.com...[color=blue]
> Thank you both for responding.
>
> The 'xwininfo' function seems very promising, but unfortunately it
> does not report the actual edges of the window (it excludes the
> borders and the title bar, which is precisely the information I would
> like to include).
>
> As to the impossibility of doing this at all, I very much doubt that
> is the case. After all, the operating system has to know where to
> draw the window. Alas, extracting this information from Motif, X,
> draphics drivers, etc. has eluded me so far.
>
> Please let me know if you have any other ideas.
>
>[/color]
You can always try things like XGetClassHint(), XGetSizeHints(),
XGetWindowAttributes(), XGetWindowProperty(),
XGetWMIconName(), XGetWMName(), XGetWMNormalHints()
and XGetWMSizeHints().
But be aware that these may return information that is not accurate -
from the method names you can see that they are only hints about
what the window would LIKE to be. Whether the window
manager honored those hints is another question entirely.
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Aero Stability and Controls Computing
Re: How to get properties of existing windows?
Ishmael wrote:[color=blue]
> Thank you both for responding.
>
> The 'xwininfo' function seems very promising, but unfortunately it
> does not report the actual edges of the window (it excludes the
> borders and the title bar, which is precisely the information I would
> like to include).
>
> As to the impossibility of doing this at all, I very much doubt that
> is the case. After all, the operating system has to know where to
> draw the window. Alas, extracting this information from Motif, X,
> draphics drivers, etc. has eluded me so far.
>
> Please let me know if you have any other ideas.
>
>[/color]
The problem is that the borders and title bar of the window aren't
actually part of the window: they are small windows created by the
window manager that give you the illusion that they are part of the main
window. You need to find window manager properties that will give you
the info that you are looking for. And, you have to hope that all
window managers will return this information back to you.
Jim Lahue
Re: How to get properties of existing windows?
[color=blue]
> The problem is that the borders and title bar of the window aren't
> actually part of the window: they are small windows created by the
> window manager that give you the illusion that they are part of the main
> window. You need to find window manager properties that will give you
> the info that you are looking for. And, you have to hope that all
> window managers will return this information back to you.
>
> Jim Lahue[/color]
Ah, that's interesting. Do you by chance know how I query window
manager properties? All the information I've been able to find refers
to setting properties (via .Xdefaults, for example), not retrieving
them. My window manager is dtwm (CDE/Solaris). Thanks again for you
help.
Re: How to get properties of existing windows?
Ishmael wrote:[color=blue]
>
> Ah, that's interesting. Do you by chance know how I query window
> manager properties? All the information I've been able to find refers
> to setting properties (via .Xdefaults, for example), not retrieving
> them. My window manager is dtwm (CDE/Solaris). Thanks again for you
> help.
>[/color]
I have always been interested in what is inside my window area so I have
never tried to find this information. Searching on Google didn't show
me anything that would tell me how to determine the size of a border
area set up by a window manager nor what the origin of a window would be
when the border areas and title bar is included.
Jim Lahue