CM: Adjust shadowing conditions

Treat all (non-off) shadow modes alike
Disable if shaped (OR too)
Disable if fullscreen (regular clients)
This commit is contained in:
Kim Woelders 2022-03-30 22:11:58 +02:00
parent 83a13eb6bf
commit a41b220904
3 changed files with 19 additions and 12 deletions

View File

@ -745,10 +745,7 @@ ECompMgrWinSetExtents(EObj * eo)
cw->extents = ERegionCreate();
#if ENABLE_SHADOWS
cw->has_shadow = (Mode_compmgr.shadow_mode != ECM_SHADOWS_OFF) &&
eo->shadow && (EShapeCheck(EobjGetWin(eo)) >= 0);
if (!cw->has_shadow)
goto skip_shadow;
cw->has_shadow = 0;
switch (Mode_compmgr.shadow_mode)
{
@ -757,6 +754,9 @@ ECompMgrWinSetExtents(EObj * eo)
case ECM_SHADOWS_SHARP:
case ECM_SHADOWS_ECHO:
if (!EobjShadowOk(eo))
goto skip_shadow;
cw->shadow_dx = Conf_compmgr.shadows.offset_x;
cw->shadow_dy = Conf_compmgr.shadows.offset_y;
cw->shadow_width = cw->rcw;
@ -764,7 +764,7 @@ ECompMgrWinSetExtents(EObj * eo)
break;
case ECM_SHADOWS_BLURRED:
if (EobjIsShaped(eo) /* || cw->mode == WINDOW_ARGB */ )
if (!EobjShadowOk(eo))
goto skip_shadow;
if (!gaussianMap)
@ -802,6 +802,7 @@ ECompMgrWinSetExtents(EObj * eo)
if (sr.y + sr.height > r.y + r.height)
r.height = sr.y + sr.height - r.y;
cw->has_shadow = 1;
ERegionSetRect(cw->extents, r.x, r.y, r.width, r.height);
goto done;

View File

@ -163,19 +163,25 @@ EobjSetFloating(EObj * eo, int floating)
EobjSetLayer(eo, eo->layer);
}
#if 1 /* FIXME - Remove */
int
EobjIsShaped(const EObj * eo)
EobjShadowOk(const EObj * eo)
{
if (!eo->shadow)
return 0; /* Shadow disabled by configuration */
if (eo->shaped)
return 0; /* Shadow disabled if shaped */
switch (eo->type)
{
default:
return 0; /* FIXME */
break;
case EOBJ_TYPE_EWIN:
return ((EWin *) eo)->state.shaped;
if (((EWin *) eo)->state.fullscreen)
return 0; /* Shadow disabled if fullscreen */
}
return 1;
}
#endif
#if USE_GLX
#define WINTYPE(t) ((t == EOBJ_TYPE_GLX) ? WIN_TYPE_GLX : WIN_TYPE_INTERNAL)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2021 Kim Woelders
* Copyright (C) 2004-2022 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
@ -186,7 +186,7 @@ void EobjChangeOpacity(EObj * eo, unsigned int opacity);
void EobjChangeShadow(EObj * eo, int shadow);
void EobjSetLayer(EObj * eo, int layer);
void EobjSetFloating(EObj * eo, int floating);
int EobjIsShaped(const EObj * eo);
int EobjShadowOk(const EObj * eo);
void EobjsOpacityUpdate(int op_or);