The following shows the diffstat and patchsets between
83977a9..68878f1^
----------------------------------------------------------------
commit 68878f1685933d309210042518b9801fab507d89
Author: Thomas Adam <[email protected]>
Date:   Thu Apr 9 10:31:29 2015 +0100

    monitor_of_xy: Correctly assign monitor
    
    When working out which monitor the pointer is on, don't use the value of the
    monitor from the tailq directly, instead assign it to a temporary variable.
    This fixes scoping rules, and always means we return a value for a monitor
    rather than NULL.
---
 libs/FScreen.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libs/FScreen.c b/libs/FScreen.c
index e5b7413..7eee5a0 100644
--- a/libs/FScreen.c
+++ b/libs/FScreen.c
@@ -149,14 +149,16 @@ monitor_by_number(int number)
 struct monitor *
 monitor_by_xy(int x, int y)
 {
-       struct monitor  *m;
+       struct monitor  *m, *m2;
 
        TAILQ_FOREACH(m, &monitor_q, entry) {
                if (x >= m->coord.x && x < m->coord.x + m->coord.w &&
-                   y >= m->coord.y && y < m->coord.y + m->coord.h)
+                   y >= m->coord.y && y < m->coord.y + m->coord.h) {
+                       m2 = m;
                        break;
+               }
        }
-       return (m);
+       return (m2);
 }
 
 void FScreenInit(Display *dpy)

----------------------------------------------------------------

Diffstat:

----------------------------------------------------------------
 libs/FScreen.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

----------------------------------------------------------------

Reply via email to