aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Moreton2015-10-29 08:46:43 +0100
committerMartin Rudalics2015-10-29 08:46:43 +0100
commitdc95cb8c2d646468186c5b379bd6d138c1ec1d1c (patch)
treef168dd389320ae28d909fb2b703a35760598d934 /src
parentd7a67c5a2fe63b6f087d6cae24c8f3b3c09eb57a (diff)
downloademacs-dc95cb8c2d646468186c5b379bd6d138c1ec1d1c.tar.gz
emacs-dc95cb8c2d646468186c5b379bd6d138c1ec1d1c.zip
Handle negative coordinates in ‘x_calc_absolute_position’
* src/w32term.c (x_calc_absolute_position): Find display origin to allow for negative coordinates.
Diffstat (limited to 'src')
-rw-r--r--src/w32term.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/w32term.c b/src/w32term.c
index 83178672679..f764e250aa8 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5913,16 +5913,49 @@ x_calc_absolute_position (struct frame *f)
5913 top_bottom_borders_height = 32; 5913 top_bottom_borders_height = 32;
5914 } 5914 }
5915 5915
5916 /* With multiple monitors, we can legitimately get negative
5917 coordinates (for monitors above or to the left of the primary
5918 monitor). Find the display origin to ensure negative positions
5919 are computed correctly (Bug#21173). */
5920 int display_left = 0;
5921 int display_top = 0;
5922 if (flags & (XNegative | YNegative))
5923 {
5924 Lisp_Object list;
5925
5926 list = Fw32_display_monitor_attributes_list (Qnil);
5927 while (CONSP (list))
5928 {
5929 Lisp_Object attributes = CAR(list);
5930 Lisp_Object geometry;
5931 Lisp_Object monitor_left, monitor_top;
5932
5933 list = CDR(list);
5934
5935 geometry = Fassoc (Qgeometry, attributes);
5936 if (!NILP (geometry))
5937 {
5938 monitor_left = Fnth (make_number (1), geometry);
5939 monitor_top = Fnth (make_number (2), geometry);
5940
5941 display_left = min (display_left, XINT (monitor_left));
5942 display_top = min (display_top, XINT (monitor_top));
5943 }
5944 }
5945 }
5946
5916 /* Treat negative positions as relative to the rightmost bottommost 5947 /* Treat negative positions as relative to the rightmost bottommost
5917 position that fits on the screen. */ 5948 position that fits on the screen. */
5918 if (flags & XNegative) 5949 if (flags & XNegative)
5919 f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f)) 5950 f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f))
5951 + display_left
5920 - FRAME_PIXEL_WIDTH (f) 5952 - FRAME_PIXEL_WIDTH (f)
5921 + f->left_pos 5953 + f->left_pos
5922 - (left_right_borders_width - 1)); 5954 - (left_right_borders_width - 1));
5923 5955
5924 if (flags & YNegative) 5956 if (flags & YNegative)
5925 f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f)) 5957 f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
5958 + display_top
5926 - FRAME_PIXEL_HEIGHT (f) 5959 - FRAME_PIXEL_HEIGHT (f)
5927 + f->top_pos 5960 + f->top_pos
5928 - (top_bottom_borders_height - 1)); 5961 - (top_bottom_borders_height - 1));