]> Dogcows Code - chaz/openbox/blob - openbox/actions.h
Fix small leak in If action option parsing
[chaz/openbox] / 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 "obt/xml.h"
22 #include "obt/keyboard.h"
23
24 #include <glib.h>
25 #include <X11/Xlib.h>
26
27 typedef struct _ObActionsDefinition ObActionsDefinition;
28 typedef struct _ObActionsAct ObActionsAct;
29 typedef struct _ObActionsData ObActionsData;
30 typedef struct _ObActionsAnyData ObActionsAnyData;
31 typedef struct _ObActionsGlobalData ObActionsGlobalData;
32 typedef struct _ObActionsClientData ObActionsClientData;
33 typedef struct _ObActionsSelectorData ObActionsSelectorData;
34
35 typedef void (*ObActionsDataFreeFunc)(gpointer options);
36 typedef gboolean (*ObActionsRunFunc)(ObActionsData *data,
37 gpointer options);
38 typedef gpointer (*ObActionsDataSetupFunc)(xmlNodePtr node);
39 typedef void (*ObActionsShutdownFunc)(void);
40
41 /* functions for interactive actions */
42 /* return TRUE if the action is going to be interactive, or false to change
43 your mind and make it not */
44 typedef gboolean (*ObActionsIPreFunc)(guint initial_state, gpointer options);
45 typedef void (*ObActionsIPostFunc)(gpointer options);
46 typedef gboolean (*ObActionsIInputFunc)(guint initial_state,
47 XEvent *e,
48 ObtIC *ic,
49 gpointer options,
50 gboolean *used);
51 typedef void (*ObActionsICancelFunc)(gpointer options);
52 typedef gpointer (*ObActionsIDataSetupFunc)(xmlNodePtr node,
53 ObActionsIPreFunc *pre,
54 ObActionsIInputFunc *input,
55 ObActionsICancelFunc *cancel,
56 ObActionsIPostFunc *post);
57
58 struct _ObActionsData {
59 ObUserAction uact;
60 guint state;
61 gint x;
62 gint y;
63 gint button;
64
65 struct _ObClient *client;
66 ObFrameContext context;
67 };
68
69 void actions_startup(gboolean reconfigure);
70 void actions_shutdown(gboolean reconfigure);
71
72 /*! Use this if the actions created from this name may be interactive */
73 gboolean actions_register_i(const gchar *name,
74 ObActionsIDataSetupFunc setup,
75 ObActionsDataFreeFunc free,
76 ObActionsRunFunc run);
77
78 gboolean actions_register(const gchar *name,
79 ObActionsDataSetupFunc setup,
80 ObActionsDataFreeFunc free,
81 ObActionsRunFunc run);
82
83 gboolean actions_set_shutdown(const gchar *name,
84 ObActionsShutdownFunc shutdown);
85
86 ObActionsAct* actions_parse(xmlNodePtr node);
87 ObActionsAct* actions_parse_string(const gchar *name);
88
89 gboolean actions_act_is_interactive(ObActionsAct *act);
90
91 void actions_act_ref(ObActionsAct *act);
92 void actions_act_unref(ObActionsAct *act);
93
94 /*! When this is true, an XAllowEvents with ReplayPointer will be called
95 if an action is going to maybe try moving windows around on screen (or
96 map/unmap windows)
97 */
98 void actions_set_need_pointer_replay_before_move(gboolean replay);
99 /*! Returns if a ReplayPointer is still needed. If it was called while running
100 actions then this will be false */
101 gboolean actions_get_need_pointer_replay_before_move(void);
102
103 /*! Pass in a GSList of ObActionsAct's to be run. */
104 void actions_run_acts(GSList *acts,
105 ObUserAction uact,
106 guint state,
107 gint x,
108 gint y,
109 gint button,
110 ObFrameContext con,
111 struct _ObClient *client);
112
113 gboolean actions_interactive_act_running(void);
114 void actions_interactive_cancel_act(void);
115
116 gboolean actions_interactive_input_event(XEvent *e);
117
118 /*! Function for actions to call when they are moving a client around */
119 void actions_client_move(ObActionsData *data, gboolean start);
This page took 0.037611 seconds and 4 git commands to generate.