5 * This function shows how to remove the border, title bar, resize button,
6 * etc from a Motif window frame from inside an Xlib-based application.
8 * Brian Paul 19 Sep 1995 brianp@ssec.wisc.edu
13 #include <X11/Xatom.h>
18 #include <Xm/MwmUtil.h>
22 /* bit definitions for MwmHints.flags */
23 #define MWM_HINTS_FUNCTIONS (1L << 0)
24 #define MWM_HINTS_DECORATIONS (1L << 1)
25 #define MWM_HINTS_INPUT_MODE (1L << 2)
26 #define MWM_HINTS_STATUS (1L << 3)
28 /* bit definitions for MwmHints.decorations */
29 #define MWM_DECOR_ALL (1L << 0)
30 #define MWM_DECOR_BORDER (1L << 1)
31 #define MWM_DECOR_RESIZEH (1L << 2)
32 #define MWM_DECOR_TITLE (1L << 3)
33 #define MWM_DECOR_MENU (1L << 4)
34 #define MWM_DECOR_MINIMIZE (1L << 5)
35 #define MWM_DECOR_MAXIMIZE (1L << 6)
40 unsigned long functions;
41 unsigned long decorations;
46 #define PROP_MOTIF_WM_HINTS_ELEMENTS 5
53 * Specify which Motif window manager border decorations to put on a
54 * top-level window. For example, you can specify that a window is not
55 * resizabe, or omit the titlebar, or completely remove all decorations.
56 * Input: dpy - the X display
58 * flags - bitwise-OR of the MWM_DECOR_xxx symbols in X11/Xm/MwmUtil.h
59 * indicating what decoration elements to enable. Zero would
62 void set_mwm_border( Display *dpy, Window w, unsigned long flags )
64 PropMotifWmHints motif_hints;
67 /* setup the property */
68 motif_hints.flags = MWM_HINTS_DECORATIONS;
69 motif_hints.decorations = flags;
71 /* get the atom for the property */
72 prop = XInternAtom( dpy, "_MOTIF_WM_HINTS", True );
74 /* something went wrong! */
78 /* not sure this is correct, seems to work, XA_WM_HINTS didn't work */
81 XChangeProperty( dpy, w, /* display, window */
82 prop, proptype, /* property, type */
83 32, /* format: 32-bit datums */
84 PropModeReplace, /* mode */
85 (unsigned char *) &motif_hints, /* data */
86 PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */