Re: XForms: Determine Window Manager Borders

From: Jens Thoms Toerring (
Date: Thu Jul 12 2001 - 02:05:00 EDT

  • Next message: Dario Abatianni: "Re: XForms: Determine Window Manager Borders"

    # To subscribers of the xforms list from Jens Thoms Toerring <> :

    On Thu, Jul 12, 2001 at 01:20:48AM +0200, Dario Abatianni wrote:
    > I want to make my application memorize it's windows coordinates. I use the
    > form.x form.y form.w form.h fields and store them in a configuration file.
    > When I display the form later on and call fl_set_form_geo() with my
    > coordinates, xforms will put the window at this coordinates plus the
    > width/height of the window manager's broders. How can I get the right
    > coordinates (inner window) or how can I determine the offset that the window
    > manager adds for borders and titlebars etc. ?

    Here's a rather ugly hack I am using:

        int temp;
        XWindowAttributes attr;
        Window win, wdummy1, *wdummy2;

        win = fl_show_form_window( form );
        XQueryTree( display, win, &wdummy1, &win, &wdummy2, &temp );
        XQueryTree( display, win, &wdummy1, &win, &wdummy2, &temp );
        XGetWindowAttributes( display, win, &attr );

    Now attr.x and attr.y are the 'real' window coordinates, i.e. the ones
    you should use (instead of form.x and form.y) to draw the form at the
    same position again. Or use the differences to figure out the sizes of
    the borders the window manager adds. If someone has a nicer solution I
    would be happy to hear about it...
                                               Regards, Jens

          _  _____  _____
         | ||_   _||_   _|
      _  | |  | |    | |          AG Moebius, Institut fuer Molekuelphysik
     | |_| |  | |    | |          Fachbereich Physik, Freie Universitaet Berlin
      \___/ens|_|homs|_|oerring   Tel: ++49 (0)30 838 - 53394 / FAX: - 56046
    To unsubscribe, send the message "unsubscribe" to   or see
    XForms Home Page:
    List Archive:

    This archive was generated by hypermail 2b29 : Thu Jul 12 2001 - 02:11:27 EDT