N64 No-border windows - Work-Around

New Message Reply Date view Thread view Subject view Author view

Sharon Clay (src++at++rose.engr.sgi.com)
Thu, 28 Aug 1997 22:19:02 -0700


Hi all,

Several times some persistant folks have asked why in N64
windows refuse to shed their borders. Sorry for the delay
but I finally chased this one down and will fix it for
future versions. I include work-around code below.
You can apply the work-around in any process as soon as
you know you have a mapped X-window. The easiest way
to do this is in your pfPWinConfig callback which is were
the example below does it and rips the borders off the window
after it is opened. Sorry again for the delay - it took
a bit to realize between us and X where the conversion
trouble was and then it turned out to be very simple.

Add this utility code:

#include <Xm/MwmUtil.h>

static Atom mwm_hints_atom = 0;

static void
getMwmHints(Display *dsp, Window w, PropMwmHints *pHints)
{
    PropMwmHints *hp;
    Atom type;
    int fmt;
     
    unsigned long nitems, bytes_after;
     
    /* get special atom for 4DWM motif window manager */
    if (!mwm_hints_atom)
        mwm_hints_atom = XInternAtom(dsp, "_MOTIF_WM_HINTS", FALSE);
     
    XGetWindowProperty(dsp, w, mwm_hints_atom, 0, 4, False, mwm_hints_atom,
                       &type,
                       &fmt, &nitems, &bytes_after, (unsigned char**)&hp);
    if (hp) {
        *pHints = *hp;
    } else
        memset(pHints, 0, sizeof *pHints);
}

static void
setXWindowDecoration(Display *dsp, Window w, int flag)
{
    PropMwmHints hints;
     
    /* get special atom for 4DWM motif window manager */
    if (!mwm_hints_atom)
        mwm_hints_atom = XInternAtom(dsp, "_MOTIF_WM_HINTS", FALSE);
     
    getMwmHints(dsp, w, &hints);
    if (flag == 0)
        hints.decorations = 0x0;
    else
        hints.decorations = MWM_DECOR_ALL;
    hints.flags |= MWM_HINTS_DECORATIONS;
    XChangeProperty(dsp, w, mwm_hints_atom, mwm_hints_atom, 32,
                    PropModeReplace, (unsigned char *)&hints, 4);
}

/* pfPWinConfigFunc() callback */
static void
OpenPipeWin(pfPipeWindow *pw)
{
    pfPipe *p;
    Window w;
    Display *dsp;
     
    pfOpenPWin(pw);

    dsp = pfGetCurWSConnection();
    setXWindowDecoration(dsp, pfGetPWinWSWindow(pw), 0);
    /* A hack upon hack: if the windows were opened with borders,
     * X moved the window up a bit. But, in libpf, Performer doesn't
     * keep track of X's changes to the window position because this
     * would be deadly to performance. So, these two lines get
     * around our check for null change to the origin and cause us
     * to put the now borderless window truly in the right spot.
     */
    pfPWinOrigin(pw, 1, 1);
    pfPWinOrigin(pw, 0, 0);
    /* flush the X display to make it happen right away */
    XFlush(dsp);

    ......
}

src.
-----{-----{---++at++ -----{----{---++at++ -----{----{---++at++ -----{----{---++at++
Sharon Rose Clay (Fischler) - Silicon Graphics, Advanced Systems Dev.
src++at++sgi.com (415) 933 - 1002 FAX: (415) 965 - 2658 MS 8U-590
-----{-----{---++at++ -----{----{---++at++ -----{----{---++at++ -----{----{---++at++
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:48 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.