changeset 51196:3fec44aca3cc

Make (many) trivial substitutions for renamed and new macros in dispextern.h, frame.h and window.h. (make_lispy_event): Use window positions returned from window_from_coordinates when constructing the lisp event for MOUSE_CLICK_EVENT and DRAG_N_DROP_EVENT, rather than calculating (incorrect) values locally. (make_lispy_movement): Use window positions returned from window_from_coordinates when constructing the lisp event, rather than calculating (incorrect) values locally.
author Kim F. Storm <storm@cua.dk>
date Sat, 24 May 2003 21:59:25 +0000
parents 3cbf29813eea
children c1bf3085654d
files src/keyboard.c
diffstat 1 files changed, 16 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Sat May 24 21:58:07 2003 +0000
+++ b/src/keyboard.c	Sat May 24 21:59:25 2003 +0000
@@ -5115,6 +5115,7 @@
 	    Lisp_Object posn;
 	    Lisp_Object string_info = Qnil;
 	    int row, column;
+	    int wx, wy;
 
 	    /* Ignore mouse events that were made on frame that
 	       have been deleted.  */
@@ -5186,7 +5187,8 @@
 	    /* Set `window' to the window under frame pixel coordinates
 	       event->x/event->y.  */
 	    window = window_from_coordinates (f, XINT (event->x),
-					      XINT (event->y), &part, 0);
+					      XINT (event->y),
+					      &part, &wx, &wy, 0);
 
 	    if (!WINDOWP (window))
 	      {
@@ -5199,11 +5201,6 @@
 		   event->x/ event->y.  */
 		struct window *w = XWINDOW (window);
 
-		/* Get window relative coordinates.  Original code
-		   `rounded' this to glyph boundaries.  */
-		int wx = FRAME_TO_WINDOW_PIXEL_X (w, XINT (event->x));
-		int wy = FRAME_TO_WINDOW_PIXEL_Y (w, XINT (event->y));
-
 		/* Set event coordinates to window-relative coordinates
 		   for constructing the Lisp event below.  */
 		XSETINT (event->x, wx);
@@ -5534,7 +5531,8 @@
 	pixel_to_glyph_coords (f, XINT (event->x), XINT (event->y),
 			       &column, &row, NULL, 1);
 	window = window_from_coordinates (f, XINT (event->x),
-                                          XINT (event->y), &part, 0);
+                                          XINT (event->y),
+					  &part, 0, 0, 0);
 
 	if (!WINDOWP (window))
 	  {
@@ -5544,8 +5542,8 @@
 	else
 	  {
 	    int pixcolumn, pixrow;
-	    column -= XINT (XWINDOW (window)->left);
-	    row -= XINT (XWINDOW (window)->top);
+	    column -= WINDOW_LEFT_EDGE_COL (XWINDOW (window));
+	    row -= WINDOW_TOP_EDGE_LINE (XWINDOW (window));
 	    glyph_to_pixel_coords (XWINDOW(window), column, row,
                                    &pixcolumn, &pixrow);
 	    XSETINT (event->x, pixcolumn);
@@ -5598,6 +5596,7 @@
 	Lisp_Object window;
 	Lisp_Object posn;
 	Lisp_Object files;
+	int wx, wy;
 
 	/* The frame_or_window field should be a cons of the frame in
 	   which the event occurred and a list of the filenames
@@ -5614,7 +5613,8 @@
 	  return Qnil;
 
 	window = window_from_coordinates (f, XINT (event->x),
-                                          XINT (event->y), &part, 0);
+                                          XINT (event->y),
+					  &part, &wx, &wy, 0);
 
 	if (!WINDOWP (window))
 	  {
@@ -5627,10 +5627,6 @@
 	       event->x/ event->y.  */
 	    struct window *w = XWINDOW (window);
 
-	    /* Get window relative coordinates.  */
-	    int wx = FRAME_TO_WINDOW_PIXEL_X (w, XINT (event->x));
-	    int wy = FRAME_TO_WINDOW_PIXEL_Y (w, XINT (event->y));
-
 	    /* Set event coordinates to window-relative coordinates
 	       for constructing the Lisp event below.  */
 	    XSETINT (event->x, wx);
@@ -5745,21 +5741,20 @@
       enum window_part area;
       Lisp_Object window;
       Lisp_Object posn;
+      int wx, wy;
 
       if (frame)
 	/* It's in a frame; which window on that frame?  */
-	window = window_from_coordinates (frame, XINT (x), XINT (y), &area, 0);
+	window = window_from_coordinates (frame, XINT (x), XINT (y),
+					  &area, &wx, &wy, 0);
       else
 	window = Qnil;
 
       if (WINDOWP (window))
 	{
 	  struct window *w = XWINDOW (window);
-	  int wx, wy;
-
-	  /* Get window relative coordinates.  */
-	  wx = FRAME_TO_WINDOW_PIXEL_X (w, XINT (x));
-	  wy = FRAME_TO_WINDOW_PIXEL_Y (w, XINT (y));
+
+	  /* Set window relative coordinates.  */
 	  XSETINT (x, wx);
 	  XSETINT (y, wy);
 
@@ -7929,7 +7924,7 @@
   register Lisp_Object name;
   int nlength;
   /* FIXME: Use the minibuffer's frame width.  */
-  int width = FRAME_WIDTH (SELECTED_FRAME ()) - 4;
+  int width = FRAME_COLS (SELECTED_FRAME ()) - 4;
   int idx = -1;
   int nobindings = 1;
   Lisp_Object rest, vector;