Commit 27addb06d4ebf6f8988a14174b2823c1a4ab1504

  • avatar
  • Peter Hutterer <peter.hutterer @wh…t.net> (Committer)
  • Fri Jan 01 03:13:44 CET 2010
  • avatar
  • Przemo Firszt (Author)
  • Wed Dec 23 16:20:57 CET 2009
Rename xf86Wcm* to wcm* - part 2

Rename xf86WcmTilt2R to wcmTilt2R

Rename xf86WcmMappingFactor to wcmMappingFactor

Change xf86WcmWrite to wcmWriteWait in comment

Rename xf86WcmInitialScreens to wcmInitialScreens

Rename xf86WcmDesktopSize to wcmDesktopSize

Reneme xf86WcmIsWacomDevice to wcmIsWacomDevice

Rename xf86WcmRotateTablet to wcmRotateTablet

Rename xf86WcmSuppress to wcmCheckSuppress

It's wcmCheckSuppress instead of wcmSuppress to avoid collision with variable
with the same name used in xf86WacomDefs.h

Rename some Wcm* to wcm* to keep function names consistent

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  
2525#include "Xwacom.h"
2626#include <xkbsrv.h>
2727
28void xf86WcmInitialScreens(LocalDevicePtr local);
29void xf86WcmRotateTablet(LocalDevicePtr local, int value);
28void wcmInitialScreens(LocalDevicePtr local);
29void wcmRotateTablet(LocalDevicePtr local, int value);
3030void wcmRotateCoordinates(LocalDevicePtr local, int* x, int* y);
3131
3232extern int xf86WcmDevSwitchModeCall(LocalDevicePtr local, int mode);
3434extern void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes);
3535extern void xf86WcmVirtualTabletSize(LocalDevicePtr local);
3636extern void xf86WcmVirtualTabletPadding(LocalDevicePtr local);
37extern void xf86WcmTilt2R(WacomDeviceStatePtr ds);
37extern void wcmTilt2R(WacomDeviceStatePtr ds);
3838extern void xf86WcmFingerTapToClick(WacomCommonPtr common);
3939
4040/*****************************************************************************
4949 int rx, int ry, int rz, int v3, int v4, int v5);
5050
5151/*****************************************************************************
52 * xf86WcmMappingFactor --
52 * wcmMappingFactor --
5353 * calculate the proper tablet to screen mapping factor according to the
5454 * screen/desktop size and the tablet size
5555 ****************************************************************************/
5656
57void xf86WcmMappingFactor(LocalDevicePtr local)
57void wcmMappingFactor(LocalDevicePtr local)
5858{
5959 WacomDevicePtr priv = (WacomDevicePtr) local->private;
6060
157157 priv->currentScreen);
158158 }
159159
160 xf86WcmMappingFactor(local);
160 wcmMappingFactor(local);
161161 if (!(priv->flags & ABSOLUTE_FLAG) || screenInfo.numScreens == 1 || !priv->wcmMMonitor)
162162 return;
163163
10181018}
10191019
10201020/*****************************************************************************
1021 * xf86WcmSuppress --
1021 * wcmCheckSuppress --
10221022 * Determine whether device state has changed enough - return 0
10231023 * if not.
10241024 ****************************************************************************/
10251025
1026static int xf86WcmSuppress(WacomCommonPtr common, const WacomDeviceState* dsOrig,
1026static int wcmCheckSuppress(WacomCommonPtr common, const WacomDeviceState* dsOrig,
10271027 WacomDeviceState* dsNew)
10281028{
10291029 int suppress = common->wcmSuppress;
11361136 if (strstr(common->wcmModel->name, "Intuos4"))
11371137 {
11381138 /* convert Intuos4 mouse tilt to rotation */
1139 xf86WcmTilt2R(&ds);
1139 wcmTilt2R(&ds);
11401140 }
11411141
11421142 fs = &pChannel->rawFilter;
11831183 }
11841184
11851185 /* Discard unwanted data */
1186 suppress = xf86WcmSuppress(common, pLast, &ds);
1186 suppress = wcmCheckSuppress(common, pLast, &ds);
11871187 if (!suppress)
11881188 {
11891189 resetSampleCounter(pChannel);
13611361 */
13621362 WacomToolAreaPtr outprox = NULL;
13631363 if (tool->current && tool->arealist->next &&
1364 !WcmPointInArea(tool->current, ds->x, ds->y))
1364 !wcmPointInArea(tool->current, ds->x, ds->y))
13651365 {
13661366 outprox = tool->current;
13671367 tool->current = NULL;
13781378 {
13791379 WacomToolAreaPtr area = tool->arealist;
13801380 for(; area; area = area->next)
1381 if (WcmPointInArea(area, ds->x, ds->y))
1381 if (wcmPointInArea(area, ds->x, ds->y))
13821382 break;
13831383 tool->current = area;
13841384 }
18071807}
18081808
18091809/*****************************************************************************
1810 * xf86WcmInitialScreens
1810 * wcmInitialScreens
18111811 ****************************************************************************/
18121812
1813void xf86WcmInitialScreens(LocalDevicePtr local)
1813void wcmInitialScreens(LocalDevicePtr local)
18141814{
18151815 WacomDevicePtr priv = (WacomDevicePtr)local->private;
18161816 int i;
19141914}
19151915
19161916/*****************************************************************************
1917 * xf86WcmRotateTablet
1917 * wcmRotateTablet
19181918 ****************************************************************************/
19191919
1920void xf86WcmRotateTablet(LocalDevicePtr local, int value)
1920void wcmRotateTablet(LocalDevicePtr local, int value)
19211921{
19221922 WacomDevicePtr priv = (WacomDevicePtr)local->private;
19231923 WacomCommonPtr common = priv->common;
19961996 }
19971997}
19981998
1999/* WcmPointInArea - check whether the point is within the area */
1999/* wcmPointInArea - check whether the point is within the area */
20002000
2001Bool WcmPointInArea(WacomToolAreaPtr area, int x, int y)
2001Bool wcmPointInArea(WacomToolAreaPtr area, int x, int y)
20022002{
20032003 if (area->topX <= x && x <= area->bottomX &&
20042004 area->topY <= y && y <= area->bottomY)
20062006 return 0;
20072007}
20082008
2009/* WcmAreasOverlap - check if two areas are overlapping */
2009/* wcmAreasOverlap - check if two areas are overlapping */
20102010
2011static Bool WcmAreasOverlap(WacomToolAreaPtr area1, WacomToolAreaPtr area2)
2011static Bool wcmAreasOverlap(WacomToolAreaPtr area1, WacomToolAreaPtr area2)
20122012{
2013 if (WcmPointInArea(area1, area2->topX, area2->topY) ||
2014 WcmPointInArea(area1, area2->topX, area2->bottomY) ||
2015 WcmPointInArea(area1, area2->bottomX, area2->topY) ||
2016 WcmPointInArea(area1, area2->bottomX, area2->bottomY))
2013 if (wcmPointInArea(area1, area2->topX, area2->topY) ||
2014 wcmPointInArea(area1, area2->topX, area2->bottomY) ||
2015 wcmPointInArea(area1, area2->bottomX, area2->topY) ||
2016 wcmPointInArea(area1, area2->bottomX, area2->bottomY))
20172017 return 1;
2018 if (WcmPointInArea(area2, area1->topX, area1->topY) ||
2019 WcmPointInArea(area2, area1->topX, area1->bottomY) ||
2020 WcmPointInArea(area2, area1->bottomX, area1->topY) ||
2021 WcmPointInArea(area2, area1->bottomX, area1->bottomY))
2018 if (wcmPointInArea(area2, area1->topX, area1->topY) ||
2019 wcmPointInArea(area2, area1->topX, area1->bottomY) ||
2020 wcmPointInArea(area2, area1->bottomX, area1->topY) ||
2021 wcmPointInArea(area2, area1->bottomX, area1->bottomY))
20222022 return 1;
20232023 return 0;
20242024}
20252025
2026/* WcmAreaListOverlaps - check if the area overlaps any area in the list */
2027Bool WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list)
2026/* wcmAreaListOverlap - check if the area overlaps any area in the list */
2027Bool wcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list)
20282028{
20292029 for (; list; list=list->next)
2030 if (area != list && WcmAreasOverlap(list, area))
2030 if (area != list && wcmAreasOverlap(list, area))
20312031 return 1;
20322032 return 0;
20332033}
  
