]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix flicker when setting hscroll of xwidget
authorPo Lu <luangruo@yahoo.com>
Tue, 9 Nov 2021 04:06:24 +0000 (05:06 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 9 Nov 2021 04:06:24 +0000 (05:06 +0100)
* 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

index 1fb3d8d7c09108bee099866ca835bce42b3196b5..172abe919ddad577617dcce3fb711564cbfd2560 100644 (file)
@@ -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);
                }
             }