From b5f4560c6512b3a63b2ac6935008adbb9cc86891 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 31 Oct 2008 23:37:30 +0100 Subject: [PATCH] Add GroupMembers action. Similar to AllClients, but acts on all members of the group the current action target is a member of. --- openbox/actions/allclients.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/openbox/actions/allclients.c b/openbox/actions/allclients.c index 12905799..c468b91a 100644 --- a/openbox/actions/allclients.c +++ b/openbox/actions/allclients.c @@ -1,14 +1,17 @@ #include "openbox/actions.h" #include "openbox/event.h" #include "openbox/client.h" +#include "openbox/group.h" static gpointer setup_func(xmlNodePtr node); static void free_func(gpointer acts); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func_all(ObActionsData *data, gpointer options); +static gboolean run_func_group(ObActionsData *data, gpointer options); void action_allclients_startup(void) { - actions_register("AllClients", setup_func, free_func, run_func, NULL, NULL); + actions_register("AllClients", setup_func, free_func, run_func_all, NULL, NULL); + actions_register("GroupMembers", setup_func, free_func, run_func_group, NULL, NULL); } static gpointer setup_func(xmlNodePtr node) @@ -37,7 +40,7 @@ static void free_func(gpointer acts) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer acts) +static gboolean run_func_all(ObActionsData *data, gpointer acts) { GList *it; GSList *a = acts; @@ -53,3 +56,20 @@ static gboolean run_func(ObActionsData *data, gpointer acts) return FALSE; } + +static gboolean run_func_group(ObActionsData *data, gpointer acts) +{ + GSList *it, *a = acts; + ObClient *c = data->client; + + if (a && c) + for (it = c->group->members; it; it = g_slist_next(it)) { + ObClient *member = it->data; + if (actions_run_acts(a, data->uact, data->state, + data->x, data->y, data->button, + data->context, member)) + return TRUE; + } + + return FALSE; +} -- 2.34.1