summaryrefslogtreecommitdiff
path: root/communicate.c
diff options
context:
space:
mode:
authorSam Spillaz <smspillaz@gmail.com>2008-04-26 21:26:42 +0800
committerSam Spillaz <smspillaz@gmail.com>2008-04-26 21:26:42 +0800
commite1737e4024c66e066531fd3552abaf5428c1c382 (patch)
tree9b8fca80b1e6e0db9c2ff4f81f7341d8aab1ad64 /communicate.c
parentca73db7c91c0e28c3170f9946c168cf4576befa8 (diff)
downloadwiimote-e1737e4024c66e066531fd3552abaf5428c1c382.tar.gz
wiimote-e1737e4024c66e066531fd3552abaf5428c1c382.tar.bz2
* Added the new files that I split into (I think I went overboard. Meh)
Diffstat (limited to 'communicate.c')
-rw-r--r--communicate.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/communicate.c b/communicate.c
new file mode 100644
index 0000000..0fa7cc0
--- /dev/null
+++ b/communicate.c
@@ -0,0 +1,56 @@
+#include "compiz-wiimote.h"
+
+/* Inter-Plugin Communication --------------------------------------------------- */
+
+Bool
+sendInfoToPlugin (CompDisplay *d, CompOption *argument, int nArgument, char *pluginName, char *actionName)
+{
+ Bool pluginExists = FALSE;
+ CompOption *options, *option;
+ CompPlugin *p;
+ CompObject *o;
+ int nOptions;
+ int i = wiimoteDisplayPrivateIndex;
+
+ free(&i);
+
+ p = findActivePlugin (pluginName);
+ o = compObjectFind (&core.base, COMP_OBJECT_TYPE_DISPLAY, NULL);
+
+ if (!o)
+ return FALSE;
+
+ if (!p || !p->vTable->getObjectOptions)
+ {
+ compLogMessage (d, "wiimote", CompLogLevelError,
+ "Reporting plugin '%s' does not exist!", pluginName);
+ return FALSE;
+ }
+
+ if (p && p->vTable->getObjectOptions)
+ {
+ options = (*p->vTable->getObjectOptions) (p, o, &nOptions);
+ option = compFindOption (options, nOptions, actionName, 0);
+ pluginExists = TRUE;
+ }
+
+ if (pluginExists)
+ {
+ if (option && option->value.action.initiate)
+ {
+ (*option->value.action.initiate) (d,
+ &option->value.action,
+ 0,
+ argument,
+ nArgument);
+ }
+ else
+ {
+ compLogMessage (d, "wiimote", CompLogLevelError,
+ "Plugin '%s' does exist, but no option named '%s' was found!", pluginName, actionName);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}