Xi: fill in barrier root x/y after clamping to RandR outputs
x/y for barrier events should contain the actual pointer position. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
This commit is contained in:
parent
21a15f9a04
commit
c50db6faba
|
@ -407,6 +407,8 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
|
|||
ev.window = c->window->drawable.id;
|
||||
c->last_timestamp = ms;
|
||||
|
||||
/* root x/y is filled in later */
|
||||
|
||||
barrier_events->barrier_event = ev;
|
||||
barrier_events++;
|
||||
*nevents += 1;
|
||||
|
@ -436,6 +438,8 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
|
|||
ev.window = c->window->drawable.id;
|
||||
c->last_timestamp = ms;
|
||||
|
||||
/* root x/y is filled in later */
|
||||
|
||||
barrier_events->barrier_event = ev;
|
||||
barrier_events++;
|
||||
*nevents += 1;
|
||||
|
|
|
@ -573,6 +573,8 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
|
|||
ScreenPtr newScreen;
|
||||
int x, y;
|
||||
Bool switch_screen = FALSE;
|
||||
Bool should_constrain_barriers = FALSE;
|
||||
int i;
|
||||
|
||||
miPointerPtr pPointer;
|
||||
|
||||
|
@ -589,7 +591,9 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
|
|||
x -= pScreen->x;
|
||||
y -= pScreen->y;
|
||||
|
||||
if (mode == Relative) {
|
||||
should_constrain_barriers = (mode == Relative);
|
||||
|
||||
if (should_constrain_barriers) {
|
||||
/* coordinates after clamped to a barrier */
|
||||
int constrained_x, constrained_y;
|
||||
int current_x, current_y; /* current position in per-screen coord */
|
||||
|
@ -637,6 +641,18 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
|
|||
if (pPointer->x != x || pPointer->y != y || pPointer->pScreen != pScreen)
|
||||
miPointerMoveNoEvent(pDev, pScreen, x, y);
|
||||
|
||||
/* check if we generated any barrier events and if so, update root x/y
|
||||
* to the fully constrained coords */
|
||||
if (should_constrain_barriers) {
|
||||
for (i = 0; i < *nevents; i++) {
|
||||
if (events[i].any.type == ET_BarrierHit ||
|
||||
events[i].any.type == ET_BarrierLeave) {
|
||||
events[i].barrier_event.root_x = x;
|
||||
events[i].barrier_event.root_y = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert to desktop coordinates again */
|
||||
x += pScreen->x;
|
||||
y += pScreen->y;
|
||||
|
|
Loading…
Reference in New Issue
Block a user