Subject: 28.0.50; [PATCH] Use frame monitor in frame_float

From: Andrii Kolomoiets <[email-masked]>
Date: Tue, 09 Feb 2021 19:46:53 +0200

To reproduce this you need at least one secondary monitor.

1. emacs -Q
2. Move the frame to the secondary monitor
3. M-: (modify-frame-parameters nil '((left . .5) (top . .5)))
   frame is moved to the main monitor
4. Move the frame to secondary monitor again
5. M-: (modify-frame-parameters nil '((width . .5) (height . .5)))
   frame size is half of the main monitor instead of the secondary one

In my case the 'display-monitor-attributes-list' function returns these
attributes:

(((geometry 0 0 1440 900) (workarea 0 25 1440 875) ...)
 ((geometry -254 900 1920 1080) (workarea -254 900 1920 1055) ...))

Attached patch make the frame position and size ratios calculations
related to the monitor on which the frame is.

>From 28192ba6ea2769c11bfce1dc4b184a15e8c09248 Mon Sep 17 00:00:00 2001
From: Andrii Kolomoiets <[email-masked]>
Date: Tue, 9 Feb 2021 19:31:50 +0200
Subject: [PATCH] Use frame monitor in frame_float

On handle frame size and positon ratios, use the attributes of frame
monitor instead of main monitor.

* src/frame.c (frame_float): Use frame monitor attributes.
---
 src/frame.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/frame.c b/src/frame.c
index 635fc94560..a62347c1fb 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3890,7 +3890,7 @@ frame_float (struct frame *f, Lisp_Object val, enum frame_float_type what,
 	      Lisp_Object frame;
 
 	      XSETFRAME (frame, f);
-	      monitor_attributes = Fcar (call1 (Qdisplay_monitor_attributes_list, frame));
+	      monitor_attributes = call1 (Qframe_monitor_attributes, frame);
 	      if (NILP (monitor_attributes))
 		{
 		  /* No monitor attributes available.  */
@@ -5890,7 +5890,7 @@ syms_of_frame (void)
   DEFSYM (Qframep, "framep");
   DEFSYM (Qframe_live_p, "frame-live-p");
   DEFSYM (Qframe_windows_min_size, "frame-windows-min-size");
-  DEFSYM (Qdisplay_monitor_attributes_list, "display-monitor-attributes-list");
+  DEFSYM (Qframe_monitor_attributes, "frame-monitor-attributes");
   DEFSYM (Qwindow__pixel_to_total, "window--pixel-to-total");
   DEFSYM (Qexplicit_name, "explicit-name");
   DEFSYM (Qheight, "height");
-- 
2.15.1