All pastes #916050 Raw Edit

Miscellany

public c v1 · immutable
#916050 ·published 2008-02-24 08:45 UTC
rendered paste body
static Bool sendReports(void *vs){	CompScreen *s = vs;	WIIMOTE_DISPLAY (s->display);	    	int i = 0;	for (i = 0; i < 1; i++);	{		int j;		//i = 0;		fprintf(stderr, "Wiimote number %i, activewindow %i\n", i, ad->active);		for (j = 0; j < ad->cWiimote[i].nReport; j++)		{			float report[3];			char *pluginName, *actionName;			Bool reporting;						switch (ad->cWiimote[i].report[j].type)			{				case WiimoteReportTypeNone:				case WiimoteReportTypeLength:				default:					reporting = FALSE;				case WiimoteReportTypeIR:					report[0] = ad->cWiimote[i].irMidX - (CWIID_IR_X_MAX / 4);					report[1] = ad->cWiimote[i].irMidY - (CWIID_IR_Y_MAX / 4);					report[2] = ad->cWiimote[i].irDistance;					reporting = TRUE;				case WiimoteReportTypeAccellerometer:					report[0] = (float) ( (int) (ad->cWiimote[i].acc.accDX / 3) * 3);					report[1] = (float) ( (int) (ad->cWiimote[i].acc.accDY / 3) * 3);					report[2] = (float) ( (int) (ad->cWiimote[i].acc.accDZ / 3) * 3);					reporting = TRUE;				case WiimoteReportTypeNunchuckAccellerometer:					report[0] = 0.0f;					report[1] = 0.0f;					report[2] = 0.0f;					reporting = TRUE;				case WiimoteReportTypeNunchuckStick:					report[0] = 0.0f;					report[1] = 0.0f;					report[2] = 0.0f;					reporting = TRUE;			}			if (reporting)			{			    CompOption argument[5];			    int nArgument = 0;    			    argument[nArgument].name = "window";			    argument[nArgument].type = CompOptionTypeInt;			    argument[nArgument].value.i = s->display->activeWindow;			    nArgument++;    			    argument[nArgument].name = "root";			    argument[nArgument].type = CompOptionTypeInt;			    argument[nArgument].value.i = s->root;			    nArgument++;    			    argument[nArgument].name = "x";			    argument[nArgument].type = CompOptionTypeFloat;			    argument[nArgument].value.f = report[0];			    nArgument++;    			    argument[nArgument].name = "y";			    argument[nArgument].type = CompOptionTypeFloat;			    argument[nArgument].value.f = report[1];			    nArgument++;    			    argument[nArgument].name = "z";			    argument[nArgument].type = CompOptionTypeFloat;			    argument[nArgument].value.f = report[2];    			    fprintf(stderr, "String check\n");			    if (ad->cWiimote[i].report[j].pluginName == NULL)				    fprintf(stderr, "It's null (pluginname)\n");			    if (ad->cWiimote[i].report[j].actionName == NULL)				    fprintf(stderr, "It's null (actionname)\n");			    if (ad->cWiimote[i].report[j].pluginName != NULL && ad->cWiimote[i].report[j].actionName != NULL)			    {			    sendInfoToPlugin (s, argument, nArgument,					      ad->cWiimote[i].report[j].pluginName,					      ad->cWiimote[i].report[j].actionName);			    }			  }		  }			}