1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 actions.h for the Openbox window manager
4 Copyright (c) 2007 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.
26 typedef struct _ObActionsDefinition ObActionsDefinition;
27 typedef struct _ObActionsAct ObActionsAct;
28 typedef struct _ObActionsData ObActionsData;
29 typedef struct _ObActionsAnyData ObActionsAnyData;
30 typedef struct _ObActionsGlobalData ObActionsGlobalData;
31 typedef struct _ObActionsClientData ObActionsClientData;
32 typedef struct _ObActionsSelectorData ObActionsSelectorData;
34 typedef void (*ObActionsDataFreeFunc)(gpointer options);
35 typedef gboolean (*ObActionsRunFunc)(ObActionsData *data,
37 typedef gpointer (*ObActionsDataSetupFunc)(xmlNodePtr node);
39 /* functions for interactive actions */
40 /* return TRUE if the action is going to be interactive, or false to change
41 your mind and make it not */
42 typedef gboolean (*ObActionsIPreFunc)(guint initial_state, gpointer options);
43 typedef void (*ObActionsIPostFunc)(gpointer options);
44 typedef gboolean (*ObActionsIInputFunc)(guint initial_state,
48 typedef void (*ObActionsICancelFunc)(gpointer options);
49 typedef gpointer (*ObActionsIDataSetupFunc)(xmlNodePtr node,
50 ObActionsIPreFunc *pre,
51 ObActionsIInputFunc *input,
52 ObActionsICancelFunc *cancel,
53 ObActionsIPostFunc *post);
55 struct _ObActionsData {
62 struct _ObClient *client;
63 ObFrameContext context;
66 void actions_startup(gboolean reconfigure);
67 void actions_shutdown(gboolean reconfigure);
69 /*! Use this if the actions created from this name may be interactive */
70 gboolean actions_register_i(const gchar *name,
71 ObActionsIDataSetupFunc setup,
72 ObActionsDataFreeFunc free,
73 ObActionsRunFunc run);
75 gboolean actions_register(const gchar *name,
76 ObActionsDataSetupFunc setup,
77 ObActionsDataFreeFunc free,
78 ObActionsRunFunc run);
80 ObActionsAct* actions_parse(xmlNodePtr node);
81 ObActionsAct* actions_parse_string(const gchar *name);
83 gboolean actions_act_is_interactive(ObActionsAct *act);
85 void actions_act_ref(ObActionsAct *act);
86 void actions_act_unref(ObActionsAct *act);
88 /*! When this is true, an XAllowEvents with ReplayPointer will be called
89 if an action is going to maybe try moving windows around on screen (or
92 void actions_set_need_pointer_replay_before_move(gboolean replay);
93 /*! Returns if a ReplayPointer is still needed. If it was called while running
94 actions then this will be false */
95 gboolean actions_get_need_pointer_replay_before_move(void);
97 /*! Pass in a GSList of ObActionsAct's to be run. */
98 void actions_run_acts(GSList *acts,
105 struct _ObClient *client);
107 gboolean actions_interactive_act_running(void);
108 void actions_interactive_cancel_act(void);
110 gboolean actions_interactive_input_event(XEvent *e);
112 /*! Function for actions to call when they are moving a client around */
113 void actions_client_move(ObActionsData *data, gboolean start);