Use new static stacking list wherever possible.

SVN revision: 9491
This commit is contained in:
Kim Woelders 2004-03-26 21:21:47 +00:00
parent 20dfaa3aad
commit 2b84f92907
19 changed files with 345 additions and 469 deletions

View File

@ -2535,8 +2535,10 @@ void EwinListAdd(EWinList * ewl, EWin * ewin);
void EwinListDelete(EWinList * ewl, EWin * ewin);
int EwinListRaise(EWinList * ewl, EWin * ewin, int mode);
int EwinListLower(EWinList * ewl, EWin * ewin, int mode);
EWin **EwinListGetForDesktop(int desk, int *num);
EWin **EwinListGetStacking(int *num);
EWin *const *EwinListGetForDesktop(int desk, int *num);
EWin *const *EwinListGetStacking(int *num);
#define EwinListGet EwinListGetStacking
int EwinListStackingRaise(EWin * ewin);
int EwinListStackingLower(EWin * ewin);
int EwinListFocusRaise(EWin * ewin);

View File

@ -1171,7 +1171,7 @@ FindEwinInList(EWin * ewin, EWin ** gwins, int num)
static int
DoRaiseLower(EWin * ewin, const void *params, int nogroup)
{
EWin **gwins, **lst;
EWin **gwins, *const *lst;
int gnum, j, raise = 0;
int i, num;
@ -1233,11 +1233,10 @@ doCleanup(EWin * edummy, const void *params)
{
char *type;
int method;
void **lst;
int i, j, k, num, speed;
RectBox *fixed, *ret, *floating;
char doslide;
EWin *ewin;
EWin *const *lst, *ewin;
Button **blst;
EDBUG(6, "doCleanup");
@ -1258,7 +1257,7 @@ doCleanup(EWin * edummy, const void *params)
method = ARRANGE_BY_POSITION;
}
}
lst = ListItemType(&num, LIST_TYPE_EWIN);
lst = EwinListGet(&num);
if (lst)
{
fixed = NULL;
@ -1268,36 +1267,35 @@ doCleanup(EWin * edummy, const void *params)
k = 0;
for (i = 0; i < num; i++)
{
if ((((EWin *) lst[i])->desktop == desks.current)
&& (!((EWin *) lst[i])->sticky)
&& (!((EWin *) lst[i])->floating)
&& (!((EWin *) lst[i])->iconified)
&& (!((EWin *) lst[i])->ignorearrange)
&& (!((EWin *) lst[i])->menu)
&& (((EWin *) lst[i])->area_x ==
desks.desk[((EWin *) lst[i])->desktop].current_area_x)
&& (((EWin *) lst[i])->area_y ==
desks.desk[((EWin *) lst[i])->desktop].current_area_y))
ewin = lst[i];
if ((ewin->desktop == desks.current)
&& (!ewin->sticky)
&& (!ewin->floating)
&& (!ewin->iconified)
&& (!ewin->ignorearrange)
&& (!ewin->menu)
&& (ewin->area_x ==
desks.desk[ewin->desktop].current_area_x)
&& (ewin->area_y == desks.desk[ewin->desktop].current_area_y))
{
floating[j].data = lst[i];
floating[j].x = ((EWin *) lst[i])->x;
floating[j].y = ((EWin *) lst[i])->y;
floating[j].w = ((EWin *) lst[i])->w;
floating[j].p = ((EWin *) lst[i])->layer;
floating[j++].h = ((EWin *) lst[i])->h;
floating[j].x = ewin->x;
floating[j].y = ewin->y;
floating[j].w = ewin->w;
floating[j].p = ewin->layer;
floating[j++].h = ewin->h;
}
else if (((((EWin *) lst[i])->desktop == desks.current)
|| (((EWin *) lst[i])->sticky))
&& (((EWin *) lst[i])->layer != 4)
&& (((EWin *) lst[i])->layer != 0)
&& (!((EWin *) lst[i])->menu))
else if (((ewin->desktop == desks.current)
|| (ewin->sticky))
&& (ewin->layer != 4)
&& (ewin->layer != 0) && (!ewin->menu))
{
fixed = Erealloc(fixed, sizeof(RectBox) * (k + 1));
fixed[k].data = lst[i];
fixed[k].x = ((EWin *) lst[i])->x;
fixed[k].y = ((EWin *) lst[i])->y;
fixed[k].w = ((EWin *) lst[i])->w;
fixed[k].h = ((EWin *) lst[i])->h;
fixed[k].x = ewin->x;
fixed[k].y = ewin->y;
fixed[k].w = ewin->w;
fixed[k].h = ewin->h;
if (fixed[k].x < 0)
{
fixed[k].x += fixed[k].w;
@ -1314,8 +1312,8 @@ doCleanup(EWin * edummy, const void *params)
fixed[k].h = root.h - fixed[k].y;
if ((fixed[k].w > 0) && (fixed[k].h > 0))
{
if (!((EWin *) lst[i])->never_use_area)
fixed[k].p = ((EWin *) lst[i])->layer;
if (!ewin->never_use_area)
fixed[k].p = ewin->layer;
else
fixed[k].p = 99;
k++;
@ -1398,8 +1396,6 @@ doCleanup(EWin * edummy, const void *params)
Efree(ret);
if (floating)
Efree(floating);
if (lst)
Efree(lst);
}
EDBUG_RETURN(0);
edummy = NULL;
@ -2351,7 +2347,7 @@ static int
doScrollWindows(EWin * edummy, const void *params)
{
int x, y, num, i;
EWin **lst;
EWin *const *lst;
EDBUG(6, "doScrollWindows");
if (!params)
@ -2361,17 +2357,12 @@ doScrollWindows(EWin * edummy, const void *params)
y = 0;
sscanf((char *)params, "%i %i", &x, &y);
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if ((lst) && (num > 0))
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
{
if ((lst[i]->desktop == desks.current) && (!lst[i]->sticky)
&& (!lst[i]->floating) && (!lst[i]->fixedpos))
MoveEwin(lst[i], lst[i]->x + x, lst[i]->y + y);
}
Efree(lst);
if ((lst[i]->desktop == desks.current) && (!lst[i]->sticky)
&& (!lst[i]->floating) && (!lst[i]->fixedpos))
MoveEwin(lst[i], lst[i]->x + x, lst[i]->y + y);
}
EDBUG_RETURN(0);
edummy = NULL;

View File

@ -83,7 +83,7 @@ SetNewAreaSize(int ax, int ay)
{
int a, b, i, num;
EWin **lst;
EWin *const *lst;
if (ax <= 0)
return;
@ -96,20 +96,16 @@ SetNewAreaSize(int ax, int ay)
SetAreaSize(ax, ay);
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
if ((!(lst[i]->sticky)) && (!(lst[i]->fixedpos)))
{
if ((!(lst[i]->sticky)) && (!(lst[i]->fixedpos)))
{
if (lst[i]->area_x >= ax)
MoveEwinToArea(lst[i], ax - 1, lst[i]->area_x);
if (lst[i]->area_y >= ay)
MoveEwinToArea(lst[i], lst[i]->area_x, ay - 1);
}
if (lst[i]->area_x >= ax)
MoveEwinToArea(lst[i], ax - 1, lst[i]->area_x);
if (lst[i]->area_y >= ay)
MoveEwinToArea(lst[i], lst[i]->area_x, ay - 1);
}
Efree(lst);
}
GetCurrentArea(&a, &b);
@ -246,7 +242,7 @@ SlideWindowsBy(Window * win, int num, int dx, int dy, int speed)
void
SetCurrentArea(int ax, int ay)
{
EWin *ewin, **lst;
EWin *const *lst, *ewin;
int i, num, a1, a2, x, y, dx, dy;
ToolTip *tt;
@ -287,54 +283,92 @@ SetCurrentArea(int ax, int ay)
desks.desk[desks.current].current_area_y = ay;
/* move all the windows around */
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&num);
if (Conf.desks.slidein)
{
if (Conf.desks.slidein)
int wnum = 0;
Window *wl = NULL;
/* create the list of windwos to move */
for (i = 0; i < num; i++)
{
int wnum = 0;
Window *wl = NULL;
ewin = lst[i];
if (ewin->desktop != desks.current || ewin->sticky ||
ewin->fixedpos || ewin->iconified)
continue;
/* create the list of windwos to move */
for (i = 0; i < num; i++)
if ((ewin->floating) && (Conf.movemode > 0))
{
ewin = lst[i];
if (ewin->desktop != desks.current || ewin->sticky ||
ewin->fixedpos || ewin->iconified)
continue;
wnum++;
wl = Erealloc(wl, sizeof(Window) * wnum);
wl[wnum - 1] = ewin->win;
}
else if (!ewin->floating)
{
wnum++;
wl = Erealloc(wl, sizeof(Window) * wnum);
wl[wnum - 1] = ewin->win;
}
}
if ((ewin->floating) && (Conf.movemode > 0))
/* slide them */
if (wl)
{
SlideWindowsBy(wl, wnum, -dx, -dy, Conf.desks.slidespeed);
Efree(wl);
}
/* move the windows to their final positions */
for (i = 0; i < num; i++)
{
char setflip = 0;
ewin = lst[i];
if (ewin->desktop != desks.current || ewin->sticky ||
ewin->fixedpos || ewin->floating || ewin->client.transient_for)
continue;
a1 = ewin->area_x;
a2 = ewin->area_y;
if (!Mode.flipp)
{
setflip = 1;
Mode.flipp = 1;
}
MoveEwin(ewin, ewin->x - dx, ewin->y - dy);
if (setflip)
Mode.flipp = 0;
ewin->area_x = a1;
ewin->area_y = a2;
HintsSetWindowArea(ewin);
}
}
else
{
/* move all windows across.... */
for (i = 0; i < num; i++)
{
ewin = lst[i];
if (ewin->desktop != desks.current || ewin->sticky ||
ewin->fixedpos)
continue;
/* if we're moving this window and its not opaque move */
/* warp it across without remebering the xy stuff */
/* well work out the xy stuff later when the move finishes */
if (ewin->floating)
{
if (Conf.movemode > 0)
{
wnum++;
wl = Erealloc(wl, sizeof(Window) * wnum);
wl[wnum - 1] = ewin->win;
}
else if (!ewin->floating)
{
wnum++;
wl = Erealloc(wl, sizeof(Window) * wnum);
wl[wnum - 1] = ewin->win;
GetWinXY(ewin->win, &x, &y);
EMoveWindow(disp, ewin->win, x - dx, y - dy);
}
}
/* slide them */
if (wl)
{
SlideWindowsBy(wl, wnum, -dx, -dy, Conf.desks.slidespeed);
Efree(wl);
}
/* move the windows to their final positions */
for (i = 0; i < num; i++)
/* if we're not moving it... move it across */
else if (!ewin->client.transient_for)
{
char setflip = 0;
ewin = lst[i];
if (ewin->desktop != desks.current || ewin->sticky ||
ewin->fixedpos || ewin->floating ||
ewin->client.transient_for)
continue;
a1 = ewin->area_x;
a2 = ewin->area_y;
if (!Mode.flipp)
@ -350,49 +384,6 @@ SetCurrentArea(int ax, int ay)
HintsSetWindowArea(ewin);
}
}
else
{
/* move all windows across.... */
for (i = 0; i < num; i++)
{
ewin = lst[i];
if (ewin->desktop != desks.current || ewin->sticky ||
ewin->fixedpos)
continue;
/* if we're moving this window and its not opaque move */
/* warp it across without remebering the xy stuff */
/* well work out the xy stuff later when the move finishes */
if (ewin->floating)
{
if (Conf.movemode > 0)
{
GetWinXY(ewin->win, &x, &y);
EMoveWindow(disp, ewin->win, x - dx, y - dy);
}
}
/* if we're not moving it... move it across */
else if (!ewin->client.transient_for)
{
char setflip = 0;
a1 = ewin->area_x;
a2 = ewin->area_y;
if (!Mode.flipp)
{
setflip = 1;
Mode.flipp = 1;
}
MoveEwin(ewin, ewin->x - dx, ewin->y - dy);
if (setflip)
Mode.flipp = 0;
ewin->area_x = a1;
ewin->area_y = a2;
HintsSetWindowArea(ewin);
}
}
}
Efree(lst);
}
/* set hints up for it */

View File

@ -821,7 +821,7 @@ EWinIsOnViewport(EWin * ewin, int desktop)
void
ArrangeEwinXY(EWin * ewin, int *px, int *py)
{
EWin **lst;
EWin *const *lst;
Button **blst;
int i, j, num;
RectBox *fixed, *ret, newrect;
@ -829,7 +829,7 @@ ArrangeEwinXY(EWin * ewin, int *px, int *py)
fixed = NULL;
ret = NULL;
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
lst = EwinListGet(&num);
if ((lst) && (num > 0))
{
fixed = Emalloc(sizeof(RectBox) * num);
@ -924,7 +924,6 @@ ArrangeEwinXY(EWin * ewin, int *px, int *py)
break;
}
}
Efree(lst);
if (ret)
Efree(ret);
if (fixed)

View File

@ -114,17 +114,13 @@ void
SetEInfoOnAll()
{
int i, num;
EWin **lst;
EWin *const *lst;
EDBUG(5, "SetEInfoOnAll");
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if ((lst) && (num > 0))
{
for (i = 0; i < num; i++)
ICCCM_SetEInfo(lst[i]);
Efree(lst);
}
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
ICCCM_SetEInfo(lst[i]);
ICCCM_SetMainEInfo();
EDBUG_RETURN_;
@ -150,7 +146,7 @@ GetEwinPointerInClient(void)
{
Window rt, ch;
int dum, px, py, d;
EWin **lst;
EWin *const *lst;
int i, num;
EDBUG(5, "GetEwinPointerInClient");
@ -341,7 +337,7 @@ void
AddToFamily(Window win)
{
EWin *ewin, *ewin2;
EWin **lst;
EWin *const *lst;
int i, k, num, speed, fx, fy, x, y;
char doslide, manplace;
char pq;
@ -408,7 +404,7 @@ AddToFamily(Window win)
if (!ewin2)
{
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
if ((lst[i]->iconified) ||
@ -418,8 +414,6 @@ AddToFamily(Window win)
ewin2 = lst[i];
break;
}
if (lst)
Efree(lst);
}
if (ewin2)
@ -3235,10 +3229,10 @@ static int
BordersEvent(XEvent * ev, border_event_func_t * func)
{
Window win = ev->xany.window;
EWin **ewins;
EWin *const *ewins;
int i, j, num, used = 0;
ewins = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
ewins = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (j = 0; j < ewins[i]->border->num_winparts; j++)
@ -3254,8 +3248,6 @@ BordersEvent(XEvent * ev, border_event_func_t * func)
}
done:
if (ewins)
Efree(ewins);
return used;
}

View File

@ -1570,22 +1570,18 @@ HandleComms(XClientMessageEvent * ev)
else
{
int i, num;
EWin **lst;
EWin *const *lst;
Conf.desks.num = atoi(w);
if (Conf.desks.num <= 0)
Conf.desks.num = 1;
else if (Conf.desks.num > ENLIGHTENMENT_CONF_NUM_DESKTOPS)
Conf.desks.num = ENLIGHTENMENT_CONF_NUM_DESKTOPS;
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
{
if (lst[i]->desktop >= Conf.desks.num)
MoveEwinToDesktop(lst[i], Conf.desks.num - 1);
}
Efree(lst);
if (lst[i]->desktop >= Conf.desks.num)
MoveEwinToDesktop(lst[i], Conf.desks.num - 1);
}
if (desks.current >= Conf.desks.num)
GotoDesktop(Conf.desks.num - 1);
@ -1819,10 +1815,10 @@ HandleComms(XClientMessageEvent * ev)
{
char buf[FILEPATH_LEN_MAX], *ret = NULL, none[] =
"-NONE-";
EWin **lst;
EWin *const *lst;
int i, num;
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
if (!lst[i]->icccm.wm_name)
@ -2031,8 +2027,6 @@ HandleComms(XClientMessageEvent * ev)
CommsSend(c, ret);
Efree(ret);
}
if (lst)
Efree(lst);
}
else
unknown = 1;

View File

@ -117,7 +117,7 @@ void
ChangeNumberOfDesktops(int quantity)
{
int pnum, i, num;
EWin **lst;
EWin *const *lst;
pnum = Conf.desks.num;
for (i = quantity; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
@ -129,16 +129,13 @@ ChangeNumberOfDesktops(int quantity)
else if (Conf.desks.num > ENLIGHTENMENT_CONF_NUM_DESKTOPS)
Conf.desks.num = ENLIGHTENMENT_CONF_NUM_DESKTOPS;
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
{
if (lst[i]->desktop >= Conf.desks.num)
MoveEwinToDesktop(lst[i], Conf.desks.num - 1);
}
Efree(lst);
if (lst[i]->desktop >= Conf.desks.num)
MoveEwinToDesktop(lst[i], Conf.desks.num - 1);
}
if (Conf.desks.num > pnum)
{
for (i = pnum; i < Conf.desks.num; i++)
@ -1179,7 +1176,7 @@ DesktopAt(int x, int y)
static void
MoveStickyWindowsToCurrentDesk(void)
{
EWin **lst, *ewin, *last_ewin;
EWin *const *lst, *ewin, *last_ewin;
int i, num;
lst = EwinListGetStacking(&num);
@ -1322,7 +1319,7 @@ void
MoveDesktop(int desk, int x, int y)
{
int i;
EWin **lst;
EWin *const *lst;
int n, v, dx, dy;
EDBUG(3, "MoveDesktop");
@ -1414,16 +1411,12 @@ MoveDesktop(int desk, int x, int y)
desks.desk[desk].x = x;
desks.desk[desk].y = y;
lst = (EWin **) ListItemType(&n, LIST_TYPE_EWIN);
if (lst)
{
for (i = 0; i < n; i++)
if (lst[i]->desktop == desk)
ICCCM_Configure(lst[i]);
Efree(lst);
}
EDBUG_RETURN_;
lst = EwinListGet(&n);
for (i = 0; i < n; i++)
if (lst[i]->desktop == desk)
ICCCM_Configure(lst[i]);
EDBUG_RETURN_;
}
void
@ -1464,7 +1457,6 @@ RaiseDesktop(int desk)
XSync(disp, False);
EDBUG_RETURN_;
}
void
@ -1494,7 +1486,6 @@ LowerDesktop(int desk)
XSync(disp, False);
EDBUG_RETURN_;
}
void
@ -1513,7 +1504,6 @@ HideDesktop(int desk)
EMoveWindow(disp, desks.desk[desk].win, root.w, 0);
EDBUG_RETURN_;
}
void
@ -1566,7 +1556,7 @@ StackDesktop(int desk)
{
Window *wl, *wl2;
int i, wnum, tot, bnum;
EWin **lst, *ewin;
EWin *const *lst, *ewin;
Button **blst;
EDBUG(2, "StackDesktop");

View File

@ -386,7 +386,7 @@ EWMH_SetClientList(void)
}
/* Stacking order */
lst = EwinListGetStacking(&num);
lst = (EWin **) EwinListGetStacking(&num);
/* FIXME: num must be unchanged here! Check! */
if (num != nwin)
printf("*** ERROR: %s %d\n", __FILE__, __LINE__);

View File

@ -25,57 +25,43 @@
EWin *
FindEwinByBase(Window win)
{
EWin **ewins;
EWin *ewin;
EWin *const *ewins;
int i, num;
EDBUG(6, "FindEwinByBase");
ewins = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
ewins = EwinListGet(&num);
for (i = 0; i < num; i++)
{
if (win == ewins[i]->win)
{
ewin = ewins[i];
Efree(ewins);
EDBUG_RETURN(ewin);
}
return ewins[i];
}
if (ewins)
Efree(ewins);
EDBUG_RETURN(NULL);
}
EWin *
FindEwinByChildren(Window win)
{
EWin *ewin;
EWin **ewins;
EWin *const *ewins;
int i, j, num;
EDBUG(6, "FindEwinByChildren");
ewins = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
ewins = EwinListGet(&num);
for (i = 0; i < num; i++)
{
if ((win == ewins[i]->client.win) || (win == ewins[i]->win_container))
{
ewin = ewins[i];
Efree(ewins);
EDBUG_RETURN(ewin);
return ewins[i];
}
else
{
for (j = 0; j < ewins[i]->border->num_winparts; j++)
if (win == ewins[i]->bits[j].win)
{
ewin = ewins[i];
Efree(ewins);
EDBUG_RETURN(ewin);
return ewins[i];
}
}
}
if (ewins)
Efree(ewins);
EDBUG_RETURN(NULL);
}
@ -83,7 +69,7 @@ EWin *
FindEwinByPartial(const char *match, int type)
{
EWin *ewin = NULL;
EWin **ewins;
EWin *const *ewins;
int i, num, len;
char ewinid[FILEPATH_LEN_MAX];
@ -93,7 +79,7 @@ FindEwinByPartial(const char *match, int type)
if (len <= 0)
goto done;
ewins = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
ewins = EwinListGet(&num);
if (ewins == NULL)
goto done;
@ -118,7 +104,6 @@ FindEwinByPartial(const char *match, int type)
ewin = ewins[i];
break;
}
Efree(ewins);
done:
EDBUG_RETURN(ewin);
@ -127,27 +112,21 @@ FindEwinByPartial(const char *match, int type)
EWin *
FindEwinByDecoration(Window win)
{
EWin *ewin;
EWin **ewins;
EWin *const *ewins;
int i, j, num;
EDBUG(6, "FindEwinByDecoration");
ewins = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
ewins = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (j = 0; j < ewins[i]->border->num_winparts; j++)
{
if (win == ewins[i]->bits[j].win)
{
ewin = ewins[i];
Efree(ewins);
EDBUG_RETURN(ewin);
}
return ewins[i];
}
}
if (ewins)
Efree(ewins);
EDBUG_RETURN(NULL);
}
@ -190,24 +169,19 @@ FindActionClass(Window win)
EWin *
FindEwinByMenu(Menu * m)
{
EWin *ewin = NULL;
EWin **ewins;
EWin *const *ewins;
int i, num;
EDBUG(6, "FindEwinByMenu");
ewins = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
ewins = EwinListGet(&num);
for (i = 0; i < num; i++)
{
if (ewins[i]->menu != m)
continue;
ewin = ewins[i];
break;
if (ewins[i]->menu == m)
return ewins[i];
}
if (ewins)
Efree(ewins);
EDBUG_RETURN(ewin);
EDBUG_RETURN(NULL);
}
Group **
@ -366,12 +340,12 @@ ListWinGroupMembersForEwin(EWin * ewin, int action, char nogroup, int *num)
EWin **
ListTransientsFor(Window win, int *num)
{
EWin **ewins, **lst = NULL;
EWin *const *ewins, **lst = NULL;
int i, j, n;
EDBUG(6, "ListTransientsFor");
ewins = (EWin **) ListItemType(&n, LIST_TYPE_EWIN);
ewins = EwinListGet(&n);
j = 0;
for (i = 0; i < n; i++)
{
@ -382,8 +356,6 @@ ListTransientsFor(Window win, int *num)
lst[j - 1] = ewins[i];
}
}
if (ewins)
Efree(ewins);
*num = j;
EDBUG_RETURN(lst);
}
@ -391,12 +363,12 @@ ListTransientsFor(Window win, int *num)
EWin **
ListGroupMembers(Window win, int *num)
{
EWin **ewins, **lst = NULL;
EWin *const *ewins, **lst = NULL;
int i, j, n;
EDBUG(6, "ListGroupMembers");
ewins = (EWin **) ListItemType(&n, LIST_TYPE_EWIN);
ewins = EwinListGet(&n);
j = 0;
for (i = 0; i < n; i++)
{
@ -407,8 +379,6 @@ ListGroupMembers(Window win, int *num)
lst[j - 1] = ewins[i];
}
}
if (ewins)
Efree(ewins);
*num = j;
EDBUG_RETURN(lst);
}
@ -416,40 +386,35 @@ ListGroupMembers(Window win, int *num)
EWin *
FindEwinByDialog(Dialog * d)
{
EWin *ewin;
EWin **ewins;
EWin *const *ewins;
int i, num;
EDBUG(6, "FindEwinByDialog");
ewins = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
ewins = EwinListGet(&num);
for (i = 0; i < num; i++)
{
if (ewins[i]->dialog == d)
{
ewin = ewins[i];
Efree(ewins);
EDBUG_RETURN(ewin);
}
return ewins[i];
}
if (ewins)
Efree(ewins);
EDBUG_RETURN(NULL);
}
int
FindADialog(void)
{
EWin **ewins;
EWin *const *ewins;
int i, num, n;
EDBUG(6, "FindADialog");
ewins = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
ewins = EwinListGet(&num);
for (i = n = 0; i < num; i++)
{
if (ewins[i]->dialog)
n++;
}
if (ewins)
Efree(ewins);
EDBUG_RETURN(n);
}

View File

@ -183,23 +183,18 @@ FocusEwinSetGrabs(EWin * ewin)
void
FocusFix(void)
{
EWin **lst, *ewin;
EWin *const *lst, *ewin;
int i, num;
EDBUG(5, "FocusFix");
num = 0;
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst == NULL)
EDBUG_RETURN_;
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
ewin = lst[i];
XUngrabButton(disp, AnyButton, AnyModifier, ewin->win_container);
FocusEwinSetGrabs(ewin);
}
Efree(lst);
EDBUG_RETURN_;
}
@ -329,7 +324,7 @@ FocusToEWin(EWin * ewin, int why)
void
FocusNewDeskBegin(void)
{
EWin *ewin, **lst;
EWin *const *lst, *ewin;
int i, j, num;
if (new_desk_focus_nesting++)
@ -340,51 +335,47 @@ FocusNewDeskBegin(void)
/* we are about to flip desktops or areas - disable enter and leave events
* temporarily */
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
ewin = lst[i];
XSelectInput(disp, ewin->win,
FocusChangeMask | SubstructureNotifyMask |
SubstructureRedirectMask | PropertyChangeMask |
ResizeRedirectMask);
if (ewin->pager)
{
ewin = lst[i];
XSelectInput(disp, ewin->win,
FocusChangeMask | SubstructureNotifyMask |
SubstructureRedirectMask | PropertyChangeMask |
ResizeRedirectMask);
if (ewin->pager)
{
#if 0 /* ??? */
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask | ButtonPressMask |
ButtonReleaseMask | PointerMotionMask);
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask | ButtonPressMask |
ButtonReleaseMask | PointerMotionMask);
#endif
}
else if (ewin->dialog)
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask | ExposureMask | KeyPressMask);
else
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask);
for (j = 0; j < ewin->border->num_winparts; j++)
{
if (ewin->border->part[j].flags & FLAG_TITLE)
XSelectInput(disp, ewin->bits[j].win,
ExposureMask | ButtonPressMask |
ButtonReleaseMask);
else
XSelectInput(disp, ewin->bits[j].win,
ButtonPressMask | ButtonReleaseMask);
}
}
Efree(lst);
else if (ewin->dialog)
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask | ExposureMask | KeyPressMask);
else
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask);
for (j = 0; j < ewin->border->num_winparts; j++)
{
if (ewin->border->part[j].flags & FLAG_TITLE)
XSelectInput(disp, ewin->bits[j].win,
ExposureMask | ButtonPressMask |
ButtonReleaseMask);
else
XSelectInput(disp, ewin->bits[j].win,
ButtonPressMask | ButtonReleaseMask);
}
}
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
@ -396,7 +387,7 @@ FocusNewDeskBegin(void)
void
FocusNewDesk(void)
{
EWin *ewin, **lst;
EWin *const *lst, *ewin;
int i, j, num;
EDBUG(4, "FocusNewDesk");
@ -405,60 +396,56 @@ FocusNewDesk(void)
return;
/* we flipped - re-enable enter and leave events */
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
ewin = lst[i];
XSelectInput(disp, ewin->win,
FocusChangeMask | SubstructureNotifyMask |
SubstructureRedirectMask | EnterWindowMask |
LeaveWindowMask | PointerMotionMask |
PropertyChangeMask | ResizeRedirectMask |
ButtonPressMask | ButtonReleaseMask);
if (ewin->pager)
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | EnterWindowMask |
LeaveWindowMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask | ButtonPressMask |
ButtonReleaseMask | PointerMotionMask);
else if (ewin->dialog)
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | EnterWindowMask |
LeaveWindowMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask | ExposureMask | KeyPressMask);
else
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | EnterWindowMask |
LeaveWindowMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask);
for (j = 0; j < ewin->border->num_winparts; j++)
{
ewin = lst[i];
XSelectInput(disp, ewin->win,
FocusChangeMask | SubstructureNotifyMask |
SubstructureRedirectMask | EnterWindowMask |
LeaveWindowMask | PointerMotionMask |
PropertyChangeMask | ResizeRedirectMask |
ButtonPressMask | ButtonReleaseMask);
if (ewin->pager)
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | EnterWindowMask |
LeaveWindowMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask | ButtonPressMask |
ButtonReleaseMask | PointerMotionMask);
else if (ewin->dialog)
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | EnterWindowMask |
LeaveWindowMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask | ExposureMask | KeyPressMask);
if (ewin->border->part[j].flags & FLAG_TITLE)
XSelectInput(disp, ewin->bits[j].win,
ExposureMask | KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask |
EnterWindowMask | LeaveWindowMask |
PointerMotionMask);
else
XSelectInput(disp, ewin->client.win,
PropertyChangeMask | EnterWindowMask |
LeaveWindowMask | FocusChangeMask |
ResizeRedirectMask | StructureNotifyMask |
ColormapChangeMask);
for (j = 0; j < ewin->border->num_winparts; j++)
{
if (ewin->border->part[j].flags & FLAG_TITLE)
XSelectInput(disp, ewin->bits[j].win,
ExposureMask | KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask |
EnterWindowMask | LeaveWindowMask |
PointerMotionMask);
else
XSelectInput(disp, ewin->bits[j].win,
KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask |
EnterWindowMask | LeaveWindowMask |
PointerMotionMask);
}
if (Mode.mode == MODE_DESKSWITCH && ewin->sticky && ewin->visible)
EwinRefresh(ewin);
XSelectInput(disp, ewin->bits[j].win,
KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask |
EnterWindowMask | LeaveWindowMask |
PointerMotionMask);
}
Efree(lst);
if (Mode.mode == MODE_DESKSWITCH && ewin->sticky && ewin->visible)
EwinRefresh(ewin);
}
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)

