Subject: bug#18657: 24.4.50; positioning frames on multi-monitor displays

From: Drew Adams <[email-masked]>
Date: Tue, 7 Oct 2014 14:18:13 -0700 (PDT)

As an update, the OP who reported the issue to me confirms that he
is using MS Windows (I thought he was not).  And he sent me this
info from his setup:

(frame-parameters):

((tool-bar-position . top) (parent-id) (explicit-name) (display . "w32") (visibility . t) (icon-name) (window-id . "459396") (top . 11) (left + -1249) (buried-buffer-list) (buffer-list #<buffer *Messages*> #<buffer  *Minibuf-1*> #<buffer procedure-codes.org> #<buffer  *Agenda Commands*> #<buffer *Org Agenda(w)*> #<buffer work-log.org>) (unsplittable) ...

M-x maximize-frame

(frame-parameters):
((tool-bar-position . top) (parent-id) (explicit-name) (display . "w32") (visibility . t) (icon-name) (window-id . "459396") (top . 0) (left . 0) (buried-buffer-list) (buffer-list #<buffer *Messages*> #<buffer  *Minibuf-1*> #<buffer procedure-codes.org> #<buffer  *Agenda Commands*> #<buffer *Org Agenda(w)*> #<buffer work-log.org>) (unsplittable) ...)
M-x restore-frame
((tool-bar-position . top) (parent-id) (explicit-name) (display . "w32") (visibility . t) (icon-name) (window-id . "459396") (top . 11) (left + -1249) (buried-buffer-list) (buffer-list #<buffer *Messages*> #<buffer  *Minibuf-1*> #<buffer procedure-codes.org> #<buffer  *Agenda Commands*> #<buffer *Org Agenda(w)*> #<buffer work-log.org>) (unsplittable) ...)

Based on that, I've sent him an updated version of `maximize-frame'
(from `frame-cmds.el'), which differs only in not using (0,0) as the
position coordinates systematically.  Instead, it uses this:

(nth 1 (assq 'workarea (frame-monitor-attributes frame))) ; For left
(nth 2 (assq 'workarea (frame-monitor-attributes frame))) ; For right

Andy, perhaps you could try that?

[I'm assuming that the `workarea' and `geometry' values are, in order:
LEFT TOP, WIDTH HEIGHT.

FWIW, The doc of `display-monitor-attributes-list' refers to them as
X Y WIDTH HEIGHT, and the doc of `frame-monitor-attributes' refers to
the `d-m-a-l' doc.  Not so clear (What are X and Y? What units for
WIDTH and HEIGHT?), but better than nothing.

(BTW, if these essentially follow the `geometry' X Window spec, why
is the order changed from what is used for that?)]