2626#include <sys/stat.h>
2727#include <fcntl.h>
2828
29extern Bool xf86WcmIsWacomDevice (char* fname);
29extern Bool wcmIsWacomDevice (char* fname);
3030extern Bool wcmIsAValidType(const char* type, unsigned long* keys);
3131extern int wcmIsDuplicate(char* device, LocalDevicePtr local);
3232extern int wcmNeedAutoHotplug(LocalDevicePtr local,
  
545545}
546546
547547/*****************************************************************************
548 * xf86WcmWrite --
548 * wcmWriteWait --
549549 * send a request
550550 ****************************************************************************/
551551
  
2222
2323#include "xf86Wacom.h"
2424
25void xf86WcmTilt2R(WacomDeviceStatePtr ds);
25void wcmTilt2R(WacomDeviceStatePtr ds);
2626
2727/* Constants to convert X and Y tilt to rotation */
2828unsigned short tiltTable_00[65] = {
690690};
691691
692692/*****************************************************************************
693 * xf86WcmTilt2R -
693 * wcmTilt2R -
694694 * Converts tilt X and Y to rotation, for Intuos4 mouse for now.
695695 * It can be used for other devices when necessary.
696696 ****************************************************************************/
697697
698void xf86WcmTilt2R(WacomDeviceStatePtr ds)
698void wcmTilt2R(WacomDeviceStatePtr ds)
699699{
700700 short tilt_x = ds->tiltx;
701701 short tilt_y = ds->tilty;
  
2525#include "wcmFilter.h"
2626
2727extern void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes);
28extern void xf86WcmRotateTablet(LocalDevicePtr local, int value);
29extern void xf86WcmInitialScreens(LocalDevicePtr local);
28extern void wcmRotateTablet(LocalDevicePtr local, int value);
29extern void wcmInitialScreens(LocalDevicePtr local);
3030
3131int xf86WcmDevSwitchModeCall(LocalDevicePtr local, int mode);
3232int xf86WcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode);
135135
136136 if (priv->screen_no != -1)
137137 priv->currentScreen = priv->screen_no;
138 xf86WcmInitialScreens(local);
138 wcmInitialScreens(local);
139139 xf86WcmInitialCoordinates(local, 0);
140140 xf86WcmInitialCoordinates(local, 1);
141141}
330330 area->bottomY = values[3];
331331
332332 /* validate the area */
333 if (WcmAreaListOverlap(area, priv->tool->arealist))
333 if (wcmAreaListOverlap(area, priv->tool->arealist))
334334 {
335335 *area = tmp_area;
336336 return BadValue;
407407 return BadValue;
408408
409409 if (!checkonly && common->wcmRotate != value)
410 xf86WcmRotateTablet(local, value);
410 wcmRotateTablet(local, value);
411411 } else if (property == prop_serials)
412412 {
413413 return BadValue; /* Read-only */
  
5353
5454void xf86WcmVirtualTabletPadding(LocalDevicePtr local);
5555void xf86WcmVirtualTabletSize(LocalDevicePtr local);
56Bool xf86WcmIsWacomDevice (char* fname);
56Bool wcmIsWacomDevice (char* fname);
5757
5858#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
5959 extern void InitWcmDeviceProperties(LocalDevicePtr local);
6262#endif
6363
6464extern int xf86WcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode);
65extern void xf86WcmRotateTablet(LocalDevicePtr local, int value);
66extern void xf86WcmInitialScreens(LocalDevicePtr local);
65extern void wcmRotateTablet(LocalDevicePtr local, int value);
66extern void wcmInitialScreens(LocalDevicePtr local);
6767extern void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes);
6868
6969static int xf86WcmDevOpen(DeviceIntPtr pWcm);
109109}
110110
111111/*****************************************************************************
112 * xf86WcmDesktopSize --
112 * wcmDesktopSize --
113113 * calculate the whole desktop size
114114 ****************************************************************************/
115static void xf86WcmDesktopSize(LocalDevicePtr local)
115static void wcmDesktopSize(LocalDevicePtr local)
116116{
117117 WacomDevicePtr priv = (WacomDevicePtr) local->private;
118118 int i = 0, minX = 0, minY = 0, maxX = 0, maxY = 0;
119119
120 xf86WcmInitialScreens(local);
120 wcmInitialScreens(local);
121121 minX = priv->screenTopX[0];
122122 minY = priv->screenTopY[0];
123123 maxX = priv->screenBottomX[0];
191191 }
192192
193193 /* need maxWidth and maxHeight for keepshape */
194 xf86WcmDesktopSize(local);
194 wcmDesktopSize(local);
195195
196196 /* Maintain aspect ratio to the whole desktop
197197 * May need to consider a specific screen in multimonitor settings
224224 inlist = priv->tool->arealist;
225225
226226 /* The first one in the list is always valid */
227 if (area != inlist && WcmAreaListOverlap(area, inlist))
227 if (area != inlist && wcmAreaListOverlap(area, inlist))
228228 {
229229 inlist = priv->tool->arealist;
230230
348348 Atom label;
349349#endif
350350
351 xf86WcmMappingFactor(local);
351 wcmMappingFactor(local);
352352
353353 /* x ax */
354354 if ( !axes )
788788 }
789789
790790 /* Rotation rotates the Max X and Y */
791 xf86WcmRotateTablet(local, common->wcmRotate);
791 wcmRotateTablet(local, common->wcmRotate);
792792
793793 /* pressure */
794794 InitValuatorAxisStruct(local->dev, 2,
887887 return TRUE;
888888}
889889
890Bool xf86WcmIsWacomDevice (char* fname)
890Bool wcmIsWacomDevice (char* fname)
891891{
892892 int fd = -1;
893893 struct input_id id;
930930 Bool is_wacom;
931931
932932 sprintf(fname, DEV_INPUT_EVENT, i);
933 is_wacom = xf86WcmIsWacomDevice(fname);
933 is_wacom = wcmIsWacomDevice(fname);
934934 if (is_wacom)
935935 {
936936 xf86Msg(X_PROBED, "%s: probed device is %s (waited %d msec)\n",
  
168168void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds);
169169
170170/* generic area check for xf86Wacom.c, wcmCommon.c and wcmXCommand.c */
171Bool WcmPointInArea(WacomToolAreaPtr area, int x, int y);
172Bool WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list);
171Bool wcmPointInArea(WacomToolAreaPtr area, int x, int y);
172Bool wcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list);
173173
174174/* Change pad's mode according to it core event status */
175175int xf86WcmSetPadCoreMode(LocalDevicePtr local);
176176
177177/* calculate the proper tablet to screen mapping factor */
178void xf86WcmMappingFactor(LocalDevicePtr local);
178void wcmMappingFactor(LocalDevicePtr local);
179179
180180/****************************************************************************/
181181#endif /* __XF86WACOM_H */