+2002-08-21 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * gnus.el (gnus-other-frame-parameters): New user option.
+ (gnus-other-frame-object): New variable.
+ (gnus-other-frame): Make it search for existing Gnus frame; don't
+ read new news; delete frame on exit.
+
+ * gnus-util.el (gnus-select-frame-set-input-focus): New function.
+
+ * lpath.el: Fbind w32-focus-frame and x-focus-frame.
+
2002-08-20 Katsumi Yamaoka <yamaoka@jpl.org>
From \e$B>.4X\e(B \e$B5HB'\e(B (KOSEKI Yoshinori) <kose@meadowy.org>.
(kill-buffer buf))
tchar))
+(defun gnus-select-frame-set-input-focus (frame)
+ "Select FRAME, raise it, and set input focus, if possible."
+ (cond ((featurep 'xemacs)
+ (raise-frame frame)
+ (select-frame frame)
+ (focus-frame frame))
+ ;; The function `select-frame-set-input-focus' won't set
+ ;; the input focus under Emacs 21.2 and X window system.
+ ;;((fboundp 'select-frame-set-input-focus)
+ ;; (defalias 'gnus-select-frame-set-input-focus
+ ;; 'select-frame-set-input-focus)
+ ;; (select-frame-set-input-focus frame))
+ (t
+ (raise-frame frame)
+ (select-frame frame)
+ (cond ((and (eq window-system 'x)
+ (fboundp 'x-focus-frame))
+ (x-focus-frame frame))
+ ((eq window-system 'w32)
+ (w32-focus-frame frame)))
+ (when (or (not (boundp 'focus-follows-mouse))
+ (symbol-value 'focus-follows-mouse))
+ (set-mouse-position frame (1- (frame-width frame)) 0)))))
+
(provide 'gnus-util)
;;; gnus-util.el ends here
:group 'gnus-agent
:type 'boolean)
+(defcustom gnus-other-frame-parameters nil
+ "Frame parameters used by `gnus-other-frame' to create a Gnus frame.
+This should be an alist for FSF Emacs, or a plist for XEmacs."
+ :group 'gnus-start
+ :type (if (featurep 'xemacs)
+ '(repeat (list :inline t :format "%v"
+ (symbol :tag "Property")
+ (sexp :tag "Value")))
+ '(repeat (cons :format "%v"
+ (symbol :tag "Parameter")
+ (sexp :tag "Value")))))
+
\f
;;; Internal variables
(defvar gnus-invalid-group-regexp "[: `'\"/]\\|^$"
"Regexp matching invalid groups.")
+(defvar gnus-other-frame-object nil
+ "A frame object which will be created by `gnus-other-frame'.")
+
;;; End of variables.
;; Define some autoload functions Gnus might use.
(defun gnus-other-frame (&optional arg)
"Pop up a frame to read news."
(interactive "P")
- (static-if (featurep 'xemacs)
- (let ((toolbar-news-use-separate-frame t))
- (toolbar-gnus))
- (if (frame-live-p gnus-frame)
- (raise-frame gnus-frame)
- (setq gnus-frame (make-frame gnus-frame-properties))
- (if (and (gnus-buffer-live-p gnus-group-buffer)
- (save-current-buffer
- (set-buffer gnus-group-buffer)
- (eq 'gnus-group-mode major-mode)))
- (progn
- (select-frame gnus-frame)
- (switch-to-buffer gnus-group-buffer))
- (add-hook 'gnus-exit-gnus-hook
- (lambda ()
- (when (and (frame-live-p gnus-frame)
- (cdr (frame-list)))
- (delete-frame gnus-frame))
- (setq gnus-frame nil)))
- (select-frame gnus-frame)
- (gnus arg)))))
+ (let ((alive (gnus-alive-p)))
+ (or (and alive
+ (catch 'found
+ (walk-windows
+ (lambda (window)
+ (when (with-current-buffer (window-buffer window)
+ (string-match "\\`gnus-.+-mode\\'"
+ (symbol-name major-mode)))
+ (gnus-select-frame-set-input-focus
+ (setq gnus-other-frame-object (window-frame window)))
+ (select-window window)
+ (throw 'found t)))
+ 'ignore t)))
+ (gnus-select-frame-set-input-focus
+ (setq gnus-other-frame-object
+ (make-frame gnus-other-frame-parameters)))
+ (if alive
+ (switch-to-buffer gnus-group-buffer)
+ (gnus arg)
+ (add-hook 'gnus-exit-gnus-hook
+ (lambda nil
+ (when (and (frame-live-p gnus-other-frame-object)
+ (cdr (frame-list)))
+ (delete-frame gnus-other-frame-object))
+ (setq gnus-other-frame-object nil)))))))
;;;###autoload
(defun gnus (&optional arg dont-connect slave)