emacs-diffs
[Top][All Lists]
Advanced

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

feature/pgtk e960860: Add scale factor in display-monitor-attributes-lis


From: Yuuki Harano
Subject: feature/pgtk e960860: Add scale factor in display-monitor-attributes-list.
Date: Sat, 23 Jan 2021 10:58:53 -0500 (EST)

branch: feature/pgtk
commit e9608601e5d5f45be36a8f833a98230086e628a8
Author: Yuuki Harano <masm+github@masm11.me>
Commit: Yuuki Harano <masm+github@masm11.me>

    Add scale factor in display-monitor-attributes-list.
    
    * lisp/frame.el (display-monitor-attributes-list): Add the comment.
    * src/frame.c (make_monitor_attribute_list): Include the scale factor value.
    (syms_of_frame): Declare intern'ed scale-factor.
    * src/frame.h (struct MonitorInfo): Add scale_factor member.
    * src/pgtkfns.c (Fpgtk_display_monitor_attributes_list): Set the value.
---
 lisp/frame.el | 1 +
 src/frame.c   | 7 +++++++
 src/frame.h   | 3 +++
 src/pgtkfns.c | 1 +
 4 files changed, 12 insertions(+)

diff --git a/lisp/frame.el b/lisp/frame.el
index 010bab4..0aae87b 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2253,6 +2253,7 @@ of attribute keys and values as follows:
  mm-size  -- Width and height in millimeters in the form of
             (WIDTH HEIGHT)
  frames   -- List of frames dominated by the physical monitor
+ scale-factor (*) -- Scale factor (float)
  name (*) -- Name of the physical monitor as a string
  source (*) -- Source of multi-monitor information as a string
 
diff --git a/src/frame.c b/src/frame.c
index daaba2a..998ddaa 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -5826,6 +5826,10 @@ make_monitor_attribute_list (struct MonitorInfo 
*monitors,
                           attributes);
       attributes = Fcons (Fcons (Qframes, AREF (monitor_frames, i)),
                          attributes);
+#ifdef HAVE_PGTK
+      attributes = Fcons (Fcons (Qscale_factor, make_float (mi->scale_factor)),
+                         attributes);
+#endif
       attributes = Fcons (Fcons (Qmm_size,
                                  list2i (mi->mm_width, mi->mm_height)),
                           attributes);
@@ -5938,6 +5942,9 @@ syms_of_frame (void)
 
   DEFSYM (Qworkarea, "workarea");
   DEFSYM (Qmm_size, "mm-size");
+#ifdef HAVE_PGTK
+  DEFSYM (Qscale_factor, "scale-factor");
+#endif
   DEFSYM (Qframes, "frames");
   DEFSYM (Qsource, "source");
 
diff --git a/src/frame.h b/src/frame.h
index 10cb3f5..7372e74 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1746,6 +1746,9 @@ struct MonitorInfo {
   Emacs_Rectangle geom, work;
   int mm_width, mm_height;
   char *name;
+#ifdef HAVE_PGTK
+  double scale_factor;
+#endif
 };
 
 extern void free_monitors (struct MonitorInfo *monitors, int n_monitors);
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index 63e121f..620680f 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -2647,6 +2647,7 @@ Internal use only, use `display-monitor-attributes-list' 
instead.  */)
       mi->work.height = work.height;
       mi->mm_width = width_mm;
       mi->mm_height = height_mm;
+      mi->scale_factor = scale;
 
       dupstring (&mi->name, (gdk_monitor_get_model (monitor)));
     }



reply via email to

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