diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-03 10:41:16 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-17 15:03:12 +1000 |
commit | 21a15f9a04ec0a6c8f654eef943561e98db2475d (patch) | |
tree | b4e799b2138d5b2b1a5f4a8a62ed794bb52c1c6c | |
parent | 707b4dc61f18960611409ef5ad8947be189f7296 (diff) |
Pass the event list through to the pointer barrier code to return it
Instead of having the pointer barrier code enqueue events separately from
GetPointerEvents, pass the event list through and let it add to it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
-rw-r--r-- | Xi/xibarriers.c | 15 | ||||
-rw-r--r-- | dix/getevents.c | 15 | ||||
-rw-r--r-- | include/input.h | 3 | ||||
-rw-r--r-- | mi/mipointer.c | 6 | ||||
-rw-r--r-- | mi/mipointer.h | 3 |
5 files changed, 31 insertions, 11 deletions
diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c index 27b21eedb..104280c62 100644 --- a/Xi/xibarriers.c +++ b/Xi/xibarriers.c @@ -335,7 +335,8 @@ void input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, int current_x, int current_y, int dest_x, int dest_y, - int *out_x, int *out_y) + int *out_x, int *out_y, + int *nevents, InternalEvent* events) { /* Clamped coordinates here refer to screen edge clamping. */ BarrierScreenPtr cs = GetBarrierScreen(screen); @@ -356,6 +357,10 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, .dy = dest_y - current_y, .root = screen->root->drawable.id, }; + InternalEvent *barrier_events = events; + + if (nevents) + *nevents = 0; if (xorg_list_is_empty(&cs->barriers) || IsFloating(dev)) goto out; @@ -402,7 +407,9 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, ev.window = c->window->drawable.id; c->last_timestamp = ms; - mieqEnqueue(dev, (InternalEvent *) &ev); + barrier_events->barrier_event = ev; + barrier_events++; + *nevents += 1; } xorg_list_for_each_entry(c, &cs->barriers, entry) { @@ -429,7 +436,9 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, ev.window = c->window->drawable.id; c->last_timestamp = ms; - mieqEnqueue(dev, (InternalEvent *) &ev); + barrier_events->barrier_event = ev; + barrier_events++; + *nevents += 1; /* If we've left the hit box, this is the * start of a new event ID. */ diff --git a/dix/getevents.c b/dix/getevents.c index fa538d9f4..3d41e1e5a 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -916,10 +916,13 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask, * @param[in,out] devy y desktop-wide coordinate in device coordinate system * @param[in,out] screenx x coordinate in desktop coordinate system * @param[in,out] screeny y coordinate in desktop coordinate system + * @param[out] nevents Number of barrier events added to events + * @param[in,out] events List of events barrier events are added to */ static ScreenPtr positionSprite(DeviceIntPtr dev, int mode, ValuatorMask *mask, - double *devx, double *devy, double *screenx, double *screeny) + double *devx, double *devy, double *screenx, double *screeny, + int *nevents, InternalEvent* events) { ScreenPtr scr = miPointerGetScreen(dev); double tmpx, tmpy; @@ -933,7 +936,7 @@ positionSprite(DeviceIntPtr dev, int mode, ValuatorMask *mask, /* miPointerSetPosition takes care of crossing screens for us, as well as * clipping to the current screen. Coordinates returned are in desktop * coord system */ - scr = miPointerSetPosition(dev, mode, screenx, screeny); + scr = miPointerSetPosition(dev, mode, screenx, screeny, nevents, events); /* If we were constrained, rescale x/y from the screen coordinates so * the device valuators reflect the correct position. For screen @@ -1319,6 +1322,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, int sx, sy; /* for POINTER_SCREEN */ ValuatorMask mask; ScreenPtr scr; + int num_barrier_events = 0; switch (type) { case MotionNotify: @@ -1395,7 +1399,10 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, } scr = positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative, - &mask, &devx, &devy, &screenx, &screeny); + &mask, &devx, &devy, &screenx, &screeny, + &num_barrier_events, events); + num_events += num_barrier_events; + events += num_barrier_events; /* screenx, screeny are in desktop coordinates, mask is in device coordinates per-screen (the event data) @@ -1945,7 +1952,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid, scr = scale_to_desktop(dev, &mask, &devx, &devy, &screenx, &screeny); if (emulate_pointer) scr = positionSprite(dev, Absolute, &mask, - &devx, &devy, &screenx, &screeny); + &devx, &devy, &screenx, &screeny, NULL, NULL); /* see fill_pointer_events for coordinate systems */ if (emulate_pointer) diff --git a/include/input.h b/include/input.h index a5d0462c9..23a20b59d 100644 --- a/include/input.h +++ b/include/input.h @@ -681,6 +681,7 @@ extern _X_HIDDEN void update_desktop_dimensions(void); extern _X_HIDDEN void input_constrain_cursor(DeviceIntPtr pDev, ScreenPtr screen, int current_x, int current_y, int dest_x, int dest_y, - int *out_x, int *out_y); + int *out_x, int *out_y, + int *nevents, InternalEvent* events); #endif /* INPUT_H */ diff --git a/mi/mipointer.c b/mi/mipointer.c index d1708249f..f4fbd2912 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -565,7 +565,8 @@ miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) */ ScreenPtr miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, - double *screeny) + double *screeny, + int *nevents, InternalEvent* events) { miPointerScreenPtr pScreenPriv; ScreenPtr pScreen; @@ -598,7 +599,8 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, input_constrain_cursor(pDev, pScreen, current_x, current_y, x, y, - &constrained_x, &constrained_y); + &constrained_x, &constrained_y, + nevents, events); x = constrained_x; y = constrained_y; diff --git a/mi/mipointer.h b/mi/mipointer.h index 1500e216a..f89dff31e 100644 --- a/mi/mipointer.h +++ b/mi/mipointer.h @@ -115,7 +115,8 @@ miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y); /* Moves the cursor to the specified position. May clip the co-ordinates: * x and y are modified in-place. */ extern _X_EXPORT ScreenPtr -miPointerSetPosition(DeviceIntPtr pDev, int mode, double *x, double *y); +miPointerSetPosition(DeviceIntPtr pDev, int mode, double *x, double *y, + int *nevents, InternalEvent *events); extern _X_EXPORT void miPointerUpdateSprite(DeviceIntPtr pDev); |