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"
331b5d61b8Smrg#include "eventstr.h"
3435c4bbdfSmrg#include <X11/extensions/XI2proto.h>
3535c4bbdfSmrg
3635c4bbdfSmrgextern Mask event_filters[MAXDEVICES][MAXEVENTS];
379ace9065Smrg
389ace9065Smrgstruct _ValuatorMask {
3935c4bbdfSmrg    int8_t last_bit;            /* highest bit set in mask */
4035c4bbdfSmrg    int8_t has_unaccelerated;
4135c4bbdfSmrg    uint8_t mask[(MAX_VALUATORS + 7) / 8];
4235c4bbdfSmrg    double valuators[MAX_VALUATORS];    /* valuator data */
4335c4bbdfSmrg    double unaccelerated[MAX_VALUATORS];    /* valuator data */
449ace9065Smrg};
459ace9065Smrg
4635c4bbdfSmrgextern void verify_internal_event(const InternalEvent *ev);
471b5d61b8Smrgextern void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms,
481b5d61b8Smrg                              enum DeviceEventSource event_source);
49ed6184dfSmrgextern void init_gesture_event(GestureEvent *event, DeviceIntPtr dev, Time ms);
5035c4bbdfSmrgextern int event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd);
5135c4bbdfSmrgextern void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd,
5235c4bbdfSmrg                            DeviceEvent *event);
53ed6184dfSmrgextern void event_set_state_gesture(DeviceIntPtr kbd, GestureEvent *event);
5435c4bbdfSmrgextern Mask event_get_filter_from_type(DeviceIntPtr dev, int evtype);
5535c4bbdfSmrgextern Mask event_get_filter_from_xi2type(int evtype);
5635c4bbdfSmrg
5735c4bbdfSmrgFP3232 double_to_fp3232(double in);
5835c4bbdfSmrgFP1616 double_to_fp1616(double in);
5935c4bbdfSmrgdouble fp1616_to_double(FP1616 in);
6035c4bbdfSmrgdouble fp3232_to_double(FP3232 in);
6135c4bbdfSmrg
6235c4bbdfSmrgXI2Mask *xi2mask_new(void);
6335c4bbdfSmrgXI2Mask *xi2mask_new_with_size(size_t, size_t); /* don't use it */
6435c4bbdfSmrgvoid xi2mask_free(XI2Mask **mask);
6535c4bbdfSmrgBool xi2mask_isset(XI2Mask *mask, const DeviceIntPtr dev, int event_type);
6635c4bbdfSmrgBool xi2mask_isset_for_device(XI2Mask *mask, const DeviceIntPtr dev, int event_type);
6735c4bbdfSmrgvoid xi2mask_set(XI2Mask *mask, int deviceid, int event_type);
6835c4bbdfSmrgvoid xi2mask_zero(XI2Mask *mask, int deviceid);
6935c4bbdfSmrgvoid xi2mask_merge(XI2Mask *dest, const XI2Mask *source);
7035c4bbdfSmrgsize_t xi2mask_num_masks(const XI2Mask *mask);
7135c4bbdfSmrgsize_t xi2mask_mask_size(const XI2Mask *mask);
7235c4bbdfSmrgvoid xi2mask_set_one_mask(XI2Mask *xi2mask, int deviceid,
7335c4bbdfSmrg                          const unsigned char *mask, size_t mask_size);
7435c4bbdfSmrgconst unsigned char *xi2mask_get_one_mask(const XI2Mask *xi2mask, int deviceid);
75ed6184dfSmrg
76ed6184dfSmrgBool CopySprite(SpritePtr src, SpritePtr dst);
77ed6184dfSmrg
789ace9065Smrg#endif
79