View File

@ -769,23 +769,20 @@ ICCCM_GetInfo(EWin * ewin, Atom atom_change)
}
else if (XGetCommand(disp, ewin->client.group, &cargv, &cargc))
{
EWin **lst;
EWin *const *lst;
int lnum, ok = 1;
lst = (EWin **) ListItemType(&lnum, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&lnum);
for (i = 0; i < lnum; i++)
{
for (i = 0; i < lnum; i++)
if ((lst[i] != ewin)
&& (lst[i]->client.group == ewin->client.group))
{
if ((lst[i] != ewin)
&& (lst[i]->client.group == ewin->client.group))
{
ok = 0;
i = lnum;
}
ok = 0;
i = lnum;
}
Efree(lst);
}
if (cargc > 0)
{
if (ok)

View File

@ -2255,7 +2255,7 @@ IB_CompleteRedraw(Iconbox * ib)
void
IB_Setup(void)
{
EWin **lst;
EWin *const *lst;
int i, num;
Iconbox **ibl;
@ -2267,15 +2267,11 @@ IB_Setup(void)
IconboxShow(ibl[i]);
Efree(ibl);
}
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
{
if (lst[i]->client.start_iconified)
IconifyEwin(lst[i]);
}
Efree(lst);
if (lst[i]->client.start_iconified)
IconifyEwin(lst[i]);
}
}

