emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs canvas support


From: Eli Zaretskii
Subject: Re: Emacs canvas support
Date: Wed, 29 Apr 2020 14:47:10 +0300

> From: Po Lu <address@hidden>
> Cc: address@hidden
> Date: Wed, 29 Apr 2020 18:27:49 +0800
> 
> >> That's the technical description of the implementation.  It doesn't
> >> explain when  canvases can be useful and for what purposes.
> >
> > Canvases are useful for when I want to be able to control a portion of a
> > screen dynamically, in a fast way, from Lisp code.  For instance,
> > displaying a constantly changing bar chart or graph inside Emacs.
> >
> >> But the result of this painting is some graphical object, similar to
> >> an image, that will be displayed within a buffer, right?
> >
> > Correct.
> >
> >> Did I miss the code that tells Emacs the click was on a canvas?  E.g.,
> >> if you click on a canvas, what does posn-object return when passed the
> >> click event as its argument?
> >
> > Oops.  I missed that.  Thanks for bringing it up.
> 
> Here is a version of the patch with several of the problems you
> mentioned rectified.

Thanks.

> +@node Canvases
> +@cindex drawing canvases
> +@cindex drawing areas
> +@cindex canvases
> +@section Canvases
> +
> +This chapter describes canvases, objects that can store drawing operations
> +which are then displayed inside buffer text.

Please consider telling something here about when this is useful.

Also, I think there should be a short subsection in "Editing Types"
with the description of the canvas type, like we have for other
editing types.

> @@ -4371,6 +4374,11 @@ scrolling_window (struct window *w, int tab_line_p)
>      return 0;
>  #endif
>  
> +  /* We need this to fix canvas movement detection in a reliable way.
> +     FIXME. */
> +  if (w->have_canvas_p)
> +    return 0;

This is sub-optimal.  Please don't follow the xwidget example of
disabling redisplay optimizations because it might be hairy to support
them.  It would make any window with canvases redisplay much slower in
many cases.

> @@ -5462,6 +5470,10 @@ buffer_posn_from_coords (struct window *w, int *x, int 
> *y, struct display_pos *p
>        if (img && !NILP (img->spec))
>       *object = img->spec;
>      }
> +  else if (it.what == IT_CANVAS)
> +    {
> +      XSETCANVAS (*object, it.canvas);
> +    }
>  #endif

This is just the object.  That's okay, but don't you want to support
clicks on various parts of the canvas, like we do with images?  That
would require more info to be returned.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]