diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-10-04 11:41:17 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-10-13 11:34:43 +1000 |
commit | 401150d7dcad08be7c1f07e076f810cd61e2105c (patch) | |
tree | f832b93a1a259d457cc864169172518f6c70d72b /mi/mipointer.c | |
parent | 6bd0eff40fae1e5d8fed28751851eb5b932d131b (diff) |
input: change pointer screen crossing behaviour for multiple ScreenRecs
miPointerSetPosition traditionally took coordinates on a per-screen basis,
triggering a screen switch when these went out-of-bounds. For absolute
devices, this prevented screen crossing in the negative x/y direction.
This patch changes the event generation patch to handle screen coordinates
in a desktop range (i.e. all screens together). Screen switches are
triggered when these coordinates are not on the current screen.
This unifies the pointer behaviour of single ScreenRec multihead and
multiple ScreenRecs multihead in that the cursor by default moves about the
whole screen rather than be confined to one single screen. The
transformation matrix may then be used to actually confine the cursor to the
screen again.
Note: fill_pointer_events has to deal with several different coordinate
systems. Make sure you read the comment before trying to understand the code.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'mi/mipointer.c')
-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 |