[PATCH 05/29] barriers: Reindent the constrainment hook
Peter Hutterer
peter.hutterer at who-t.net
Tue Dec 11 23:18:58 PST 2012
From: "Jasper St. Pierre" <jstpierre at mecheye.net>
This is to make future diffs much cleaner. Best viewed with -w.
Signed-off-by: Jasper St. Pierre <jstpierre at mecheye.net>
---
Xi/xibarriers.c | 57 +++++++++++++++++++++++++++++----------------------------
1 file changed, 29 insertions(+), 28 deletions(-)
diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
index 21ad6c7..0affde6 100644
--- a/Xi/xibarriers.c
+++ b/Xi/xibarriers.c
@@ -311,43 +311,44 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
BarrierScreenPtr cs = GetBarrierScreen(screen);
int x = dest_x,
y = dest_y;
+ int dir;
+ int i;
+ struct PointerBarrier *nearest = NULL;
+ PointerBarrierClientPtr c;
+
+ if (xorg_list_is_empty(&cs->barriers) || IsFloating(dev))
+ goto out;
- if (!xorg_list_is_empty(&cs->barriers) && !IsFloating(dev)) {
- int dir;
- int i;
- struct PointerBarrier *nearest = NULL;
- PointerBarrierClientPtr c;
-
- /* How this works:
- * Given the origin and the movement vector, get the nearest barrier
- * to the origin that is blocking the movement.
- * Clamp to that barrier.
- * Then, check from the clamped intersection to the original
- * destination, again finding the nearest barrier and clamping.
- */
- dir = barrier_get_direction(current_x, current_y, x, y);
+ /* How this works:
+ * Given the origin and the movement vector, get the nearest barrier
+ * to the origin that is blocking the movement.
+ * Clamp to that barrier.
+ * Then, check from the clamped intersection to the original
+ * destination, again finding the nearest barrier and clamping.
+ */
+ dir = barrier_get_direction(current_x, current_y, x, y);
#define MAX_BARRIERS 2
- for (i = 0; i < MAX_BARRIERS; i++) {
- c = barrier_find_nearest(cs, dev, dir, current_x, current_y, x, y);
- if (!c)
- break;
+ for (i = 0; i < MAX_BARRIERS; i++) {
+ c = barrier_find_nearest(cs, dev, dir, current_x, current_y, x, y);
+ if (!c)
+ break;
- nearest = &c->barrier;
+ nearest = &c->barrier;
- barrier_clamp_to_barrier(nearest, dir, &x, &y);
+ barrier_clamp_to_barrier(nearest, dir, &x, &y);
- if (barrier_is_vertical(nearest)) {
- dir &= ~(BarrierNegativeX | BarrierPositiveX);
- current_x = x;
- }
- else if (barrier_is_horizontal(nearest)) {
- dir &= ~(BarrierNegativeY | BarrierPositiveY);
- current_y = y;
- }
+ if (barrier_is_vertical(nearest)) {
+ dir &= ~(BarrierNegativeX | BarrierPositiveX);
+ current_x = x;
+ }
+ else if (barrier_is_horizontal(nearest)) {
+ dir &= ~(BarrierNegativeY | BarrierPositiveY);
+ current_y = y;
}
}
+ out:
*out_x = x;
*out_y = y;
}
--
1.8.0.1
More information about the xorg-devel
mailing list