From 50e51beabb2420ba3f844742352a98c7987c4932 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 6 Feb 2022 10:43:38 +0800 Subject: [PATCH] Allow disabling frame resize synchronization * doc/emacs/xresources.texi (Table of Resources): Document new parameter `synchronizeResize'. * etc/NEWS: Announce frame resize synchronization. * src/xterm.c (x_term_init): Don't enable XSync if the X resource `synchronizeResize' is off or false. --- doc/emacs/xresources.texi | 8 ++++++++ etc/NEWS | 8 ++++++++ src/xterm.c | 16 +++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi index bb362ca3eae..5e01c955d16 100644 --- a/doc/emacs/xresources.texi +++ b/doc/emacs/xresources.texi @@ -373,6 +373,14 @@ Use some location on display specific to the input method for displaying the preview text. @end table +@item @code{synchronizeResize} (class @code{SynchronizeResize}) +If @samp{off} or @samp{false}, Emacs will not try to tell the window +manager when it has finished redrawing the display in response to a +request to resize a frame. Otherwise, the window manager will +postpone drawing a frame that was just resized until its contents are +updated, which prevents blank areas of a frame that have not yet been +painted from being displayed. + @item @code{verticalScrollBars} (class @code{ScrollBars}) Give frames scroll bars on the left if @samp{left}, on the right if @samp{right}; don't have scroll bars if @samp{off} (@pxref{Scroll Bars}). diff --git a/etc/NEWS b/etc/NEWS index b432da5d48d..6c5aeacb7be 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -182,6 +182,14 @@ and pop-up menus. This controls the style of the pre-edit and status areas of X input methods. ++++ +** On X11, Emacs now tries to synchronize window resize with the window manager. +This leads to less flicker and empty areas of a frame being displayed +when a frame is being resized. Unfortunately, it does not work on +some ancient buggy window managers, so if Emacs appears to freeze, but +is still responive to input, you can turn it off by setting the X +resource "synchronizeResize" to "off". + +++ ** New frame parameter 'alpha-background' and X resource "alphaBackground". This controls the opacity of the text background when running on a diff --git a/src/xterm.c b/src/xterm.c index 0d0a08d078b..67b9f5b38c8 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -15681,8 +15681,22 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo->xsync_supported_p = XSyncInitialize (dpyinfo->display, &dpyinfo->xsync_major, &dpyinfo->xsync_minor); -#endif + { + AUTO_STRING (synchronizeResize, "synchronizeResize"); + AUTO_STRING (SynchronizeResize, "SynchronizeResize"); + + Lisp_Object value = gui_display_get_resource (dpyinfo, + synchronizeResize, + SynchronizeResize, + Qnil, Qnil); + + if (STRINGP (value) && + (!strcmp (SSDATA (value), "false") + || !strcmp (SSDATA (value), "off"))) + dpyinfo->xsync_supported_p = false; + } +#endif /* See if a private colormap is requested. */ if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen)) { -- 2.39.5