unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#46406: 28.0.50; [PATCH] Use frame monitor in frame_float
@ 2021-02-09 17:46 Andrii Kolomoiets
  2021-02-11  9:10 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Andrii Kolomoiets @ 2021-02-09 17:46 UTC (permalink / raw)
  To: 46406

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-frame-monitor-in-frame_float.patch --]
[-- Type: text/x-patch, Size: 1436 bytes --]

From 28192ba6ea2769c11bfce1dc4b184a15e8c09248 Mon Sep 17 00:00:00 2001
From: Andrii Kolomoiets <andreyk.mad@gmail.com>
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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-22 22:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m1v9arf7nl.fsf@christiantietze.de>
2021-02-17 10:27 ` bug#46406: 28.0.50; [PATCH] Use frame monitor in frame_float Andrii Kolomoiets
2021-02-19 10:07   ` Andrii Kolomoiets
2021-02-19 13:04     ` Lars Ingebrigtsen
2021-02-19 19:38       ` Alan Third
2021-02-20 13:00         ` Lars Ingebrigtsen
2021-02-22 22:08           ` Christian Tietze
2021-02-22 22:11             ` Lars Ingebrigtsen
2021-02-09 17:46 Andrii Kolomoiets
2021-02-11  9:10 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).