summaryrefslogtreecommitdiff
path: root/src/xwidget.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2021-11-17 20:31:41 +0800
committerPo Lu <luangruo@yahoo.com>2021-11-17 20:34:30 +0800
commit9ae741750cc3e96cacb3c496f7c941e5fc3f1052 (patch)
tree68bee7fd2fafa035177f1b361afb12bee523ee03 /src/xwidget.c
parentb6ea007f9dc02f2699d5d772032344fbd189c55d (diff)
downloademacs-9ae741750cc3e96cacb3c496f7c941e5fc3f1052.tar.gz
Don't draw xwidgets that have just been resized
This serves to eliminate the huge black bar displayed when the offscreen widget has been resized (and as such the damage event signal is sent), but the X window hasn't. * src/xwidget.c (xv_do_draw): Don't draw xwidgets that have just been resized. (x_draw_xwidget_glyph_string) (xwidget_init_view): Clear just_resized. (Fxwidget_resize): Set just_resized first, then queue allocate.
Diffstat (limited to 'src/xwidget.c')
-rw-r--r--src/xwidget.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/xwidget.c b/src/xwidget.c
index 650572a8896..e1d54d43b74 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -1062,6 +1062,9 @@ xv_do_draw (struct xwidget_view *xw, struct xwidget *w)
GtkOffscreenWindow *wnd;
cairo_surface_t *surface;
+ if (xw->just_resized)
+ return;
+
if (NILP (w->buffer))
{
XClearWindow (xw->dpy, xw->wdesc);
@@ -1578,6 +1581,7 @@ xwidget_init_view (struct xwidget *xww,
xv->wdesc = None;
xv->frame = s->f;
xv->cursor = cursor_for_hit (xww->hit_result, s->f);
+ xv->just_resized = false;
#elif defined NS_IMPL_COCOA
nsxwidget_init_view (xv, xww, s, x, y);
nsxwidget_resize_view(xv, xww->width, xww->height);
@@ -1609,6 +1613,8 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
#ifdef USE_GTK
if (!xv)
xv = xwidget_init_view (xww, s, x, y);
+
+ xv->just_resized = false;
#elif defined NS_IMPL_COCOA
if (!xv)
{
@@ -1970,20 +1976,7 @@ DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 3, 3, 0,
xw->width = w;
xw->height = h;
- /* If there is an offscreen widget resize it first. */
-#ifdef USE_GTK
- if (xw->widget_osr)
- {
- gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width,
- xw->height);
- gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width,
- xw->height);
-
- gtk_widget_queue_allocate (GTK_WIDGET (xw->widget_osr));
- }
-#elif defined NS_IMPL_COCOA
- nsxwidget_resize (xw);
-#endif
+ block_input ();
for (Lisp_Object tail = internal_xwidget_view_list; CONSP (tail);
tail = XCDR (tail))
@@ -1993,13 +1986,34 @@ DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 3, 3, 0,
struct xwidget_view *xv = XXWIDGET_VIEW (XCAR (tail));
if (XXWIDGET (xv->model) == xw)
{
+#ifdef USE_GTK
+ xv->just_resized = true;
+ SET_FRAME_GARBAGED (xv->frame);
+#else
wset_redisplay (XWINDOW (xv->w));
+#endif
}
}
}
redisplay ();
+ /* If there is an offscreen widget resize it first. */
+#ifdef USE_GTK
+ if (xw->widget_osr)
+ {
+ gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width,
+ xw->height);
+ gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width,
+ xw->height);
+
+ gtk_widget_queue_allocate (GTK_WIDGET (xw->widget_osr));
+ }
+#elif defined NS_IMPL_COCOA
+ nsxwidget_resize (xw);
+#endif
+ unblock_input ();
+
return Qnil;
}