summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@ACER-SUSE.SUSE>2008-03-04 23:44:09 +0900
committerSam Spilsbury <Sam@ACER-SUSE.SUSE>2008-03-04 23:44:09 +0900
commit73a5973d5f259ab88aa01ac7aa863b4ab9f407ca (patch)
treed7f5c6534dd7cef178be10ac16e82390b7108e21
parent2350e71f42893344bd3d74c73755b4808d488818 (diff)
downloadwiimote-73a5973d5f259ab88aa01ac7aa863b4ab9f407ca.tar.gz
wiimote-73a5973d5f259ab88aa01ac7aa863b4ab9f407ca.tar.bz2
* Added option to specify reporting arguments (broken, but falls back on previous method, so it should work normally)
-rw-r--r--compiz-wiimote.h4
-rw-r--r--wiimote.c64
-rw-r--r--wiimote.xml.in15
3 files changed, 48 insertions, 35 deletions
diff --git a/compiz-wiimote.h b/compiz-wiimote.h
index 80f4962..5ed06c4 100644
--- a/compiz-wiimote.h
+++ b/compiz-wiimote.h
@@ -132,6 +132,10 @@ typedef struct _WiimoteReport
char *pluginName;
char *actionName;
int sensitivity;
+
+ char *xarg;
+ char *yarg;
+ char *zarg;
} WiimoteReport;
/* Wiimote Buttons */
diff --git a/wiimote.c b/wiimote.c
index 6b083d0..18dce29 100644
--- a/wiimote.c
+++ b/wiimote.c
@@ -659,34 +659,7 @@ wiimotePaintOutput (CompScreen *s,
return status;
}
-/* Utility function to move the pointer.
- * This will probably end up in another plugin
- */
-
-/*
-static void
-moveCursor (CompScreen *s, int x, int y) // Because warpPointer isn't good enough
-{
-
- //fprintf(stderr, "X is: %i\nY is : %i\n", x, y);
-
- if (x >= s->width)
- x = s->width - 1;
- else if (x < 0)
- x = 0;
-
- if (y >= s->height)
- y = s->height - 1;
- else if (y < 0)
- y = 0;
-
- XWarpPointer (s->display->display,
- None, s->root,
- 0, 0, 0, 0,
- x, y);
-}*/
-
-/* Report Creationg */
+/* Report Creation */
/* Get the data first */
/* Info Send */
@@ -834,19 +807,28 @@ static Bool sendReports(void *vs)
argument[nArgument].value.i = s->root;
nArgument++;
- argument[nArgument].name = "x";
+ if (ad->cWiimote[i].report[j].xarg)
+ argument[nArgument].name = ad->cWiimote[i].report[j].xarg;
+ else
+ argument[nArgument].name = "x";
argument[nArgument].type = CompOptionTypeFloat;
- argument[nArgument].value.f = (int) report[0];
+ argument[nArgument].value.f = report[0];
nArgument++;
- argument[nArgument].name = "y";
+ if (ad->cWiimote[i].report[j].yarg)
+ argument[nArgument].name = ad->cWiimote[i].report[j].yarg;
+ else
+ argument[nArgument].name = "y";
argument[nArgument].type = CompOptionTypeFloat;
- argument[nArgument].value.f = (int) report[1];
+ argument[nArgument].value.f = report[1];
nArgument++;
- argument[nArgument].name = "z";
+ if (ad->cWiimote[i].report[j].yarg)
+ argument[nArgument].name = ad->cWiimote[i].report[j].yarg;
+ else
+ argument[nArgument].name = "y";
argument[nArgument].type = CompOptionTypeFloat;
- argument[nArgument].value.f = (int) report[2];
+ argument[nArgument].value.f = report[2];
if (ad->cWiimote[i].report[j].pluginName && ad->cWiimote[i].report[j].actionName){
sendInfoToPlugin (s->display, argument, nArgument,
@@ -1385,6 +1367,10 @@ reloadWiimoteReporters(CompDisplay *d)
CompListValue *cActionName = wiimoteGetReportActionName (d);
CompListValue *cReportSensitivity = wiimoteGetReportSensitivity (d);
+ CompListValue *cXArgument = wiimoteGetReportXArgument (d);
+ CompListValue *cYArgument = wiimoteGetReportYArgument (d);
+ CompListValue *cZArgument = wiimoteGetReportZArgument (d);
+
int nReport;
int iReport = 0;
int i = 0;
@@ -1394,9 +1380,13 @@ reloadWiimoteReporters(CompDisplay *d)
if ((cWiimoteNumber->nValue != cReportType->nValue) ||
(cWiimoteNumber->nValue != cPluginName->nValue) ||
(cWiimoteNumber->nValue != cActionName->nValue) ||
+ (cWiimoteNumber->nValue != cXArgument->nValue) ||
+ (cWiimoteNumber->nValue != cYArgument->nValue) ||
+ (cWiimoteNumber->nValue != cZArgument->nValue) ||
(cWiimoteNumber->nValue != cReportSensitivity->nValue))
{
- /* Options have not been set correctly */
+ compLogMessage (d, "wiimote", CompLogLevelError,
+ "Options are not set correctly. Please revisit them and make sure each option in the list is set\n");
return;
}
@@ -1418,6 +1408,10 @@ reloadWiimoteReporters(CompDisplay *d)
ad->cWiimote[i].report[k].actionName = strdup(cActionName->value[iReport].s);
ad->cWiimote[i].report[k].sensitivity = cReportSensitivity->value[iReport].i;
+ ad->cWiimote[i].report[k].xarg = strdup(cXArgument->value[iReport].s);
+ ad->cWiimote[i].report[k].yarg = strdup(cYArgument->value[iReport].s);
+ ad->cWiimote[i].report[k].zarg = strdup(cZArgument->value[iReport].s);
+
ad->cWiimote[i].report[k].type = cReportType->value[iReport].i;
k++; /* Set next availiable option */
diff --git a/wiimote.xml.in b/wiimote.xml.in
index 1892fdb..0a821f2 100644
--- a/wiimote.xml.in
+++ b/wiimote.xml.in
@@ -262,6 +262,21 @@
<_long>Action to report to</_long>
<type>string</type>
</option>
+ <option type="list" name="report_x_argument">
+ <_short>X Argument</_short>
+ <_long>What option name the plugin expects for the X value</_long>
+ <type>string</type>
+ </option>
+ <option type="list" name="report_y_argument">
+ <_short>Y Argument</_short>
+ <_long>What option name the plugin expects for the Y value</_long>
+ <type>string</type>
+ </option>
+ <option type="list" name="report_z_argument">
+ <_short>Z Argument</_short>
+ <_long>What option name the plugin expects for the Z value</_long>
+ <type>string</type>
+ </option>
<option type="list" name="report_sensitivity">
<_short>Sensitivity</_short>
<_long>How sensitive Wii Remote movements should be</_long>