View File

@ -2584,10 +2584,10 @@ IPC_InternalList(const char *params, Client * c)
if (params)
{
EWin **lst;
EWin *const *lst;
int num, i;
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
lst = EwinListGet(&num);
if (!strcmp(params, "pagers"))
{
for (i = 0; i < num; i++)
@ -2641,9 +2641,6 @@ IPC_InternalList(const char *params, Client * c)
Esnprintf(buf, sizeof(buf),
"Error: unknown internal list specified");
}
if (lst)
Efree(lst);
}
if (buf[0])
CommsSend(c, buf);
@ -3469,11 +3466,11 @@ IPC_WinList(const char *params, Client * c)
{
char *ret = NULL;
char buf[FILEPATH_LEN_MAX];
EWin **lst, *e;
EWin *const *lst, *e;
int num, i;
char none[] = "-NONE-";
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
lst = EwinListGet(&num);
if (lst)
{
for (i = 0; i < num; i++)
@ -3515,9 +3512,6 @@ IPC_WinList(const char *params, Client * c)
{
CommsSend(c, "");
}
if (lst)
Efree(lst);
}
static void

View File

@ -88,21 +88,17 @@ EWin *
FindEwinSpawningMenu(Menu * m)
{
EWin *ewin = NULL;
EWin **ewins;
EWin *const *ewins;
int i, num;
EDBUG(6, "FindEwinSpawningMenu");
ewins = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
ewins = EwinListGet(&num);
for (i = 0; i < num; i++)
{
if (ewins[i]->shownmenu != m->win)
continue;
ewin = ewins[i];
break;
if (ewins[i]->shownmenu == m->win)
return ewins[i];
}
if (ewins)
Efree(ewins);
EDBUG_RETURN(ewin);
}
@ -1762,7 +1758,7 @@ Menu *
MenuCreateFromAllEWins(const char *name, MenuStyle * ms)
{
Menu *m;
EWin **lst;
EWin *const *lst;
int i, num;
char s[256];
@ -1772,22 +1768,19 @@ MenuCreateFromAllEWins(const char *name, MenuStyle * ms)
m = MenuCreate(name);
m->style = ms;
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
if ((!lst[i]->menu) && (!lst[i]->pager) && (!lst[i]->skipwinlist)
&& (EwinGetTitle(lst[i])) && (!lst[i]->ibox))
{
if ((!lst[i]->menu) && (!lst[i]->pager) && (!lst[i]->skipwinlist)
&& (EwinGetTitle(lst[i])) && (!lst[i]->ibox))
{
Esnprintf(s, sizeof(s), "%i", (int)(lst[i]->client.win));
mi = MenuItemCreate(EwinGetTitle(lst[i]), NULL,
ACTION_FOCUS_SET, s, NULL);
MenuAddItem(m, mi);
}
Esnprintf(s, sizeof(s), "%i", (int)(lst[i]->client.win));
mi = MenuItemCreate(EwinGetTitle(lst[i]), NULL,
ACTION_FOCUS_SET, s, NULL);
MenuAddItem(m, mi);
}
Efree(lst);
}
EDBUG_RETURN(m);
}
@ -1796,7 +1789,7 @@ static Menu *
MenuCreateFromDesktopEWins(char *name, MenuStyle * ms, int desk)
{
Menu *m;
EWin **lst;
EWin *const *lst;
int i, num;
char s[256];
@ -1806,24 +1799,21 @@ MenuCreateFromDesktopEWins(char *name, MenuStyle * ms, int desk)
m = MenuCreate(name);
m->style = ms;
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
if (((lst[i]->desktop == desk) || (lst[i]->sticky))
&& (!lst[i]->menu) && (!lst[i]->pager)
&& (!lst[i]->skipwinlist) && (lst[i]->client.title)
&& (!lst[i]->ibox))
{
if (((lst[i]->desktop == desk) || (lst[i]->sticky))
&& (!lst[i]->menu) && (!lst[i]->pager)
&& (!lst[i]->skipwinlist) && (lst[i]->client.title)
&& (!lst[i]->ibox))
{
Esnprintf(s, sizeof(s), "%i", (int)(lst[i]->client.win));
mi = MenuItemCreate(lst[i]->client.title, NULL,
ACTION_FOCUS_SET, s, NULL);
MenuAddItem(m, mi);
}
Esnprintf(s, sizeof(s), "%i", (int)(lst[i]->client.win));
mi = MenuItemCreate(lst[i]->client.title, NULL,
ACTION_FOCUS_SET, s, NULL);
MenuAddItem(m, mi);
}
Efree(lst);
}
EDBUG_RETURN(m);
desk = 0;
}
@ -1833,16 +1823,16 @@ Menu *
MenuCreateFromDesktops(const char *name, MenuStyle * ms)
{
Menu *m, *mm;
EWin **lst;
EWin *const *lst;
int j, i, num;
char s[256];
MenuItem *mi;
EDBUG(5, "MenuCreateFromDesktops");
m = MenuCreate(name);
m->style = ms;
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
lst = EwinListGet(&num);
for (j = 0; j < Conf.desks.num; j++)
{
mm = MenuCreate("__SUBMENUDESK_E");
@ -1868,8 +1858,7 @@ MenuCreateFromDesktops(const char *name, MenuStyle * ms)
mi = MenuItemCreate(s, NULL, 0, NULL, mm);
MenuAddItem(m, mi);
}
if (lst)
Efree(lst);
EDBUG_RETURN(m);
}

