1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 action_filter.h for the Openbox window manager
4 Copyright (c) 2011 Dana Jansens
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.
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.
16 See the COPYING file for a copy of the GNU General Public License.
21 struct _ObActionListRun;
22 struct _ObConfigValue;
26 typedef struct _ObActionFilter ObActionFilter;
27 typedef struct _ObActionFilterFuncs ObActionFilterFuncs;
28 typedef enum _ObActionFilterDefault ObActionFilterDefault;
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);
36 void action_filter_startup(gboolean reconfig);
37 void action_filter_shutdown(gboolean reconfig);
39 /*! Registers a filter test in the system.
40 @name The name of the key for the filter. [foo] or [foo=bar] would register
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
45 @destroy Destroys the data returned from @setup.
46 @filter A function that returns an ObClientSet* of clients that this filter
48 @return TRUE if the registration was successful.
50 gboolean action_filter_register(const gchar *name,
51 ObActionFilterSetupFunc setup,
52 ObActionFilterDestroyFunc destroy,
53 ObActionFilterFunc set);
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);
59 /*! Returns a set of clients for a filter.
61 @run Data for the user event which caused this filter to be run.
63 struct _ObClientSet* action_filter_set(ObActionFilter *f,
64 const struct _ObActionListRun *run);