kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=5132afd31397c1d4b971668c6f25a73a94b3ebb9
commit 5132afd31397c1d4b971668c6f25a73a94b3ebb9 Author: Kim Woelders <k...@woelders.dk> Date: Fri Sep 25 06:55:51 2020 +0200 Simplify checks for borderless --- src/borders.c | 19 ++++++++++++++++++- src/borders.h | 4 +++- src/ewin-ops.c | 24 ++++++------------------ src/ewins.c | 7 ++++--- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/borders.c b/src/borders.c index e6b34dfa..c69ff181 100644 --- a/src/borders.c +++ b/src/borders.c @@ -479,6 +479,12 @@ BorderGetName(const Border * b) return (b) ? b->name : NULL; } +int +BorderCanShade(const Border * b) +{ + return !b->no_extent; +} + void EwinBorderSelect(EWin * ewin) { @@ -562,7 +568,7 @@ EwinBorderSetTo(EWin * ewin, const Border * b) _BorderIncRefcount(b); HintsSetWindowBorder(ewin); - ewin->state.no_border = b->num_winparts <= 0; + ewin->state.no_border = b->no_extent; EventCallbackRegister(EoGetWin(ewin), _BorderFrameHandleEvents, ewin); @@ -682,6 +688,16 @@ _BorderCreate(const char *name) return b; } +static int +_BorderCheck(Border * b) +{ + b->no_extent = b->num_winparts <= 0 || + (b->border.left == 0 && b->border.right == 0 && + b->border.top == 0 && b->border.bottom == 0); + + return 0; +} + static void _BorderDestroy(Border * b) { @@ -1233,6 +1249,7 @@ BorderConfigLoad(FILE * fs) switch (i1) { case CONFIG_CLOSE: + _BorderCheck(b); goto done; case CONFIG_CLASSNAME: case BORDER_NAME: diff --git a/src/borders.h b/src/borders.h index 22f0aec5..f7a9eeab 100644 --- a/src/borders.h +++ b/src/borders.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2013 Kim Woelders + * Copyright (C) 2004-2020 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -64,6 +64,7 @@ struct _border { EImageBorder border; int num_winparts; WinPart *part; + char no_extent; char changes_shape; char shadedir; char throwaway; @@ -86,6 +87,7 @@ struct _ewinbit { /* borders.c */ Border *BorderFind(const char *name); const char *BorderGetName(const Border * b); +int BorderCanShade(const Border * b); int BorderConfigLoad(FILE * fs); void EwinBorderSelect(EWin * ewin); void EwinBorderDetach(EWin * ewin); diff --git a/src/ewin-ops.c b/src/ewin-ops.c index 45c57bc3..689d9e7d 100644 --- a/src/ewin-ops.c +++ b/src/ewin-ops.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2019 Kim Woelders + * Copyright (C) 2004-2020 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -752,10 +752,7 @@ EwinInstantShade(EWin * ewin, int force) int x, y, w, h; int minw, minh; - if ((ewin->border->border.left == 0) && (ewin->border->border.right == 0) - && (ewin->border->border.top == 0) && (ewin->border->border.bottom == 0)) - return; - if (ewin->state.zoomed) + if (ewin->state.inhibit_shade) return; if (ewin->state.shaded && !force) return; @@ -958,14 +955,9 @@ EwinShade(EWin * ewin) _ewin_shade_data esd; int duration; - if ((ewin->border->border.left == 0) && (ewin->border->border.right == 0) && - (ewin->border->border.top == 0) && (ewin->border->border.bottom == 0)) - return; - if (ewin->state.zoomed) + if (ewin->state.inhibit_shade) return; - if (ewin->state.shaded || ewin->state.shading || ewin->state.iconified) - return; - if ((ewin->border) && (!strcmp(ewin->border->name, "BORDERLESS"))) + if (ewin->state.shaded || ewin->state.shading) return; esd.ewin = ewin; @@ -1592,12 +1584,8 @@ EwinOpSetBorder(EWin * ewin, int source __UNUSED__, const char *name) break; } } - if (has_shaded) - { - if ((b->border.left == 0) && (b->border.right == 0) - && (b->border.top == 0) && (b->border.bottom == 0)) - return; - } + if (has_shaded && !BorderCanShade(b)) + return; for (i = 0; i < num; i++) { diff --git a/src/ewins.c b/src/ewins.c index b72ca7c5..1c848a3e 100644 --- a/src/ewins.c +++ b/src/ewins.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2019 Kim Woelders + * Copyright (C) 2004-2020 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -352,6 +352,8 @@ EwinConfigure(EWin * ewin) EwinSetGeometry(ewin); /* Calculate window geometry before border parts */ EwinBorderSetTo(ewin, NULL); + EwinStateUpdate(ewin); /* Update after border configuration */ + if (!ewin->props.no_button_grabs) GrabButtonGrabs(EoGetWin(ewin)); @@ -360,8 +362,7 @@ EwinConfigure(EWin * ewin) EwinUpdateOpacity(ewin); - if ((ewin->border) && (!strcmp(ewin->border->name, "BORDERLESS")) && - EoGetWin(ewin)->argb) + if (ewin->state.no_border && EoGetWin(ewin)->argb) EoSetShadow(ewin, 0); HintsSetWindowState(ewin); --