Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting size of a single physical window

9 views
Skip to first unread message

Aaron W. Hsu

unread,
Jul 26, 2011, 7:15:50 PM7/26/11
to
I have an X setup where there is a single screen 0 with two physical displays
overlayed onto it. That gives me a single large desktop with two viewports.

Using XtScreen() it is fairly easy for me to get the size of the screen, but
I want my application to center itself in the middle of one of the physical
displays/monitors, and not in the center of the screen, where it will be cut
in half by the two monitors.

How can I get this information?

Aaron W. Hsu

--
Programming is just another word for the lost art of thinking.

Robert Riches

unread,
Jul 26, 2011, 11:18:35 PM7/26/11
to
On 2011-07-26, Aaron W Hsu <arc...@sacrideo.us> wrote:
> I have an X setup where there is a single screen 0 with two physical displays
> overlayed onto it. That gives me a single large desktop with two viewports.
>
> Using XtScreen() it is fairly easy for me to get the size of the screen, but
> I want my application to center itself in the middle of one of the physical
> displays/monitors, and not in the center of the screen, where it will be cut
> in half by the two monitors.
>
> How can I get this information?
>
> Aaron W. Hsu

There are X-related library calls that can get you the size of a
window. The xwininfo and xprop programs get size information
about a window. Ahhh, here it is. Try XGetGeometry. If you
need to find the window, you can use XQueryTree to search for
it. If you check the man pages, you will find
XGetWindowAttributes might be useful in place of XGetGeometry if
you need more general info.

HTH

--
Robert Riches
spamt...@jacob21819.net
(Yes, that is one of my email addresses.)

Aaron W. Hsu

unread,
Jul 27, 2011, 1:19:04 AM7/27/11
to
Robert Riches <spamt...@jacob21819.net> writes:

I saw those, but I can't figure out how to get the size of a Window corresponding
to one of the physical displays. The Root Window is the same size as the
X Screen, which is the size of the maximum values of the heights and widths
of the two monitors connected to my X server display. I am trying to create
or instantiate a TopLevelShell and XmMainWindow in the right place, but in
order to do that, I need the right height and width of the individual primary
monitor or output.

Xrandr seems to be able to get this information from the XRRGetOutputInfo
function, but that's about as far as I got.

0 new messages