[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 83a497ee87: Prevent crashes upon trying to focus a child frame on
From: |
Po Lu |
Subject: |
master 83a497ee87: Prevent crashes upon trying to focus a child frame on click |
Date: |
Mon, 14 Nov 2022 01:08:14 -0500 (EST) |
branch: master
commit 83a497ee879959cd1b052fa9138adb79b480394d
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Prevent crashes upon trying to focus a child frame on click
* src/xterm.c (handle_one_xevent): Do not try to activate
override-redirect frames. Explain why.
(x_focus_frame): Catch errors around XSetInputFocus.
---
src/xterm.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/xterm.c b/src/xterm.c
index 48ddd17568..7a1fd6086c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -21135,8 +21135,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (FRAME_PARENT_FRAME (f) || (hf && frame_ancestor_p (f, hf)))
{
+ x_ignore_errors_for_next_request (dpyinfo);
XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
RevertToParent, event->xbutton.time);
+ x_stop_ignoring_errors (dpyinfo);
+
if (FRAME_PARENT_FRAME (f))
XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
}
@@ -22838,9 +22841,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
}
#else
/* Non-no toolkit builds without GTK 3 use core
- events to handle focus. */
+ events to handle focus. Errors are still
+ caught here in case the window is not
+ viewable. */
+ x_ignore_errors_for_next_request (dpyinfo);
XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW
(f),
RevertToParent, xev->time);
+ x_stop_ignoring_errors (dpyinfo);
#endif
if (FRAME_PARENT_FRAME (f))
XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW
(f));
@@ -27602,6 +27609,10 @@ x_focus_frame (struct frame *f, bool noactivate)
else
{
if (!noactivate
+ /* If F is override-redirect, use SetInputFocus instead.
+ Override-redirect frames are not subject to window
+ management. */
+ && !FRAME_OVERRIDE_REDIRECT (f)
/* If F is a child frame, use SetInputFocus instead. This
may not work if its parent is not activated. */
&& !FRAME_PARENT_FRAME (f)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 83a497ee87: Prevent crashes upon trying to focus a child frame on click,
Po Lu <=