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

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

bug#34516: Multi-monitor frame sets


From: Robert Pluim
Subject: bug#34516: Multi-monitor frame sets
Date: Fri, 29 Mar 2019 09:16:54 +0100

>>>>> On Thu, 28 Mar 2019 23:57:43 +0200, Juri Linkov <juri@linkov.net> said:

    Juri> Thanks for the hint.  Now I added the default value to
    Juri> make-frame-on-monitor, so for the current monitor you can
    Juri> just do: M-x make-frame-on-monitor RET RET
    >> 
    >> Thanks for that. I guess we can close the bug, if it isnʼt
    >> closed already.

    Juri> But what about your implementation of monitor names for
    Juri> macOS?

The fake ones? I guess I can push that, unless we have a working way
to get the real ones. I havenʼt had a chance to look at the other
project suggested by someone on this thread, nor do I know what
license itʼs under. Current version below.

Robert

>From abcc4431240f9a9b3b9d8a22b3acbdb30b28f7d4 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim@gmail.com>
Date: Thu, 28 Feb 2019 10:13:05 +0100
Subject: [PATCH] Provide a fallback monitor name on macOS
To: emacs-devel@gnu.org

The fix for Bug#34516 provides a way to make a frame on a specific
monitor.  It relies on monitor names being available, which is not the
case for recent versions of macOS, so provide fake ones of the form
Monitorx.

* src/nsfns.m (Fns_display_monitor_attributes_list): Provide a
fallback for the monitor name if the existing methods don't work.
---
 src/nsfns.m | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/nsfns.m b/src/nsfns.m
index ee7598a1c7..3c4d8c91f3 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -2587,6 +2587,12 @@ Frames are listed from topmost (first) to bottommost 
(last).  */)
 
 #ifdef NS_IMPL_COCOA
       m->name = ns_screen_name (did);
+      if (m->name == NULL)      /* Fallback value.  */
+        {
+          char name[28];
+          snprintf (name, sizeof(name), "Monitor%lu", i+1);
+          m->name = xstrdup (name);
+        }
 
       {
         CGSize mms = CGDisplayScreenSize (did);
-- 
2.21.0.196.g041f5ea1cf





reply via email to

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