~jderose/ubuntu/raring/xserver-xorg-input-synaptics/clickpad

« back to all changes in this revision

Viewing changes to src/synproto.c

  • Committer: Package Import Robot
  • Author(s): Cyril Brulebois, Julien Cristau, Cyril Brulebois
  • Date: 2012-05-20 16:50:18 UTC
  • mfrom: (0.4.9)
  • mto: (61.1.1 quantal)
  • mto: This revision was merged to the branch mainline in revision 60.
  • Revision ID: package-import@ubuntu.com-20120520165018-ap60y9jh84nv75vp
Tags: 1.6.1-1
[ Julien Cristau ]
* The mtdev build-dep is linux-only (closes: #672572).  Thanks, Pino
  Toscano!

[ Cyril Brulebois ]
* New upstream release, from the 1.6 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 * DEALINGS IN THE SOFTWARE.
22
22
 */
23
23
 
24
 
 
25
24
#include "synproto.h"
26
25
#include "synaptics.h"
27
26
#include "synapticsstr.h"
28
27
 
29
28
#ifdef HAVE_MULTITOUCH
30
29
static int
31
 
HwStateAllocTouch(struct SynapticsHwState *hw, SynapticsPrivate *priv)
 
30
HwStateAllocTouch(struct SynapticsHwState *hw, SynapticsPrivate * priv)
32
31
{
33
32
    int num_vals;
34
33
    int i = 0;
38
37
    if (!hw->mt_mask)
39
38
        goto fail;
40
39
 
41
 
    num_vals = 2; /* x and y */
42
 
    num_vals += 2; /* scroll axes */
 
40
    num_vals = 2;               /* x and y */
 
41
    num_vals += 2;              /* scroll axes */
43
42
    num_vals += priv->num_mt_axes;
44
43
 
45
 
    for (; i < hw->num_mt_mask; i++)
46
 
    {
 
44
    for (; i < hw->num_mt_mask; i++) {
47
45
        hw->mt_mask[i] = valuator_mask_new(num_vals);
48
46
        if (!hw->mt_mask[i])
49
47
            goto fail;
55
53
 
56
54
    return Success;
57
55
 
58
 
fail:
 
56
 fail:
59
57
    for (i--; i >= 0; i--)
60
58
        valuator_mask_free(&hw->mt_mask[i]);
61
59
    free(hw->mt_mask);
65
63
#endif
66
64
 
67
65
struct SynapticsHwState *
68
 
SynapticsHwStateAlloc(SynapticsPrivate *priv)
 
66
SynapticsHwStateAlloc(SynapticsPrivate * priv)
69
67
{
70
68
    struct SynapticsHwState *hw;
71
69
 
74
72
        return NULL;
75
73
 
76
74
#ifdef HAVE_MULTITOUCH
77
 
    if (HwStateAllocTouch(hw, priv) != Success)
78
 
    {
 
75
    if (HwStateAllocTouch(hw, priv) != Success) {
79
76
        free(hw);
80
77
        return NULL;
81
78
    }
162
159
#ifdef HAVE_MULTITOUCH
163
160
    int i;
164
161
 
165
 
    for (i = 0; i < hw->num_mt_mask; i++)
166
 
    {
 
162
    for (i = 0; i < hw->num_mt_mask; i++) {
167
163
        int j;
168
164
 
169
165
        /* Leave x and y valuators in case we need to restart touch */
170
166
        for (j = 2; j < valuator_mask_num_valuators(hw->mt_mask[i]); j++)
171
167
            valuator_mask_unset(hw->mt_mask[i], j);
172
168
 
173
 
        switch (hw->slot_state[i])
174
 
        {
175
 
            case SLOTSTATE_OPEN:
176
 
            case SLOTSTATE_OPEN_EMPTY:
177
 
            case SLOTSTATE_UPDATE:
178
 
                hw->slot_state[i] = set_slot_empty ? SLOTSTATE_EMPTY : SLOTSTATE_OPEN_EMPTY;
179
 
                break;
 
169
        switch (hw->slot_state[i]) {
 
170
        case SLOTSTATE_OPEN:
 
171
        case SLOTSTATE_OPEN_EMPTY:
 
172
        case SLOTSTATE_UPDATE:
 
173
            hw->slot_state[i] =
 
174
                set_slot_empty ? SLOTSTATE_EMPTY : SLOTSTATE_OPEN_EMPTY;
 
175
            break;
180
176
 
181
 
            default:
182
 
                hw->slot_state[i] = SLOTSTATE_EMPTY;
183
 
                break;
 
177
        default:
 
178
            hw->slot_state[i] = SLOTSTATE_EMPTY;
 
179
            break;
184
180
        }
185
181
    }
186
182
#endif