first draft of beginning of new action code
[mikachu/openbox.git] / openbox / actions.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    actions.h for the Openbox window manager
4    Copyright (c) 2007        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 typedef enum {
20     OB_ACTION_DONE,
21     OB_ACTION_CANCELLED,
22     OB_ACTION_INTERACTING,
23     OB_NUM_ACTIONS_INTERACTIVE_STATES
24 } ObActionsInteractiveState;
25
26 typedef gpointer (*ObActionsDataSetupFunc)();
27 typedef void     (*ObActionsDataParseFunc)(gpointer action_data,
28                                            ObParseInst *i,
29                                            xmlDocPtr doc, xmlNodePtr node);
30 typedef void     (*ObActionsDataFreeFunc)(gpointer action_data);
31 typedef void     (*ObActionsRunFunc)(ObActionsAnyData *data);
32
33 struct _ObActionsDefinition {
34     gchar *name;
35     gboolean interactive;
36
37     ObActionsDataSetupFunc setup;
38     ObActionsDataParseFunc parse;
39     ObActionsDataFreeFunc free;
40     ObActionsRunFunc run;
41 };
42
43 struct _ObActionsAnyData {
44     ObUserAction uact;
45     gint x;
46     gint y;
47     gint button;
48     Time time;
49
50     ObActionsInteractiveState interactive;
51
52     gpointer action_data;
53 };
54
55 struct _ObActionsGlobalData {
56     ObActionsData any;
57 };
58
59 struct _ObActionsClientData {
60     ObActionsData any;
61
62     struct _ObClient *c;
63     ObFrameContext context;
64 };
65
66 struct _ObActionsSelectorData {
67     ObActionsData any;
68
69     GSList *actions;
70 };
71
72 void actions_startup(gboolean reconfigure);
73 void actions_shutdown(gboolean reconfigure);
74
75 gboolean actions_register(const gchar *name,
76                           gboolean interactive,
77                           ObActionsDataSetupFunc setup,
78                           ObActionsDataParseFunc parse,
79                           ObActionsDataFreeFunc free,
80                           ObActionsRunFunc run);