unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51697: 29.0.50; [PATCH] Fix flicker when setting hscroll of xwidget
       [not found] <87ee7qnm15.fsf.ref@yahoo.com>
@ 2021-11-09  1:41 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-11-09  3:05   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 3+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-11-09  1:41 UTC (permalink / raw)
  To: 51697

[-- Attachment #1: Type: text/plain, Size: 10 bytes --]


Thanks.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-flicker-when-setting-hscroll-of-xwidget.patch --]
[-- Type: text/x-patch, Size: 1048 bytes --]

From a898413fcf34b045ecc8c4dfa312f767e1bbc12a Mon Sep 17 00:00:00 2001
From: Po Lu <luangruo@yahoo.com>
Date: Tue, 9 Nov 2021 09:40:09 +0800
Subject: [PATCH] Fix flicker when setting hscroll of xwidget

* src/xterm.c (x_scroll_run): Use original height of xwidget instead
of window height.
---
 src/xterm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 1fb3d8d7c0..38122d8534 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4445,15 +4445,15 @@ x_scroll_run (struct window *w, struct run *run)
 		  view->y = y;
 
 		  clip_top = 0;
-		  clip_bottom = window_height;
+		  clip_bottom = view->clip_bottom + view->clip_top;
 
 		  if (y < text_area_y)
 		    clip_top = text_area_y - y;
 
-		  if ((y + clip_top + window_height)
+		  if ((y + clip_top + clip_bottom)
 		      > (text_area_y + text_area_height))
 		    {
-		      clip_bottom -= (y + clip_top + window_height)
+		      clip_bottom -= (y + clip_top + clip_bottom)
 			- (text_area_y + text_area_height);
 		    }
 
-- 
2.31.1


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

* bug#51697: 29.0.50; [PATCH] Fix flicker when setting hscroll of xwidget
  2021-11-09  1:41 ` bug#51697: 29.0.50; [PATCH] Fix flicker when setting hscroll of xwidget Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-11-09  3:05   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-11-09  4:06     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-11-09  3:05 UTC (permalink / raw)
  To: 51697

[-- Attachment #1: Type: text/plain, Size: 125 bytes --]

Po Lu <luangruo@yahoo.com> writes:

> Thanks.

Please ignore that and use this instead, which also fixes disappearing
text.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-flicker-when-setting-hscroll-of-xwidget.patch --]
[-- Type: text/x-patch, Size: 2260 bytes --]

From 7142d3186afeabdfeaf64fd0b180a0057bde8f4f Mon Sep 17 00:00:00 2001
From: Po Lu <luangruo@yahoo.com>
Date: Tue, 9 Nov 2021 09:40:09 +0800
Subject: [PATCH] Fix flicker when setting hscroll of xwidget

* src/xterm.c (x_scroll_run): Use original height of xwidget instead
of window height and set cairo surface size.
---
 src/xterm.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 1fb3d8d7c0..172abe919d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4408,7 +4408,7 @@ x_scroll_run (struct window *w, struct run *run)
 	  Window child = children[i];
 	  struct xwidget_view *view = xwidget_view_from_window (child);
 
-	  if (view)
+	  if (view && !view->hidden)
 	    {
 	      int window_y = view->y + view->clip_top;
 	      int window_height = view->clip_bottom - view->clip_top;
@@ -4445,16 +4445,14 @@ x_scroll_run (struct window *w, struct run *run)
 		  view->y = y;
 
 		  clip_top = 0;
-		  clip_bottom = window_height;
+		  clip_bottom = XXWIDGET (view->model)->height;
 
 		  if (y < text_area_y)
 		    clip_top = text_area_y - y;
 
-		  if ((y + clip_top + window_height)
-		      > (text_area_y + text_area_height))
+		  if ((y + clip_bottom) > (text_area_y + text_area_height))
 		    {
-		      clip_bottom -= (y + clip_top + window_height)
-			- (text_area_y + text_area_height);
+		      clip_bottom -= (y + clip_bottom) - (text_area_y + text_area_height);
 		    }
 
 		  view->clip_top = clip_top;
@@ -4468,10 +4466,16 @@ x_scroll_run (struct window *w, struct run *run)
 		      XUnmapWindow (dpy, child);
 		    }
 		  else
-		    XMoveResizeWindow (dpy, child, view->x + view->clip_left,
-				       view->y + view->clip_top,
-				       view->clip_right - view->clip_left,
-				       view->clip_bottom - view->clip_top);
+		    {
+		      XMoveResizeWindow (dpy, child, view->x + view->clip_left,
+					 view->y + view->clip_top,
+					 view->clip_right - view->clip_left,
+					 view->clip_bottom - view->clip_top);
+		      cairo_xlib_surface_set_size (view->cr_surface,
+						   view->clip_right - view->clip_left,
+						   view->clip_bottom - view->clip_top);
+		    }
+		  xwidget_expose (view);
 		  XFlush (dpy);
 		}
             }
-- 
2.31.1


[-- Attachment #3: Type: text/plain, Size: 9 bytes --]


Thanks.

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

* bug#51697: 29.0.50; [PATCH] Fix flicker when setting hscroll of xwidget
  2021-11-09  3:05   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-11-09  4:06     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-09  4:06 UTC (permalink / raw)
  To: Po Lu; +Cc: 51697

Po Lu <luangruo@yahoo.com> writes:

> Please ignore that and use this instead, which also fixes disappearing
> text.

Thanks; pushed now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-11-09  4:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87ee7qnm15.fsf.ref@yahoo.com>
2021-11-09  1:41 ` bug#51697: 29.0.50; [PATCH] Fix flicker when setting hscroll of xwidget Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-09  3:05   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-09  4:06     ` Lars Ingebrigtsen

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).