Menu

#1298 `motion` message emits canvas_doclick, is it useless?

v0.47
open-invalid
nobody
None
5
2018-10-08
2017-06-03
Giulio Moro
No

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?

Related

Bugs: #1298

Discussion

  • Giulio Moro

    Giulio Moro - 2017-06-03

    Alright, got it. That line is there to make the sure the cursor is set appropriately.

     

    Last edit: Giulio Moro 2017-06-03
  • IOhannes m zmölnig

    • status: open --> open-invalid
     
    • Giulio Moro

      Giulio Moro - 2018-10-08

      I remember I spotted this last year, as it was eating lots of CPU time. 

      4) Is there any reason why the call to canvas_doclick(... doit = 0) is there? can we take it out?

      I think someone pointed out (either here or on the Pd-l2ork mailing list) that maybe there are externals that use it to track mouse position, but I cannot find that thread just now

      Giulio

      On Monday, 8 October 2018, 22:36:20 BST, IOhannes m zmölnig zmoelnig@users.sourceforge.net wrote:

          * status: open --> open-invalid


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

      Status: open-invalid
      Group: v0.47
      Created: Sat Jun 03, 2017 12:03 AM UTC by Giulio Moro
      Last Updated: Sat Jun 03, 2017 12:49 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 you indicated interest in https://sourceforge.net/p/pure-data/bugs/1298/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #1298

Anonymous
Anonymous

Add attachments
Cancel