From: Yuuki Harano Date: Sat, 23 Jan 2021 15:47:50 +0000 (+0900) Subject: Add scale factor in display-monitor-attributes-list. X-Git-Tag: emacs-29.0.90~3735 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e9608601e5d5f45be36a8f833a98230086e628a8;p=emacs.git 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. --- diff --git a/lisp/frame.el b/lisp/frame.el index 010bab41d2d..0aae87b9f4b 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 daaba2abfec..998ddaabb39 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 10cb3f52e5e..7372e74cfef 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 63e121f1180..620680fbdaa 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))); }