unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* About x_draw_xwidget_glyph_string
@ 2016-01-25  2:07 YAMAMOTO Mitsuharu
  2016-01-25  6:59 ` joakim
  2016-01-25 15:46 ` Eli Zaretskii
  0 siblings, 2 replies; 11+ messages in thread
From: YAMAMOTO Mitsuharu @ 2016-01-25  2:07 UTC (permalink / raw)
  To: emacs-devel

I have a question and a comment about x_draw_xwidget_glyph_string in
src/xwidget.c.

1. Question about xwidget initialization.

   559	x_draw_xwidget_glyph_string (struct glyph_string *s)
   560	{
   561	  /* This method is called by the redisplay engine and places the
   562	     xwidget on screen.  Moving and clipping is done here.  Also view
   563	     initialization.  */
   564	  struct xwidget *xww = s->xwidget;
   565	  struct xwidget_view *xv = xwidget_view_lookup (xww, s->w);
(snip)
   574	  /* Do initialization here in the display loop because there is no
   575	     other time to know things like window placement etc.  */
   576	  xv = xwidget_init_view (xww, s, x, y);

Line 576 indicates a new xwidget view is created in every
x_draw_xwidget_glyph_string call.  But this makes xwidget-view-list
longer and longer, and looks like a waste of memory, if not a leak.
Also, if it is an intended behavior, then it looks strange to look up
a view at Line 565.

2. Comment on clipping.

   578	  /* Calculate clipping, which is used for all manner of onscreen
   579	     xwidget views.  Each widget border can get clipped by other emacs
   580	     objects so there are four clipping variables.  */
   581	  clip_right =
   582	    min (xww->width,
   583	         WINDOW_RIGHT_EDGE_X (s->w) - x -
   584	         WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w) -
   585	         WINDOW_RIGHT_FRINGE_WIDTH (s->w));
   586	  clip_left =
   587	    max (0,
   588	         WINDOW_LEFT_EDGE_X (s->w) - x +
   589	         WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w) +
   590	         WINDOW_LEFT_FRINGE_WIDTH (s->w));
   591	
   592	  clip_bottom =
   593	    min (xww->height,
   594	         WINDOW_BOTTOM_EDGE_Y (s->w) - WINDOW_MODE_LINE_HEIGHT (s->w) - y);
   595	  clip_top = max (0, WINDOW_TOP_EDGE_Y (s->w) - y);

I think the calculation of clipping should use the function window_box
rather than manual calculation with various window macros.  Otherwise,
xwidget views will cover horizontal scroll bars, for example.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-04-12 21:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25  2:07 About x_draw_xwidget_glyph_string YAMAMOTO Mitsuharu
2016-01-25  6:59 ` joakim
2016-01-25 15:46 ` Eli Zaretskii
2016-04-08 15:35   ` joakim
2016-04-09  7:38     ` Eli Zaretskii
2016-04-09 11:22       ` joakim
2016-04-09 12:06         ` Eli Zaretskii
2016-04-10  8:29         ` YAMAMOTO Mitsuharu
2016-04-11  0:04           ` YAMAMOTO Mitsuharu
2016-04-12 20:46             ` joakim
2016-04-12 21:13             ` joakim

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).