dont build the old action stuff.
[dana/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 #include "misc.h"
20 #include "frame.h"
21 #include "parser/parse.h"
22 #include <glib.h>
23
24 typedef struct _ObActionsDefinition   ObActionsDefinition;
25 typedef struct _ObActionsAct          ObActionsAct;
26 typedef struct _ObActionsData         ObActionsData;
27 typedef struct _ObActionsAnyData      ObActionsAnyData;
28 typedef struct _ObActionsGlobalData   ObActionsGlobalData;
29 typedef struct _ObActionsClientData   ObActionsClientData;
30 typedef struct _ObActionsSelectorData ObActionsSelectorData;
31
32 typedef enum {
33     OB_ACTION_DONE,
34     OB_ACTION_CANCELLED,
35     OB_ACTION_INTERACTING,
36     OB_NUM_ACTIONS_INTERACTIVE_STATES
37 } ObActionsInteractiveState;
38
39 typedef gpointer (*ObActionsDataSetupFunc)(ObParseInst *i,
40                                            xmlDocPtr doc, xmlNodePtr node);
41 typedef void     (*ObActionsDataFreeFunc)(gpointer options);
42 typedef void     (*ObActionsRunFunc)(ObActionsData *data,
43                                      gpointer options);
44
45 /*
46   The theory goes:
47
48   06:10 (@dana) hm i think there are 3 types of actions
49   06:10 (@dana) global actions, window actions, and selector actions
50   06:11 (@dana) eg show menu/exit, raise/focus, and cycling/directional/expose
51 */
52
53 typedef enum {
54     OB_ACTION_TYPE_GLOBAL,
55     OB_ACTION_TYPE_CLIENT,
56     OB_ACTION_TYPE_SELECTOR
57 } ObActionsType;
58
59 struct _ObActionsAnyData {
60     ObUserAction uact;
61     gint x;
62     gint y;
63     gint button;
64     Time time;
65
66     ObActionsInteractiveState interactive;
67 };
68
69 struct _ObActionsGlobalData {
70     ObActionsAnyData any;
71 };
72
73 struct _ObActionsClientData {
74     ObActionsAnyData any;
75
76     struct _ObClient *c;
77     ObFrameContext context;
78 };
79
80 struct _ObActionsSelectorData {
81     ObActionsAnyData any;
82
83     GSList *actions;
84 };
85
86 struct _ObActionsData {
87     ObActionsType type;
88
89     union {
90         ObActionsAnyData      any;
91         ObActionsGlobalData   global;
92         ObActionsClientData   client;
93         ObActionsSelectorData selector;
94     };
95 };
96
97 void actions_startup(gboolean reconfigure);
98 void actions_shutdown(gboolean reconfigure);
99
100 gboolean actions_register(const gchar *name,
101                           gboolean allow_interactive,
102                           ObActionsDataSetupFunc setup,
103                           ObActionsDataFreeFunc free,
104                           ObActionsRunFunc run);
105
106 ObActionsAct* actions_parse(ObParseInst *i,
107                             xmlDocPtr doc,
108                             xmlNodePtr node);
109 ObActionsAct* actions_parse_string(const gchar *name);
110
111 void actions_act_ref(ObActionsAct *act);
112 void actions_act_unref(ObActionsAct *act);