From 0570839b76f24c5673a379366455de4779515760 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Wed, 1 Jun 2016 21:15:22 -0400
Subject: [PATCH] port 103943d2cc67a5c7f6640cca747c169edddfeb33 from Pd-l2ork: 
 fixed illogical layer selection when selecting/deselecting individual objects
 on the canvas (e.g two objects where one cover the other, typically the one
 below would be selected/deselected first instead of the top one)

---
 pd/src/g_editor.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 940c834b0..e0331ed6c 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -2236,17 +2236,6 @@ t_gobj *canvas_findhitbox(t_canvas *x, int xpos, int ypos,
             /* commented section looks for whichever is more to the right
                which is wrong since we are looking for topmost object */
                 *x1p = x1, *y1p = y1, *x2p = x2, *y2p = y2, rval = y; 
-    }
-        /* if there are at least two selected objects, we'd prefer
-        to find a selected one (never mind which) to the one we got. */
-    if (x->gl_editor && x->gl_editor->e_selection &&
-        x->gl_editor->e_selection->sel_next && !glist_isselected(x, y))
-    {
-        t_selection *sel;
-        for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
-            if (canvas_hitbox(x, sel->sel_what, xpos, ypos, &x1, &y1, &x2, &y2))
-                *x1p = x1, *y1p = y1, *x2p = x2, *y2p = y2,
-                    rval = sel->sel_what; 
     }
     return (rval);
 }
-- 
GitLab