Commit fe2d108ac2e2bbddc1a8dba96550e737a15aee9e
- Diff rendering mode:
- inline
- side by side
src/wcmCommon.c
(43 / 33)
|   | |||
| 27 | 27 | ||
| 28 | 28 | void xf86WcmInitialScreens(LocalDevicePtr local); | |
| 29 | 29 | void xf86WcmRotateTablet(LocalDevicePtr local, int value); | |
| 30 | void wcmRotateCoordinates(LocalDevicePtr local, int* x, int* y); | ||
| 30 | 31 | ||
| 31 | 32 | extern int xf86WcmDevSwitchModeCall(LocalDevicePtr local, int mode); | |
| 32 | 33 | extern void xf86WcmChangeScreen(LocalDevicePtr local, int value); | |
| … | … | ||
| 714 | 714 | sendWheelStripEvents(local, ds, x, y, z, v3, v4, v5); | |
| 715 | 715 | } | |
| 716 | 716 | ||
| 717 | /* rotate x and y before post X inout events */ | ||
| 718 | void wcmRotateCoordinates(LocalDevicePtr local, int* x, int* y) | ||
| 719 | { | ||
| 720 | WacomDevicePtr priv = (WacomDevicePtr) local->private; | ||
| 721 | WacomCommonPtr common = priv->common; | ||
| 722 | int tmp_coord; | ||
| 723 | |||
| 724 | /* rotation mixes x and y up a bit */ | ||
| 725 | if (common->wcmRotate == ROTATE_CW) | ||
| 726 | { | ||
| 727 | tmp_coord = *x; | ||
| 728 | *x = *y; | ||
| 729 | if (!IsTouch(priv)) | ||
| 730 | *y = common->wcmMaxY - tmp_coord; | ||
| 731 | else | ||
| 732 | *y = common->wcmMaxTouchY - tmp_coord; | ||
| 733 | } | ||
| 734 | else if (common->wcmRotate == ROTATE_CCW) | ||
| 735 | { | ||
| 736 | tmp_coord = *y; | ||
| 737 | *y = *x; | ||
| 738 | if (!IsTouch(priv)) | ||
| 739 | *x = common->wcmMaxX - tmp_coord; | ||
| 740 | else | ||
| 741 | *y = common->wcmMaxTouchX - tmp_coord; | ||
| 742 | } | ||
| 743 | else if (common->wcmRotate == ROTATE_HALF) | ||
| 744 | { | ||
| 745 | if (!IsTouch(priv)) | ||
| 746 | { | ||
| 747 | *x = common->wcmMaxX - *x; | ||
| 748 | *y = common->wcmMaxY - *y; | ||
| 749 | } | ||
| 750 | else | ||
| 751 | { | ||
| 752 | *x = common->wcmMaxTouchX - *x; | ||
| 753 | *y = common->wcmMaxTouchY - *y; | ||
| 754 | } | ||
| 755 | } | ||
| 756 | } | ||
| 757 | |||
| 717 | 758 | /***************************************************************************** | |
| 718 | 759 | * xf86WcmSendEvents -- | |
| 719 | 760 | * Send events according to the device state. | |
| … | … | ||
| 778 | 778 | int rot = ds->rotation; | |
| 779 | 779 | int throttle = ds->throttle; | |
| 780 | 780 | int wheel = ds->abswheel; | |
| 781 | int tmp_coord; | ||
| 782 | 781 | WacomDevicePtr priv = (WacomDevicePtr) local->private; | |
| 783 | 782 | WacomCommonPtr common = priv->common; | |
| 784 | 783 | int naxes = priv->naxes; | |
| … | … | ||
| 816 | 816 | x, y, z, is_button ? "true" : "false", buttons, | |
| 817 | 817 | tx, ty, wheel, rot, throttle); | |
| 818 | 818 | ||
| 819 | /* rotation mixes x and y up a bit */ | ||
| 820 | if (common->wcmRotate == ROTATE_CW) | ||
| 821 | { | ||
| 822 | tmp_coord = x; | ||
| 823 | x = y; | ||
| 824 | if (!IsTouch(priv)) | ||
| 825 | y = common->wcmMaxY - tmp_coord; | ||
| 826 | else | ||
| 827 | y = common->wcmMaxTouchY - tmp_coord; | ||
| 828 | } | ||
| 829 | else if (common->wcmRotate == ROTATE_CCW) | ||
| 830 | { | ||
| 831 | tmp_coord = y; | ||
| 832 | y = x; | ||
| 833 | if (!IsTouch(priv)) | ||
| 834 | x = common->wcmMaxX - tmp_coord; | ||
| 835 | else | ||
| 836 | y = common->wcmMaxTouchX - tmp_coord; | ||
| 837 | } | ||
| 838 | else if (common->wcmRotate == ROTATE_HALF) | ||
| 839 | { | ||
| 840 | if (!IsTouch(priv)) | ||
| 841 | { | ||
| 842 | x = common->wcmMaxX - x; | ||
| 843 | y = common->wcmMaxY - y; | ||
| 844 | } | ||
| 845 | else | ||
| 846 | { | ||
| 847 | x = common->wcmMaxTouchX - x; | ||
| 848 | y = common->wcmMaxTouchY - y; | ||
| 849 | } | ||
| 850 | } | ||
| 819 | wcmRotateCoordinates(local, &x, &y); | ||
| 851 | 820 | ||
| 852 | 821 | if (IsCursor(priv)) | |
| 853 | 822 | { |
src/wcmTouchFilter.c
(2 / 2)
|   | |||
| 44 | 44 | ||
| 45 | 45 | void xf86WcmFingerTapToClick(WacomCommonPtr common); | |
| 46 | 46 | ||
| 47 | extern void xf86WcmRotateCoordinates(LocalDevicePtr local, int x, int y); | ||
| 47 | extern void wcmRotateCoordinates(LocalDevicePtr local, int* x, int* y); | ||
| 48 | 48 | extern void emitKeysym (DeviceIntPtr keydev, int keysym, int state); | |
| 49 | 49 | ||
| 50 | 50 | static void xf86WcmFingerScroll(WacomDevicePtr priv); | |
| … | … | ||
| 334 | 334 | ||
| 335 | 335 | /* rotate the coordinates first */ | |
| 336 | 336 | for (i=0; i<6; i++) | |
| 337 | xf86WcmRotateCoordinates(priv->local, filterd.x[i], filterd.y[i]); | ||
| 337 | wcmRotateCoordinates(priv->local, &filterd.x[i], &filterd.y[i]); | ||
| 338 | 338 | ||
| 339 | 339 | /* check vertical direction */ | |
| 340 | 340 | midPoint_old = (((double)filterd.x[4] + (double)filterd.x[5]) / 2.); |

