From 37751569902a8c1073bea64059f01540221d7361 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 6 Feb 2022 19:51:05 +0800 Subject: [PATCH] Disable extended frame synchronization by default * doc/emacs/xresources.texi (Table of Resources): Document new possible value of `synchronizeResize'. * src/xfns.c (Fx_create_frame): Set synchronization protocol according to `synchronizeResize'. --- doc/emacs/xresources.texi | 5 ++++- src/xfns.c | 22 +++++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi index 5e01c955d16..c7c6c072ee8 100644 --- a/doc/emacs/xresources.texi +++ b/doc/emacs/xresources.texi @@ -379,7 +379,10 @@ 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. +painted from being displayed. If set to @samp{extended}, it will +enable use of extended frame synchronization, which might be supported +by some compositing window managers which don't support basic +synchronization. @item @code{verticalScrollBars} (class @code{ScrollBars}) Give frames scroll bars on the left if @samp{left}, on the right if diff --git a/src/xfns.c b/src/xfns.c index 1ed4f032053..2b8a1abdfe0 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4815,15 +4815,25 @@ This function is an internal primitive--use `make-frame' instead. */) XSyncValue initial_value; XSyncCounter counters[2]; + AUTO_STRING (synchronizeResize, "synchronizeResize"); + AUTO_STRING (SynchronizeResize, "SynchronizeResize"); + + Lisp_Object value = gui_display_get_resource (dpyinfo, + synchronizeResize, + SynchronizeResize, + Qnil, Qnil); + XSyncIntToValue (&initial_value, 0); counters[0] = FRAME_X_BASIC_COUNTER (f) = XSyncCreateCounter (FRAME_X_DISPLAY (f), initial_value); - counters[1] - = FRAME_X_EXTENDED_COUNTER (f) - = XSyncCreateCounter (FRAME_X_DISPLAY (f), - initial_value); + + if (STRINGP (value) && !strcmp (SSDATA (value), "extended")) + counters[1] + = FRAME_X_EXTENDED_COUNTER (f) + = XSyncCreateCounter (FRAME_X_DISPLAY (f), + initial_value); FRAME_X_OUTPUT (f)->current_extended_counter_value = initial_value; @@ -4831,7 +4841,9 @@ This function is an internal primitive--use `make-frame' instead. */) XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), dpyinfo->Xatom_net_wm_sync_request_counter, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *) &counters, 2); + (unsigned char *) &counters, + ((STRINGP (value) + && !strcmp (SSDATA (value), "extended")) ? 2 : 1)); #endif } #endif -- 2.39.5