From faad732eb0d5b1eb9706ccc1bcfbf160c77b24dd Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@vt.edu> Date: Mon, 9 Dec 2013 10:04:58 -0500 Subject: [PATCH] *improved proper detection of the topmost object without the redundant gobj_click calls --- pd/src/g_editor.c | 9 +++------ pd/src/g_graph.c | 11 ++++------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index 59796b76b..2a70a0b6d 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -2752,7 +2752,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, t_gobj *y; int shiftmod, runmode, altmod, doublemod = 0, rightclick; - int x1=0, y1=0, x2=0, y2=0, clickreturned = 0, tmpclickreturned = 0; + int x1=0, y1=0, x2=0, y2=0, clickreturned = 0; t_gobj *yclick = NULL; //fprintf(stderr,"MAIN canvas_doclick %d %d %d %d %d\n", xpos, ypos, which, mod, doit); @@ -2831,15 +2831,12 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, for (y = x->gl_list; y; y = y->g_next) { // check if the object wants to be clicked (we pick the topmost clickable) - if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2) && (tmpclickreturned = gobj_click(y, x, xpos, ypos, - shiftmod, ((mod & CTRLMOD) && (!x->gl_edit)) || altmod, - 0, 0))) { + if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) { yclick = y; - clickreturned = tmpclickreturned; //fprintf(stderr," MAIN found clickable %d\n", clickreturned); } } - if (yclick && doit) { + if (yclick) { clickreturned = gobj_click(yclick, x, xpos, ypos, shiftmod, ((mod & CTRLMOD) && (!x->gl_edit)) || altmod, 0, doit); diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c index 6aa78f9ef..ec75c9d6b 100644 --- a/pd/src/g_graph.c +++ b/pd/src/g_graph.c @@ -1327,11 +1327,11 @@ static void graph_motion(void *z, t_floatarg dx, t_floatarg dy) static int graph_click(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { - //fprintf(stderr, "graph_click\n"); + fprintf(stderr, "graph_click %d\n", doit); t_glist *x = (t_glist *)z; t_gobj *y, *clickme = NULL; int clickreturned = 0; - int tmpclickreturned = 0; + //int tmpclickreturned = 0; if (!x->gl_isgraph) return (text_widgetbehavior.w_clickfn(z, glist, xpix, ypix, shift, alt, dbl, doit)); @@ -1343,15 +1343,12 @@ static int graph_click(t_gobj *z, struct _glist *glist, for (y = x->gl_list; y; y = y->g_next) { /* check if the object wants to be clicked */ - if (canvas_hitbox(x, y, xpix, ypix, &x1, &y1, &x2, &y2) - && (tmpclickreturned = gobj_click(y, x, xpix, ypix, - shift, alt, 0, 0))) { + if (canvas_hitbox(x, y, xpix, ypix, &x1, &y1, &x2, &y2)) { clickme = y; - clickreturned = tmpclickreturned; //fprintf(stderr," found clickable %d\n", clickreturned); } } - if (clickme != NULL && doit) { + if (clickme) { //fprintf(stderr," clicking\n"); clickreturned = gobj_click(clickme, x, xpix, ypix, shift, alt, 0, doit); -- GitLab