From 46933bb2f5fe486e22dcad84036ce91f71b84dd0 Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@vt.edu> Date: Thu, 25 Sep 2014 00:07:32 -0400 Subject: [PATCH] *fixed regression where cnv objects captured runtime clicks due to pd-l2ork's passing of the click to the topmost visible object, rather than the first clickable object in the stack. This also fixes problems with legacy patches that rely vanilla/extended's assignment of click to the lowest, and as is the case with s-env-help.pd in s-abstractions, invisible object, rather than the one apparent to the user. --- pd/src/g_editor.c | 6 ++++-- pd/src/g_graph.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index b77230834..c1167d9d8 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -3008,6 +3008,8 @@ static double canvas_upclicktime; static int canvas_upx, canvas_upy; #define DCLICKINTERVAL 0.25 +extern t_class *my_canvas_class; // for ignoring runtime clicks + /* mouse click */ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, int mod, int doit) @@ -3120,8 +3122,8 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) { ob = pd_checkobject(&y->g_pd); - /* do not give clicks to comments during runtime */ - if (!ob || ob->te_type != T_TEXT) + /* do not give clicks to comments or cnv during runtime */ + if (!ob || (ob->te_type != T_TEXT && ob->ob_pd != my_canvas_class)) yclick = y; //fprintf(stderr," MAIN found clickable %d\n", // clickreturned); diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c index aedca1731..6c1b05bdf 100644 --- a/pd/src/g_graph.c +++ b/pd/src/g_graph.c @@ -1483,6 +1483,8 @@ static void graph_motion(void *z, t_floatarg dx, t_floatarg dy) garray_redraw(a); } +extern t_class *my_canvas_class; // for ignoring runtime clicks + static int graph_click(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { @@ -1517,8 +1519,8 @@ static int graph_click(t_gobj *z, struct _glist *glist, if (canvas_hitbox(x, y, xpix, ypix, &x1, &y1, &x2, &y2)) { ob = pd_checkobject(&y->g_pd); - /* do not give clicks to comments during runtime */ - if (!ob || ob->te_type != T_TEXT) + /* do not give clicks to comments or cnv during runtime */ + if (!ob || (ob->te_type != T_TEXT && ob->ob_pd != my_canvas_class)) clickme = y; //fprintf(stderr," found clickable %d\n", clickreturned); } -- GitLab