emacs-devel
[Top][All Lists]
Advanced

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

Re: x-display-pixel-width/height inconsistency


From: Eli Zaretskii
Subject: Re: x-display-pixel-width/height inconsistency
Date: Wed, 08 May 2013 20:41:39 +0300

> Date: Wed, 08 May 2013 19:46:51 +0900
> From: YAMAMOTO Mitsuharu <address@hidden>
> 
> I also tried implementing a W32 version of multi-monitor support, but
> I can't test it (I didn't even compile, actually).  Please test it.

You need more changes to get this to compile, see the patches below
that should be applied on top of what you sent.

After that, the code seems to work on my single-monitor system.  (I
don't have access to any multi-monitor machines.)

Thanks.

P.S.  Is it possible to use something more elegant to pass a parameter
to w32_monitor_enum?  The way you did it, by casting a Lisp_Object to
a LPARAM, will not work when the width of a Lisp_Object is different
from the width of a pointer.  And even when it does work, it feels
kludgey.

P.P.S.  Would you mind to also add the necessary documentation changes,
like NEWS and additions to the ELisp manual?  TIA.


--- src/w32fns.c~0      2013-05-08 20:19:43.313375000 +0300
+++ src/w32fns.c        2013-05-08 20:31:52.704000000 +0300
@@ -4909,7 +4909,8 @@ w32_display_monitor_attributes_list (voi
        && monitor_from_window_fn))
     return Qnil;
 
-  if (!enum_display_monitors_fn (NULL, NULL, w32_monitor_enum, &monitor_list)
+  if (!enum_display_monitors_fn (NULL, NULL, w32_monitor_enum,
+                                (LPARAM)&monitor_list)
       || NILP (monitor_list))
     return Qnil;
 
@@ -4929,8 +4930,7 @@ w32_display_monitor_attributes_list (voi
     {
       struct frame *f = XFRAME (frame);
 
-      if (FRAME_W32_P (f) && FRAME_W32_DISPLAY_INFO (f) == dpyinfo
-         && !EQ (frame, tip_frame))
+      if (FRAME_W32_P (f) && !EQ (frame, tip_frame))
        {
          HMONITOR monitor =
            monitor_from_window_fn (FRAME_W32_WINDOW (f),
@@ -4994,29 +4994,29 @@ w32_display_monitor_attributes_list (voi
 static Lisp_Object
 w32_display_monitor_attributes_list_fallback (void)
 {
-  Lisp_Object geometry, workarea, frames, attributes = Qnil;
+  Lisp_Object geometry, workarea, frames, rest, frame, attributes = Qnil;
   HDC hdc;
   double mm_per_pixel;
   int pixel_width, pixel_height, width_mm, height_mm;
   RECT workarea_rect;
+  struct w32_display_info *dpyinfo;
+  struct frame *f = XFRAME (frame);
 
   /* Fallback: treat (possibly) multiple physical monitors as if they
      formed a single monitor as a whole.  This should provide a
      consistent result at least on single monitor environments.  */
-  attributes = Fcons (Fcons (Qname, build_string ("combined screen"),
-                            attributes));
+  attributes = Fcons (Fcons (Qname, build_string ("combined screen")),
+                            attributes);
 
   frames = Qnil;
   FOR_EACH_FRAME (rest, frame)
     {
-      struct frame *f = XFRAME (frame);
-
-      if (FRAME_W32_P (f) && FRAME_W32_DISPLAY_INFO (f) == dpyinfo
-         && !EQ (frame, tip_frame))
+      if (FRAME_W32_P (f) && !EQ (frame, tip_frame))
        frames = Fcons (frame, frames);
     }
   attributes = Fcons (Fcons (Qframes, frames), attributes);
 
+  dpyinfo = FRAME_W32_DISPLAY_INFO (f);
   pixel_width = x_display_pixel_width (dpyinfo);
   pixel_height = x_display_pixel_height (dpyinfo);
 



reply via email to

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