0
|
1 |
/*****************************************************************************
|
|
2 |
** wacomcfg.h
|
|
3 |
**
|
|
4 |
** Copyright (C) 2003 - John E. Joganic
|
|
5 |
** Copyright (C) 2004-2008 - Ping Cheng
|
|
6 |
**
|
|
7 |
** This program is free software; you can redistribute it and/or
|
|
8 |
** modify it under the terms of the GNU Lesser General Public License
|
|
9 |
** as published by the Free Software Foundation; either version 2
|
|
10 |
** of the License, or (at your option) any later version.
|
|
11 |
**
|
|
12 |
** This program is distributed in the hope that it will be useful,
|
|
13 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 |
** GNU Lesser General Public License for more details.
|
|
16 |
**
|
|
17 |
** You should have received a copy of the GNU Lesser General Public License
|
|
18 |
** along with this program; if not, write to the Free Software
|
|
19 |
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
20 |
**
|
|
21 |
****************************************************************************/
|
|
22 |
|
|
23 |
#ifndef __LINUXWACOM_WACOMCFG_H
|
|
24 |
#define __LINUXWACOM_WACOMCFG_H
|
|
25 |
|
|
26 |
#include <X11/Xlib.h>
|
|
27 |
#include <X11/extensions/XInput.h>
|
|
28 |
#include <X11/extensions/XIproto.h>
|
|
29 |
|
|
30 |
/* JEJ - NOTE WE DO NOT INCLUDE Xwacom.h HERE. THIS ELIMINATES A CONFLICT
|
|
31 |
* WHEN THIS FILE IS INSTALLED SINCE Xwacom.h WILL IN MANY CASES NOT
|
|
32 |
* GO WITH IT. SOMEDAY IT MAY BE PART OF XFREE86. */
|
|
33 |
|
|
34 |
typedef struct _WACOMCONFIG WACOMCONFIG;
|
|
35 |
typedef struct _WACOMDEVICE WACOMDEVICE;
|
|
36 |
typedef void (*WACOMERRORFUNC)(int err, const char* pszText);
|
|
37 |
typedef struct _WACOMDEVICEINFO WACOMDEVICEINFO;
|
|
38 |
|
|
39 |
typedef enum
|
|
40 |
{
|
|
41 |
WACOMDEVICETYPE_UNKNOWN,
|
|
42 |
WACOMDEVICETYPE_CURSOR,
|
|
43 |
WACOMDEVICETYPE_STYLUS,
|
|
44 |
WACOMDEVICETYPE_ERASER,
|
|
45 |
WACOMDEVICETYPE_PAD,
|
|
46 |
WACOMDEVICETYPE_TOUCH,
|
|
47 |
WACOMDEVICETYPE_MAX
|
|
48 |
} WACOMDEVICETYPE;
|
|
49 |
|
|
50 |
struct _WACOMDEVICEINFO
|
|
51 |
{
|
|
52 |
const char* pszName;
|
|
53 |
WACOMDEVICETYPE type;
|
|
54 |
};
|
|
55 |
|
|
56 |
struct _WACOMCONFIG
|
|
57 |
{
|
|
58 |
Display* pDisp;
|
|
59 |
WACOMERRORFUNC pfnError;
|
|
60 |
XDeviceInfo * pDevs;
|
|
61 |
int nDevCnt;
|
|
62 |
};
|
|
63 |
|
|
64 |
struct _WACOMDEVICE
|
|
65 |
{
|
|
66 |
WACOMCONFIG* pCfg;
|
|
67 |
XDevice* pDev;
|
|
68 |
};
|
|
69 |
|
|
70 |
|
|
71 |
/*****************************************************************************
|
|
72 |
** Functions
|
|
73 |
*****************************************************************************/
|
|
74 |
|
|
75 |
WACOMCONFIG * WacomConfigInit(Display* pDisplay, WACOMERRORFUNC pfnErrorHandler);
|
|
76 |
/* Initializes configuration library.
|
|
77 |
* pDisplay - display to configure
|
|
78 |
* pfnErrorHandler - handler to which errors are reported; may be NULL
|
|
79 |
* Returns WACOMCONFIG handle on success, NULL on error.
|
|
80 |
* errno contains error code. */
|
|
81 |
|
|
82 |
void WacomConfigTerm(WACOMCONFIG * hConfig);
|
|
83 |
/* Terminates configuration library, releasing display. */
|
|
84 |
|
|
85 |
int WacomConfigListDevices(WACOMCONFIG * hConfig, WACOMDEVICEINFO** ppInfo,
|
|
86 |
unsigned int* puCount);
|
|
87 |
/* Returns a list of wacom devices.
|
|
88 |
* ppInfo - pointer to WACOMDEVICEINFO* to receive device data
|
|
89 |
* puSize - pointer to receive device count
|
|
90 |
* Returns 0 on success, -1 on failure. errno contains error code.
|
|
91 |
* Comments: You must free this structure using WacomConfigFree. */
|
|
92 |
|
|
93 |
WACOMDEVICE * WacomConfigOpenDevice(WACOMCONFIG * hConfig,
|
|
94 |
const char* pszDeviceName);
|
|
95 |
/* Open a device by name.
|
|
96 |
* pszDeviceName - name of XInput device corresponding to wacom device
|
|
97 |
* Returns handle to device on success, NULL on error.
|
|
98 |
* errno contains error code.
|
|
99 |
* Comments: Close using WacomConfigCloseDevice */
|
|
100 |
|
|
101 |
int WacomConfigCloseDevice(WACOMDEVICE * hDevice);
|
|
102 |
/* Closes a device.
|
|
103 |
* Returns 0 on success, -1 on error. errno contains error code. */
|
|
104 |
|
|
105 |
int WacomConfigSetRawParam(WACOMDEVICE * hDevice, int nParam, int nValue, unsigned * keys);
|
|
106 |
/* Sets the raw device parameter to specified value.
|
|
107 |
* nParam - valid paramters can be found Xwacom.h which is not
|
|
108 |
* automatically included.
|
|
109 |
* nValue - 32 bit integer value
|
|
110 |
* keys - an array of keys and modifiers
|
|
111 |
* Returns 0 on success, -1 on error. errno contains error code.
|
|
112 |
* EINVAL - invalid parameter or value
|
|
113 |
* EIO - unknown X failure, use XSetErrorHandler to capture complete
|
|
114 |
* error code and message
|
|
115 |
* Comments: Data is sent to wacom_drv module without any error checking.
|
|
116 |
* Generally, you should use the more specific handler functions in this
|
|
117 |
* library, but for some parameters, particularly experimental ones, you
|
|
118 |
* will probably have to set them directly. */
|
|
119 |
|
|
120 |
int WacomConfigGetRawParam(WACOMDEVICE *hDevice, int nParam, int *nValue, int valu, unsigned * keys);
|
|
121 |
/* Gets the raw device parameter.
|
|
122 |
* nParam - valid paramters can be found Xwacom.h which is not
|
|
123 |
* automatically included.
|
|
124 |
* nValue - the device parameter is returned in the integer
|
|
125 |
* pointed by this parameter.
|
|
126 |
* valu - calling valuator value: 1: Get 3: GetDefault
|
|
127 |
* keys - an array of keys and modifiers
|
|
128 |
* Returns 0 on success, -1 on error. errno contains error code.
|
|
129 |
* EINVAL - invalid parameter or value
|
|
130 |
* EIO - unknown X failure, use XSetErrorHandler to capture complete
|
|
131 |
* error code and message
|
|
132 |
*/
|
|
133 |
|
|
134 |
void WacomConfigFree(void* pvData);
|
|
135 |
/* Frees memory allocated by library. */
|
|
136 |
|
|
137 |
#endif /* __LINUXWACOM_WACOMCFG_H */
|
|
138 |
|