From 5e5221d82d1d0c8679329e5bfb5a913e1b543a29 Mon Sep 17 00:00:00 2001 From: okan Date: Sat, 26 Feb 2022 15:03:42 +0000 Subject: [PATCH] Fix spelling of some unused MWM hints; from Sean C. Farley. While here, flesh out the rest of the MWM hints. --- calmwm.h | 45 +++++++++++++++++++++++++++------------------ client.c | 12 +++++++----- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/calmwm.h b/calmwm.h index 17bd55a..5c4e45c 100644 --- a/calmwm.h +++ b/calmwm.h @@ -309,30 +309,39 @@ struct conf { /* MWM hints */ struct mwm_hints { -#define MWM_HINTS_ELEMENTS 3L -#define MWM_FLAGS_STATUS (1<<3) +#define MWM_HINTS_ELEMENTS 5L -#define MWM_FLAGS_FUNCTIONS (1<<0) -#define MWM_FLAGS_DECORATIONS (1<<1) -#define MWM_FLAGS_INPUT_MODE (1<<2) +#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) unsigned long flags; -#define MWM_FUNCS_ALL (1<<0) -#define MWM_FUNCS_RESIZE (1<<1) -#define MWM_FUNCS_MOVE (1<<2) -#define MWM_FUNCS_MINIMIZE (1<<3) -#define MWM_FUNCS_MAXIMIZE (1<<4) -#define MWM_FUNCS_CLOSE (1<<5) +#define MWM_FUNC_ALL (1L << 0) +#define MWM_FUNC_RESIZE (1L << 1) +#define MWM_FUNC_MOVE (1L << 2) +#define MWM_FUNC_MINIMIZE (1L << 3) +#define MWM_FUNC_MAXIMIZE (1L << 4) +#define MWM_FUNC_CLOSE (1L << 5) unsigned long functions; -#define MWM_DECOR_ALL (1<<0) -#define MWM_DECOR_BORDER (1<<1) -#define MWM_DECOR_RESIZE_HANDLE (1<<2) -#define MWM_DECOR_TITLEBAR (1<<3) -#define MWM_DECOR_MENU (1<<4) -#define MWM_DECOR_MINIMIZE (1<<5) -#define MWM_DECOR_MAXIMIZE (1<<6) +#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) unsigned long decorations; + +#define MWM_INPUT_MODELESS 0 +#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 +#define MWM_INPUT_SYSTEM_MODAL 2 +#define MWM_INPUT_FULL_APPLICATION_MODAL 3 + long inputMode; + +#define MWM_TEAROFF_WINDOW (1L << 0) + unsigned long status; }; enum cwmh { diff --git a/client.c b/client.c index 0d93714..e66ca28 100644 --- a/client.c +++ b/client.c @@ -849,13 +849,15 @@ client_mwm_hints(struct client_ctx *cc) if (xu_get_prop(cc->win, cwmh[_MOTIF_WM_HINTS], cwmh[_MOTIF_WM_HINTS], MWM_HINTS_ELEMENTS, - (unsigned char **)&mwmh) == MWM_HINTS_ELEMENTS) { - if (mwmh->flags & MWM_FLAGS_DECORATIONS && - !(mwmh->decorations & MWM_DECOR_ALL) && - !(mwmh->decorations & MWM_DECOR_BORDER)) + (unsigned char **)&mwmh) <= 0) + return; + + if ((mwmh->flags & MWM_HINTS_DECORATIONS) && + !(mwmh->decorations & MWM_DECOR_ALL)) { + if (!(mwmh->decorations & MWM_DECOR_BORDER)) cc->bwidth = 0; - XFree(mwmh); } + XFree(mwmh); } void