From 6234f7d1dbc8592753aaf16d5fbaf91bbaa7bd34 Mon Sep 17 00:00:00 2001 From: Marek Chalupa Date: Mon, 2 Mar 2015 07:46:16 -0500 Subject: [PATCH] native: fix pointer constraining fix copy-paste mistake in computing bottom constrain. Also save few instructions by moving setting of always-the-same value off loop. https://bugzilla.gnome.org/show_bug.cgi?id=727337 --- src/backends/native/meta-backend-native.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c index 6d0e5db74..5d1f0b149 100644 --- a/src/backends/native/meta-backend-native.c +++ b/src/backends/native/meta-backend-native.c @@ -100,7 +100,7 @@ check_all_screen_monitors(MetaMonitorInfo *monitors, left = monitor->rect.x; right = left + monitor->rect.width; top = monitor->rect.y; - bottom = left + monitor->rect.height; + bottom = top + monitor->rect.height; if ((x >= left) && (x < right) && (y >= top) && (y < bottom)) return TRUE; @@ -118,25 +118,25 @@ constrain_all_screen_monitors (ClutterInputDevice *device, { ClutterPoint current; unsigned int i; + float cx, cy; clutter_input_device_get_coords (device, NULL, ¤t); + cx = current.x; + cy = current.y; + /* if we're trying to escape, clamp to the CRTC we're coming from */ for (i = 0; i < n_monitors; i++) { MetaMonitorInfo *monitor = &monitors[i]; int left, right, top, bottom; - float nx, ny; left = monitor->rect.x; right = left + monitor->rect.width; top = monitor->rect.y; - bottom = left + monitor->rect.height; + bottom = top + monitor->rect.height; - nx = current.x; - ny = current.y; - - if ((nx >= left) && (nx < right) && (ny >= top) && (ny < bottom)) + if ((cx >= left) && (cx < right) && (cy >= top) && (cy < bottom)) { if (*x < left) *x = left;