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
10 * This code is in the public domain.
15 #include <X11/Xatom.h>
20 #include <X11/Xm/MwmUtil.h>
24 /* bit definitions for MwmHints.flags */
25 #define MWM_HINTS_FUNCTIONS (1L << 0)
26 #define MWM_HINTS_DECORATIONS (1L << 1)
27 #define MWM_HINTS_INPUT_MODE (1L << 2)
28 #define MWM_HINTS_STATUS (1L << 3)
30 /* bit definitions for MwmHints.decorations */
31 #define MWM_DECOR_ALL (1L << 0)
32 #define MWM_DECOR_BORDER (1L << 1)
33 #define MWM_DECOR_RESIZEH (1L << 2)
34 #define MWM_DECOR_TITLE (1L << 3)
35 #define MWM_DECOR_MENU (1L << 4)
36 #define MWM_DECOR_MINIMIZE (1L << 5)
37 #define MWM_DECOR_MAXIMIZE (1L << 6)
42 unsigned long functions
;
43 unsigned long decorations
;
48 #define PROP_MOTIF_WM_HINTS_ELEMENTS 5
55 * Specify which Motif window manager border decorations to put on a
56 * top-level window. For example, you can specify that a window is not
57 * resizabe, or omit the titlebar, or completely remove all decorations.
58 * Input: dpy - the X display
60 * flags - bitwise-OR of the MWM_DECOR_xxx symbols in X11/Xm/MwmUtil.h
61 * indicating what decoration elements to enable. Zero would
64 void set_mwm_border( Display
*dpy
, Window w
, unsigned long flags
)
66 PropMotifWmHints motif_hints
;
69 /* setup the property */
70 motif_hints
.flags
= MWM_HINTS_DECORATIONS
;
71 motif_hints
.decorations
= flags
;
73 /* get the atom for the property */
74 prop
= XInternAtom( dpy
, "_MOTIF_WM_HINTS", True
);
76 /* something went wrong! */
80 /* not sure this is correct, seems to work, XA_WM_HINTS didn't work */
83 XChangeProperty( dpy
, w
, /* display, window */
84 prop
, proptype
, /* property, type */
85 32, /* format: 32-bit datums */
86 PropModeReplace
, /* mode */
87 (unsigned char *) &motif_hints
, /* data */
88 PROP_MOTIF_WM_HINTS_ELEMENTS
/* nelements */