top_bottom_borders_height = 32;
}
+ /* With multiple monitors, we can legitimately get negative
+ coordinates (for monitors above or to the left of the primary
+ monitor). Find the display origin to ensure negative positions
+ are computed correctly (Bug#21173). */
+ int display_left = 0;
+ int display_top = 0;
+ if (flags & (XNegative | YNegative))
+ {
+ Lisp_Object list;
+
+ list = Fw32_display_monitor_attributes_list (Qnil);
+ while (CONSP (list))
+ {
+ Lisp_Object attributes = CAR(list);
+ Lisp_Object geometry;
+ Lisp_Object monitor_left, monitor_top;
+
+ list = CDR(list);
+
+ geometry = Fassoc (Qgeometry, attributes);
+ if (!NILP (geometry))
+ {
+ monitor_left = Fnth (make_number (1), geometry);
+ monitor_top = Fnth (make_number (2), geometry);
+
+ display_left = min (display_left, XINT (monitor_left));
+ display_top = min (display_top, XINT (monitor_top));
+ }
+ }
+ }
+
/* Treat negative positions as relative to the rightmost bottommost
position that fits on the screen. */
if (flags & XNegative)
f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f))
+ + display_left
- FRAME_PIXEL_WIDTH (f)
+ f->left_pos
- (left_right_borders_width - 1));
if (flags & YNegative)
f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
+ + display_top
- FRAME_PIXEL_HEIGHT (f)
+ f->top_pos
- (top_bottom_borders_height - 1));