Re: XForms: fl_winhide // fl_winshow

From: Steve Lamont (spl@ncmir.ucsd.edu)
Date: Fri May 11 2001 - 10:22:04 EDT

  • Next message: Ivan Powis: "XForms: CanvasInteraction with Images on a Canvas"

    # To subscribers of the xforms list from Steve Lamont <spl@ncmir.ucsd.edu> :

    This question presents problems which are related to window managers
    and, thus, somewhat outside the pwrview of XForms. You may find that
    things will work for one window manager and not for another, since
    window managers are free to handle iconification in whatever manner
    they so choose.

    > 1) XMapWindow used on a HIDDEN form will display it entirely, even though
    > it was iconified before hiding. On the contrary, I would prefer to display
    > the form with the exact aspect (iconified or maped) it had before hiding.
    >
    > 2) XMapWindow on a hidden GL window will display it entirely, even though
    > it was iconified before hiding (same pb).
    >
    > 3) if the GL window (created with fl_glwincreate) was mapped before
    > hiding, XMapWindow will ask the user to place interactively the GL
    > windows, in spite displaying it at the position it had. So, I would like
    > to be able to precise a kind of "initial position," not before "creating"
    > the window but before displaying it a second time...

    Here's something I found at

            <http://sunland.gsfc.nasa.gov/info/motif_faq/part8.html>

    that may be useful:

      If you insist on looking at WM_STATE, here is some code (from Ken
      Sall) to do it:

            /*
            ------------------------------------------------------------------
            Try a function such as CheckWinMgrState below which returns
            one of
            IconicState | NormalState | WithdrawnState | NULL :
            ------------------------------------------------------------------
            */
            #define WM_STATE_ELEMENTS 1

            unsigned long *CheckWinMgrState (dpy, window)
            Display *dpy;
            Window window;
            {
              unsigned long *property = NULL;
              unsigned long nitems;
              unsigned long leftover;
              Atom xa_WM_STATE, actual_type;
              int actual_format;
              int status;

                xa_WM_STATE = XInternAtom (dpy, "WM_STATE", False);

                status = XGetWindowProperty (dpy, window,
                              xa_WM_STATE, 0L, WM_STATE_ELEMENTS,
                              False, xa_WM_STATE, &actual_type,
                              &actual_format,
                              &nitems, &leftover, (unsigned char
                              **)&property);

                if ( ! ((status == Success) &&
                            (actual_type == xa_WM_STATE) &&
                            (nitems == WM_STATE_ELEMENTS)))
                    {
                    if (property)
                        {
                        XFree ((char *)property);
                        property = NULL;
                        }
                    }
                return (property);
            } /* end CheckWinMgrState */

      One problem with testing WM_STATE is that a race condition is
      possible; immediately after testing it, it could change, and the
      logic proceeds to behave as if it were in the old state.

    I haven't tested teh code, so I don't know if it will work as you wish
    but it's worth a try.

    Google is a wonderful resource.

                                                            spl
    _________________________________________________
    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 : Fri May 11 2001 - 10:30:06 EDT