View File

@ -105,11 +105,12 @@ PagerUpdateTimeout(int val, void *data)
if (p->update_phase >= p->h)
{
int i, num;
EWin **lst;
EWin *const *lst;
lst = EwinListGetForDesktop(p->desktop, &num);
for (i = 0; i < num; i++)
PagerEwinUpdateFromPager(p, lst[i]);
p->update_phase = 0;
}
return;
@ -228,7 +229,7 @@ PagerMoveResize(EWin * ewin, int resize)
int ax, ay, cx, cy;
char pq;
ImageClass *ic;
EWin **lst;
EWin *const *lst;
int i, num;
if (!Conf.pagers.enable || !p)
@ -587,7 +588,7 @@ PagerRedraw(Pager * p, char newbg)
int x, y, ax, ay, cx, cy;
GC gc;
XGCValues gcv;
EWin **lst;
EWin *const *lst;
int i, num;
if (!Conf.pagers.enable || Mode.mode == MODE_DESKSWITCH)
@ -756,7 +757,7 @@ void
PagerForceUpdate(Pager * p)
{
int ww, hh, xx, yy, ax, ay, cx, cy;
EWin **lst;
EWin *const *lst;
int i, num;
if (!Conf.pagers.enable || Mode.mode == MODE_DESKSWITCH)
@ -879,7 +880,7 @@ static EWin *
EwinInPagerAt(Pager * p, int x, int y)
{
int wx, wy, ww, wh, ax, ay, cx, cy;
EWin **lst;
EWin *const *lst;
int i, num;
if (!Conf.pagers.enable)
@ -1486,20 +1487,16 @@ void
PagerSetHiQ(char onoff)
{
Pager **pl;
EWin **lst;
EWin *const *lst;
int i, num;
HIQ = onoff;
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
{
lst[i]->mini_w = 0;
lst[i]->mini_h = 0;
}
Efree(lst);
lst[i]->mini_w = 0;
lst[i]->mini_h = 0;
}
pl = (Pager **) ListItemType(&num, LIST_TYPE_PAGER);
@ -1519,22 +1516,19 @@ void
PagerSetSnap(char onoff)
{
Pager **pl;
EWin **lst;
EWin *const *lst;
int i, num;
char s[256];
Conf.pagers.snap = onoff;
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
lst = EwinListGet(&num);
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
{
lst[i]->mini_w = 0;
lst[i]->mini_h = 0;
}
Efree(lst);
lst[i]->mini_w = 0;
lst[i]->mini_h = 0;
}
pl = (Pager **) ListItemType(&num, LIST_TYPE_PAGER);
if (pl)
{

View File

@ -207,12 +207,12 @@ GetGenericSMFile(void)
static void
SaveWindowStates(void)
{
EWin **lst, *ewin;
EWin *const *lst, *ewin;
int i, num, x, y;
FILE *f;
char s[4096], ss[4096];
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
lst = EwinListGet(&num);
if (lst)
{
Etmp(s);
@ -262,7 +262,6 @@ SaveWindowStates(void)
"to write to your filing system "
"or other similar problems.\n"));
}
Efree(lst);
}
}

