]> icculus.org git repositories - dana/openbox.git/blob - openbox/client_set.h
wip: Add config_parser.c which will provide a nice means to specify config variables...
[dana/openbox.git] / openbox / client_set.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    client_set.h for the Openbox window manager
4    Copyright (c) 2011        Dana Jansens
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #include <glib.h>
20
21 struct _ObClient;
22 struct _ObActionListRun;
23
24 typedef struct _ObClientSet ObClientSet;
25
26 typedef gboolean (*ObClientSetReduceFunc)(struct _ObClient *c, gpointer data);
27 typedef gboolean (*ObClientSetExpandFunc)(struct _ObClient *c, gpointer data);
28 typedef gboolean (*ObClientSetForeachFunc)(struct _ObClient *c, gpointer data);
29 typedef gboolean (*ObClientSetRunFunc)(struct _ObClient *c,
30                                        const struct _ObActionListRun *run,
31                                        gpointer data);
32
33 /*! Returns a new set of clients without anything in it. */
34 ObClientSet* client_set_empty(void);
35 /*! Returns a new set of clients with a single client in it. */
36 ObClientSet* client_set_single(struct _ObClient *c);
37 /*! Returns a new set of clients with all possible clients in it. */
38 ObClientSet* client_set_all(void);
39
40 /*! Returns an identical set to @a. */
41 ObClientSet* client_set_clone(const ObClientSet *a);
42
43 void client_set_destroy(ObClientSet *set);
44
45 /*! Returns a new set which contains all clients in either @a or @b.  The sets
46   @a and @b are considered freed once passed to this function.
47 */
48 ObClientSet* client_set_union(ObClientSet *a, ObClientSet *b);
49
50 /*! Returns a new set which contains all clients in both @a and @b.  The sets
51   @a and @b are considered freed once passed to this function.
52 */
53 ObClientSet* client_set_intersection(ObClientSet *a, ObClientSet *b);
54
55 /*! Returns a new set which contains all clients in @a but not in @b.  The sets
56   @a and @b are considered freed once passed to this function.
57 */
58 ObClientSet* client_set_minus(ObClientSet *a, ObClientSet *b);
59
60 /*! Reduce a set of clients.  The function @f is called for each client
61   currently in the set. For each client that it returns TRUE, the client will
62   be removed from the set. */
63 ObClientSet* client_set_reduce(ObClientSet *set, ObClientSetReduceFunc f,
64                                gpointer data);
65
66 /*! Expand a set of clients.  The function @f is called for each client
67   not currently in the set. For each client that it returns TRUE, the client
68   will be added to the set. */
69 ObClientSet* client_set_expand(ObClientSet *set, ObClientSetExpandFunc f,
70                                gpointer data);
71
72 /*! Returns TRUE if there is nothing in the set. */
73 gboolean client_set_is_empty(const ObClientSet *set);
74
75 /*! Returns TRUE if there is someting in the set, or if it is the special
76   "ALL" set, which contains all clients.  Even when there are no clients
77   present, this set returns TRUE. */
78 gboolean client_set_test_boolean(const ObClientSet *set);
79
80 /*! Returns TRUE if @set contains @c. */
81 gboolean client_set_contains(const ObClientSet *set, struct _ObClient *c);
82
83 /*! Runs the given funcion on each client in the @set, passing the given
84   @data to the function along with the client. */
85 void client_set_foreach(const ObClientSet *set, ObClientSetForeachFunc func,
86                         gpointer data);
87
88 /*! Runs the given funcion on each client in the @set, passing the given
89   @data to the function along with the client. */
90 void client_set_run(const ObClientSet *set, const struct _ObActionListRun *run,
91                     ObClientSetRunFunc func, gpointer data);
92
93 /*! Returns the size of the set.
94   In the special case where the set contains all windows, it returns
95   (unsigned)-1.  Otherwise it returns the number of windows in the set.
96 */
97 guint client_set_size(const ObClientSet *set);
98
99 /*! Returns a list of all clients in the set. */
100 GList *client_set_get_all(const ObClientSet *set);