Restore group border show/hide feature.

SVN revision: 37749
This commit is contained in:
Kim Woelders 2008-11-22 21:16:55 +00:00
parent 8abe7ff142
commit 20e9396c05
4 changed files with 30 additions and 68 deletions

View File

@ -574,33 +574,37 @@ EwinBorderSetTo(EWin * ewin, const Border * b)
}
void
EwinBorderChange(EWin * ewin, const Border * b, int apply)
EwinBorderChange(EWin * ewin, const Border * b, int normal)
{
if (!b || ewin->border == b ||
ewin->inh_wm.b.border || ewin->state.fullscreen)
return;
EwinBorderSetTo(ewin, b);
EwinMoveResize(ewin, EoGetX(ewin), EoGetY(ewin),
ewin->client.w, ewin->client.h);
if (normal)
ewin->normal_border = b;
}
static void
EwinBorderAssign(EWin * ewin, const Border * b)
{
if (!b || ewin->border == b || ewin->inh_wm.b.border)
return;
if (apply)
{
EwinBorderSetTo(ewin, b);
EwinMoveResize(ewin, EoGetX(ewin), EoGetY(ewin),
ewin->client.w, ewin->client.h);
}
else
{
if (ewin->border)
BorderDecRefcount(ewin->border);
ewin->border = b;
BorderIncRefcount(b);
}
if (ewin->border)
BorderDecRefcount(ewin->border);
BorderIncRefcount(b);
if (!ewin->state.fullscreen)
ewin->normal_border = b;
ewin->border = ewin->normal_border = b;
}
void
EwinBorderSetInitially(EWin * ewin, const char *name)
{
EwinBorderChange(ewin, BorderFind(name), 0);
EwinBorderAssign(ewin, BorderFind(name));
}
static Border *

View File

@ -92,7 +92,7 @@ void EwinBorderDraw(EWin * ewin, int do_shape, int do_paint);
void EwinBorderCalcSizes(EWin * ewin, int propagate);
void EwinBorderMinShadeSize(EWin * ewin, int *mw, int *mh);
void EwinBorderUpdateInfo(EWin * ewin);
void EwinBorderChange(EWin * ewin, const Border * b, int apply);
void EwinBorderChange(EWin * ewin, const Border * b, int normal);
void EwinBorderSetInitially(EWin * ewin, const char *name);
int BorderWinpartIndex(EWin * ewin, Win win);
void BorderCheckState(EWin * ewin, XEvent * ev);

View File

@ -69,7 +69,6 @@ struct _ewin {
const Border *border;
const Border *normal_border;
const Border *previous_border;
EWinBit *bits;
struct {

View File

@ -40,7 +40,7 @@
#define Dprintf(fmt...)
#endif
#define USE_GROUP_SHOWHIDE 0 /* Don't think this is useful. */
#define USE_GROUP_SHOWHIDE 1 /* Enable group borders */
#define SET_OFF 0
#define SET_ON 1
@ -464,7 +464,6 @@ ShowHideWinGroups(EWin * ewin, int group_index, char onoff)
EWin **gwins;
int i, num;
const Border *b = NULL;
const Border *previous_border;
if (!ewin || group_index >= ewin->num_groups)
return;
@ -479,60 +478,20 @@ ShowHideWinGroups(EWin * ewin, int group_index, char onoff)
num = ewin->groups[group_index]->num_members;
}
previous_border = ewin->previous_border;
if (onoff == SET_TOGGLE)
onoff = (ewin->border == ewin->normal_border) ? SET_ON : SET_OFF;
for (i = 0; i < num; i++)
{
b = NULL;
switch (onoff)
{
case SET_TOGGLE:
if ((!previous_border) && (!gwins[i]->previous_border))
{
if (!gwins[i]->border->group_border_name)
continue;
if (onoff == SET_ON)
b = BorderFind(gwins[i]->border->group_border_name);
else
b = gwins[i]->normal_border;
b = BorderFind(gwins[i]->border->group_border_name);
if (b)
gwins[i]->previous_border = gwins[i]->border;
}
else if ((previous_border) && (gwins[i]->previous_border))
{
b = gwins[i]->previous_border;
gwins[i]->previous_border = NULL;
}
break;
case SET_ON:
if (!gwins[i]->previous_border)
{
if (!gwins[i]->border->group_border_name)
continue;
b = BorderFind(gwins[i]->border->group_border_name);
if (b)
gwins[i]->previous_border = gwins[i]->border;
}
break;
case SET_OFF:
if (gwins[i]->previous_border)
{
b = gwins[i]->previous_border;
gwins[i]->previous_border = NULL;
}
break;
default:
break;
}
if (b)
{
EwinBorderChange(gwins[i], b, 1);
SnapshotEwinUpdate(gwins[i], SNAP_USE_GROUPS);
}
EwinBorderChange(gwins[i], b, 0);
}
if (group_index < 0)
Efree(gwins);
GroupsSave();
}
#else