Introduce EwinFindGroupMember()

This commit is contained in:
Kim Woelders 2019-03-03 19:22:53 +01:00
parent 84788b993c
commit 6dab84f6c6
3 changed files with 30 additions and 19 deletions

View File

@ -857,24 +857,8 @@ AddToFamily(EWin * ewin, EX_Window xwin, XWindowAttributes * pxwa, int startup)
if (ewin->icccm.transient && Conf.focus.transientsfollowleader)
{
EWin *const *lst2;
if (!ewin2)
ewin2 = EwinFindByClient(ewin->icccm.group);
if (!ewin2)
{
lst2 = EwinListGetAll(&num);
for (i = 0; i < num; i++)
{
if ((lst2[i]->state.iconified) ||
(ewin->icccm.group != lst2[i]->icccm.group))
continue;
ewin2 = lst2[i];
break;
}
}
ewin2 = EwinFindGroupMember(ewin);
if (ewin2)
{

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2014 Kim Woelders
* Copyright (C) 2004-2019 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
@ -459,6 +459,7 @@ void EwinOpFullscreen(EWin * ewin, int source, int on);
/* finders.c */
EWin *EwinFindByPtr(const EWin * ewin);
EWin *EwinFindByClient(EX_Window win);
EWin *EwinFindGroupMember(EWin * ewin);
EWin **EwinsFindByExpr(const char *match, int *pnum, int *pflags);
EWin *EwinFindByExpr(const char *match);

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2008-2015 Kim Woelders
* Copyright (C) 2008-2019 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
@ -61,6 +61,32 @@ EwinFindByClient(EX_Window win)
return NULL;
}
EWin *
EwinFindGroupMember(EWin * ewin)
{
EWin *ewin2;
EWin *const *ewins;
int i, num;
ewin2 = EwinFindByClient(ewin->icccm.group);
if (ewin2 && ewin2 != ewin)
return ewin2;
ewins = EwinListGetAll(&num);
for (i = 0; i < num; i++)
{
ewin2 = ewins[i];
if (ewin2 == ewin)
continue;
if (ewin2->state.iconified)
continue;
if (ewin2->icccm.group == ewin->icccm.group)
return ewin2;
}
return NULL;
}
EWin **
EwinsFindByExpr(const char *match, int *pnum, int *pflags)
{