View File

@ -4631,7 +4631,7 @@ SettingsRemember()
{
Dialog *d;
DItem *table, *di;
EWin **lst, *ewin;
EWin *const *lst, *ewin;
int i, ri, num;
/* init remember window */
@ -4672,7 +4672,7 @@ SettingsRemember()
/* there's a much more efficient way of doing this, but this will work
* for now */
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
lst = EwinListGet(&num);
rd_ewin_list = Emalloc(sizeof(RememberWinList *) * (num + 1));
ri = 0;
if ((lst) && (num > 0))
@ -4723,8 +4723,6 @@ SettingsRemember()
}
}
}
if (lst)
Efree(lst);
rd_ewin_list[ri] = 0;
/* finish remember window */

View File

@ -35,7 +35,7 @@ static void
MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
{
int x, y, w, h, x1, x2, y1, y2, type;
EWin **lst, *pe;
EWin *const *lst, *pe;
int i, num;
if (!ewin)
@ -102,7 +102,7 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
}
else
{
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
lst = EwinListGet(&num);
}
if (direction & MAX_VER)
@ -155,8 +155,6 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
ewin->border->border.right);
}
if (lst)
Efree(lst);
break;
}

View File

@ -181,14 +181,14 @@ EwinListRaise(EWinList * ewl, EWin * ewin, int mode)
EWinList EwinListFocus = { "Focus", 0, 0, NULL };
EWinList EwinListStack = { "Stack", 0, 0, NULL };
EWin **
EWin *const *
EwinListGetStacking(int *num)
{
*num = EwinListStack.nwins;
return EwinListStack.list;
}
EWin **
EWin *const *
EwinListGetForDesktop(int desk, int *num)
{
static EWin **lst = NULL;
@ -200,7 +200,7 @@ EwinListGetForDesktop(int desk, int *num)
nwins = EwinListStack.nwins;
if (nalloc < nwins)
{
nalloc = nwins;
nalloc += 16;
lst = Erealloc(lst, nalloc * sizeof(EWin *));
}