Re: XForms: Determine Window Manager Borders

From: Jens Thoms Toerring (Jens.Toerring@physik.fu-berlin.de)
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 <Jens.Toerring@physik.fu-berlin.de> :

    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

    -- 
          _  _____  _____
         | ||_   _||_   _|        Jens.Toerring@physik.fu-berlin.de
      _  | |  | |    | |          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
    xforms-request@bob.usuhs.mil   or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/
    



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