Commit 27addb06d4ebf6f8988a14174b2823c1a4ab1504
- Diff rendering mode:
- inline
- side by side
src/wcmCommon.c
(31 / 31)
|   | |||
| 25 | 25 | #include "Xwacom.h" | |
| 26 | 26 | #include <xkbsrv.h> | |
| 27 | 27 | ||
| 28 | void xf86WcmInitialScreens(LocalDevicePtr local); | ||
| 29 | void xf86WcmRotateTablet(LocalDevicePtr local, int value); | ||
| 28 | void wcmInitialScreens(LocalDevicePtr local); | ||
| 29 | void wcmRotateTablet(LocalDevicePtr local, int value); | ||
| 30 | 30 | void wcmRotateCoordinates(LocalDevicePtr local, int* x, int* y); | |
| 31 | 31 | ||
| 32 | 32 | extern int xf86WcmDevSwitchModeCall(LocalDevicePtr local, int mode); | |
| … | … | ||
| 34 | 34 | extern void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes); | |
| 35 | 35 | extern void xf86WcmVirtualTabletSize(LocalDevicePtr local); | |
| 36 | 36 | extern void xf86WcmVirtualTabletPadding(LocalDevicePtr local); | |
| 37 | extern void xf86WcmTilt2R(WacomDeviceStatePtr ds); | ||
| 37 | extern void wcmTilt2R(WacomDeviceStatePtr ds); | ||
| 38 | 38 | extern void xf86WcmFingerTapToClick(WacomCommonPtr common); | |
| 39 | 39 | ||
| 40 | 40 | /***************************************************************************** | |
| … | … | ||
| 49 | 49 | int rx, int ry, int rz, int v3, int v4, int v5); | |
| 50 | 50 | ||
| 51 | 51 | /***************************************************************************** | |
| 52 | * xf86WcmMappingFactor -- | ||
| 52 | * wcmMappingFactor -- | ||
| 53 | 53 | * calculate the proper tablet to screen mapping factor according to the | |
| 54 | 54 | * screen/desktop size and the tablet size | |
| 55 | 55 | ****************************************************************************/ | |
| 56 | 56 | ||
| 57 | void xf86WcmMappingFactor(LocalDevicePtr local) | ||
| 57 | void wcmMappingFactor(LocalDevicePtr local) | ||
| 58 | 58 | { | |
| 59 | 59 | WacomDevicePtr priv = (WacomDevicePtr) local->private; | |
| 60 | 60 | ||
| … | … | ||
| 157 | 157 | priv->currentScreen); | |
| 158 | 158 | } | |
| 159 | 159 | ||
| 160 | xf86WcmMappingFactor(local); | ||
| 160 | wcmMappingFactor(local); | ||
| 161 | 161 | if (!(priv->flags & ABSOLUTE_FLAG) || screenInfo.numScreens == 1 || !priv->wcmMMonitor) | |
| 162 | 162 | return; | |
| 163 | 163 | ||
| … | … | ||
| 1018 | 1018 | } | |
| 1019 | 1019 | ||
| 1020 | 1020 | /***************************************************************************** | |
| 1021 | * xf86WcmSuppress -- | ||
| 1021 | * wcmCheckSuppress -- | ||
| 1022 | 1022 | * Determine whether device state has changed enough - return 0 | |
| 1023 | 1023 | * if not. | |
| 1024 | 1024 | ****************************************************************************/ | |
| 1025 | 1025 | ||
| 1026 | static int xf86WcmSuppress(WacomCommonPtr common, const WacomDeviceState* dsOrig, | ||
| 1026 | static int wcmCheckSuppress(WacomCommonPtr common, const WacomDeviceState* dsOrig, | ||
| 1027 | 1027 | WacomDeviceState* dsNew) | |
| 1028 | 1028 | { | |
| 1029 | 1029 | int suppress = common->wcmSuppress; | |
| … | … | ||
| 1136 | 1136 | if (strstr(common->wcmModel->name, "Intuos4")) | |
| 1137 | 1137 | { | |
| 1138 | 1138 | /* convert Intuos4 mouse tilt to rotation */ | |
| 1139 | xf86WcmTilt2R(&ds); | ||
| 1139 | wcmTilt2R(&ds); | ||
| 1140 | 1140 | } | |
| 1141 | 1141 | ||
| 1142 | 1142 | fs = &pChannel->rawFilter; | |
| … | … | ||
| 1183 | 1183 | } | |
| 1184 | 1184 | ||
| 1185 | 1185 | /* Discard unwanted data */ | |
| 1186 | suppress = xf86WcmSuppress(common, pLast, &ds); | ||
| 1186 | suppress = wcmCheckSuppress(common, pLast, &ds); | ||
| 1187 | 1187 | if (!suppress) | |
| 1188 | 1188 | { | |
| 1189 | 1189 | resetSampleCounter(pChannel); | |
| … | … | ||
| 1361 | 1361 | */ | |
| 1362 | 1362 | WacomToolAreaPtr outprox = NULL; | |
| 1363 | 1363 | if (tool->current && tool->arealist->next && | |
| 1364 | !WcmPointInArea(tool->current, ds->x, ds->y)) | ||
| 1364 | !wcmPointInArea(tool->current, ds->x, ds->y)) | ||
| 1365 | 1365 | { | |
| 1366 | 1366 | outprox = tool->current; | |
| 1367 | 1367 | tool->current = NULL; | |
| … | … | ||
| 1378 | 1378 | { | |
| 1379 | 1379 | WacomToolAreaPtr area = tool->arealist; | |
| 1380 | 1380 | for(; area; area = area->next) | |
| 1381 | if (WcmPointInArea(area, ds->x, ds->y)) | ||
| 1381 | if (wcmPointInArea(area, ds->x, ds->y)) | ||
| 1382 | 1382 | break; | |
| 1383 | 1383 | tool->current = area; | |
| 1384 | 1384 | } | |
| … | … | ||
| 1807 | 1807 | } | |
| 1808 | 1808 | ||
| 1809 | 1809 | /***************************************************************************** | |
| 1810 | * xf86WcmInitialScreens | ||
| 1810 | * wcmInitialScreens | ||
| 1811 | 1811 | ****************************************************************************/ | |
| 1812 | 1812 | ||
| 1813 | void xf86WcmInitialScreens(LocalDevicePtr local) | ||
| 1813 | void wcmInitialScreens(LocalDevicePtr local) | ||
| 1814 | 1814 | { | |
| 1815 | 1815 | WacomDevicePtr priv = (WacomDevicePtr)local->private; | |
| 1816 | 1816 | int i; | |
| … | … | ||
| 1914 | 1914 | } | |
| 1915 | 1915 | ||
| 1916 | 1916 | /***************************************************************************** | |
| 1917 | * xf86WcmRotateTablet | ||
| 1917 | * wcmRotateTablet | ||
| 1918 | 1918 | ****************************************************************************/ | |
| 1919 | 1919 | ||
| 1920 | void xf86WcmRotateTablet(LocalDevicePtr local, int value) | ||
| 1920 | void wcmRotateTablet(LocalDevicePtr local, int value) | ||
| 1921 | 1921 | { | |
| 1922 | 1922 | WacomDevicePtr priv = (WacomDevicePtr)local->private; | |
| 1923 | 1923 | WacomCommonPtr common = priv->common; | |
| … | … | ||
| 1996 | 1996 | } | |
| 1997 | 1997 | } | |
| 1998 | 1998 | ||
| 1999 | /* WcmPointInArea - check whether the point is within the area */ | ||
| 1999 | /* wcmPointInArea - check whether the point is within the area */ | ||
| 2000 | 2000 | ||
| 2001 | Bool WcmPointInArea(WacomToolAreaPtr area, int x, int y) | ||
| 2001 | Bool wcmPointInArea(WacomToolAreaPtr area, int x, int y) | ||
| 2002 | 2002 | { | |
| 2003 | 2003 | if (area->topX <= x && x <= area->bottomX && | |
| 2004 | 2004 | area->topY <= y && y <= area->bottomY) | |
| … | … | ||
| 2006 | 2006 | return 0; | |
| 2007 | 2007 | } | |
| 2008 | 2008 | ||
| 2009 | /* WcmAreasOverlap - check if two areas are overlapping */ | ||
| 2009 | /* wcmAreasOverlap - check if two areas are overlapping */ | ||
| 2010 | 2010 | ||
| 2011 | static Bool WcmAreasOverlap(WacomToolAreaPtr area1, WacomToolAreaPtr area2) | ||
| 2011 | static Bool wcmAreasOverlap(WacomToolAreaPtr area1, WacomToolAreaPtr area2) | ||
| 2012 | 2012 | { | |
| 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)) | ||
| 2017 | 2017 | 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)) | ||
| 2022 | 2022 | return 1; | |
| 2023 | 2023 | return 0; | |
| 2024 | 2024 | } | |
| 2025 | 2025 | ||
| 2026 | /* WcmAreaListOverlaps - check if the area overlaps any area in the list */ | ||
| 2027 | Bool WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list) | ||
| 2026 | /* wcmAreaListOverlap - check if the area overlaps any area in the list */ | ||
| 2027 | Bool wcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list) | ||
| 2028 | 2028 | { | |
| 2029 | 2029 | for (; list; list=list->next) | |
| 2030 | if (area != list && WcmAreasOverlap(list, area)) | ||
| 2030 | if (area != list && wcmAreasOverlap(list, area)) | ||
| 2031 | 2031 | return 1; | |
| 2032 | 2032 | return 0; | |
| 2033 | 2033 | } |
src/wcmConfig.c
(1 / 1)
|   | |||
| 26 | 26 | #include <sys/stat.h> | |
| 27 | 27 | #include <fcntl.h> | |
| 28 | 28 | ||
| 29 | extern Bool xf86WcmIsWacomDevice (char* fname); | ||
| 29 | extern Bool wcmIsWacomDevice (char* fname); | ||
| 30 | 30 | extern Bool wcmIsAValidType(const char* type, unsigned long* keys); | |
| 31 | 31 | extern int wcmIsDuplicate(char* device, LocalDevicePtr local); | |
| 32 | 32 | extern int wcmNeedAutoHotplug(LocalDevicePtr local, |
src/wcmISDV4.c
(1 / 1)
|   | |||
| 545 | 545 | } | |
| 546 | 546 | ||
| 547 | 547 | /***************************************************************************** | |
| 548 | * xf86WcmWrite -- | ||
| 548 | * wcmWriteWait -- | ||
| 549 | 549 | * send a request | |
| 550 | 550 | ****************************************************************************/ | |
| 551 | 551 |
src/wcmTilt2Rotation.c
(3 / 3)
|   | |||
| 22 | 22 | ||
| 23 | 23 | #include "xf86Wacom.h" | |
| 24 | 24 | ||
| 25 | void xf86WcmTilt2R(WacomDeviceStatePtr ds); | ||
| 25 | void wcmTilt2R(WacomDeviceStatePtr ds); | ||
| 26 | 26 | ||
| 27 | 27 | /* Constants to convert X and Y tilt to rotation */ | |
| 28 | 28 | unsigned short tiltTable_00[65] = { | |
| … | … | ||
| 690 | 690 | }; | |
| 691 | 691 | ||
| 692 | 692 | /***************************************************************************** | |
| 693 | * xf86WcmTilt2R - | ||
| 693 | * wcmTilt2R - | ||
| 694 | 694 | * Converts tilt X and Y to rotation, for Intuos4 mouse for now. | |
| 695 | 695 | * It can be used for other devices when necessary. | |
| 696 | 696 | ****************************************************************************/ | |
| 697 | 697 | ||
| 698 | void xf86WcmTilt2R(WacomDeviceStatePtr ds) | ||
| 698 | void wcmTilt2R(WacomDeviceStatePtr ds) | ||
| 699 | 699 | { | |
| 700 | 700 | short tilt_x = ds->tiltx; | |
| 701 | 701 | short tilt_y = ds->tilty; |
src/wcmXCommand.c
(5 / 5)
|   | |||
| 25 | 25 | #include "wcmFilter.h" | |
| 26 | 26 | ||
| 27 | 27 | extern void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes); | |
| 28 | extern void xf86WcmRotateTablet(LocalDevicePtr local, int value); | ||
| 29 | extern void xf86WcmInitialScreens(LocalDevicePtr local); | ||
| 28 | extern void wcmRotateTablet(LocalDevicePtr local, int value); | ||
| 29 | extern void wcmInitialScreens(LocalDevicePtr local); | ||
| 30 | 30 | ||
| 31 | 31 | int xf86WcmDevSwitchModeCall(LocalDevicePtr local, int mode); | |
| 32 | 32 | int xf86WcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode); | |
| … | … | ||
| 135 | 135 | ||
| 136 | 136 | if (priv->screen_no != -1) | |
| 137 | 137 | priv->currentScreen = priv->screen_no; | |
| 138 | xf86WcmInitialScreens(local); | ||
| 138 | wcmInitialScreens(local); | ||
| 139 | 139 | xf86WcmInitialCoordinates(local, 0); | |
| 140 | 140 | xf86WcmInitialCoordinates(local, 1); | |
| 141 | 141 | } | |
| … | … | ||
| 330 | 330 | area->bottomY = values[3]; | |
| 331 | 331 | ||
| 332 | 332 | /* validate the area */ | |
| 333 | if (WcmAreaListOverlap(area, priv->tool->arealist)) | ||
| 333 | if (wcmAreaListOverlap(area, priv->tool->arealist)) | ||
| 334 | 334 | { | |
| 335 | 335 | *area = tmp_area; | |
| 336 | 336 | return BadValue; | |
| … | … | ||
| 407 | 407 | return BadValue; | |
| 408 | 408 | ||
| 409 | 409 | if (!checkonly && common->wcmRotate != value) | |
| 410 | xf86WcmRotateTablet(local, value); | ||
| 410 | wcmRotateTablet(local, value); | ||
| 411 | 411 | } else if (property == prop_serials) | |
| 412 | 412 | { | |
| 413 | 413 | return BadValue; /* Read-only */ |
src/xf86Wacom.c
(12 / 12)
|   | |||
| 53 | 53 | ||
| 54 | 54 | void xf86WcmVirtualTabletPadding(LocalDevicePtr local); | |
| 55 | 55 | void xf86WcmVirtualTabletSize(LocalDevicePtr local); | |
| 56 | Bool xf86WcmIsWacomDevice (char* fname); | ||
| 56 | Bool wcmIsWacomDevice (char* fname); | ||
| 57 | 57 | ||
| 58 | 58 | #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3 | |
| 59 | 59 | extern void InitWcmDeviceProperties(LocalDevicePtr local); | |
| … | … | ||
| 62 | 62 | #endif | |
| 63 | 63 | ||
| 64 | 64 | extern int xf86WcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode); | |
| 65 | extern void xf86WcmRotateTablet(LocalDevicePtr local, int value); | ||
| 66 | extern void xf86WcmInitialScreens(LocalDevicePtr local); | ||
| 65 | extern void wcmRotateTablet(LocalDevicePtr local, int value); | ||
| 66 | extern void wcmInitialScreens(LocalDevicePtr local); | ||
| 67 | 67 | extern void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes); | |
| 68 | 68 | ||
| 69 | 69 | static int xf86WcmDevOpen(DeviceIntPtr pWcm); | |
| … | … | ||
| 109 | 109 | } | |
| 110 | 110 | ||
| 111 | 111 | /***************************************************************************** | |
| 112 | * xf86WcmDesktopSize -- | ||
| 112 | * wcmDesktopSize -- | ||
| 113 | 113 | * calculate the whole desktop size | |
| 114 | 114 | ****************************************************************************/ | |
| 115 | static void xf86WcmDesktopSize(LocalDevicePtr local) | ||
| 115 | static void wcmDesktopSize(LocalDevicePtr local) | ||
| 116 | 116 | { | |
| 117 | 117 | WacomDevicePtr priv = (WacomDevicePtr) local->private; | |
| 118 | 118 | int i = 0, minX = 0, minY = 0, maxX = 0, maxY = 0; | |
| 119 | 119 | ||
| 120 | xf86WcmInitialScreens(local); | ||
| 120 | wcmInitialScreens(local); | ||
| 121 | 121 | minX = priv->screenTopX[0]; | |
| 122 | 122 | minY = priv->screenTopY[0]; | |
| 123 | 123 | maxX = priv->screenBottomX[0]; | |
| … | … | ||
| 191 | 191 | } | |
| 192 | 192 | ||
| 193 | 193 | /* need maxWidth and maxHeight for keepshape */ | |
| 194 | xf86WcmDesktopSize(local); | ||
| 194 | wcmDesktopSize(local); | ||
| 195 | 195 | ||
| 196 | 196 | /* Maintain aspect ratio to the whole desktop | |
| 197 | 197 | * May need to consider a specific screen in multimonitor settings | |
| … | … | ||
| 224 | 224 | inlist = priv->tool->arealist; | |
| 225 | 225 | ||
| 226 | 226 | /* The first one in the list is always valid */ | |
| 227 | if (area != inlist && WcmAreaListOverlap(area, inlist)) | ||
| 227 | if (area != inlist && wcmAreaListOverlap(area, inlist)) | ||
| 228 | 228 | { | |
| 229 | 229 | inlist = priv->tool->arealist; | |
| 230 | 230 | ||
| … | … | ||
| 348 | 348 | Atom label; | |
| 349 | 349 | #endif | |
| 350 | 350 | ||
| 351 | xf86WcmMappingFactor(local); | ||
| 351 | wcmMappingFactor(local); | ||
| 352 | 352 | ||
| 353 | 353 | /* x ax */ | |
| 354 | 354 | if ( !axes ) | |
| … | … | ||
| 788 | 788 | } | |
| 789 | 789 | ||
| 790 | 790 | /* Rotation rotates the Max X and Y */ | |
| 791 | xf86WcmRotateTablet(local, common->wcmRotate); | ||
| 791 | wcmRotateTablet(local, common->wcmRotate); | ||
| 792 | 792 | ||
| 793 | 793 | /* pressure */ | |
| 794 | 794 | InitValuatorAxisStruct(local->dev, 2, | |
| … | … | ||
| 887 | 887 | return TRUE; | |
| 888 | 888 | } | |
| 889 | 889 | ||
| 890 | Bool xf86WcmIsWacomDevice (char* fname) | ||
| 890 | Bool wcmIsWacomDevice (char* fname) | ||
| 891 | 891 | { | |
| 892 | 892 | int fd = -1; | |
| 893 | 893 | struct input_id id; | |
| … | … | ||
| 930 | 930 | Bool is_wacom; | |
| 931 | 931 | ||
| 932 | 932 | sprintf(fname, DEV_INPUT_EVENT, i); | |
| 933 | is_wacom = xf86WcmIsWacomDevice(fname); | ||
| 933 | is_wacom = wcmIsWacomDevice(fname); | ||
| 934 | 934 | if (is_wacom) | |
| 935 | 935 | { | |
| 936 | 936 | xf86Msg(X_PROBED, "%s: probed device is %s (waited %d msec)\n", |
src/xf86Wacom.h
(3 / 3)
|   | |||
| 168 | 168 | void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds); | |
| 169 | 169 | ||
| 170 | 170 | /* generic area check for xf86Wacom.c, wcmCommon.c and wcmXCommand.c */ | |
| 171 | Bool WcmPointInArea(WacomToolAreaPtr area, int x, int y); | ||
| 172 | Bool WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list); | ||
| 171 | Bool wcmPointInArea(WacomToolAreaPtr area, int x, int y); | ||
| 172 | Bool wcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list); | ||
| 173 | 173 | ||
| 174 | 174 | /* Change pad's mode according to it core event status */ | |
| 175 | 175 | int xf86WcmSetPadCoreMode(LocalDevicePtr local); | |
| 176 | 176 | ||
| 177 | 177 | /* calculate the proper tablet to screen mapping factor */ | |
| 178 | void xf86WcmMappingFactor(LocalDevicePtr local); | ||
| 178 | void wcmMappingFactor(LocalDevicePtr local); | ||
| 179 | 179 | ||
| 180 | 180 | /****************************************************************************/ | |
| 181 | 181 | #endif /* __XF86WACOM_H */ |

