summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@ACER-SUSE.SUSE>2008-03-05 20:52:26 +0900
committerSam Spilsbury <Sam@ACER-SUSE.SUSE>2008-03-05 20:52:26 +0900
commita309a7c1bf90bd543299a36ce0dc0ceba50312f5 (patch)
tree45deda1e0c18f624515e031fe4ae7d690b0ceab1
parent0c9c6fc52351bd666b64a07fbd67c56dcd42fd3b (diff)
downloadwiimote-a309a7c1bf90bd543299a36ce0dc0ceba50312f5.tar.gz
wiimote-a309a7c1bf90bd543299a36ce0dc0ceba50312f5.tar.bz2
* Option to choose between interger and float arguments
-rw-r--r--compiz-wiimote.h1
-rw-r--r--wiimote.c48
-rw-r--r--wiimote.xml.in11
3 files changed, 52 insertions, 8 deletions
diff --git a/compiz-wiimote.h b/compiz-wiimote.h
index d63de34..38db2ce 100644
--- a/compiz-wiimote.h
+++ b/compiz-wiimote.h
@@ -132,6 +132,7 @@ typedef struct _WiimoteReport
char *pluginName;
char *actionName;
int sensitivity;
+ int dataType;
char *xarg;
char *yarg;
diff --git a/wiimote.c b/wiimote.c
index a5620e7..c5f687d 100644
--- a/wiimote.c
+++ b/wiimote.c
@@ -157,7 +157,7 @@ wiimoteFreeWindowTitle (CompScreen *s)
{
WIIMOTE_SCREEN(s);
- if (!as->textPixmap || as->textTexture != NULL)
+ if (!as->textPixmap)
return;
releasePixmapFromTexture (s, &as->textTexture);
@@ -810,24 +810,52 @@ static Bool sendReports(void *vs)
argument[nArgument].name = ad->cWiimote[i].report[j].xarg;
else
argument[nArgument].name = "x";
- argument[nArgument].type = CompOptionTypeFloat;
- argument[nArgument].value.f = report[0];
+
+ if (ad->cWiimote[i].report[j].dataType == 0)
+ {
+ argument[nArgument].type = CompOptionTypeFloat;
+ argument[nArgument].value.f = report[0];
+ }
+ else if (ad->cWiimote[i].report[j].dataType == 1)
+ {
+ argument[nArgument].type = CompOptionTypeInt;
+ argument[nArgument].value.i = (int) report[0];
+ }
nArgument++;
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 = report[1];
+
+ if (ad->cWiimote[i].report[j].dataType == 0)
+ {
+ argument[nArgument].type = CompOptionTypeFloat;
+ argument[nArgument].value.f = report[1];
+ }
+ else if (ad->cWiimote[i].report[j].dataType == 1)
+ {
+ argument[nArgument].type = CompOptionTypeInt;
+ argument[nArgument].value.i = (int) report[1];
+ }
nArgument++;
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 = report[2];
+ argument[nArgument].name = "z";
+
+ if (ad->cWiimote[i].report[j].dataType == 0)
+ {
+ argument[nArgument].type = CompOptionTypeFloat;
+ argument[nArgument].value.f = report[2];
+ }
+ else if (ad->cWiimote[i].report[j].dataType == 1)
+ {
+ argument[nArgument].type = CompOptionTypeInt;
+ argument[nArgument].value.i = (int) report[2];
+ }
+ nArgument++;
if (ad->cWiimote[i].report[j].pluginName && ad->cWiimote[i].report[j].actionName){
sendInfoToPlugin (s->display, argument, nArgument,
@@ -1369,6 +1397,8 @@ reloadWiimoteReporters(CompDisplay *d)
CompListValue *cYArgument = wiimoteGetReportYArgument (d);
CompListValue *cZArgument = wiimoteGetReportZArgument (d);
+ CompListValue *cDataType = wiimoteGetReportDataType (d);
+
int nReport;
int iReport = 0;
int i = 0;
@@ -1381,6 +1411,7 @@ reloadWiimoteReporters(CompDisplay *d)
(cWiimoteNumber->nValue != cXArgument->nValue) ||
(cWiimoteNumber->nValue != cYArgument->nValue) ||
(cWiimoteNumber->nValue != cZArgument->nValue) ||
+ (cWiimoteNumber->nValue != cDataType->nValue) ||
(cWiimoteNumber->nValue != cReportSensitivity->nValue))
{
compLogMessage (d, "wiimote", CompLogLevelError,
@@ -1411,6 +1442,7 @@ reloadWiimoteReporters(CompDisplay *d)
ad->cWiimote[i].report[k].zarg = strdup(cZArgument->value[iReport].s);
ad->cWiimote[i].report[k].type = cReportType->value[iReport].i;
+ ad->cWiimote[i].report[k].dataType = cDataType->value[iReport].i;
k++; /* Set next availiable option */
}
diff --git a/wiimote.xml.in b/wiimote.xml.in
index 0a821f2..c1a921b 100644
--- a/wiimote.xml.in
+++ b/wiimote.xml.in
@@ -277,6 +277,17 @@
<_long>What option name the plugin expects for the Z value</_long>
<type>string</type>
</option>
+ <option type="list" name="report_data_type">
+ <_short>Data Type</_short>
+ <_long>What data type the plugin expects (Use the other one if the current one doesn't work)</_long>
+ <type>int</type>
+ <desc>
+ <value>0</value><name>Decimal</name>
+ </desc>
+ <desc>
+ <value>1</value><name>Interger</name>
+ </desc>
+ </option>
<option type="list" name="report_sensitivity">
<_short>Sensitivity</_short>
<_long>How sensitive Wii Remote movements should be</_long>