summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@ACER-SUSE.SUSE>2008-03-08 13:58:14 +0900
committerSam Spilsbury <Sam@ACER-SUSE.SUSE>2008-03-08 13:58:14 +0900
commitf121b1552ce8daee527f3cbab0e48764198a4a39 (patch)
tree4e3c6514dd011029b79aa6b5ecd480c63e4d3d94
parent94b22cea308526656d300d3511f531f816364c73 (diff)
downloadwiimote-f121b1552ce8daee527f3cbab0e48764198a4a39.tar.gz
wiimote-f121b1552ce8daee527f3cbab0e48764198a4a39.tar.bz2
* Now depends on prompt
-rw-r--r--compiz-wiimote.h1
-rw-r--r--wiimote.c122
-rw-r--r--wiimote.xml.in5
3 files changed, 116 insertions, 12 deletions
diff --git a/compiz-wiimote.h b/compiz-wiimote.h
index aad3ff6..9c7674d 100644
--- a/compiz-wiimote.h
+++ b/compiz-wiimote.h
@@ -375,6 +375,7 @@ cwiid_err_t err;
static int findMin (CompDisplay *, int, int, int, int); // No you can't have fminf
static int findMax (CompDisplay *, int, int, int, int); // Or fmaxf
+static Bool sendInfoToPlugin (CompDisplay *, CompOption *, int, char *, char *);
#define GET_WIIMOTE_CORE(c) \
((WiimoteCore *) (c)->base.privates[corePrivateIndex].ptr)
diff --git a/wiimote.c b/wiimote.c
index 6481cef..2d60411 100644
--- a/wiimote.c
+++ b/wiimote.c
@@ -413,10 +413,36 @@ static void* connectWiimote (void *vd)
for (s = d->screens; s; s = s->next)
{
// WIIMOTE_SCREEN (s);
- stringData = "Wii Remote not found";
+ CompOption arg[4];
+ int nArg = 0;
+
+ arg[nArg].name = "window";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = d->activeWindow;
+ nArg++;
+
+ arg[nArg].name = "root";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = s->root;
+ nArg++;
+
+ arg[nArg].name = "string";
+ arg[nArg].type = CompOptionTypeString;
+ arg[nArg].value.s = "Wii Remote not found";
+ nArg++;
+
+ arg[nArg].name = "timeout";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = 500;
+
+ sendInfoToPlugin (d, arg, nArg,
+ "prompt",
+ "display_text");
+
+ /*stringData = "Wii Remote not found";
wiimoteFreeWindowTitle (s);
wiimoteRenderWindowTitle (s, stringData);
- compAddTimeout(3000, removeTitle, s);
+ compAddTimeout(3000, removeTitle, s);*/
}
compRemoveTimeout(ad->checkingTimeoutHandle); // Do not continue polling
}
@@ -424,10 +450,37 @@ static void* connectWiimote (void *vd)
{
for (s = d->screens; s; s = s->next)
{
- stringData = " Wii Remote(s) found. Continue to\n"\
+ CompOption arg[4];
+ int nArg = 0;
+
+ arg[nArg].name = "window";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = d->activeWindow;
+ nArg++;
+
+ arg[nArg].name = "root";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = s->root;
+ nArg++;
+
+ arg[nArg].name = "string";
+ arg[nArg].type = CompOptionTypeString;
+ arg[nArg].value.s = "Wii Remote(s) found. Continue to\n"\
+ " hold (1) and (2) to finalize connection sequence";
+ nArg++;
+
+ arg[nArg].name = "timeout";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = 500;
+
+ sendInfoToPlugin (d, arg, nArg,
+ "prompt",
+ "display_text");
+
+ /*stringData = " Wii Remote(s) found. Continue to\n"\
" hold (1) and (2) to finalize connection sequence";
wiimoteFreeWindowTitle (s);
- wiimoteRenderWindowTitle (s, stringData);
+ wiimoteRenderWindowTitle (s, stringData);*/
}
if (!(wiimote = cwiid_open(&bdaddr, 0))) {
compLogMessage (d, "wiimote", CompLogLevelError,
@@ -439,10 +492,35 @@ static void* connectWiimote (void *vd)
ad->cWiimote[ad->nWiimote].connected = TRUE;
for (s = d->screens; s; s = s->next)
{
- stringData = "Wii Remote successfully connected";
+ CompOption arg[4];
+ int nArg = 0;
+
+ arg[nArg].name = "window";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = d->activeWindow;
+ nArg++;
+
+ arg[nArg].name = "root";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = s->root;
+ nArg++;
+
+ arg[nArg].name = "string";
+ arg[nArg].type = CompOptionTypeString;
+ arg[nArg].value.s = "Wii Remote successfully connected";
+ nArg++;
+
+ arg[nArg].name = "timeout";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = 500;
+
+ sendInfoToPlugin (d, arg, nArg,
+ "prompt",
+ "display_text");
+ /*stringData = "Wii Remote successfully connected";
wiimoteFreeWindowTitle (s);
wiimoteRenderWindowTitle (s, stringData);
- compAddTimeout(3000, removeTitle, s);
+ compAddTimeout(3000, removeTitle, s);*/
}
}
return NULL; // This is required for pthread
@@ -1224,12 +1302,32 @@ wiimoteToggle (CompDisplay *d,
WIIMOTE_SCREEN (w->screen);
/* Create Message */
- as->title = TRUE;
- stringData = " Holding the Nintendo Wii Remote on a flat surface\n"\
- " away from the sensor bar, press and hold the (1) and (2)\n"\
- " buttons until prompted or the lights start flashing\n"\
- " in a slower pattern ";
- wiimoteRenderWindowTitle (w->screen, stringData);
+ CompOption arg[4];
+ int nArg = 0;
+
+ arg[nArg].name = "window";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = d->activeWindow;
+ nArg++;
+
+ arg[nArg].name = "root";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = s->root;
+ nArg++;
+
+ arg[nArg].name = "string";
+ arg[nArg].type = CompOptionTypeString;
+ arg[nArg].value.s = "Put your Wii Remote in a neutral position and \n"\
+ "hold down the 1 and 2 Buttons now";
+ nArg++;
+
+ arg[nArg].name = "timeout";
+ arg[nArg].type = CompOptionTypeInt;
+ arg[nArg].value.i = 2000;
+
+ sendInfoToPlugin (d, arg, nArg,
+ "prompt",
+ "display_text");
compLogMessage (d, "wiimote", CompLogLevelInfo,
"Hold down the 1 and 2 Buttons on your Nintendo Wii Remote now");
// Create the second thread.
diff --git a/wiimote.xml.in b/wiimote.xml.in
index 5fc61ce..2a4e508 100644
--- a/wiimote.xml.in
+++ b/wiimote.xml.in
@@ -2,6 +2,11 @@
<compiz>
<plugin name="wiimote" useBcop="true">
<_short>Wii Remote</_short>
+ <deps>
+ <requirement>
+ <plugin>prompt</plugin>
+ </requirement>
+ </deps>
<_long>Compiz interface for the Nintendo Wii Remote.</_long>
<category>Utility</category>
<display>