[mutter] native: fix pointer constraining
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] native: fix pointer constraining
- Date: Mon, 2 Mar 2015 15:09:58 +0000 (UTC)
commit 6234f7d1dbc8592753aaf16d5fbaf91bbaa7bd34
Author: Marek Chalupa <mchqwerty gmail com>
Date: Mon Mar 2 07:46:16 2015 -0500
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 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index 6d0e5db..5d1f0b1 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;
-
- nx = current.x;
- ny = current.y;
+ bottom = top + monitor->rect.height;
- if ((nx >= left) && (nx < right) && (ny >= top) && (ny < bottom))
+ if ((cx >= left) && (cx < right) && (cy >= top) && (cy < bottom))
{
if (*x < left)
*x = left;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]