all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 23568@debbugs.gnu.org
Subject: bug#23568: 25.0.94; Mode line menus appear incorrectly in some monitor configurations
Date: Fri, 02 Jun 2017 01:18:46 -0600	[thread overview]
Message-ID: <8737bi97s9.fsf@gmail.com> (raw)
In-Reply-To: <5931014B.20700@gmx.at> (martin rudalics's message of "Fri, 02 Jun 2017 08:10:19 +0200")

martin rudalics <rudalics@gmx.at> writes:

>> I just noticed that frame.el also includes frame-monitor-attributes,
>> which also makes me think that frame.el is a nice place for these
>> procedures.
>
> For the moment putting them in frame.el should be OK.  Eventually these
> functions should be in frame.c and represent stripped down versions of
> ‘display-monitor-attributes-list’ where only the dominating monitor for
> the given frame or coordinates is investigated.  Other monitors and
> things like lists of frames dominated by a monitor, mm values, name and
> source would not be calculated by the respective backends.  These values
> are not needed for checking tip frame or menu positions and repeatedly
> evaluating and returning the same values seems rather silly.

I agree that you shouldn't have to calculate everything each time,
though I don't know enough about the C code to achieve that right now.

In the end, we would still leave the function interface so that users
can still call the discussed procedures from lisp code, right? I don't
want to introduce an interface just for it to be removed later on if I
can avoid it.

In any case, I altered display-monitor-attribute to use
frame-monitor-attributes and to not succeed on {x, y} = max-{x, y}:

(defun display-monitor-attribute (attribute &optional frame x y)
  "Return the value of the attribute of the 'current' monitor.
By default, use the frame info to determine the current monitor,
but if x and y are non-nil then use the given coordinates to
determine it."
  (if (and x y)
      (cl-loop for monitor in (display-monitor-attributes-list)
               for geometry = (alist-get 'geometry monitor)
               for min-x = (pop geometry)
               for min-y = (pop geometry)
               for max-x = (+ min-x (pop geometry))
               for max-y = (+ min-y (car geometry))
               when (and (<= min-x x)
                         (< x max-x)
                         (<= min-y y)
                         (< y max-y))
               return (alist-get attribute monitor))
    (alist-get attribute (frame-monitor-attributes frame))))





  reply	other threads:[~2017-06-02  7:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17 20:44 bug#23568: 25.0.94; Mode line menus appear incorrectly in some monitor configurations Alex
2016-05-18 21:28 ` Alex
2017-05-28  7:09 ` Alex
2017-05-31  7:14   ` Alex
2017-05-31  9:26     ` martin rudalics
2017-05-31 21:18       ` Alex
2017-06-01  5:39         ` martin rudalics
2017-06-01 20:33           ` Alex
2017-06-01 20:51             ` Alex
2017-06-02  6:10               ` martin rudalics
2017-06-02  7:18                 ` Alex [this message]
2017-06-02  9:00                   ` martin rudalics
2017-06-03  0:54                     ` Alex
2017-06-03  6:32                       ` Eli Zaretskii
2017-06-03 19:19                         ` Alex
2017-06-04 14:28                           ` Eli Zaretskii
2017-06-05  8:03                             ` Alex
2017-06-05 15:36                               ` Eli Zaretskii
2017-06-05 19:33                                 ` martin rudalics
2017-06-10  9:30                               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8737bi97s9.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=23568@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.