#include <X11/Xlib.h>
#include <X11/Xatom.h>
#define HAVE_MOTIF
#ifdef HAVE_MOTIF
#include <X11/Xm/MwmUtil.h>
#else
#define MWM_HINTS_FUNCTIONS (1L << 0)
#define MWM_HINTS_DECORATIONS (1L << 1)
#define MWM_HINTS_INPUT_MODE (1L << 2)
#define MWM_HINTS_STATUS (1L << 3)
#define MWM_DECOR_ALL (1L << 0)
#define MWM_DECOR_BORDER (1L << 1)
#define MWM_DECOR_RESIZEH (1L << 2)
#define MWM_DECOR_TITLE (1L << 3)
#define MWM_DECOR_MENU (1L << 4)
#define MWM_DECOR_MINIMIZE (1L << 5)
#define MWM_DECOR_MAXIMIZE (1L << 6)
typedef struct
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long inputMode;
unsigned long status;
} PropMotifWmHints;
#define PROP_MOTIF_WM_HINTS_ELEMENTS 5
#endif
void set_mwm_border( Display *dpy, Window w, unsigned long flags )
{
PropMotifWmHints motif_hints;
Atom prop, proptype;
motif_hints.flags = MWM_HINTS_DECORATIONS;
motif_hints.decorations = flags;
prop = XInternAtom( dpy, "_MOTIF_WM_HINTS", True );
if (!prop) {
return;
}
proptype = prop;
XChangeProperty( dpy, w,
prop, proptype,
32,
PropModeReplace,
(unsigned char *) &motif_hints,
PROP_MOTIF_WM_HINTS_ELEMENTS
);
}