summaryrefslogtreecommitdiff
path: root/src/xterm.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-11-16 10:37:14 +0800
committerPo Lu <luangruo@yahoo.com>2022-11-16 10:37:14 +0800
commit0600065ff276d5c55c3ff2f466dfbce74586164f (patch)
treec641c4d30714eb8bb6b3c96f070b48c73d5d07ca /src/xterm.c
parentd2ba4538cb561b5f93f53c1088d55530f12bf483 (diff)
downloademacs-0600065ff276d5c55c3ff2f466dfbce74586164f.tar.gz
Fix error trapping in x_focus_frame
* src/xterm.c (x_focus_frame): Improve commentary. Dno not trap errors around x_get_server_time.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 7a1fd6086cf..d6ba532f16e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -27632,8 +27632,6 @@ x_focus_frame (struct frame *f, bool noactivate)
return;
}
- /* Ignore any BadMatch error this request might result in. */
- x_ignore_errors_for_next_request (dpyinfo);
if (NILP (Vx_no_window_manager))
{
/* Use the last user time. It is invalid to use CurrentTime
@@ -27651,15 +27649,24 @@ x_focus_frame (struct frame *f, bool noactivate)
&& !dpyinfo->x_focus_frame)
time = x_get_server_time (f);
+ /* Ignore any BadMatch error this request might result in.
+ A BadMatch error can occur if the window was obscured
+ after the time of the last user interaction without
+ changing the last-focus-change-time. */
+ x_ignore_errors_for_next_request (dpyinfo);
XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
RevertToParent, time);
+ x_stop_ignoring_errors (dpyinfo);
}
else
- XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
- /* But when no window manager is in use, we
- don't care. */
- RevertToParent, CurrentTime);
- x_stop_ignoring_errors (dpyinfo);
+ {
+ x_ignore_errors_for_next_request (dpyinfo);
+ XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
+ /* But when no window manager is in use, we
+ don't care. */
+ RevertToParent, CurrentTime);
+ x_stop_ignoring_errors (dpyinfo);
+ }
}
}