summaryrefslogtreecommitdiff
path: root/src/xterm.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-12-09 18:28:42 +0800
committerPo Lu <luangruo@yahoo.com>2022-12-09 18:30:23 +0800
commitcce37ac9f4c66d927d1acae75763e5fb56632783 (patch)
treee082050be86bbea101feec4c953bb7409ab8fa08 /src/xterm.c
parentab1fd3e8d3aa9fa3e5b27fe8eb6178b54bedb67b (diff)
downloademacs-cce37ac9f4c66d927d1acae75763e5fb56632783.tar.gz
Improve some behavior when the X server does not trust Emacs
* src/xterm.c (x_dnd_begin_drag_and_drop): Display error when Emacs is untrusted instead of hanging indefinitely. (x_focus_frame): Simply return instead of wasting time when Emacs is untrusted.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 4c859c46c31..872326392a6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -12308,6 +12308,13 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
struct xi_device_t *device;
#endif
+ if (FRAME_DISPLAY_INFO (f)->untrusted)
+ /* Untrusted clients cannot send messages to trusted clients or
+ read the window tree, so drag and drop will likely not work at
+ all. */
+ error ("Drag-and-drop is not possible when the client is"
+ " not trusted by the X server.");
+
base = SPECPDL_INDEX ();
/* Bind this here to avoid juggling bindings and SAFE_FREE in
@@ -27949,12 +27956,17 @@ x_focus_frame (struct frame *f, bool noactivate)
struct x_display_info *dpyinfo;
Time time;
+ dpyinfo = FRAME_DISPLAY_INFO (f);
+
+ if (dpyinfo->untrusted)
+ /* The X server ignores all input focus related requests from
+ untrusted clients. */
+ return;
+
/* The code below is not reentrant wrt to dpyinfo->x_focus_frame and
friends being set. */
block_input ();
- dpyinfo = FRAME_DISPLAY_INFO (f);
-
if (FRAME_X_EMBEDDED_P (f))
/* For Xembedded frames, normally the embedder forwards key
events. See XEmbed Protocol Specification at