summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2009-01-28 08:48:59 +0100
committerDanny Baumann <dannybaumann@web.de>2009-02-04 08:47:27 +0100
commitb6c51395d3182ab9b344227a9b8bc179c9f5a0e0 (patch)
tree950eb1c31020ae6d7b9bf5dfd4824d806653de30
parent289423858bc14eee87f0c2de410179de8be4bf25 (diff)
Added commands plugin which provides bindings for arbitrary commands.
-rw-r--r--metadata/Makefile.am1
-rw-r--r--metadata/commands.xml.in225
-rw-r--r--plugins/Makefile.am4
-rw-r--r--plugins/commands.c351
4 files changed, 581 insertions, 0 deletions
diff --git a/metadata/Makefile.am b/metadata/Makefile.am
index 08c826eb..05517d11 100644
--- a/metadata/Makefile.am
+++ b/metadata/Makefile.am
@@ -4,6 +4,7 @@ xml_in_files = \
annotate.xml.in \
blur.xml.in \
clone.xml.in \
+ commands.xml.in \
cube.xml.in \
dbus.xml.in \
decoration.xml.in \
diff --git a/metadata/commands.xml.in b/metadata/commands.xml.in
new file mode 100644
index 00000000..2fe2f6db
--- /dev/null
+++ b/metadata/commands.xml.in
@@ -0,0 +1,225 @@
+<compiz>
+ <plugin name="commands">
+ <_short>Commands</_short>
+ <_long>Assigns bindings to arbitrary commands</_long>
+ <category>General</category>
+ <display>
+ <group>
+ <_short>Commands</_short>
+ <option name="command0" type="string">
+ <_short>Command line 1</_short>
+ <_long>Command line to be executed in shell when run_command0 is invoked</_long>
+ <default></default>
+ </option>
+ <option name="command1" type="string">
+ <_short>Command line 2</_short>
+ <_long>Command line to be executed in shell when run_command1 is invoked</_long>
+ <default></default>
+ </option>
+ <option name="command2" type="string">
+ <_short>Command line 3</_short>
+ <_long>Command line to be executed in shell when run_command2 is invoked</_long>
+ <default></default>
+ </option>
+ <option name="command3" type="string">
+ <_short>Command line 4</_short>
+ <_long>Command line to be executed in shell when run_command3 is invoked</_long>
+ <default></default>
+ </option>
+ <option name="command4" type="string">
+ <_short>Command line 5</_short>
+ <_long>Command line to be executed in shell when run_command4 is invoked</_long>
+ <default></default>
+ </option>
+ <option name="command5" type="string">
+ <_short>Command line 6</_short>
+ <_long>Command line to be executed in shell when run_command5 is invoked</_long>
+ <default></default>
+ </option>
+ <option name="command6" type="string">
+ <_short>Command line 7</_short>
+ <_long>Command line to be executed in shell when run_command6 is invoked</_long>
+ <default></default>
+ </option>
+ <option name="command7" type="string">
+ <_short>Command line 8</_short>
+ <_long>Command line to be executed in shell when run_command7 is invoked</_long>
+ <default></default>
+ </option>
+ <option name="command8" type="string">
+ <_short>Command line 9</_short>
+ <_long>Command line to be executed in shell when run_command8 is invoked</_long>
+ <default></default>
+ </option>
+ <option name="command9" type="string">
+ <_short>Command line 10</_short>
+ <_long>Command line to be executed in shell when run_command9 is invoked</_long>
+ <default></default>
+ </option>
+ <option name="command10" type="string">
+ <_short>Command line 11</_short>
+ <_long>Command line to be executed in shell when run_command10 is invoked</_long>
+ <default></default>
+ </option>
+ <option name="command11" type="string">
+ <_short>Command line 12</_short>
+ <_long>Command line to be executed in shell when run_command11 is invoked</_long>
+ <default></default>
+ </option>
+ </group>
+ <group>
+ <_short>Key Bindings</_short>
+ <option name="run_command0_key" type="key">
+ <_short>Run command 1</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command0</_long>
+ </option>
+ <option name="run_command1_key" type="key">
+ <_short>Run command 2</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command1</_long>
+ </option>
+ <option name="run_command2_key" type="key">
+ <_short>Run command 3</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command2</_long>
+ </option>
+ <option name="run_command3_key" type="key">
+ <_short>Run command 4</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command3</_long>
+ </option>
+ <option name="run_command4_key" type="key">
+ <_short>Run command 5</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command4</_long>
+ </option>
+ <option name="run_command5_key" type="key">
+ <_short>Run command 6</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command5</_long>
+ </option>
+ <option name="run_command6_key" type="key">
+ <_short>Run command 7</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command6</_long>
+ </option>
+ <option name="run_command7_key" type="key">
+ <_short>Run command 8</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command7</_long>
+ </option>
+ <option name="run_command8_key" type="key">
+ <_short>Run command 9</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command8</_long>
+ </option>
+ <option name="run_command9_key" type="key">
+ <_short>Run command 10</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command9</_long>
+ </option>
+ <option name="run_command10_key" type="key">
+ <_short>Run command 11</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command10</_long>
+ </option>
+ <option name="run_command11_key" type="key">
+ <_short>Run command 12</_short>
+ <_long>A keybinding that when invoked, will run the shell command identified by command11</_long>
+ </option>
+ </group>
+ <group>
+ <_short>Button Bindings</_short>
+ <option name="run_command0_button" type="button">
+ <_short>Run command 1</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command0</_long>
+ </option>
+ <option name="run_command1_button" type="button">
+ <_short>Run command 2</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command1</_long>
+ </option>
+ <option name="run_command2_button" type="button">
+ <_short>Run command 3</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command2</_long>
+ </option>
+ <option name="run_command3_button" type="button">
+ <_short>Run command 4</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command3</_long>
+ </option>
+ <option name="run_command4_button" type="button">
+ <_short>Run command 5</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command4</_long>
+ </option>
+ <option name="run_command5_button" type="button">
+ <_short>Run command 6</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command5</_long>
+ </option>
+ <option name="run_command6_button" type="button">
+ <_short>Run command 7</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command6</_long>
+ </option>
+ <option name="run_command7_button" type="button">
+ <_short>Run command 8</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command7</_long>
+ </option>
+ <option name="run_command8_button" type="button">
+ <_short>Run command 9</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command8</_long>
+ </option>
+ <option name="run_command9_button" type="button">
+ <_short>Run command 10</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command9</_long>
+ </option>
+ <option name="run_command10_button" type="button">
+ <_short>Run command 11</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command10</_long>
+ </option>
+ <option name="run_command11_button" type="button">
+ <_short>Run command 12</_short>
+ <_long>A button binding that when invoked, will run the shell command identified by command11</_long>
+ </option>
+ </group>
+ <group>
+ <_short>Edge Bindings</_short>
+ <option name="run_command0_edge" type="edge">
+ <_short>Run command 1</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command0</_long>
+ </option>
+ <option name="run_command1_edge" type="edge">
+ <_short>Run command 2</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command1</_long>
+ </option>
+ <option name="run_command2_edge" type="edge">
+ <_short>Run command 3</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command2</_long>
+ </option>
+ <option name="run_command3_edge" type="edge">
+ <_short>Run command 4</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command3</_long>
+ </option>
+ <option name="run_command4_edge" type="edge">
+ <_short>Run command 5</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command4</_long>
+ </option>
+ <option name="run_command5_edge" type="edge">
+ <_short>Run command 6</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command5</_long>
+ </option>
+ <option name="run_command6_edge" type="edge">
+ <_short>Run command 7</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command6</_long>
+ </option>
+ <option name="run_command7_edge" type="edge">
+ <_short>Run command 8</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command7</_long>
+ </option>
+ <option name="run_command8_edge" type="edge">
+ <_short>Run command 9</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command8</_long>
+ </option>
+ <option name="run_command9_edge" type="edge">
+ <_short>Run command 10</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command9</_long>
+ </option>
+ <option name="run_command10_edge" type="edge">
+ <_short>Run command 11</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command10</_long>
+ </option>
+ <option name="run_command11_edge" type="edge">
+ <_short>Run command 12</_short>
+ <_long>An edge binding that when invoked, will run the shell command identified by command11</_long>
+ </option>
+ </group>
+ </display>
+ </plugin>
+</compiz>
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index c2b3cf01..1fa1d7b7 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -65,6 +65,9 @@ libini_la_SOURCES = ini.c
libobs_la_LDFLAGS = -module -avoid-version -no-undefined
libobs_la_SOURCES = obs.c
+libcommands_la_LDFLAGS = -module -avoid-version -no-undefined
+libcommands_la_SOURCES = commands.c
+
if USE_LIBRSVG
libsvg_la_DEPENDENCIES = $(top_builddir)/libdecoration/libdecoration.la
libsvg_la_LDFLAGS = -module -avoid-version -no-undefined
@@ -169,6 +172,7 @@ module_LTLIBRARIES = \
libvideo.la \
libini.la \
libobs.la \
+ libcommands.la \
$(libsvg_module) \
$(libannotate_module) \
$(libinotify_module) \
diff --git a/plugins/commands.c b/plugins/commands.c
new file mode 100644
index 00000000..b3adc798
--- /dev/null
+++ b/plugins/commands.c
@@ -0,0 +1,351 @@
+/*
+ * Copyright © 2009 Danny Baumann
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Danny Baumann not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Danny Baumann makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DANNY BAUMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Danny Baumann <dannybaumann@web.de>
+ */
+
+#include <compiz-core.h>
+
+static CompMetadata commandsMetadata;
+
+static int displayPrivateIndex;
+
+#define COMMANDS_DISPLAY_OPTION_COMMAND0 0
+#define COMMANDS_DISPLAY_OPTION_COMMAND1 1
+#define COMMANDS_DISPLAY_OPTION_COMMAND2 2
+#define COMMANDS_DISPLAY_OPTION_COMMAND3 3
+#define COMMANDS_DISPLAY_OPTION_COMMAND4 4
+#define COMMANDS_DISPLAY_OPTION_COMMAND5 5
+#define COMMANDS_DISPLAY_OPTION_COMMAND6 6
+#define COMMANDS_DISPLAY_OPTION_COMMAND7 7
+#define COMMANDS_DISPLAY_OPTION_COMMAND8 8
+#define COMMANDS_DISPLAY_OPTION_COMMAND9 9
+#define COMMANDS_DISPLAY_OPTION_COMMAND10 10
+#define COMMANDS_DISPLAY_OPTION_COMMAND11 11
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND0_KEY 12
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND1_KEY 13
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND2_KEY 14
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND3_KEY 15
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND4_KEY 16
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND5_KEY 17
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND6_KEY 18
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND7_KEY 19
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND8_KEY 20
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND9_KEY 21
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND10_KEY 22
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND11_KEY 23
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND0_BUTTON 24
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND1_BUTTON 25
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND2_BUTTON 26
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND3_BUTTON 27
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND4_BUTTON 28
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND5_BUTTON 29
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND6_BUTTON 30
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND7_BUTTON 31
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND8_BUTTON 32
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND9_BUTTON 33
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND10_BUTTON 34
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND11_BUTTON 35
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND0_EDGE 36
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND1_EDGE 37
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND2_EDGE 38
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND3_EDGE 39
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND4_EDGE 40
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND5_EDGE 41
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND6_EDGE 42
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND7_EDGE 43
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND8_EDGE 44
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND9_EDGE 45
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND10_EDGE 46
+#define COMMANDS_DISPLAY_OPTION_RUN_COMMAND11_EDGE 47
+#define COMMANDS_DISPLAY_OPTION_NUM 48
+
+typedef struct _CommandsDisplay {
+ CompOption opt[COMMANDS_DISPLAY_OPTION_NUM];
+} CommandsDisplay;
+
+#define GET_COMMANDS_DISPLAY(d) \
+ ((CommandsDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
+#define COMMANDS_DISPLAY(d) \
+ CommandsDisplay *cd = GET_COMMANDS_DISPLAY (d)
+
+#define NUM_OPTIONS(d) (sizeof ((d)->opt) / sizeof (CompOption))
+
+static Bool
+runCommandDispatch (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
+{
+ CompScreen *s;
+ Window xid;
+
+ xid = getIntOptionNamed (option, nOption, "root", 0);
+ s = findScreenAtDisplay (d, xid);
+
+ if (s)
+ {
+ int index = COMMANDS_DISPLAY_OPTION_COMMAND0 + action->priv.val;
+
+ COMMANDS_DISPLAY (d);
+
+ runCommand (s, cd->opt[index].value.s);
+ }
+
+ return TRUE;
+}
+
+static const CompMetadataOptionInfo commandsDisplayOptionInfo[] = {
+ { "command0", "string", 0, 0, 0 },
+ { "command1", "string", 0, 0, 0 },
+ { "command2", "string", 0, 0, 0 },
+ { "command3", "string", 0, 0, 0 },
+ { "command4", "string", 0, 0, 0 },
+ { "command5", "string", 0, 0, 0 },
+ { "command6", "string", 0, 0, 0 },
+ { "command7", "string", 0, 0, 0 },
+ { "command8", "string", 0, 0, 0 },
+ { "command9", "string", 0, 0, 0 },
+ { "command10", "string", 0, 0, 0 },
+ { "command11", "string", 0, 0, 0 },
+ { "run_command0_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command1_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command2_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command3_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command4_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command5_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command6_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command7_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command8_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command9_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command10_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command11_key", "key", 0, runCommandDispatch, 0 },
+ { "run_command0_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command1_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command2_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command3_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command4_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command5_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command6_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command7_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command8_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command9_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command10_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command11_button", "button", 0, runCommandDispatch, 0 },
+ { "run_command0_edge", "edge", 0, runCommandDispatch, 0 },
+ { "run_command1_edge", "edge", 0, runCommandDispatch, 0 },
+ { "run_command2_edge", "edge", 0, runCommandDispatch, 0 },
+ { "run_command3_edge", "edge", 0, runCommandDispatch, 0 },
+ { "run_command4_edge", "edge", 0, runCommandDispatch, 0 },
+ { "run_command5_edge", "edge", 0, runCommandDispatch, 0 },
+ { "run_command6_edge", "edge", 0, runCommandDispatch, 0 },
+ { "run_command7_edge", "edge", 0, runCommandDispatch, 0 },
+ { "run_command8_edge", "edge", 0, runCommandDispatch, 0 },
+ { "run_command9_edge", "edge", 0, runCommandDispatch, 0 },
+ { "run_command10_edge", "edge", 0, runCommandDispatch, 0 },
+ { "run_command11_edge", "edge", 0, runCommandDispatch, 0 }
+};
+
+static CompBool
+commandsInitDisplay (CompPlugin *p,
+ CompDisplay *d)
+{
+ CommandsDisplay *cd;
+ int i;
+
+ if (!checkPluginABI ("core", CORE_ABIVERSION))
+ return FALSE;
+
+ cd = malloc (sizeof (CommandsDisplay));
+ if (!cd)
+ return FALSE;
+
+ if (!compInitDisplayOptionsFromMetadata (d,
+ &commandsMetadata,
+ commandsDisplayOptionInfo,
+ cd->opt,
+ COMMANDS_DISPLAY_OPTION_NUM))
+ {
+ free (cd);
+ return FALSE;
+ }
+
+ for (i = 0; i < 12; i++)
+ {
+ int opt;
+
+ opt = COMMANDS_DISPLAY_OPTION_RUN_COMMAND0_KEY + i;
+ cd->opt[opt].value.action.priv.val = i;
+ opt = COMMANDS_DISPLAY_OPTION_RUN_COMMAND0_BUTTON + i;
+ cd->opt[opt].value.action.priv.val = i;
+ opt = COMMANDS_DISPLAY_OPTION_RUN_COMMAND0_EDGE + i;
+ cd->opt[opt].value.action.priv.val = i;
+ }
+
+ d->base.privates[displayPrivateIndex].ptr = cd;
+
+ return TRUE;
+}
+
+static void
+commandsFiniDisplay (CompPlugin *p,
+ CompDisplay *d)
+{
+ COMMANDS_DISPLAY (d);
+
+ compFiniDisplayOptions (d, cd->opt, COMMANDS_DISPLAY_OPTION_NUM);
+
+ free (cd);
+}
+
+static CompOption *
+commandsGetDisplayOptions (CompPlugin *p,
+ CompDisplay *d,
+ int *count)
+{
+ COMMANDS_DISPLAY (d);
+
+ *count = NUM_OPTIONS (cd);
+ return cd->opt;
+}
+
+static CompBool
+commandsSetDisplayOption (CompPlugin *p,
+ CompDisplay *d,
+ const char *name,
+ CompOptionValue *value)
+{
+ CompOption *o;
+
+ COMMANDS_DISPLAY (d);
+
+ o = compFindOption (cd->opt, NUM_OPTIONS (cd), name, NULL);
+ if (!o)
+ return FALSE;
+
+ return compSetDisplayOption (d, o, value);
+}
+
+static CompBool
+commandsInitObject (CompPlugin *p,
+ CompObject *o)
+{
+ static InitPluginObjectProc dispTab[] = {
+ (InitPluginObjectProc) 0, /* InitCore */
+ (InitPluginObjectProc) commandsInitDisplay
+ };
+
+ RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
+}
+
+static void
+commandsFiniObject (CompPlugin *p,
+ CompObject *o)
+{
+ static FiniPluginObjectProc dispTab[] = {
+ (FiniPluginObjectProc) 0, /* FiniCore */
+ (FiniPluginObjectProc) commandsFiniDisplay
+ };
+
+ DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
+}
+
+static CompOption *
+commandsGetObjectOptions (CompPlugin *p,
+ CompObject *o,
+ int *count)
+{
+ static GetPluginObjectOptionsProc dispTab[] = {
+ (GetPluginObjectOptionsProc) 0, /* GetCoreOptions */
+ (GetPluginObjectOptionsProc) commandsGetDisplayOptions
+ };
+
+ RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab),
+ (void *) (*count = 0), (p, o, count));
+}
+
+static CompBool
+commandsSetObjectOption (CompPlugin *p,
+ CompObject *o,
+ const char *name,
+ CompOptionValue *value)
+{
+ static SetPluginObjectOptionProc dispTab[] = {
+ (SetPluginObjectOptionProc) 0, /* SetCoreOption */
+ (SetPluginObjectOptionProc) commandsSetDisplayOption,
+ };
+
+ RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), FALSE,
+ (p, o, name, value));
+}
+
+static Bool
+commandsInit (CompPlugin *p)
+{
+ if (!compInitPluginMetadataFromInfo (&commandsMetadata,
+ p->vTable->name,
+ commandsDisplayOptionInfo,
+ COMMANDS_DISPLAY_OPTION_NUM, 0, 0))
+ return FALSE;
+
+ displayPrivateIndex = allocateDisplayPrivateIndex ();
+ if (displayPrivateIndex < 0)
+ {
+ compFiniMetadata (&commandsMetadata);
+ return FALSE;
+ }
+
+ compAddMetadataFromFile (&commandsMetadata, p->vTable->name);
+
+ return TRUE;
+}
+
+static void
+commandsFini (CompPlugin *p)
+{
+ freeDisplayPrivateIndex (displayPrivateIndex);
+ compFiniMetadata (&commandsMetadata);
+}
+
+static CompMetadata *
+commandsGetMetadata (CompPlugin *p)
+{
+ return &commandsMetadata;
+}
+
+static CompPluginVTable commandsVTable = {
+ "commands",
+ commandsGetMetadata,
+ commandsInit,
+ commandsFini,
+ commandsInitObject,
+ commandsFiniObject,
+ commandsGetObjectOptions,
+ commandsSetObjectOption
+};
+
+CompPluginVTable *
+getCompPluginInfo20070830 (void)
+{
+ return &commandsVTable;
+}