inpututils.h revision 35c4bbdf
19ace9065Smrg/*
29ace9065Smrg * Copyright © 2010 Red Hat, Inc.
39ace9065Smrg *
49ace9065Smrg * Permission is hereby granted, free of charge, to any person obtaining a
59ace9065Smrg * copy of this software and associated documentation files (the "Software"),
69ace9065Smrg * to deal in the Software without restriction, including without limitation
79ace9065Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
89ace9065Smrg * and/or sell copies of the Software, and to permit persons to whom the
99ace9065Smrg * Software is furnished to do so, subject to the following conditions:
109ace9065Smrg *
119ace9065Smrg * The above copyright notice and this permission notice (including the next
129ace9065Smrg * paragraph) shall be included in all copies or substantial portions of the
139ace9065Smrg * Software.
149ace9065Smrg *
159ace9065Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
169ace9065Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
179ace9065Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
189ace9065Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
199ace9065Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
209ace9065Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
219ace9065Smrg * DEALINGS IN THE SOFTWARE.
229ace9065Smrg *
239ace9065Smrg */
249ace9065Smrg
259ace9065Smrg#ifdef HAVE_DIX_CONFIG_H
269ace9065Smrg#include "dix-config.h"
279ace9065Smrg#endif
289ace9065Smrg
299ace9065Smrg#ifndef INPUTUTILS_H
309ace9065Smrg#define INPUTUTILS_H
319ace9065Smrg
329ace9065Smrg#include "input.h"
3335c4bbdfSmrg#include <X11/extensions/XI2proto.h>
3435c4bbdfSmrg
3535c4bbdfSmrgextern Mask event_filters[MAXDEVICES][MAXEVENTS];
369ace9065Smrg
379ace9065Smrgstruct _ValuatorMask {
3835c4bbdfSmrg    int8_t last_bit;            /* highest bit set in mask */
3935c4bbdfSmrg    int8_t has_unaccelerated;
4035c4bbdfSmrg    uint8_t mask[(MAX_VALUATORS + 7) / 8];
4135c4bbdfSmrg    double valuators[MAX_VALUATORS];    /* valuator data */
4235c4bbdfSmrg    double unaccelerated[MAX_VALUATORS];    /* valuator data */
439ace9065Smrg};
449ace9065Smrg
4535c4bbdfSmrgextern void verify_internal_event(const InternalEvent *ev);
4635c4bbdfSmrgextern void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms);
4735c4bbdfSmrgextern int event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd);
4835c4bbdfSmrgextern void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd,
4935c4bbdfSmrg                            DeviceEvent *event);
5035c4bbdfSmrgextern Mask event_get_filter_from_type(DeviceIntPtr dev, int evtype);
5135c4bbdfSmrgextern Mask event_get_filter_from_xi2type(int evtype);
5235c4bbdfSmrg
5335c4bbdfSmrgFP3232 double_to_fp3232(double in);
5435c4bbdfSmrgFP1616 double_to_fp1616(double in);
5535c4bbdfSmrgdouble fp1616_to_double(FP1616 in);
5635c4bbdfSmrgdouble fp3232_to_double(FP3232 in);
5735c4bbdfSmrg
5835c4bbdfSmrgXI2Mask *xi2mask_new(void);
5935c4bbdfSmrgXI2Mask *xi2mask_new_with_size(size_t, size_t); /* don't use it */
6035c4bbdfSmrgvoid xi2mask_free(XI2Mask **mask);
6135c4bbdfSmrgBool xi2mask_isset(XI2Mask *mask, const DeviceIntPtr dev, int event_type);
6235c4bbdfSmrgBool xi2mask_isset_for_device(XI2Mask *mask, const DeviceIntPtr dev, int event_type);
6335c4bbdfSmrgvoid xi2mask_set(XI2Mask *mask, int deviceid, int event_type);
6435c4bbdfSmrgvoid xi2mask_zero(XI2Mask *mask, int deviceid);
6535c4bbdfSmrgvoid xi2mask_merge(XI2Mask *dest, const XI2Mask *source);
6635c4bbdfSmrgsize_t xi2mask_num_masks(const XI2Mask *mask);
6735c4bbdfSmrgsize_t xi2mask_mask_size(const XI2Mask *mask);
6835c4bbdfSmrgvoid xi2mask_set_one_mask(XI2Mask *xi2mask, int deviceid,
6935c4bbdfSmrg                          const unsigned char *mask, size_t mask_size);
7035c4bbdfSmrgconst unsigned char *xi2mask_get_one_mask(const XI2Mask *xi2mask, int deviceid);
719ace9065Smrg#endif
72