diff options
author | Keith Packard <keithp@keithp.com> | 2011-11-02 21:20:07 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-11-02 21:20:07 -0700 |
commit | d91aa0e6601bdf3e2cfa57b3412ab14ac486edc4 (patch) | |
tree | 7c18b19cfd5fb4d05f54549121fda33e1b9cd249 /mi | |
parent | 8df3a9ca5abbd56eb2013fa65250d21a8f18865b (diff) | |
parent | 401150d7dcad08be7c1f07e076f810cd61e2105c (diff) |
Merge remote-tracking branch 'whot/two-screen-coordinates'
Diffstat (limited to 'mi')
-rw-r--r-- | mi/mipointer.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/mi/mipointer.c b/mi/mipointer.c index 55e4081f2..998c86c15 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -569,8 +569,8 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen, * * @param pDev The device to move * @param mode Movement mode (Absolute or Relative) - * @param[in,out] screenx The x coordinate in screen coordinates - * @param[in,out] screeny The y coordinate in screen coordinates + * @param[in,out] screenx The x coordinate in desktop coordinates + * @param[in,out] screeny The y coordinate in desktop coordinates */ ScreenPtr miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, double *screeny) @@ -579,6 +579,7 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, double *scree ScreenPtr pScreen; ScreenPtr newScreen; int x, y; + Bool switch_screen = FALSE; miPointerPtr pPointer; @@ -593,7 +594,14 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, double *scree x = trunc(*screenx); y = trunc(*screeny); - if (x < 0 || x >= pScreen->width || y < 0 || y >= pScreen->height) + switch_screen = !point_on_screen(pScreen, x, y); + + /* Switch to per-screen coordinates for CursorOffScreen and + * Pointer->limits */ + x -= pScreen->x; + y -= pScreen->y; + + if (switch_screen) { pScreenPriv = GetScreenPrivate (pScreen); if (!pPointer->confined) @@ -628,6 +636,10 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, double *scree pPointer->pScreen != pScreen) miPointerMoveNoEvent(pDev, pScreen, x, y); + /* Convert to desktop coordinates again */ + x += pScreen->x; + y += pScreen->y; + /* In the event we actually change screen or we get confined, we just * drop the float component on the floor * FIXME: only drop remainder for ConstrainCursorHarder, not for screen |