diff options
author | Matt Dew <marcoz@osource.org> | 2013-06-21 10:24:16 -0600 |
---|---|---|
committer | Matt Dew <marcoz@osource.org> | 2013-06-21 10:24:16 -0600 |
commit | 7dec1d38799d82923e3241f73c83aa1ad357f72b (patch) | |
tree | 08c8297183626398d467d6c67de56594eb6ad1a7 | |
parent | 187cb5a037a03ab1e7702da5eebb2e7d884c6186 (diff) |
Revert "dix: pre-scale x by the screen:device:resolution ratio"
This reverts commit 14d89b9a466b521b985bc95fc4994637367362a8.
-rw-r--r-- | dix/getevents.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index 51d4fd4da..dfe465254 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -770,29 +770,6 @@ add_to_scroll_valuator(DeviceIntPtr dev, ValuatorMask *mask, int valuator, doubl } -static void -scale_for_device_resolution(DeviceIntPtr dev, ValuatorMask *mask) -{ - double x; - ValuatorClassPtr v = dev->valuator; - int xrange = v->axes[0].max_value - v->axes[0].min_value + 1; - int yrange = v->axes[1].max_value - v->axes[1].min_value + 1; - - double screen_ratio = 1.0 * screenInfo.width/screenInfo.height; - double device_ratio = 1.0 * xrange/yrange; - double resolution_ratio = 1.0; - double ratio; - - if (!valuator_mask_fetch_double(mask, 0, &x)) - return; - - if (v->axes[0].resolution != 0 && v->axes[1].resolution != 0) - resolution_ratio = 1.0 * v->axes[0].resolution/v->axes[1].resolution; - - ratio = device_ratio/resolution_ratio/screen_ratio; - valuator_mask_set_double(mask, 0, x * ratio); -} - /** * Move the device's pointer by the values given in @valuators. * @@ -804,14 +781,27 @@ moveRelative(DeviceIntPtr dev, int flags, ValuatorMask *mask) { int i; Bool clip_xy = IsMaster(dev) || !IsFloating(dev); - ValuatorClassPtr v = dev->valuator; /* for abs devices in relative mode, we've just scaled wrong, since we mapped the device's shape into the screen shape. Undo this. */ - if ((flags & POINTER_ABSOLUTE) == 0 && v && v->numAxes > 1 && - v->axes[0].min_value < v->axes[0].max_value && - v->axes[1].min_value < v->axes[1].max_value) { - scale_for_device_resolution(dev, mask); + if ((flags & POINTER_ABSOLUTE) == 0 && dev->valuator && + dev->valuator->axes[0].min_value < dev->valuator->axes[0].max_value) { + + double ratio = 1.0 * screenInfo.width/screenInfo.height; + + if (ratio > 1.0) { + double y; + if (valuator_mask_fetch_double(mask, 1, &y)) { + y *= ratio; + valuator_mask_set_double(mask, 1, y); + } + } else { + double x; + if (valuator_mask_fetch_double(mask, 0, &x)) { + x *= ratio; + valuator_mask_set_double(mask, 0, x); + } + } } /* calc other axes, clip, drop back into valuators */ |