[comp.windows.x.motif] mwm decorations

koe@kivax.UUCP (Diana Koehler) (10/30/90)

Hello,

I want to create an ApplicationShell without the whole 
mwm decorations.
I read that ApplicationShell inherits the behaviour from VendorShell.
VendorShell has the Resource:

	  XmNmwmDecorations

Now I only want the following decorations:

	    border
	    resize
	    title

How can I specify the Resource to obtain the desired behaviour.

I tried:

-  The values described in chapter 3.3.1 _MOTIF_WM_HINTS (Programming
   Manual)
- I tried the flags set for the mwm Resource clientDecorations

but it does not work.
Any help would be appreciate !

Diana

------------------------------------------------------------------------

Diana Koehler                     Tel.:   +49 7721 867034
Mannesmann Kienzle GmbH
Abt. 011.22                       e-mail: koe@kivax.UUCP
Postfach 1640                             ..!mcsun!unido!kivax!koe
D-7730 VS-Villingen                       ..!uunet!unido!kivax!koe

paulm@hpcvlx.cv.hp.com (Paul J. McClellan) (11/01/90)

The following client sets its mwm decorations to only include the
resize handles and the title bar.  The border is not included when
resize handles are specified.  The defines you need are listed in
/usr/include/X11/MwmUtil.h .

/************************************************************************
 *  File:  decor.c
 *
 *  Allow only the resize and title client decoration (border decoration
 *  is not included when the resize handles are).
 ***********************************************************************/

#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#include <X11/MwmUtil.h>
#include <X11/Shell.h>
#include <Xm/Xm.h>
#include <Xm/Label.h>

/************************************************************************
 *  main
 ***********************************************************************/

main (argc, argv)
    int    argc;
    char **argv;
{

    XtAppContext   context;
    Display	  *display;
    int            ac;
    Arg            al[2];
    Widget         app_shell, label;

    /*  Initialize toolkit, create app context, and open display. */

    XtToolkitInitialize ();
    context = XtCreateApplicationContext ();
    display = XtOpenDisplay (context, NULL, argv[0], "App-notes",
			     NULL, 0, &argc, argv);
    if (!display)
    {
	XtWarning ("%s: can't open display, exiting...", argv[0]);
	exit (0);
    }

    /*
     *  Create the ApplicationShell.
     *  Set the XmNmwmDecorations resource.
     */

    app_shell = XtAppCreateShell (argv[0], "App-notes",
				  applicationShellWidgetClass,
			          display, NULL, 0);

    ac = 0;
    XtSetArg (al[ac], XmNmwmDecorations, MWM_DECOR_RESIZEH|MWM_DECOR_TITLE);
	ac++;
    XtSetValues (app_shell, al, ac);

    /*
     *  Create a Label widget for display purposes.
     */

    label = XmCreateLabel (app_shell, "label", NULL, 0);
    XtManageChild (label);

    /*
     *  Realize the widget hierarchy and enter the main loop.
     */

    XtRealizeWidget (app_shell);
    XtAppMainLoop (context);
}

dbrooks@osf.org (11/01/90)

> I want to create an ApplicationShell without the whole 
> mwm decorations.
> I read that ApplicationShell inherits the behaviour from VendorShell.
> VendorShell has the Resource:
> 
> 	  XmNmwmDecorations

Unfortunately, this was broken in 1.0.A, which may be the release you have.  It
was fixed in 1.0.3.

I strongly advise applying patches 1.0.2 and 1.0.3 if you have them.  The fix
here is in WmWinInfo.c, on line 2915, change a ! to ~

David Brooks
Systems Engineering
Open Software Foundation

ctday@lbl.gov (Christopher T. Day) (11/19/90)

H'mm.  My Motif (ICS version 1.0.3) seems to have the opposite parity on the
decoration bits from yours.  The example you give has only the resize handles
REMOVED.  If I use MWM_DECOR_ALL, all the decorations are ADDED, not removed
as the Programmer's Guide suggests.  If I use

MWM_DECOR_RESIZEH | MWM_DECOR_MENU | MWM_DECOR_MINIMIZE | 
MWM_DECOR_MAXIMIZE | MWM_DECOR_TITLE

then I get ONLY the border.  Is there a definitive statement somewhere as to
which parity is correct?

Chris

david@lta.com (David B. Lewis) (11/19/90)

In article <1990Nov18.095526@lbl.gov>, ctday@lbl.gov (Christopher T. Day) writes:
|> H'mm.  My Motif (ICS version 1.0.3) seems to have the opposite parity on the
|> decoration bits from yours.  The example you give has only the resize handles
|> REMOVED.  If I use MWM_DECOR_ALL, all the decorations are ADDED, not removed
|> as the Programmer's Guide suggests.  If I use
|> 
|> MWM_DECOR_RESIZEH | MWM_DECOR_MENU | MWM_DECOR_MINIMIZE | 
|> MWM_DECOR_MAXIMIZE | MWM_DECOR_TITLE
|> 
|> then I get ONLY the border.  Is there a definitive statement somewhere as to
|> which parity is correct?

I missed the original posting, but I believe the former is correct.

Most versions of 1.0.3 suffer from a flaw in mwm code which miscompares
the functions and decorations fields; the bug appears in the case in which 
the functions do not coincidentally match. ICS submitted a fix against
1.0.2 in February to correct this problem and a problem with mwm's resetting of
its internal fields; but it was not fully applied to the 1.0.3 release.

For those keeping track, this should be part of fix #931.

Motif 1.1 has the correct code.

 
*** /tmp/WmWinInfo.c	Fri Nov 16 18:43:25 1990
--- WmWinInfo.c	Fri Nov 16 18:45:16 1990
***************
*** 2902,2922 ****
  	    else
  	    {
  		/* client indicating applicable functions */
  		pCD->clientFunctions &= pHints->functions;
  	    }
  	    /* !!! check for some minimal level of functionality? !!! */
  	}
  
  	if (pHints->flags & MWM_HINTS_DECORATIONS)
  	{
! 	    if (pHints->functions & MWM_DECOR_ALL)
  	    {
  		/* client indicating decorations to be removed */
  		pCD->clientDecoration &= ~(pHints->decorations);
  	    }
  	    else
  	    {
  		/* client indicating decorations to be added */
  		pCD->clientDecoration &= pHints->decorations;
  	    }
  
--- 2902,2922 ----
  	    else
  	    {
  		/* client indicating applicable functions */
  		pCD->clientFunctions &= pHints->functions;
  	    }
  	    /* !!! check for some minimal level of functionality? !!! */
  	}
  
  	if (pHints->flags & MWM_HINTS_DECORATIONS)
  	{
! 	    if (pHints->decorations & MWM_DECOR_ALL)
  	    {
  		/* client indicating decorations to be removed */
  		pCD->clientDecoration &= ~(pHints->decorations);
  	    }
  	    else
  	    {
  		/* client indicating decorations to be added */
  		pCD->clientDecoration &= pHints->decorations;
  	    }
  



-- 
David B. Lewis  			Lewis, Trachtenberg & Associates (LTA)
					+1 617 225 0366
Note new address!:	david@lta.com 			(Real Soon Now)
			david%lta.uucp@uunet.uu.net	(Works for Now)