[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ade1238bce: Try to restore the initial "daemon" frame when a disp
From: |
Po Lu |
Subject: |
master ade1238bce: Try to restore the initial "daemon" frame when a display goes down |
Date: |
Thu, 14 Jul 2022 06:49:28 -0400 (EDT) |
branch: master
commit ade1238bce1cf69ebce8809a2d73cb92db94b977
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Try to restore the initial "daemon" frame when a display goes down
* src/xterm.c (x_try_restore_frame): New function.
(x_connection_closed): Call it if selected_frame is nil.
---
src/xterm.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/xterm.c b/src/xterm.c
index 1d0e69d32b..85367b78e3 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -23312,6 +23312,22 @@ x_trace_wire (Display *dpy)
static char *error_msg;
+/* Try to find a frame in Vframe_list, and make it the selected frame.
+ `delete_frame' sometimes misses the initial frame for an unknown
+ reason when Emacs is running as a background daemon. */
+
+static void
+x_try_restore_frame (void)
+{
+ Lisp_Object tail, frame;
+
+ FOR_EACH_FRAME (tail, frame)
+ {
+ if (!NILP (do_switch_frame (frame, 1, Qnil)))
+ return;
+ }
+}
+
/* Handle the loss of connection to display DPY. ERROR_MESSAGE is
the text of an error message that lead to the connection loss. */
@@ -23529,6 +23545,11 @@ For details, see etc/PROBLEMS.\n",
Fdelete_terminal (tmp, Qnoelisp);
}
+ /* The initial "daemon" frame is sometimes not selected by
+ `delete_frame' when Emacs is a background daemon. */
+ if (NILP (selected_frame))
+ x_try_restore_frame ();
+
unblock_input ();
/* Sometimes another terminal is still alive, but deleting this
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master ade1238bce: Try to restore the initial "daemon" frame when a display goes down,
Po Lu <=