[bugs:#1298] motion message emits canvas_doclick, is it useless?

Status: open
Group: v0.47
Created: Sat Jun 03, 2017 12:03 AM UTC by Giulio Moro
Last Updated: Sat Jun 03, 2017 12:03 AM UTC
Owner: nobody

In g_editor.c, canvas_motion() is called when the canvas receives a motion message. As far as I can tell, this happens only when the mouse is moved on the GUI (and there is no click).

In a long chain of if .. else if, the last else is:

else
{
    canvas_doclick(x, xpos, ypos, 0, mod, 0);
}

The signature for canvas_doclick() is

void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, int mod, int doit)

So the above call invokes it with doit = 0.

So, my points are:

1) why is canvas_doclick called when there is no click? This seems semantically wrong.
2) the above call always results in nothing being done (at least with the vanilla GUI objects), as they all do nothing when doit == 0 (as you would expect).
3) So, it seems that the above call is useless. Unfortunately, it requires a lot of CPU time for patches with a large number of objects, as it calls canvas_hitbox() on every object in the patch.
4) Is there any reason why the call to canvas_doclick(... doit = 0) is there? can we take it out?


Sent from sourceforge.net because pd-dev@lists.iem.at is subscribed to https://sourceforge.net/p/pure-data/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/pure-data/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.