* [PATCH] Fix unnecessary xwidget_view creation
@ 2017-11-05 19:56 Jaesup Kwak
0 siblings, 0 replies; 3+ messages in thread
From: Jaesup Kwak @ 2017-11-05 19:56 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 499 bytes --]
Hi!
While I am trying out xwidget in master branch, I found many xwidget
views are made and kept in `xwidget-view-list' for one xwidget model
while I have only one xwidget buffer open.
I am attaching a patch for the problem and here is how to test.
Test procedure:
1. `xwidget-webkit-browse-url' to a web page
2. Resize emacs frame, scroll it up/down several times
3. C-x b to *scratch* and C-x 1
4. check with `(length xwidget-view-list)'
Expected output is 1
Actual output is > 1
Thanks,
[-- Attachment #1.2: Type: text/html, Size: 808 bytes --]
[-- Attachment #2: 0001-FIX-UNNECESSARY-XWIDGET-VIEW-CREATION.patch --]
[-- Type: application/octet-stream, Size: 1506 bytes --]
From cbd894121367cda2bd412bffec5412540fe6c7f9 Mon Sep 17 00:00:00 2001
From: Jaesup Kwak <veshboo@gmail.com>
Date: Mon, 6 Nov 2017 03:47:11 +0900
Subject: [PATCH] Fix unnecessary xwidget_view creations
* src/xwidget.c (x_draw_xwidget_glyph_string): Don't create new
xwidget view if we have one already.
Copyright-paperwork-exempt: yes
---
src/xwidget.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/xwidget.c b/src/xwidget.c
index a0c9e03477..fb776fb189 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -585,22 +585,20 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
xwidget on screen. Moving and clipping is done here. Also view
initialization. */
struct xwidget *xww = s->xwidget;
- struct xwidget_view *xv;
+ struct xwidget_view *xv = xwidget_view_lookup (xww, s->w);
int clip_right;
int clip_bottom;
int clip_top;
int clip_left;
- /* FIXME: The result of this call is discarded.
- What if the lookup fails? */
- xwidget_view_lookup (xww, s->w);
-
int x = s->x;
int y = s->y + (s->height / 2) - (xww->height / 2);
/* Do initialization here in the display loop because there is no
other time to know things like window placement etc. */
- xv = xwidget_init_view (xww, s, x, y);
+ /* Do not create new one if we have found one to use. */
+ if (!xv)
+ xv = xwidget_init_view (xww, s, x, y);
int text_area_x, text_area_y, text_area_width, text_area_height;
--
2.13.6 (Apple Git-96)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix unnecessary xwidget_view creation
@ 2017-11-16 3:40 Jaesup Kwak
2017-11-24 9:35 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Jaesup Kwak @ 2017-11-16 3:40 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 94 bytes --]
The patch file attached in the original post appears as a binary file.
Reposting with ".txt".
[-- Attachment #1.2: Type: text/html, Size: 135 bytes --]
[-- Attachment #2: 0001-FIX-UNNECESSARY-XWIDGET-VIEW-CREATION.txt --]
[-- Type: text/plain, Size: 1506 bytes --]
From cbd894121367cda2bd412bffec5412540fe6c7f9 Mon Sep 17 00:00:00 2001
From: Jaesup Kwak <veshboo@gmail.com>
Date: Mon, 6 Nov 2017 03:47:11 +0900
Subject: [PATCH] Fix unnecessary xwidget_view creations
* src/xwidget.c (x_draw_xwidget_glyph_string): Don't create new
xwidget view if we have one already.
Copyright-paperwork-exempt: yes
---
src/xwidget.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/xwidget.c b/src/xwidget.c
index a0c9e03477..fb776fb189 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -585,22 +585,20 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
xwidget on screen. Moving and clipping is done here. Also view
initialization. */
struct xwidget *xww = s->xwidget;
- struct xwidget_view *xv;
+ struct xwidget_view *xv = xwidget_view_lookup (xww, s->w);
int clip_right;
int clip_bottom;
int clip_top;
int clip_left;
- /* FIXME: The result of this call is discarded.
- What if the lookup fails? */
- xwidget_view_lookup (xww, s->w);
-
int x = s->x;
int y = s->y + (s->height / 2) - (xww->height / 2);
/* Do initialization here in the display loop because there is no
other time to know things like window placement etc. */
- xv = xwidget_init_view (xww, s, x, y);
+ /* Do not create new one if we have found one to use. */
+ if (!xv)
+ xv = xwidget_init_view (xww, s, x, y);
int text_area_x, text_area_y, text_area_width, text_area_height;
--
2.13.6 (Apple Git-96)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix unnecessary xwidget_view creation
2017-11-16 3:40 [PATCH] Fix unnecessary xwidget_view creation Jaesup Kwak
@ 2017-11-24 9:35 ` Eli Zaretskii
0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2017-11-24 9:35 UTC (permalink / raw)
To: Jaesup Kwak; +Cc: emacs-devel
> From: Jaesup Kwak <veshboo@gmail.com>
> Date: Thu, 16 Nov 2017 12:40:31 +0900
>
> The patch file attached in the original post appears as a binary file.
> Reposting with ".txt".
>
> From cbd894121367cda2bd412bffec5412540fe6c7f9 Mon Sep 17 00:00:00 2001
> From: Jaesup Kwak <veshboo@gmail.com>
> Date: Mon, 6 Nov 2017 03:47:11 +0900
> Subject: [PATCH] Fix unnecessary xwidget_view creations
>
> * src/xwidget.c (x_draw_xwidget_glyph_string): Don't create new
> xwidget view if we have one already.
Thanks, I pushed this to the master branch.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-24 9:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-16 3:40 [PATCH] Fix unnecessary xwidget_view creation Jaesup Kwak
2017-11-24 9:35 ` Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2017-11-05 19:56 Jaesup Kwak
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).