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 /src | |
| parent | 173d728d812e78b299cbc9475fc237b9023eee2b (diff) | |
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>
Diffstat (limited to 'src')
| -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 |
5 files changed, 33 insertions, 33 deletions
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 @@ | |||
| 25 | 25 | ||
| 26 | void extract_gestures(struct Gestures *gs, struct MTouch* mt) | 26 | void extract_gestures(struct Gestures *gs, struct MTouch* mt) |
| 27 | { | 27 | { |
| 28 | const struct FingerState *b = mt->ns.finger; | 28 | const struct FingerState *b = mt->nhs.finger; |
| 29 | const struct FingerState *e = b + mt->ns.nfinger; | 29 | const struct FingerState *e = b + mt->nhs.nfinger; |
| 30 | const struct FingerState *p, *fs; | 30 | const struct FingerState *p, *fs; |
| 31 | int nof = count_fingers(&mt->os); | 31 | int nof = count_fingers(&mt->ohs); |
| 32 | int nsf = count_fingers(&mt->ns); | 32 | int nsf = count_fingers(&mt->nhs); |
| 33 | int dn = 0, i; | 33 | int dn = 0, i; |
| 34 | memset(gs, 0, sizeof(struct Gestures)); | 34 | memset(gs, 0, sizeof(struct Gestures)); |
| 35 | if (nof == nsf) { | 35 | if (nof == nsf) { |
| 36 | for (p = b; p != e; p++) { | 36 | for (p = b; p != e; p++) { |
| 37 | fs = find_finger(&mt->os, p->id); | 37 | fs = find_finger(&mt->ohs, p->id); |
| 38 | if (fs) { | 38 | if (fs) { |
| 39 | gs->dx += p->hw.position_x - fs->hw.position_x; | 39 | gs->dx += p->hw.position_x - fs->hw.position_x; |
| 40 | gs->dy += p->hw.position_y - fs->hw.position_y; | 40 | gs->dy += p->hw.position_y - fs->hw.position_y; |
| @@ -52,14 +52,14 @@ void extract_gestures(struct Gestures *gs, struct MTouch* mt) | |||
| 52 | if (nsf == 3) | 52 | if (nsf == 3) |
| 53 | SETBIT(gs->type, GS_HSCROLL); | 53 | SETBIT(gs->type, GS_HSCROLL); |
| 54 | } | 54 | } |
| 55 | if (mt->ns.button == BITMASK(MT_BUTTON_LEFT)) { | 55 | if (mt->nhs.button == BITMASK(MT_BUTTON_LEFT)) { |
| 56 | if (nsf == 2) | 56 | if (nsf == 2) |
| 57 | mt->ns.button = BITMASK(MT_BUTTON_RIGHT); | 57 | mt->nhs.button = BITMASK(MT_BUTTON_RIGHT); |
| 58 | if (nsf == 3) | 58 | if (nsf == 3) |
| 59 | mt->ns.button = BITMASK(MT_BUTTON_MIDDLE); | 59 | mt->nhs.button = BITMASK(MT_BUTTON_MIDDLE); |
| 60 | } | 60 | } |
| 61 | gs->btmask = (mt->ns.button ^ mt->os.button) & BITONES(DIM_BUTTON); | 61 | gs->btmask = (mt->nhs.button ^ mt->ohs.button) & BITONES(DIM_BUTTON); |
| 62 | gs->btdata = mt->ns.button & BITONES(DIM_BUTTON); | 62 | gs->btdata = mt->nhs.button & BITONES(DIM_BUTTON); |
| 63 | mt->os = mt->ns; | 63 | mt->ohs = mt->nhs; |
| 64 | } | 64 | } |
| 65 | 65 | ||
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 @@ | |||
| 19 | * | 19 | * |
| 20 | **************************************************************************/ | 20 | **************************************************************************/ |
| 21 | 21 | ||
| 22 | #include "state.h" | 22 | #include "hwstate.h" |
| 23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
| 24 | #include <limits.h> | 24 | #include <limits.h> |
| 25 | 25 | ||
| @@ -27,9 +27,9 @@ const double FTW = 0.05; | |||
| 27 | const double FTS = 0.05; | 27 | const double FTS = 0.05; |
| 28 | const int XMAX = 32767; | 28 | const int XMAX = 32767; |
| 29 | 29 | ||
| 30 | void init_state(struct State *s) | 30 | void init_hwstate(struct HWState *s) |
| 31 | { | 31 | { |
| 32 | memset(s, 0, sizeof(struct State)); | 32 | memset(s, 0, sizeof(struct HWState)); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | static int fincmp(const void *a, const void *b) | 35 | static int fincmp(const void *a, const void *b) |
| @@ -74,9 +74,9 @@ static int touching_finger(const struct FingerData *hw, | |||
| 74 | return 1; | 74 | return 1; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | void modify_state(struct State *s, | 77 | void modify_hwstate(struct HWState *s, |
| 78 | const struct HWData *hw, | 78 | const struct HWData *hw, |
| 79 | const struct Capabilities *caps) | 79 | const struct Capabilities *caps) |
| 80 | { | 80 | { |
| 81 | int A[DIM2_FINGER], *row; | 81 | int A[DIM2_FINGER], *row; |
| 82 | int sid[DIM_FINGER], hw2s[DIM_FINGER]; | 82 | int sid[DIM_FINGER], hw2s[DIM_FINGER]; |
| @@ -112,7 +112,7 @@ void modify_state(struct State *s, | |||
| 112 | qsort(s->finger, s->nfinger, sizeof(struct FingerState), fincmp); | 112 | qsort(s->finger, s->nfinger, sizeof(struct FingerState), fincmp); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | const struct FingerState *find_finger(const struct State *s, int id) | 115 | const struct FingerState *find_finger(const struct HWState *s, int id) |
| 116 | { | 116 | { |
| 117 | int i; | 117 | int i; |
| 118 | 118 | ||
| @@ -125,7 +125,7 @@ const struct FingerState *find_finger(const struct State *s, int id) | |||
| 125 | return NULL; | 125 | return NULL; |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | int count_fingers(const struct State *s) | 128 | int count_fingers(const struct HWState *s) |
| 129 | { | 129 | { |
| 130 | int i, n = 0; | 130 | int i, n = 0; |
| 131 | for (i = 0; i < s->nfinger; i++) | 131 | for (i = 0; i < s->nfinger; i++) |
| @@ -134,7 +134,7 @@ int count_fingers(const struct State *s) | |||
| 134 | return n; | 134 | return n; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | void output_state(const struct State *s) | 137 | void output_hwstate(const struct HWState *s) |
| 138 | { | 138 | { |
| 139 | int i; | 139 | int i; |
| 140 | xf86Msg(X_INFO, "buttons: %d%d%d\n", | 140 | 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 { | |||
| 31 | int id; | 31 | int id; |
| 32 | }; | 32 | }; |
| 33 | 33 | ||
| 34 | struct State { | 34 | struct HWState { |
| 35 | struct FingerState finger[DIM_FINGER]; | 35 | struct FingerState finger[DIM_FINGER]; |
| 36 | unsigned button; | 36 | unsigned button; |
| 37 | int nfinger; | 37 | int nfinger; |
| @@ -39,13 +39,13 @@ struct State { | |||
| 39 | int lastid; | 39 | int lastid; |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | void init_state(struct State *s); | 42 | void init_hwstate(struct HWState *s); |
| 43 | void modify_state(struct State *s, | 43 | void modify_hwstate(struct HWState *s, |
| 44 | const struct HWData *hw, | 44 | const struct HWData *hw, |
| 45 | const struct Capabilities *caps); | 45 | const struct Capabilities *caps); |
| 46 | void output_state(const struct State *s); | 46 | void output_hwstate(const struct HWState *s); |
| 47 | 47 | ||
| 48 | const struct FingerState *find_finger(const struct State *s, int id); | 48 | const struct FingerState *find_finger(const struct HWState *s, int id); |
| 49 | int count_fingers(const struct State *s); | 49 | int count_fingers(const struct HWState *s); |
| 50 | 50 | ||
| 51 | #endif | 51 | #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) | |||
| 35 | int rc; | 35 | int rc; |
| 36 | init_iobuf(&mt->buf); | 36 | init_iobuf(&mt->buf); |
| 37 | init_hwdata(&mt->hw); | 37 | init_hwdata(&mt->hw); |
| 38 | init_state(&mt->os); | 38 | init_hwstate(&mt->ohs); |
| 39 | init_state(&mt->ns); | 39 | init_hwstate(&mt->nhs); |
| 40 | SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1)); | 40 | SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1)); |
| 41 | return rc; | 41 | return rc; |
| 42 | } | 42 | } |
| @@ -59,5 +59,5 @@ int read_synchronized_event(struct MTouch *mt, int fd) | |||
| 59 | 59 | ||
| 60 | void parse_event(struct MTouch *mt) | 60 | void parse_event(struct MTouch *mt) |
| 61 | { | 61 | { |
| 62 | modify_state(&mt->ns, &mt->hw, &mt->caps); | 62 | modify_hwstate(&mt->nhs, &mt->hw, &mt->caps); |
| 63 | } | 63 | } |
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 @@ | |||
| 25 | #include "capabilities.h" | 25 | #include "capabilities.h" |
| 26 | #include "iobuffer.h" | 26 | #include "iobuffer.h" |
| 27 | #include "hwdata.h" | 27 | #include "hwdata.h" |
| 28 | #include "state.h" | 28 | #include "hwstate.h" |
| 29 | 29 | ||
| 30 | struct MTouch { | 30 | struct MTouch { |
| 31 | struct Capabilities caps; | 31 | struct Capabilities caps; |
| 32 | struct IOBuffer buf; | 32 | struct IOBuffer buf; |
| 33 | struct HWData hw; | 33 | struct HWData hw; |
| 34 | struct State os, ns; | 34 | struct HWState ohs, nhs; |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | int configure_mtouch(struct MTouch *mt, int fd); | 37 | int configure_mtouch(struct MTouch *mt, int fd); |
