]> icculus.org git repositories - dana/openbox.git/blob - openbox/actions.h
some first structural stuff for new actions
[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 _ObActionsAnyData      ObActionsAnyData;
26 typedef struct _ObActionsGlobalData   ObActionsGlobalData;
27 typedef struct _ObActionsClientData   ObActionsClientData;
28 typedef struct _ObActionsSelectorData ObActionsSelectorData;
29
30 typedef enum {
31     OB_ACTION_DONE,
32     OB_ACTION_CANCELLED,
33     OB_ACTION_INTERACTING,
34     OB_NUM_ACTIONS_INTERACTIVE_STATES
35 } ObActionsInteractiveState;
36
37 typedef gpointer (*ObActionsDataSetupFunc)();
38 typedef void     (*ObActionsDataParseFunc)(gpointer action_data,
39                                            ObParseInst *i,
40                                            xmlDocPtr doc, xmlNodePtr node);
41 typedef void     (*ObActionsDataFreeFunc)(gpointer action_data);
42 typedef void     (*ObActionsRunFunc)(ObActionsAnyData *data,
43                                      gpointer action_data);
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 struct _ObActionsAnyData {
54     ObUserAction uact;
55     gint x;
56     gint y;
57     gint button;
58     Time time;
59
60     ObActionsInteractiveState interactive;
61 };
62
63 struct _ObActionsGlobalData {
64     ObActionsAnyData any;
65 };
66
67 struct _ObActionsClientData {
68     ObActionsAnyData any;
69
70     struct _ObClient *c;
71     ObFrameContext context;
72 };
73
74 struct _ObActionsSelectorData {
75     ObActionsAnyData any;
76
77     GSList *actions;
78 };
79
80 void actions_startup(gboolean reconfigure);
81 void actions_shutdown(gboolean reconfigure);
82
83 gboolean actions_register(const gchar *name,
84                           gboolean interactive,
85                           ObActionsDataSetupFunc setup,
86                           ObActionsDataParseFunc parse,
87                           ObActionsDataFreeFunc free,
88                           ObActionsRunFunc run);