1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 action.h for the Openbox window manager
4 Copyright (c) 2007-2011 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.
22 #include "obt/keyboard.h"
29 typedef struct _ObActionDefinition ObActionDefinition;
30 typedef struct _ObAction ObAction;
31 typedef struct _ObActionData ObActionData;
33 typedef void (*ObActionDataFreeFunc)(gpointer options);
34 typedef gboolean (*ObActionRunFunc)(ObActionData *data,
36 typedef gpointer (*ObActionDataSetupFunc)(GHashTable *config);
37 typedef void (*ObActionShutdownFunc)(void);
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 (*ObActionIPreFunc)(guint initial_state, gpointer options);
43 typedef void (*ObActionIPostFunc)(gpointer options);
44 typedef gboolean (*ObActionIInputFunc)(guint initial_state,
49 typedef void (*ObActionICancelFunc)(gpointer options);
50 typedef gpointer (*ObActionIDataSetupFunc)(GHashTable *config,
51 ObActionIPreFunc *pre,
52 ObActionIInputFunc *input,
53 ObActionICancelFunc *cancel,
54 ObActionIPostFunc *post);
56 /*! The default filter an action would like if no filter is provided by the
59 OB_ACTION_DEFAULT_FILTER_EMPTY,
60 OB_ACTION_DEFAULT_FILTER_SINGLE,
61 OB_ACTION_DEFAULT_FILTER_ALL,
62 OB_NUM_ACTION_DEFAULT_FILTERS
63 } ObActionDefaultFilter;
65 struct _ObActionData {
72 struct _ObClient *client;
73 ObFrameContext context;
76 void action_startup(gboolean reconfigure);
77 void action_shutdown(gboolean reconfigure);
79 /*! Use this if the actions created from this name may be interactive */
80 gboolean action_register_i(const gchar *name,
81 ObActionDefaultFilter def_filter,
82 ObActionIDataSetupFunc setup,
83 ObActionDataFreeFunc free,
86 gboolean action_register(const gchar *name,
87 ObActionDefaultFilter def_filter,
88 ObActionDataSetupFunc setup,
89 ObActionDataFreeFunc free,
92 gboolean action_set_shutdown(const gchar *name,
93 ObActionShutdownFunc shutdown);
95 gboolean action_is_interactive(ObAction *act);
97 /*! Create a new ObAction structure.
98 @name The name of the action.
99 @keys The names of the options passed to the action.
100 @values The values of the options passed to the action, paired with the
101 keys. These are ObActionListValue objects.
103 ObAction* action_new(const gchar *name, GHashTable *config);
105 void action_ref(ObAction *act);
106 void action_unref(ObAction *act);
108 /*! Runs a list of actions.
109 @return TRUE if an interactive action was started, FALSE otherwise.
111 gboolean action_run_acts(struct _ObActionList *acts,
118 struct _ObClient *client);
120 gboolean action_interactive_act_running(void);
121 void action_interactive_cancel_act(void);
123 gboolean action_interactive_input_event(XEvent *e);
125 /*! Function for actions to call when they are moving a client around */
126 void action_client_move(ObActionData *data, gboolean start);