diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-07-10 23:27:02 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-07-10 23:27:02 +0000 |
| commit | 81af5a8b0caadc0a82ff2304c315f816c9576e93 (patch) | |
| tree | ccbe40fccf5bd00b6a5cba87c20aec3ad8b6e55a /openbox/client.c | |
| parent | b0e8e276e451639689ebc9c58c1afe54897bceb2 (diff) | |
add disabled buttons, instead of now showing buttons at all when they wont do anything, now show a disabled button instead. this severely breaks compatibility with blackbox themes since there is no good way to automiatically create a disabled button that i can think of, so if they dont exist in the theme you get black and white for the button.
when a window cant be resized, its handle is not removed but its grips are.
change allowing the user to disable individual decorations as that is overkill,
instead allow a toggle through the client.decorate boolean.
Diffstat (limited to 'openbox/client.c')
| -rw-r--r-- | openbox/client.c | 92 |
1 files changed, 44 insertions, 48 deletions
diff --git a/openbox/client.c b/openbox/client.c index aa6e5be7..a339bf0f 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -544,7 +544,7 @@ static void client_get_all(ObClient *self) self->layer = -1; self->urgent = FALSE; self->positioned = FALSE; - self->disabled_decorations = 0; + self->decorate = TRUE; self->group = NULL; self->nicons = 0; @@ -914,22 +914,28 @@ void client_update_normal_hints(ObClient *self) void client_setup_decor_and_functions(ObClient *self) { /* start with everything (cept fullscreen) */ - self->decorations = Decor_Titlebar | Decor_Handle | Decor_Border | - Decor_Icon | Decor_AllDesktops | Decor_Iconify | Decor_Maximize | - Decor_Shade; - self->functions = OB_CLIENT_FUNC_RESIZE | OB_CLIENT_FUNC_MOVE | - OB_CLIENT_FUNC_ICONIFY | OB_CLIENT_FUNC_MAXIMIZE | - OB_CLIENT_FUNC_SHADE; + self->decorations = (OB_FRAME_DECOR_TITLEBAR | + OB_FRAME_DECOR_HANDLE | + OB_FRAME_DECOR_GRIPS | + OB_FRAME_DECOR_BORDER | + OB_FRAME_DECOR_ICON | + OB_FRAME_DECOR_ALLDESKTOPS | + OB_FRAME_DECOR_ICONIFY | + OB_FRAME_DECOR_MAXIMIZE | + OB_FRAME_DECOR_SHADE); + self->functions = (OB_CLIENT_FUNC_RESIZE | + OB_CLIENT_FUNC_MOVE | + OB_CLIENT_FUNC_ICONIFY | + OB_CLIENT_FUNC_MAXIMIZE | + OB_CLIENT_FUNC_SHADE); if (self->delete_window) { - self->decorations |= Decor_Close; self->functions |= OB_CLIENT_FUNC_CLOSE; + self->decorations |= OB_FRAME_DECOR_CLOSE; } if (!(self->min_size.width < self->max_size.width || - self->min_size.height < self->max_size.height)) { - self->decorations &= ~(Decor_Maximize | Decor_Handle); + self->min_size.height < self->max_size.height)) self->functions &= ~OB_CLIENT_FUNC_RESIZE; - } switch (self->type) { case OB_CLIENT_TYPE_NORMAL: @@ -941,14 +947,12 @@ void client_setup_decor_and_functions(ObClient *self) case OB_CLIENT_TYPE_DIALOG: case OB_CLIENT_TYPE_UTILITY: /* these windows cannot be maximized */ - self->decorations &= ~Decor_Maximize; self->functions &= ~OB_CLIENT_FUNC_MAXIMIZE; break; case OB_CLIENT_TYPE_MENU: case OB_CLIENT_TYPE_TOOLBAR: /* these windows get less functionality */ - self->decorations &= ~(Decor_Iconify | Decor_Handle); self->functions &= ~(OB_CLIENT_FUNC_ICONIFY | OB_CLIENT_FUNC_RESIZE); break; @@ -965,16 +969,11 @@ void client_setup_decor_and_functions(ObClient *self) decor and functionality */ 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 & OB_MWM_DECOR_HANDLE)) - self->decorations &= ~Decor_Handle; - if (! (self->mwmhints.decorations & OB_MWM_DECOR_TITLE)) - self->decorations &= ~Decor_Titlebar; - if (! (self->mwmhints.decorations & OB_MWM_DECOR_ICONIFY)) - self->decorations &= ~Decor_Iconify; - if (! (self->mwmhints.decorations & OB_MWM_DECOR_MAXIMIZE)) - self->decorations &= ~Decor_Maximize; + if (! ((self->mwmhints.decorations & OB_MWM_DECOR_HANDLE) || + (self->mwmhints.decorations & OB_MWM_DECOR_TITLE))) + /* if the mwm hints request no handle or title, then all + decorations are disabled */ + self->decorations = 0; } } @@ -984,43 +983,40 @@ void client_setup_decor_and_functions(ObClient *self) self->functions &= ~OB_CLIENT_FUNC_RESIZE; if (! (self->mwmhints.functions & OB_MWM_FUNC_MOVE)) self->functions &= ~OB_CLIENT_FUNC_MOVE; + /* dont let mwm hints kill any buttons if (! (self->mwmhints.functions & OB_MWM_FUNC_ICONIFY)) self->functions &= ~OB_CLIENT_FUNC_ICONIFY; if (! (self->mwmhints.functions & OB_MWM_FUNC_MAXIMIZE)) self->functions &= ~OB_CLIENT_FUNC_MAXIMIZE; + */ /* dont let mwm hints kill the close button if (! (self->mwmhints.functions & MwmFunc_Close)) - self->functions &= ~Func_Close; */ + self->functions &= ~OB_CLIENT_FUNC_CLOSE; */ } } + if (!(self->functions & OB_CLIENT_FUNC_SHADE)) + self->decorations &= ~OB_FRAME_DECOR_SHADE; + if (!(self->functions & OB_CLIENT_FUNC_ICONIFY)) + self->decorations &= ~OB_FRAME_DECOR_ICONIFY; + if (!(self->functions & OB_CLIENT_FUNC_RESIZE)) + self->decorations &= ~OB_FRAME_DECOR_GRIPS; + /* can't maximize without moving/resizing */ - if (!((self->functions & OB_CLIENT_FUNC_MOVE) && - (self->functions & OB_CLIENT_FUNC_RESIZE))) - self->functions &= ~(OB_CLIENT_FUNC_MAXIMIZE | - OB_CLIENT_FUNC_FULLSCREEN); - - /* finally, user specified disabled decorations are applied to subtract - decorations */ - if (self->disabled_decorations & Decor_Titlebar) - self->decorations &= ~Decor_Titlebar; - if (self->disabled_decorations & Decor_Handle) - self->decorations &= ~Decor_Handle; - if (self->disabled_decorations & Decor_Border) - self->decorations &= ~Decor_Border; - if (self->disabled_decorations & Decor_Iconify) - self->decorations &= ~Decor_Iconify; - if (self->disabled_decorations & Decor_Maximize) - self->decorations &= ~Decor_Maximize; - if (self->disabled_decorations & Decor_AllDesktops) - self->decorations &= ~Decor_AllDesktops; - if (self->disabled_decorations & Decor_Shade) - self->decorations &= ~Decor_Shade; - if (self->disabled_decorations & Decor_Close) - self->decorations &= ~Decor_Close; + if (!((self->functions & OB_CLIENT_FUNC_MAXIMIZE) && + (self->functions & OB_CLIENT_FUNC_MOVE) && + (self->functions & OB_CLIENT_FUNC_RESIZE))) { + self->functions &= ~OB_CLIENT_FUNC_MAXIMIZE; + self->decorations &= ~OB_FRAME_DECOR_MAXIMIZE; + } + + /* finally, the user can have requested no decorations, which overrides + everything */ + if (!self->decorate) + self->decorations = 0; /* if we don't have a titlebar, then we cannot shade! */ - if (!(self->decorations & Decor_Titlebar)) + if (!(self->decorations & OB_FRAME_DECOR_TITLEBAR)) self->functions &= ~OB_CLIENT_FUNC_SHADE; /* now we need to check against rules for the client's current state */ |
