From 35f9e0f46975c35ffec494a46dedf03304ca9da1 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 9 Nov 2021 05:06:24 +0100 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 (bug#51697). --- src/xterm.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 1fb3d8d7c09..172abe919dd 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.39.5