[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master a3d7332d75: Correctly handle frame synchronization on fullscreen
From: |
Po Lu |
Subject: |
master a3d7332d75: Correctly handle frame synchronization on fullscreen KWin |
Date: |
Tue, 6 Sep 2022 07:39:33 -0400 (EDT) |
branch: master
commit a3d7332d758aca4583a0a6b953a4b383679a6f20
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Correctly handle frame synchronization on fullscreen KWin
* src/xfns.c (x_set_use_frame_synchronization): Announce that we
do not want the compositor to unredirect the frame while
fullscreen.
* src/xterm.c (x_atom_refs): New atom
`_NET_WM_BYPASS_COMPOSITOR'.
* src/xterm.h (struct x_display_info): Likewise.
---
src/xfns.c | 25 ++++++++++++++++++++++---
src/xterm.c | 1 +
src/xterm.h | 3 ++-
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/src/xfns.c b/src/xfns.c
index 2da1e7bcf8..fc8b30a9d6 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2423,14 +2423,33 @@ x_set_use_frame_synchronization (struct frame *f,
Lisp_Object arg,
{
#if defined HAVE_XSYNC && !defined USE_GTK && defined HAVE_CLOCK_GETTIME
struct x_display_info *dpyinfo;
+ unsigned long bypass_compositor;
dpyinfo = FRAME_DISPLAY_INFO (f);
if (!NILP (arg) && FRAME_X_EXTENDED_COUNTER (f))
- FRAME_X_OUTPUT (f)->use_vsync_p
- = x_wm_supports (f, dpyinfo->Xatom_net_wm_frame_drawn);
+ {
+ FRAME_X_OUTPUT (f)->use_vsync_p
+ = x_wm_supports (f, dpyinfo->Xatom_net_wm_frame_drawn);
+
+ /* At the same time, write the bypass compositor property to the
+ outer window. 2 means to never bypass the compositor, as we
+ need its cooperation for frame synchronization. */
+ bypass_compositor = 2;
+ XChangeProperty (dpyinfo->display, FRAME_OUTER_WINDOW (f),
+ dpyinfo->Xatom_net_wm_bypass_compositor,
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &bypass_compositor, 1);
+ }
else
- FRAME_X_OUTPUT (f)->use_vsync_p = false;
+ {
+ FRAME_X_OUTPUT (f)->use_vsync_p = false;
+
+ /* Remove the compositor bypass property from the outer
+ window. */
+ XDeleteProperty (dpyinfo->display, FRAME_OUTER_WINDOW (f),
+ dpyinfo->Xatom_net_wm_bypass_compositor);
+ }
store_frame_param (f, Quse_frame_synchronization,
FRAME_X_OUTPUT (f)->use_vsync_p ? Qt : Qnil);
diff --git a/src/xterm.c b/src/xterm.c
index c58f2d15da..6f76622bfe 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -998,6 +998,7 @@ static const struct x_atom_ref x_atom_refs[] =
ATOM_REFS_INIT ("_NET_WM_SYNC_REQUEST", Xatom_net_wm_sync_request)
ATOM_REFS_INIT ("_NET_WM_SYNC_REQUEST_COUNTER",
Xatom_net_wm_sync_request_counter)
ATOM_REFS_INIT ("_NET_WM_SYNC_FENCES", Xatom_net_wm_sync_fences)
+ ATOM_REFS_INIT ("_NET_WM_BYPASS_COMPOSITOR",
Xatom_net_wm_bypass_compositor)
ATOM_REFS_INIT ("_NET_WM_FRAME_DRAWN", Xatom_net_wm_frame_drawn)
ATOM_REFS_INIT ("_NET_WM_FRAME_TIMINGS", Xatom_net_wm_frame_timings)
ATOM_REFS_INIT ("_NET_WM_USER_TIME", Xatom_net_wm_user_time)
diff --git a/src/xterm.h b/src/xterm.h
index 7c5a889af3..d6ff15e40f 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -656,7 +656,8 @@ struct x_display_info
Xatom_net_wm_sync_request, Xatom_net_wm_sync_request_counter,
Xatom_net_wm_sync_fences, Xatom_net_wm_frame_drawn,
Xatom_net_wm_frame_timings,
Xatom_net_wm_user_time, Xatom_net_wm_user_time_window,
- Xatom_net_client_list_stacking, Xatom_net_wm_pid;
+ Xatom_net_client_list_stacking, Xatom_net_wm_pid,
+ Xatom_net_wm_bypass_compositor;
/* XSettings atoms and windows. */
Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master a3d7332d75: Correctly handle frame synchronization on fullscreen KWin,
Po Lu <=