From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: About x_draw_xwidget_glyph_string Date: Mon, 25 Jan 2016 11:07:16 +0900 Organization: Faculty of Science, Chiba University Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1453688242 31639 80.91.229.3 (25 Jan 2016 02:17:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Jan 2016 02:17:22 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 25 03:17:13 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aNWiP-0003KS-79 for ged-emacs-devel@m.gmane.org; Mon, 25 Jan 2016 03:17:13 +0100 Original-Received: from localhost ([::1]:34227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNWZ6-0007WO-VG for ged-emacs-devel@m.gmane.org; Sun, 24 Jan 2016 21:07:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNWYu-0007WG-9L for emacs-devel@gnu.org; Sun, 24 Jan 2016 21:07:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNWYr-00034b-2k for emacs-devel@gnu.org; Sun, 24 Jan 2016 21:07:24 -0500 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:62186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNWYq-00032b-Js for emacs-devel@gnu.org; Sun, 24 Jan 2016 21:07:21 -0500 Original-Received: from fermat1.math.s.chiba-u.ac.jp (fermat [192.168.32.10]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 0CC49C0560 for ; Mon, 25 Jan 2016 11:07:17 +0900 (JST) User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 133.82.132.2 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:198740 Archived-At: 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