Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void xf86FpitSetUpAxes(DeviceIntPtr dev, FpitPrivatePtr priv)
- {
- /*
- * Device reports motions on 2 axes in absolute coordinates.
- * Axes min and max values are reported in raw coordinates.
- * Resolution is computed roughly by the difference between
- * max and min values scaled from the approximate size of the
- * screen to fit one meter.
- */
- int quarter_turns;
- #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
- Atom axis_labels[2] = { 0, 0 };
- #endif
- priv->screen_width = screenInfo.screens[priv->screen_no]->width;
- priv->screen_height = screenInfo.screens[priv->screen_no]->height;
- priv->fpitTotalOrientation = priv->fpitBaseOrientation;
- if (!priv->fpitTrackRandR)
- return;
- /* now apply transforms specified by RandR:
- * slightly complicated because invertX/Y and swapXY don't commute. */
- priv->screen_rotation = RRGetRotation(screenInfo.screens[priv->screen_no]);
- quarter_turns = (
- (priv->screen_rotation & RR_Rotate_90 ? 1 : 0) +
- (priv->screen_rotation & RR_Rotate_180 ? 2 : 0) +
- (priv->screen_rotation & RR_Rotate_270 ? 3 : 0) ) % 4;
- if (quarter_turns / 2 != 0)
- priv->fpitTotalOrientation ^= FPIT_INVERT_X | FPIT_INVERT_Y;
- if (quarter_turns % 2 != 0) {
- priv->fpitTotalOrientation ^=
- (priv->fpitTotalOrientation & FPIT_THEN_SWAP_XY ? FPIT_INVERT_X : FPIT_INVERT_Y)
- | FPIT_THEN_SWAP_XY;
- }
- if (priv->fpitTotalOrientation & FPIT_THEN_SWAP_XY) {
- InitValuatorAxisStruct(dev, 1,
- #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
- axis_labels[1],
- #endif
- priv->fpitMinX, priv->fpitMaxX, 9500, 0 /* min_res */ ,
- 9500 /* max_res */ );
- InitValuatorAxisStruct(dev, 0,
- #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
- axis_labels[0],
- #endif
- priv->fpitMinY, priv->fpitMaxY, 10500, 0 /* min_res */ ,
- 10500 /* max_res */ );
- } else {
- /*
- typo fpit...Y changed
- */
- InitValuatorAxisStruct(dev, 0,
- #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
- axis_labels[0],
- #endif
- priv->fpitMinX, priv->fpitMaxX, 9500, 0 /* min_res */ ,
- 9500 /* max_res */ );
- InitValuatorAxisStruct(dev, 1,
- #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
- axis_labels[1],
- #endif
- priv->fpitMinY, priv->fpitMaxY, 10500, 0 /* min_res */ ,
- 10500 /* max_res */ );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment