diff options
author | Sam Spilsbury <Sam@XPS-SUSE.site> | 2008-12-11 22:31:55 +0900 |
---|---|---|
committer | Sam Spilsbury <Sam@XPS-SUSE.site> | 2008-12-11 22:31:55 +0900 |
commit | ec9b9bd955061cb3975755521c082e0cd84eefa6 (patch) | |
tree | 513c4ef2f6e763e31bcc8cc5182bb0bfdb2e0f4a | |
parent | 22f3ecbfc18939984e59139f0c074969e3d8f3c0 (diff) | |
download | wiimote-ec9b9bd955061cb3975755521c082e0cd84eefa6.tar.gz wiimote-ec9b9bd955061cb3975755521c082e0cd84eefa6.tar.bz2 |
* It makes no sense to expose internal things to other plugins
-rw-r--r-- | action.c | 2 | ||||
-rw-r--r-- | callback.c | 2 | ||||
-rw-r--r-- | communicate.c | 2 | ||||
-rw-r--r-- | compiz-wiimote.h | 139 | ||||
-rw-r--r-- | connect.c | 2 | ||||
-rw-r--r-- | gesture.c | 2 | ||||
-rw-r--r-- | option.c | 2 | ||||
-rw-r--r-- | report.c | 2 | ||||
-rw-r--r-- | util.c | 2 | ||||
-rw-r--r-- | wiimote-internal.h | 159 | ||||
-rw-r--r-- | wiimote.c | 2 |
11 files changed, 169 insertions, 147 deletions
@@ -18,7 +18,7 @@ * */ -#include "compiz-wiimote.h" +#include "wiimote-internal.h" #include "wiimote_options.h" int wiimoteDisplayPrivateIndex; @@ -18,7 +18,7 @@ * */ -#include "compiz-wiimote.h" +#include "wiimote-internal.h" #include "wiimote_options.h" int wiimoteDisplayPrivateIndex; diff --git a/communicate.c b/communicate.c index d1b4ba1..0fbebae 100644 --- a/communicate.c +++ b/communicate.c @@ -18,7 +18,7 @@ * */ -#include "compiz-wiimote.h" +#include "wiimote-internal.h" /* Inter-Plugin Communication --------------------------------------------------- */ diff --git a/compiz-wiimote.h b/compiz-wiimote.h index 5669475..ec507fe 100644 --- a/compiz-wiimote.h +++ b/compiz-wiimote.h @@ -20,6 +20,7 @@ #ifndef _COMPIZ_WIIMOTE_H #define _COMPIZ_WIIMOTE_H +#endif #include <compiz-core.h> #include <cwiid.h> @@ -323,143 +324,6 @@ typedef struct _CompWiimote } CompWiimote; -/* Core / Display / Screen structs */ - -typedef struct _WiimoteDisplay -{ - int screenPrivateIndex; - int count; - - CompWiimote cWiimote[MAX_WIIMOTES]; // The past - int nWiimote; - - CompWiimote *wiimotes; // The future $$$$$$$$ =) - - /* Hack */ - - int firstRoot; - - Bool report; - - Bool CallbackSet; - - CompTimeoutHandle infoTimeoutHandle; - CompTimeoutHandle gestureTimeoutHandle; - CompTimeoutHandle checkingTimeoutHandle; - -} WiimoteDisplay; - -typedef struct _WiimoteScreen -{ - PaintOutputProc paintOutput; -} WiimoteScreen; - -#define GET_WIIMOTE_DISPLAY(d) \ - ((WiimoteDisplay *) (d)->base.privates[wiimoteDisplayPrivateIndex].ptr) -#define WIIMOTE_DISPLAY(d) \ - WiimoteDisplay *ad = GET_WIIMOTE_DISPLAY (d) -#define GET_WIIMOTE_SCREEN(s, ad) \ - ((WiimoteScreen *) (s)->base.privates[(ad)->screenPrivateIndex].ptr) -#define WIIMOTE_SCREEN(s) \ - WiimoteScreen *as = GET_WIIMOTE_SCREEN (s, GET_WIIMOTE_DISPLAY (s->display)) -#define GET_WIIMOTE_WINDOW(w, as) \ - ((WiimoteWindow *) (w)->base.privates[ (as)->windowPrivateIndex].ptr) -#define WIIMOTE_WINDOW(w) \ - WiimoteWindow *aw = GET_WIIMOTE_WINDOW (w, \ - GET_WIIMOTE_SCREEN (w->screen, \ - GET_WIIMOTE_DISPLAY (w->screen->display))) - -extern int wiimoteDisplayPrivateIndex; -cwiid_mesg_callback_t wiimoteCWiiDCallback; -cwiid_err_t err; -CompDisplay *firstDisplay; - -/* Function Prototypes */ - -/* util.c*/ - -int findMinIR (CompDisplay *, CompWiimote *, int, int, int, int); // No you can't have fminf -int findMaxIR (CompDisplay *, CompWiimote *, int, int, int, int); // Or fmaxf -Bool wiimoteChangeLights(void *Wiimote); -void set_led_state(cwiid_wiimote_t *wiimote, unsigned char led_state); -void set_rpt_mode(cwiid_wiimote_t *wiimote, unsigned char rpt_mode); - -/* communicate.c */ - -Bool sendInfoToPlugin (CompDisplay *, CompOption *, int, char *, char *); - -/* gesture.c */ - -void wiimoteProcessButtons (CompDisplay *, CompWiimote *, struct cwiid_btn_mesg *); -void wiimoteProcessNunchuckButtons (CompDisplay *, CompWiimote *, struct cwiid_nunchuk_mesg *); -Bool wiimoteCheckForGestures (void *vs); - -/* connect.c */ - -Bool find_wiimote(bdaddr_t *bdaddr, int timeout); -void* connectWiimote (void *vd); -Bool checkConnected (void *vd); - -/* report.c */ - -Bool sendReports(void *vs); - -/* option.c */ - -void -reloadReportersForWiimote (CompDisplay *d, - CompWiimote *wiimote); - -void -reloadReportersForWiimoteNumber (CompDisplay *d, - int wiimoteNumber); - -void -reloadGesturesForWiimote (CompDisplay *d, - CompWiimote *wiimote); - -void -reloadGesturesForWiimoteNumber (CompDisplay *d, - int wiimoteNumber); - -void -reloadOptionsForWiimote (CompDisplay *d, - CompWiimote *wiimote); - -void -reloadOptionsForWiimoteNumber (CompDisplay *d, - int wiimoteNumber); - -/* action.c */ - -Bool -wiimoteToggle (CompDisplay *d, - CompAction *action, - CompActionState cstate, - CompOption *option, - int nOption); - -Bool -wiimoteDisable (CompDisplay *d, - CompAction *action, - CompActionState cstate, - CompOption *option, - int nOption); - -Bool -wiimoteSendInfo (CompDisplay *d, - CompAction *action, - CompActionState cstate, - CompOption *option, - int nOption); - -/* wiimote.c */ -CompWiimote * -wiimoteAddWiimote (CompDisplay *d); -void -wiimoteRemoveWiimote (CompDisplay *d, - CompWiimote *wiimote); - /* Shortcut Macros --------------------------------------------------- */ #define toggle_bit(bf,b) \ @@ -470,4 +334,3 @@ wiimoteRemoveWiimote (CompDisplay *d, #define PI 3.14159265358979323846 #define DEG2RAD2(DEG) ((DEG)*((PI)/(180.0))) -#endif @@ -18,7 +18,7 @@ * */ -#include "compiz-wiimote.h" +#include "wiimote-internal.h" #include "wiimote_options.h" int wiimoteDisplayPrivateIndex; @@ -18,7 +18,7 @@ * */ -#include "compiz-wiimote.h" +#include "wiimote-internal.h" #include "wiimote_options.h" int wiimoteDisplayPrivateIndex; @@ -18,7 +18,7 @@ * */ -#include "compiz-wiimote.h" +#include "wiimote-internal.h" #include "wiimote_options.h" int wiimoteDisplayPrivateIndex; @@ -18,7 +18,7 @@ * */ -#include "compiz-wiimote.h" +#include "wiimote-internal.h" int wiimoteDisplayPrivateIndex; @@ -18,7 +18,7 @@ * */ -#include "compiz-wiimote.h" +#include "wiimote-internal.h" /* Utility Functions --------------------------------------------------- */ diff --git a/wiimote-internal.h b/wiimote-internal.h new file mode 100644 index 0000000..6815ae2 --- /dev/null +++ b/wiimote-internal.h @@ -0,0 +1,159 @@ +/** + * + * Compiz Nintendo(R) Wii(TM) Remote Interface Plugin + * + * Copyright : (C) 2008 by Sam Spilsbury + * E-mail : smspillaz@gmail.com + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "compiz-wiimote.h" + +#define MAX_GESTURES 32 +#define MAX_REPORTS 16 +#define MAX_WIIMOTES 10 + +/* Core / Display / Screen structs */ + +typedef struct _WiimoteDisplay +{ + int screenPrivateIndex; + int count; + + int nWiimote; + CompWiimote *wiimotes; + /* Hack */ + + int firstRoot; + + Bool report; + + Bool CallbackSet; + + CompTimeoutHandle infoTimeoutHandle; + CompTimeoutHandle gestureTimeoutHandle; + CompTimeoutHandle checkingTimeoutHandle; + +} WiimoteDisplay; + +typedef struct _WiimoteScreen +{ + PaintOutputProc paintOutput; +} WiimoteScreen; + +#define GET_WIIMOTE_DISPLAY(d) \ + ((WiimoteDisplay *) (d)->base.privates[wiimoteDisplayPrivateIndex].ptr) +#define WIIMOTE_DISPLAY(d) \ + WiimoteDisplay *ad = GET_WIIMOTE_DISPLAY (d) +#define GET_WIIMOTE_SCREEN(s, ad) \ + ((WiimoteScreen *) (s)->base.privates[(ad)->screenPrivateIndex].ptr) +#define WIIMOTE_SCREEN(s) \ + WiimoteScreen *as = GET_WIIMOTE_SCREEN (s, GET_WIIMOTE_DISPLAY (s->display)) +#define GET_WIIMOTE_WINDOW(w, as) \ + ((WiimoteWindow *) (w)->base.privates[ (as)->windowPrivateIndex].ptr) +#define WIIMOTE_WINDOW(w) \ + WiimoteWindow *aw = GET_WIIMOTE_WINDOW (w, \ + GET_WIIMOTE_SCREEN (w->screen, \ + GET_WIIMOTE_DISPLAY (w->screen->display))) + +extern int wiimoteDisplayPrivateIndex; +cwiid_mesg_callback_t wiimoteCWiiDCallback; +cwiid_err_t err; +CompDisplay *firstDisplay; + +/* Function Prototypes */ + +/* util.c*/ + +int findMinIR (CompDisplay *, CompWiimote *, int, int, int, int); // No you can't have fminf +int findMaxIR (CompDisplay *, CompWiimote *, int, int, int, int); // Or fmaxf +Bool wiimoteChangeLights(void *Wiimote); +void set_led_state(cwiid_wiimote_t *wiimote, unsigned char led_state); +void set_rpt_mode(cwiid_wiimote_t *wiimote, unsigned char rpt_mode); + +/* communicate.c */ + +Bool sendInfoToPlugin (CompDisplay *, CompOption *, int, char *, char *); + +/* gesture.c */ + +void wiimoteProcessButtons (CompDisplay *, CompWiimote *, struct cwiid_btn_mesg *); +void wiimoteProcessNunchuckButtons (CompDisplay *, CompWiimote *, struct cwiid_nunchuk_mesg *); +Bool wiimoteCheckForGestures (void *vs); + +/* connect.c */ + +Bool find_wiimote(bdaddr_t *bdaddr, int timeout); +void* connectWiimote (void *vd); +Bool checkConnected (void *vd); + +/* report.c */ + +Bool sendReports(void *vs); + +/* option.c */ + +void +reloadReportersForWiimote (CompDisplay *d, + CompWiimote *wiimote); + +void +reloadReportersForWiimoteNumber (CompDisplay *d, + int wiimoteNumber); + +void +reloadGesturesForWiimote (CompDisplay *d, + CompWiimote *wiimote); + +void +reloadGesturesForWiimoteNumber (CompDisplay *d, + int wiimoteNumber); + +void +reloadOptionsForWiimote (CompDisplay *d, + CompWiimote *wiimote); + +void +reloadOptionsForWiimoteNumber (CompDisplay *d, + int wiimoteNumber); + +/* action.c */ + +Bool +wiimoteToggle (CompDisplay *d, + CompAction *action, + CompActionState cstate, + CompOption *option, + int nOption); + +Bool +wiimoteDisable (CompDisplay *d, + CompAction *action, + CompActionState cstate, + CompOption *option, + int nOption); + +Bool +wiimoteSendInfo (CompDisplay *d, + CompAction *action, + CompActionState cstate, + CompOption *option, + int nOption); + +/* wiimote.c */ +CompWiimote * +wiimoteAddWiimote (CompDisplay *d); +void +wiimoteRemoveWiimote (CompDisplay *d, + CompWiimote *wiimote); @@ -20,7 +20,7 @@ * TODO: * - ??? */ -#include "compiz-wiimote.h" +#include "wiimote-internal.h" #include "wiimote_options.h" static int corePrivateIndex; |