Call select-frame-set-input-focus to restore focus on the frame
that had last-focus-update frame parameter before saving frameset.
(Bug#36894)
(error
(delay-warning 'frameset (error-message-string err) :warning))))))
+ ;; Make sure the frame with last-focus-update 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