From b42ef7362ccd35aeebf7863528556a7cc444a176 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 10 Jul 2003 06:23:38 +0000 Subject: [PATCH] add a mwm.h for the mwm hint structure and flags. use proper prefixing and capitalization for the new mwm stuff. --- openbox/client.c | 32 +++++++++++++------------- openbox/client.h | 46 ++----------------------------------- openbox/mwm.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 60 deletions(-) create mode 100644 openbox/mwm.h diff --git a/openbox/client.c b/openbox/client.c index 3249fd57..e79f3617 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -764,7 +764,7 @@ static void client_get_mwm_hints(Client *self) if (PROP_GETA32(self->window, motif_wm_hints, motif_wm_hints, &hints, &num)) { - if (num >= MWM_ELEMENTS) { + if (num >= OB_MWM_ELEMENTS) { self->mwmhints.flags = hints[0]; self->mwmhints.functions = hints[1]; self->mwmhints.decorations = hints[2]; @@ -802,8 +802,8 @@ void client_get_type(Client *self) else if (val[i] == prop_atoms.kde_net_wm_window_type_override) { /* prevent this window from getting any decor or functionality */ - self->mwmhints.flags &= (MwmFlag_Functions | - MwmFlag_Decorations); + self->mwmhints.flags &= (OB_MWM_FLAG_FUNCTIONS | + OB_MWM_FLAG_DECORATIONS); self->mwmhints.decorations = 0; self->mwmhints.functions = 0; } @@ -960,30 +960,30 @@ void client_setup_decor_and_functions(Client *self) /* Mwm Hints are applied subtractively to what has already been chosen for decor and functionality */ - if (self->mwmhints.flags & MwmFlag_Decorations) { - if (! (self->mwmhints.decorations & MwmDecor_All)) { - if (! (self->mwmhints.decorations & MwmDecor_Border)) + if (self->mwmhints.flags & OB_MWM_FLAG_DECORATIONS) { + if (! (self->mwmhints.decorations & OB_MWM_DECOR_ALL)) { + if (! (self->mwmhints.decorations & OB_MWM_DECOR_BORDER)) self->decorations &= ~Decor_Border; - if (! (self->mwmhints.decorations & MwmDecor_Handle)) + if (! (self->mwmhints.decorations & OB_MWM_DECOR_HANDLE)) self->decorations &= ~Decor_Handle; - if (! (self->mwmhints.decorations & MwmDecor_Title)) + if (! (self->mwmhints.decorations & OB_MWM_DECOR_TITLE)) self->decorations &= ~Decor_Titlebar; - if (! (self->mwmhints.decorations & MwmDecor_Iconify)) + if (! (self->mwmhints.decorations & OB_MWM_DECOR_ICONIFY)) self->decorations &= ~Decor_Iconify; - if (! (self->mwmhints.decorations & MwmDecor_Maximize)) + if (! (self->mwmhints.decorations & OB_MWM_DECOR_MAXIMIZE)) self->decorations &= ~Decor_Maximize; } } - if (self->mwmhints.flags & MwmFlag_Functions) { - if (! (self->mwmhints.functions & MwmFunc_All)) { - if (! (self->mwmhints.functions & MwmFunc_Resize)) + if (self->mwmhints.flags & OB_MWM_FLAG_FUNCTIONS) { + if (! (self->mwmhints.functions & OB_MWM_FUNC_ALL)) { + if (! (self->mwmhints.functions & OB_MWM_FUNC_RESIZE)) self->functions &= ~Func_Resize; - if (! (self->mwmhints.functions & MwmFunc_Move)) + if (! (self->mwmhints.functions & OB_MWM_FUNC_MOVE)) self->functions &= ~Func_Move; - if (! (self->mwmhints.functions & MwmFunc_Iconify)) + if (! (self->mwmhints.functions & OB_MWM_FUNC_ICONIFY)) self->functions &= ~Func_Iconify; - if (! (self->mwmhints.functions & MwmFunc_Maximize)) + if (! (self->mwmhints.functions & OB_MWM_FUNC_MAXIMIZE)) self->functions &= ~Func_Maximize; /* dont let mwm hints kill the close button if (! (self->mwmhints.functions & MwmFunc_Close)) diff --git a/openbox/client.h b/openbox/client.h index 1e8adf6e..65376719 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -2,6 +2,7 @@ #define __client_h #include "misc.h" +#include "mwm.h" #include "geom.h" #include "stacking.h" #include "render/color.h" @@ -22,49 +23,6 @@ typedef struct Icon { RrPixel32 *data; } Icon; -/*! The MWM Hints as retrieved from the window property - This structure only contains 3 elements, even though the Motif 2.0 - structure contains 5. We only use the first 3, so that is all gets - defined. -*/ -typedef struct MwmHints { - /*! A bitmask of Client::MwmFlags values */ - unsigned long flags; - /*! A bitmask of Client::MwmFunctions values */ - unsigned long functions; - /*! A bitmask of Client::MwmDecorations values */ - unsigned long decorations; -} MwmHints; -/*! The number of elements in the Client::MwmHints struct */ -#define MWM_ELEMENTS 3 - -/*! Possible flags for MWM Hints (defined by Motif 2.0) */ -typedef enum { - MwmFlag_Functions = 1 << 0, /*!< The MMW Hints define funcs */ - MwmFlag_Decorations = 1 << 1 /*!< The MWM Hints define decor */ -} MwmFlags; - -/*! Possible functions for MWM Hints (defined by Motif 2.0) */ -typedef enum { - MwmFunc_All = 1 << 0, /*!< All functions */ - MwmFunc_Resize = 1 << 1, /*!< Allow resizing */ - MwmFunc_Move = 1 << 2, /*!< Allow moving */ - MwmFunc_Iconify = 1 << 3, /*!< Allow to be iconfied */ - MwmFunc_Maximize = 1 << 4 /*!< Allow to be maximized */ - /*MwmFunc_Close = 1 << 5 /!< Allow to be closed */ -} MwmFunctions; - -/*! Possible decorations for MWM Hints (defined by Motif 2.0) */ -typedef enum { - MwmDecor_All = 1 << 0, /*!< All decorations */ - MwmDecor_Border = 1 << 1, /*!< Show a border */ - MwmDecor_Handle = 1 << 2, /*!< Show a handle (bottom) */ - MwmDecor_Title = 1 << 3, /*!< Show a titlebar */ - /*MwmDecor_Menu = 1 << 4, /!< Show a menu */ - MwmDecor_Iconify = 1 << 5, /*!< Show an iconify button */ - MwmDecor_Maximize = 1 << 6 /*!< Show a maximize button */ -} MemDecorations; - /*! Possible window types */ typedef enum { Type_Desktop, /*!< A desktop (bottom-most window) */ @@ -203,7 +161,7 @@ typedef struct Client { Size base_size; /*! Window decoration and functionality hints */ - MwmHints mwmhints; + ObMwmHints mwmhints; /*! Where to place the decorated window in relation to the undecorated window */ diff --git a/openbox/mwm.h b/openbox/mwm.h new file mode 100644 index 00000000..f90ae263 --- /dev/null +++ b/openbox/mwm.h @@ -0,0 +1,60 @@ +#ifndef __ob__mwm_h +#define __ob__mwm_h + +#include + +typedef struct _ObMwmHints ObMwmHints; + +/*! The MWM Hints as retrieved from the window property + This structure only contains 3 elements, even though the Motif 2.0 + structure contains 5. We only use the first 3, so that is all gets + defined. +*/ +struct _ObMwmHints +{ + /*! A bitmask of ObMwmFlags values */ + guint flags; + /*! A bitmask of ObMwmFunctions values */ + guint functions; + /*! A bitmask of ObMwmDecorations values */ + guint decorations; +}; + +/*! The number of elements in the ObMwmHints struct */ +#define OB_MWM_ELEMENTS 3 + +/*! Possible flags for MWM Hints (defined by Motif 2.0) */ +typedef enum +{ + OB_MWM_FLAG_FUNCTIONS = 1 << 0, /*!< The MMW Hints define funcs */ + OB_MWM_FLAG_DECORATIONS = 1 << 1 /*!< The MWM Hints define decor */ +} ObMwmFlags; + +/*! Possible functions for MWM Hints (defined by Motif 2.0) */ +typedef enum +{ + OB_MWM_FUNC_ALL = 1 << 0, /*!< All functions */ + OB_MWM_FUNC_RESIZE = 1 << 1, /*!< Allow resizing */ + OB_MWM_FUNC_MOVE = 1 << 2, /*!< Allow moving */ + OB_MWM_FUNC_ICONIFY = 1 << 3, /*!< Allow to be iconfied */ + OB_MWM_FUNC_MAXIMIZE = 1 << 4 /*!< Allow to be maximized */ +#if 0 + OM_MWM_FUNC_CLOSE = 1 << 5 /*!< Allow to be closed */ +#endif +} ObMwmFunctions; + +/*! Possible decorations for MWM Hints (defined by Motif 2.0) */ +typedef enum +{ + OB_MWM_DECOR_ALL = 1 << 0, /*!< All decorations */ + OB_MWM_DECOR_BORDER = 1 << 1, /*!< Show a border */ + OB_MWM_DECOR_HANDLE = 1 << 2, /*!< Show a handle (bottom) */ + OB_MWM_DECOR_TITLE = 1 << 3, /*!< Show a titlebar */ +#if 0 + OB_MWM_DECOR_MENU = 1 << 4, /*!< Show a menu */ +#endif + OB_MWM_DECOR_ICONIFY = 1 << 5, /*!< Show an iconify button */ + OB_MWM_DECOR_MAXIMIZE = 1 << 6 /*!< Show a maximize button */ +} ObMwmDecorations; + +#endif -- 2.39.2