]> icculus.org git repositories - dana/openbox.git/blob - openbox/action_filter.h
wip: Add config_parser.c which will provide a nice means to specify config variables...
[dana/openbox.git] / openbox / action_filter.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    action_filter.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 _ObActionListRun;
22 struct _ObConfigValue;
23 struct _ObClient;
24 struct _ObClientSet;
25
26 typedef struct _ObActionFilter ObActionFilter;
27 typedef struct _ObActionFilterFuncs ObActionFilterFuncs;
28 typedef enum _ObActionFilterDefault ObActionFilterDefault;
29
30 typedef gpointer (*ObActionFilterSetupFunc)(gboolean invert,
31                                             struct _ObConfigValue *v);
32 typedef void (*ObActionFilterDestroyFunc)(gpointer data);
33 typedef struct _ObClientSet* (*ObActionFilterFunc)(
34     gboolean invert, const struct _ObActionListRun *run, gpointer data);
35
36 void action_filter_startup(gboolean reconfig);
37 void action_filter_shutdown(gboolean reconfig);
38
39 /*! Registers a filter test in the system.
40   @name The name of the key for the filter. [foo] or [foo=bar] would register
41     "foo" as its name.
42   @setup A setup function which takes the parameter given to the filter.
43     This would receive the bar in [foo=bar].  This returns a pointer to data
44     used by the filter.
45   @destroy Destroys the data returned from @setup.
46   @filter A function that returns an ObClientSet* of clients that this filter
47     includes.
48   @return TRUE if the registration was successful.
49 */
50 gboolean action_filter_register(const gchar *name,
51                                 ObActionFilterSetupFunc setup,
52                                 ObActionFilterDestroyFunc destroy,
53                                 ObActionFilterFunc set);
54
55 ObActionFilter* action_filter_new(const gchar *key, struct _ObConfigValue *v);
56 void action_filter_ref(ObActionFilter *f);
57 void action_filter_unref(ObActionFilter *f);
58
59 /*! Returns a set of clients for a filter.
60   @f The filter.
61   @run Data for the user event which caused this filter to be run.
62 */
63 struct _ObClientSet* action_filter_set(ObActionFilter *f,
64                                        const struct _ObActionListRun *run);