diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2010-03-29 23:50:05 +0200 |
---|---|---|
committer | Henrik Rydberg <rydberg@euromail.se> | 2010-04-15 06:10:07 +0200 |
commit | 9c24576540ba57449c31bafcb8f4aab41b8623b7 (patch) | |
tree | 8a9001c10f2598b74d141ea783114575c91fd39c | |
parent | 173d728d812e78b299cbc9475fc237b9023eee2b (diff) | |
download | xorg-input-kobomultitouch-9c24576540ba57449c31bafcb8f4aab41b8623b7.tar.gz xorg-input-kobomultitouch-9c24576540ba57449c31bafcb8f4aab41b8623b7.tar.bz2 xorg-input-kobomultitouch-9c24576540ba57449c31bafcb8f4aab41b8623b7.zip |
Rename State to HWState
Rename the hardware state struct State to HWState, to make
room for additional state structures.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | src/gestures.c | 22 | ||||
-rw-r--r-- | src/hwstate.c (renamed from src/state.c) | 18 | ||||
-rw-r--r-- | src/hwstate.h (renamed from src/state.h) | 16 | ||||
-rw-r--r-- | src/mtouch.c | 6 | ||||
-rw-r--r-- | src/mtouch.h | 4 |
6 files changed, 34 insertions, 34 deletions
@@ -11,7 +11,7 @@ o_match = match o_src = capabilities \ iobuffer \ hwdata \ - state \ + hwstate \ mtouch \ gestures \ multitouch diff --git a/src/gestures.c b/src/gestures.c index 01e7b10..5dd6861 100644 --- a/src/gestures.c +++ b/src/gestures.c @@ -25,16 +25,16 @@ void extract_gestures(struct Gestures *gs, struct MTouch* mt) { - const struct FingerState *b = mt->ns.finger; - const struct FingerState *e = b + mt->ns.nfinger; + const struct FingerState *b = mt->nhs.finger; + const struct FingerState *e = b + mt->nhs.nfinger; const struct FingerState *p, *fs; - int nof = count_fingers(&mt->os); - int nsf = count_fingers(&mt->ns); + int nof = count_fingers(&mt->ohs); + int nsf = count_fingers(&mt->nhs); int dn = 0, i; memset(gs, 0, sizeof(struct Gestures)); if (nof == nsf) { for (p = b; p != e; p++) { - fs = find_finger(&mt->os, p->id); + fs = find_finger(&mt->ohs, p->id); if (fs) { gs->dx += p->hw.position_x - fs->hw.position_x; gs->dy += p->hw.position_y - fs->hw.position_y; @@ -52,14 +52,14 @@ void extract_gestures(struct Gestures *gs, struct MTouch* mt) if (nsf == 3) SETBIT(gs->type, GS_HSCROLL); } - if (mt->ns.button == BITMASK(MT_BUTTON_LEFT)) { + if (mt->nhs.button == BITMASK(MT_BUTTON_LEFT)) { if (nsf == 2) - mt->ns.button = BITMASK(MT_BUTTON_RIGHT); + mt->nhs.button = BITMASK(MT_BUTTON_RIGHT); if (nsf == 3) - mt->ns.button = BITMASK(MT_BUTTON_MIDDLE); + mt->nhs.button = BITMASK(MT_BUTTON_MIDDLE); } - gs->btmask = (mt->ns.button ^ mt->os.button) & BITONES(DIM_BUTTON); - gs->btdata = mt->ns.button & BITONES(DIM_BUTTON); - mt->os = mt->ns; + gs->btmask = (mt->nhs.button ^ mt->ohs.button) & BITONES(DIM_BUTTON); + gs->btdata = mt->nhs.button & BITONES(DIM_BUTTON); + mt->ohs = mt->nhs; } diff --git a/src/state.c b/src/hwstate.c index 72bb759..7e40b50 100644 --- a/src/state.c +++ b/src/hwstate.c @@ -19,7 +19,7 @@ * **************************************************************************/ -#include "state.h" +#include "hwstate.h" #include <stdlib.h> #include <limits.h> @@ -27,9 +27,9 @@ const double FTW = 0.05; const double FTS = 0.05; const int XMAX = 32767; -void init_state(struct State *s) +void init_hwstate(struct HWState *s) { - memset(s, 0, sizeof(struct State)); + memset(s, 0, sizeof(struct HWState)); } static int fincmp(const void *a, const void *b) @@ -74,9 +74,9 @@ static int touching_finger(const struct FingerData *hw, return 1; } -void modify_state(struct State *s, - const struct HWData *hw, - const struct Capabilities *caps) +void modify_hwstate(struct HWState *s, + const struct HWData *hw, + const struct Capabilities *caps) { int A[DIM2_FINGER], *row; int sid[DIM_FINGER], hw2s[DIM_FINGER]; @@ -112,7 +112,7 @@ void modify_state(struct State *s, qsort(s->finger, s->nfinger, sizeof(struct FingerState), fincmp); } -const struct FingerState *find_finger(const struct State *s, int id) +const struct FingerState *find_finger(const struct HWState *s, int id) { int i; @@ -125,7 +125,7 @@ const struct FingerState *find_finger(const struct State *s, int id) return NULL; } -int count_fingers(const struct State *s) +int count_fingers(const struct HWState *s) { int i, n = 0; for (i = 0; i < s->nfinger; i++) @@ -134,7 +134,7 @@ int count_fingers(const struct State *s) return n; } -void output_state(const struct State *s) +void output_hwstate(const struct HWState *s) { int i; xf86Msg(X_INFO, "buttons: %d%d%d\n", diff --git a/src/state.h b/src/hwstate.h index 2c2d2b7..fd53e71 100644 --- a/src/state.h +++ b/src/hwstate.h @@ -31,7 +31,7 @@ struct FingerState { int id; }; -struct State { +struct HWState { struct FingerState finger[DIM_FINGER]; unsigned button; int nfinger; @@ -39,13 +39,13 @@ struct State { int lastid; }; -void init_state(struct State *s); -void modify_state(struct State *s, - const struct HWData *hw, - const struct Capabilities *caps); -void output_state(const struct State *s); +void init_hwstate(struct HWState *s); +void modify_hwstate(struct HWState *s, + const struct HWData *hw, + const struct Capabilities *caps); +void output_hwstate(const struct HWState *s); -const struct FingerState *find_finger(const struct State *s, int id); -int count_fingers(const struct State *s); +const struct FingerState *find_finger(const struct HWState *s, int id); +int count_fingers(const struct HWState *s); #endif diff --git a/src/mtouch.c b/src/mtouch.c index f7ffb12..5bf72ec 100644 --- a/src/mtouch.c +++ b/src/mtouch.c @@ -35,8 +35,8 @@ int open_mtouch(struct MTouch *mt, int fd) int rc; init_iobuf(&mt->buf); init_hwdata(&mt->hw); - init_state(&mt->os); - init_state(&mt->ns); + init_hwstate(&mt->ohs); + init_hwstate(&mt->nhs); SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1)); return rc; } @@ -59,5 +59,5 @@ int read_synchronized_event(struct MTouch *mt, int fd) void parse_event(struct MTouch *mt) { - modify_state(&mt->ns, &mt->hw, &mt->caps); + modify_hwstate(&mt->nhs, &mt->hw, &mt->caps); } diff --git a/src/mtouch.h b/src/mtouch.h index 753a400..e4a59fb 100644 --- a/src/mtouch.h +++ b/src/mtouch.h @@ -25,13 +25,13 @@ #include "capabilities.h" #include "iobuffer.h" #include "hwdata.h" -#include "state.h" +#include "hwstate.h" struct MTouch { struct Capabilities caps; struct IOBuffer buf; struct HWData hw; - struct State os, ns; + struct HWState ohs, nhs; }; int configure_mtouch(struct MTouch *mt, int fd); |