From 1a988d9ff55c098ddee0c79afcccbdc63e7c680e Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 8 May 2022 14:33:34 +0800 Subject: [PATCH] Improve handling of invisible cursor alloc failures * src/xterm.c (x_toggle_visible_pointer): Use Xfixes if cursor allocation really fails. This happens when the X server has a limit on the number of cursors that can be created. --- src/xterm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/xterm.c b/src/xterm.c index 2fc4c559a9c..a7f0f3d7efa 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9452,8 +9452,21 @@ x_toggle_visible_pointer (struct frame *f, bool invisible) if (dpyinfo->invisible_cursor == None) dpyinfo->invisible_cursor = make_invisible_cursor (dpyinfo); +#ifndef HAVE_XFIXES if (dpyinfo->invisible_cursor == None) invisible = false; +#else + /* But if Xfixes is available, try using it instead. */ + if (x_probe_xfixes_extension (dpyinfo)) + { + dpyinfo->fixes_pointer_blanking = true; + xfixes_toggle_visible_pointer (f, invisible); + + return; + } + else + invisible = false; +#endif if (invisible) XDefineCursor (dpyinfo->display, FRAME_X_WINDOW (f), -- 2.39.2