aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorKim F. Storm2003-05-24 21:59:25 +0000
committerKim F. Storm2003-05-24 21:59:25 +0000
commit2cdbe73edfe73c1d21eefa3f7a32628e1345da4e (patch)
treeec101844ab19351829112e8cab4349ea0d8fde53 /src/keyboard.c
parentb45afe99ed29a2bcb8b525878f81630233c1097d (diff)
downloademacs-2cdbe73edfe73c1d21eefa3f7a32628e1345da4e.tar.gz
emacs-2cdbe73edfe73c1d21eefa3f7a32628e1345da4e.zip
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.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index c8780867bb0..4067880223d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5115,6 +5115,7 @@ make_lispy_event (event)
5115 Lisp_Object posn; 5115 Lisp_Object posn;
5116 Lisp_Object string_info = Qnil; 5116 Lisp_Object string_info = Qnil;
5117 int row, column; 5117 int row, column;
5118 int wx, wy;
5118 5119
5119 /* Ignore mouse events that were made on frame that 5120 /* Ignore mouse events that were made on frame that
5120 have been deleted. */ 5121 have been deleted. */
@@ -5186,7 +5187,8 @@ make_lispy_event (event)
5186 /* Set `window' to the window under frame pixel coordinates 5187 /* Set `window' to the window under frame pixel coordinates
5187 event->x/event->y. */ 5188 event->x/event->y. */
5188 window = window_from_coordinates (f, XINT (event->x), 5189 window = window_from_coordinates (f, XINT (event->x),
5189 XINT (event->y), &part, 0); 5190 XINT (event->y),
5191 &part, &wx, &wy, 0);
5190 5192
5191 if (!WINDOWP (window)) 5193 if (!WINDOWP (window))
5192 { 5194 {
@@ -5199,11 +5201,6 @@ make_lispy_event (event)
5199 event->x/ event->y. */ 5201 event->x/ event->y. */
5200 struct window *w = XWINDOW (window); 5202 struct window *w = XWINDOW (window);
5201 5203
5202 /* Get window relative coordinates. Original code
5203 `rounded' this to glyph boundaries. */
5204 int wx = FRAME_TO_WINDOW_PIXEL_X (w, XINT (event->x));
5205 int wy = FRAME_TO_WINDOW_PIXEL_Y (w, XINT (event->y));
5206
5207 /* Set event coordinates to window-relative coordinates 5204 /* Set event coordinates to window-relative coordinates
5208 for constructing the Lisp event below. */ 5205 for constructing the Lisp event below. */
5209 XSETINT (event->x, wx); 5206 XSETINT (event->x, wx);
@@ -5534,7 +5531,8 @@ make_lispy_event (event)
5534 pixel_to_glyph_coords (f, XINT (event->x), XINT (event->y), 5531 pixel_to_glyph_coords (f, XINT (event->x), XINT (event->y),
5535 &column, &row, NULL, 1); 5532 &column, &row, NULL, 1);
5536 window = window_from_coordinates (f, XINT (event->x), 5533 window = window_from_coordinates (f, XINT (event->x),
5537 XINT (event->y), &part, 0); 5534 XINT (event->y),
5535 &part, 0, 0, 0);
5538 5536
5539 if (!WINDOWP (window)) 5537 if (!WINDOWP (window))
5540 { 5538 {
@@ -5544,8 +5542,8 @@ make_lispy_event (event)
5544 else 5542 else
5545 { 5543 {
5546 int pixcolumn, pixrow; 5544 int pixcolumn, pixrow;
5547 column -= XINT (XWINDOW (window)->left); 5545 column -= WINDOW_LEFT_EDGE_COL (XWINDOW (window));
5548 row -= XINT (XWINDOW (window)->top); 5546 row -= WINDOW_TOP_EDGE_LINE (XWINDOW (window));
5549 glyph_to_pixel_coords (XWINDOW(window), column, row, 5547 glyph_to_pixel_coords (XWINDOW(window), column, row,
5550 &pixcolumn, &pixrow); 5548 &pixcolumn, &pixrow);
5551 XSETINT (event->x, pixcolumn); 5549 XSETINT (event->x, pixcolumn);
@@ -5598,6 +5596,7 @@ make_lispy_event (event)
5598 Lisp_Object window; 5596 Lisp_Object window;
5599 Lisp_Object posn; 5597 Lisp_Object posn;
5600 Lisp_Object files; 5598 Lisp_Object files;
5599 int wx, wy;
5601 5600
5602 /* The frame_or_window field should be a cons of the frame in 5601 /* The frame_or_window field should be a cons of the frame in
5603 which the event occurred and a list of the filenames 5602 which the event occurred and a list of the filenames
@@ -5614,7 +5613,8 @@ make_lispy_event (event)
5614 return Qnil; 5613 return Qnil;
5615 5614
5616 window = window_from_coordinates (f, XINT (event->x), 5615 window = window_from_coordinates (f, XINT (event->x),
5617 XINT (event->y), &part, 0); 5616 XINT (event->y),
5617 &part, &wx, &wy, 0);
5618 5618
5619 if (!WINDOWP (window)) 5619 if (!WINDOWP (window))
5620 { 5620 {
@@ -5627,10 +5627,6 @@ make_lispy_event (event)
5627 event->x/ event->y. */ 5627 event->x/ event->y. */
5628 struct window *w = XWINDOW (window); 5628 struct window *w = XWINDOW (window);
5629 5629
5630 /* Get window relative coordinates. */
5631 int wx = FRAME_TO_WINDOW_PIXEL_X (w, XINT (event->x));
5632 int wy = FRAME_TO_WINDOW_PIXEL_Y (w, XINT (event->y));
5633
5634 /* Set event coordinates to window-relative coordinates 5630 /* Set event coordinates to window-relative coordinates
5635 for constructing the Lisp event below. */ 5631 for constructing the Lisp event below. */
5636 XSETINT (event->x, wx); 5632 XSETINT (event->x, wx);
@@ -5745,21 +5741,20 @@ make_lispy_movement (frame, bar_window, part, x, y, time)
5745 enum window_part area; 5741 enum window_part area;
5746 Lisp_Object window; 5742 Lisp_Object window;
5747 Lisp_Object posn; 5743 Lisp_Object posn;
5744 int wx, wy;
5748 5745
5749 if (frame) 5746 if (frame)
5750 /* It's in a frame; which window on that frame? */ 5747 /* It's in a frame; which window on that frame? */
5751 window = window_from_coordinates (frame, XINT (x), XINT (y), &area, 0); 5748 window = window_from_coordinates (frame, XINT (x), XINT (y),
5749 &area, &wx, &wy, 0);
5752 else 5750 else
5753 window = Qnil; 5751 window = Qnil;
5754 5752
5755 if (WINDOWP (window)) 5753 if (WINDOWP (window))
5756 { 5754 {
5757 struct window *w = XWINDOW (window); 5755 struct window *w = XWINDOW (window);
5758 int wx, wy;
5759 5756
5760 /* Get window relative coordinates. */ 5757 /* Set window relative coordinates. */
5761 wx = FRAME_TO_WINDOW_PIXEL_X (w, XINT (x));
5762 wy = FRAME_TO_WINDOW_PIXEL_Y (w, XINT (y));
5763 XSETINT (x, wx); 5758 XSETINT (x, wx);
5764 XSETINT (y, wy); 5759 XSETINT (y, wy);
5765 5760
@@ -7929,7 +7924,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
7929 register Lisp_Object name; 7924 register Lisp_Object name;
7930 int nlength; 7925 int nlength;
7931 /* FIXME: Use the minibuffer's frame width. */ 7926 /* FIXME: Use the minibuffer's frame width. */
7932 int width = FRAME_WIDTH (SELECTED_FRAME ()) - 4; 7927 int width = FRAME_COLS (SELECTED_FRAME ()) - 4;
7933 int idx = -1; 7928 int idx = -1;
7934 int nobindings = 1; 7929 int nobindings = 1;
7935 Lisp_Object rest, vector; 7930 Lisp_Object rest, vector;