GNU bug report logs - #16647
Imprecisions with window-resizing cursors

Previous Next

Package: emacs;

Reported by: E Sabof <evgkeni.sampelnikof <at> gmail.com>

Date: Wed, 5 Feb 2014 06:36:02 UTC

Severity: normal

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: E Sabof <esabof <at> gmail.com>
Cc: 16647 <at> debbugs.gnu.org
Subject: bug#16647: Imprecisions with window-resizing cursors
Date: Fri, 07 Feb 2014 20:14:47 +0100
>> (1) Check whether setting the right-divider frame parameter to 1 suffers
>>      from the same problem.
>
> No change.

Sorry, the parameter is called right-divider-width.  Does it still show
a <-> cursor when moving the mouse to the right and that is 1?  What
happens when you increase the width?

>> (2) Try putting `coordinates-in-window-p' in a loop where you simulate
>>      (by incrementing the car of the first argument) the course of the
>>      mouse and display the return value via a message.
>>
>> (3) In window.c DEFVAR_LISP a new variable, in coordinates_in_window set
>>      that variable to the value coordinates_in_window is about to return,
>>      display the value of that variable in the modeline, and then move
>>      the mouse to find out what it reports.
>>
>
> (progn
>   (scroll-bar-mode -1)
>   (require 'cl-lib)
>   (run-with-timer 0 0.1
>                   (lambda ()
>                     (let ((win-list (window-list))
>                           (func (apply-partially
>                                  'coordinates-in-window-p
>                                  (cdr (mouse-position)))))
>                       (message "%s" (cl-find-if func win-list))))))
>
> I've tried the snippet above. There where imprecisions, but shouldn't that be expected, given `coordinates-in-window-p' returns characters and not pixels?

I forgot that `coordinates-in-window-p' can't be given pixels as
arguments.  Please try the patch below.

> Should I try something similar with `track-mouse' and pixels?

And the pixelized version of `coordinates-in-window-p', if possible.  We
want to know what that function returns when your mouse is right after
the border.

martin

=== modified file 'src/window.c'
--- src/window.c	2014-02-07 10:55:28 +0000
+++ src/window.c	2014-02-07 18:05:15 +0000
@@ -1401,13 +1401,15 @@


 DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
-       Scoordinates_in_window_p, 2, 2, 0,
+       Scoordinates_in_window_p, 2, 3, 0,
        doc: /* Return non-nil if COORDINATES are in WINDOW.
 WINDOW must be a live window and defaults to the selected one.
 COORDINATES is a cons of the form (X . Y), X and Y being distances
 measured in characters from the upper-left corner of the frame.
 \(0 . 0) denotes the character in the upper left corner of the
-frame.
+frame.  Third argument PIXELWISE non-nil means interpret coordinates
+pixelwise.
+
 If COORDINATES are in the text portion of WINDOW,
    the coordinates relative to the window are returned.
 If they are in the mode line of WINDOW, `mode-line' is returned.
@@ -1418,7 +1420,7 @@
   `vertical-line' is returned.
 If they are in the windows's left or right marginal areas, `left-margin'\n\
   or `right-margin' is returned.  */)
-  (register Lisp_Object coordinates, Lisp_Object window)
+  (register Lisp_Object coordinates, Lisp_Object window, Lisp_Object pixelwise)
 {
   struct window *w;
   struct frame *f;
@@ -1430,10 +1432,16 @@
   CHECK_CONS (coordinates);
   lx = Fcar (coordinates);
   ly = Fcdr (coordinates);
-  CHECK_NUMBER_OR_FLOAT (lx);
-  CHECK_NUMBER_OR_FLOAT (ly);
-  x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH (f);
-  y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH (f);
+  CHECK_NUMBER (lx);
+  CHECK_NUMBER (ly);
+  x = ((!NILP (pixelwise)
+	? XINT (lx)
+	: FRAME_PIXEL_X_FROM_CANON_X (f, lx))
+       + FRAME_INTERNAL_BORDER_WIDTH (f));
+  y = ((!NILP (pixelwise)
+	? XINT (ly)
+	: FRAME_PIXEL_Y_FROM_CANON_Y (f, ly))
+       + FRAME_INTERNAL_BORDER_WIDTH (f));

   switch (coordinates_in_window (w, x, y))
     {






This bug report was last modified 10 years and 327 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.