bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36894: Restore frameset focus and selectedness


From: Juri Linkov
Subject: bug#36894: Restore frameset focus and selectedness
Date: Wed, 14 Aug 2019 23:50:44 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>>  > The window manager always selects the last created frame, i.e.
>>  > it seems it's impossible to create a new frame without selecting it.
>> 
>> The xfce window manager has an option for whether a new window should
>> be automatically given focus or not.
>
> I'm not sure I understand what you both are saying.  Are you saying
> that this problem is impossible to solve in Emacs?

The problem can be solved with this patch:

diff --git a/lisp/frameset.el b/lisp/frameset.el
index 60b6fe38ad..4f7800630c 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -1346,6 +1352,16 @@ frameset-restore
            (error
             (delay-warning 'frameset (error-message-string err) :warning))))))
 
+    ;; Make sure the last selected frame has focus.
+    (let ((last-focus-frame
+           (catch 'last-focus
+             (maphash (lambda (frame _)
+                        (when (frame-parameter frame 'last-focus-update)
+                          (throw 'last-focus frame)))
+                      frameset--action-map))))
+      (when last-focus-frame
+        (select-frame-set-input-focus last-focus-frame)))
+
     ;; Make sure there's at least one visible frame.
     (unless (or (daemonp)
                (catch 'visible

reply via email to

[Prev in Thread] Current Thread [Next in Thread]