[comp.sys.hp] Programatically Dispensing with MWM Decorations

ries@venice.SEDD.TRW.COM (Marc Ries) (12/22/89)

[In response to my plea for help, the following code was emailed to
me.  Unfortunately, my mailer doesn't recognize the senders email
address so I could not respond directly. I have left out the orig.
senders name.  Thanks to the sender for at least responding 8-)]

The problem is, the code doesn't work, at least on our HP 360's
running HP MOTIF under HPUX 7.0.  I ran the following code, and
on our system, I still got a pushbutton widget with a full set of
MWM decorations around it?!?!?  

Is it HP MOTIF or me or ????

================================================================
/* mwm3.c - change mwm borders and frames. Based on pushb.c */
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <X11/AtomMgr.h>
#include <X11/Protocols.h>
#include <X11/MwmUtil.h>
#include <Xm/Xm.h>
#include <Xm/PushB.h>

void Exit (widget, closure, call_data)
Widget widget;
caddr_t closure, call_data;
{
printf ("About to Exit\n");
exit();
}

main (argc, argv)
int argc;
char *argv[];
{
Widget toplevel, pushb;
Arg arglist[10];
int n;

toplevel = XtInitialize(argv[0], "Motif", NULL, 0, &argc, argv);

pushb = XmCreatePushButton (toplevel, "Close", NULL,0);
XtManageChild (pushb);
XtAddCallback (pushb, XmNactivateCallback, Exit, NULL);
XtRealizeWidget (toplevel);

  {
  Display *display = XtDisplay (toplevel);
  Atom Motif_atom = XmInternAtom (display, _XA_MWM_HINTS, False);
  PropMwmHints data;

  data.flags = MWM_HINTS_DECORATIONS;
  /* leave out resize handles, title, system menu, zoom */
  data.decorations = MWM_DECOR_BORDER | MWM_DECOR_TITLE 
				| MWM_DECOR_MINIMIZE;

  /* property will stay there, present for when Mwm finally runs */
  XChangeProperty (display, XtWindow(toplevel), Motif_atom,
	Motif_atom, 32, PropModeReplace, (unsigned char *) &data, 
	PROP_MOTIF_WM_HINTS_ELEMENTS); 
  }

XtMainLoop();
}
================================================================


    Am I missing something or is HP Motif screwed up?  In either case,
    I typed in the above code verbatim and ran it and none of the
    border attributes changed (ie, I still had a push-button widget
    appear with a full MWM border decorations).

    Thanks,

    Marc Ries (ries@venice)
-- 
Marc Ries
           ries@venice.sedd.trw.com     (ARPA)
           somewhere!trwind!venice!ries (UUCP)
           #include <std.disclaimer>

david@jpl-devvax.JPL.NASA.GOV (David E. Smyth) (12/28/89)

ries@venice.sedd.trw.com (Marc Ries) writes:
>[In response to my plea for help, the following code was emailed to
>me.
>
>The problem is, the code doesn't work, at least on our HP 360's
>running HP MOTIF under HPUX 7.0.  I ran the following code, and
>on our system, I still got a pushbutton widget with a full set of
>MWM decorations around it?!?!?  
>
>Is it HP MOTIF or me or ????

It works great for me!

Machine:	Sun 3/260HM mono
OS:		SunOS 4.0.3
Compiler:	Sun cc
Server:		X11R3 + Purdue + all patches, gcc compiled
Motif:		ICS version 1.0 Nov 14 Motif tape.
Window Mgr:	mwm from Nov 14 Motif Tape from ICS.
Compile Line:	cc -g -Dsun -I/usr/include/Xm -c mwm3.c
Load Line:	cc -g -Dsun  mwm3.o -lXm -lXtm -lX11 -o mwm3
Libs:		-rw-r--r--  1 root       665446 Nov 14 09:21 libXm.a
		-rw-r--r--  1 root       206708 Nov 14 09:20 libXtm.a
		-rw-r--r--  1 root       198756 Jul 19 07:12 libX11.a
Includes:	Also from Nov 14 Motif Tape from ICS.

david@devvax.jpl.nasa.gov