diff options
| author | Gerd Moellmann | 2001-03-02 20:51:32 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-03-02 20:51:32 +0000 |
| commit | b52b65bdb3e5598b9cd4bf6def4ed2baa7d2312c (patch) | |
| tree | b188f11a98334d43ff1a4d15949d550c3b1d2818 | |
| parent | 75ed43a6a2c1fe63f0021e2aa4a42942a2fbc522 (diff) | |
| download | emacs-b52b65bdb3e5598b9cd4bf6def4ed2baa7d2312c.tar.gz emacs-b52b65bdb3e5598b9cd4bf6def4ed2baa7d2312c.zip | |
(glyph_rect): New function.
(XTmouse_position): Use it to raise the threshold for mouse
movement event generation.
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/xterm.c | 122 |
2 files changed, 93 insertions, 35 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 897c618d0b7..fd1a1c76861 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2001-03-02 Gerd Moellmann <gerd@gnu.org> | ||
| 2 | |||
| 3 | * xterm.c (glyph_rect): New function. | ||
| 4 | (XTmouse_position): Use it to raise the threshold for mouse | ||
| 5 | movement event generation. | ||
| 6 | |||
| 1 | 2001-03-02 Eli Zaretskii <eliz@is.elta.co.il> | 7 | 2001-03-02 Eli Zaretskii <eliz@is.elta.co.il> |
| 2 | 8 | ||
| 3 | * msdos.c (Fmsdos_remember_default_colors): If default-frame-alist | 9 | * msdos.c (Fmsdos_remember_default_colors): If default-frame-alist |
diff --git a/src/xterm.c b/src/xterm.c index 6db999e241e..8c2100cb8c4 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -477,7 +477,11 @@ static void x_draw_vertical_border P_ ((struct window *)); | |||
| 477 | static void x_after_update_window_line P_ ((struct glyph_row *)); | 477 | static void x_after_update_window_line P_ ((struct glyph_row *)); |
| 478 | static INLINE void take_vertical_position_into_account P_ ((struct it *)); | 478 | static INLINE void take_vertical_position_into_account P_ ((struct it *)); |
| 479 | static void x_produce_stretch_glyph P_ ((struct it *)); | 479 | static void x_produce_stretch_glyph P_ ((struct it *)); |
| 480 | 480 | static struct scroll_bar *x_window_to_scroll_bar P_ ((Window)); | |
| 481 | static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *, | ||
| 482 | enum scroll_bar_part *, | ||
| 483 | Lisp_Object *, Lisp_Object *, | ||
| 484 | unsigned long *)); | ||
| 481 | 485 | ||
| 482 | /* Flush display of frame F, or of all frames if F is null. */ | 486 | /* Flush display of frame F, or of all frames if F is null. */ |
| 483 | 487 | ||
| @@ -7385,23 +7389,71 @@ cancel_mouse_face (f) | |||
| 7385 | dpyinfo->mouse_face_window = Qnil; | 7389 | dpyinfo->mouse_face_window = Qnil; |
| 7386 | } | 7390 | } |
| 7387 | } | 7391 | } |
| 7392 | |||
| 7388 | 7393 | ||
| 7389 | static struct scroll_bar *x_window_to_scroll_bar (); | 7394 | static int glyph_rect P_ ((struct frame *f, int, int, XRectangle *)); |
| 7390 | static void x_scroll_bar_report_motion (); | 7395 | |
| 7396 | |||
| 7397 | /* Try to determine frame pixel position and size of the glyph under | ||
| 7398 | frame pixel coordinates X/Y on frame F . Return the position and | ||
| 7399 | size in *RECT. Value is non-zero if we could compute these | ||
| 7400 | values. */ | ||
| 7401 | |||
| 7402 | static int | ||
| 7403 | glyph_rect (f, x, y, rect) | ||
| 7404 | struct frame *f; | ||
| 7405 | int x, y; | ||
| 7406 | XRectangle *rect; | ||
| 7407 | { | ||
| 7408 | Lisp_Object window; | ||
| 7409 | int part, found = 0; | ||
| 7410 | |||
| 7411 | window = window_from_coordinates (f, x, y, &part, 0); | ||
| 7412 | if (!NILP (window)) | ||
| 7413 | { | ||
| 7414 | struct window *w = XWINDOW (window); | ||
| 7415 | struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | ||
| 7416 | struct glyph_row *end = r + w->current_matrix->nrows - 1; | ||
| 7417 | int area; | ||
| 7418 | |||
| 7419 | frame_to_window_pixel_xy (w, &x, &y); | ||
| 7420 | |||
| 7421 | for (; !found && r < end && r->enabled_p; ++r) | ||
| 7422 | if (r->y >= y) | ||
| 7423 | { | ||
| 7424 | struct glyph *g = r->glyphs[TEXT_AREA]; | ||
| 7425 | struct glyph *end = g + r->used[TEXT_AREA]; | ||
| 7426 | int gx; | ||
| 7427 | |||
| 7428 | for (gx = r->x; !found && g < end; gx += g->pixel_width, ++g) | ||
| 7429 | if (gx >= x) | ||
| 7430 | { | ||
| 7431 | rect->width = g->pixel_width; | ||
| 7432 | rect->height = r->height; | ||
| 7433 | rect->x = WINDOW_TO_FRAME_PIXEL_X (w, gx); | ||
| 7434 | rect->y = WINDOW_TO_FRAME_PIXEL_Y (w, r->y); | ||
| 7435 | found = 1; | ||
| 7436 | } | ||
| 7437 | } | ||
| 7438 | } | ||
| 7439 | |||
| 7440 | return found; | ||
| 7441 | } | ||
| 7442 | |||
| 7391 | 7443 | ||
| 7392 | /* Return the current position of the mouse. | 7444 | /* Return the current position of the mouse. |
| 7393 | *fp should be a frame which indicates which display to ask about. | 7445 | *FP should be a frame which indicates which display to ask about. |
| 7394 | 7446 | ||
| 7395 | If the mouse movement started in a scroll bar, set *fp, *bar_window, | 7447 | If the mouse movement started in a scroll bar, set *FP, *BAR_WINDOW, |
| 7396 | and *part to the frame, window, and scroll bar part that the mouse | 7448 | and *PART to the frame, window, and scroll bar part that the mouse |
| 7397 | is over. Set *x and *y to the portion and whole of the mouse's | 7449 | is over. Set *X and *Y to the portion and whole of the mouse's |
| 7398 | position on the scroll bar. | 7450 | position on the scroll bar. |
| 7399 | 7451 | ||
| 7400 | If the mouse movement started elsewhere, set *fp to the frame the | 7452 | If the mouse movement started elsewhere, set *FP to the frame the |
| 7401 | mouse is on, *bar_window to nil, and *x and *y to the character cell | 7453 | mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell |
| 7402 | the mouse is over. | 7454 | the mouse is over. |
| 7403 | 7455 | ||
| 7404 | Set *time to the server time-stamp for the time at which the mouse | 7456 | Set *TIME to the server time-stamp for the time at which the mouse |
| 7405 | was at this position. | 7457 | was at this position. |
| 7406 | 7458 | ||
| 7407 | Don't store anything if we don't have a valid set of values to report. | 7459 | Don't store anything if we don't have a valid set of values to report. |
| @@ -7573,32 +7625,32 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 7573 | on it, i.e. into the same rectangles that matrices on | 7625 | on it, i.e. into the same rectangles that matrices on |
| 7574 | the frame are divided into. */ | 7626 | the frame are divided into. */ |
| 7575 | 7627 | ||
| 7576 | #if OLD_REDISPLAY_CODE | 7628 | int width, height, gx, gy; |
| 7577 | int ignore1, ignore2; | 7629 | XRectangle rect; |
| 7578 | pixel_to_glyph_coords (f1, win_x, win_y, &ignore1, &ignore2, | 7630 | |
| 7579 | &last_mouse_glyph, | 7631 | if (glyph_rect (f1, win_x, win_y, &rect)) |
| 7580 | FRAME_X_DISPLAY_INFO (f1)->grabbed | 7632 | last_mouse_glyph = rect; |
| 7581 | || insist); | 7633 | else |
| 7582 | #else | 7634 | { |
| 7583 | { | 7635 | width = FRAME_SMALLEST_CHAR_WIDTH (f1); |
| 7584 | int width = FRAME_SMALLEST_CHAR_WIDTH (f1); | 7636 | height = FRAME_SMALLEST_FONT_HEIGHT (f1); |
| 7585 | int height = FRAME_SMALLEST_FONT_HEIGHT (f1); | 7637 | gx = win_x; |
| 7586 | int x = win_x; | 7638 | gy = win_y; |
| 7587 | int y = win_y; | ||
| 7588 | |||
| 7589 | /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to | ||
| 7590 | round down even for negative values. */ | ||
| 7591 | if (x < 0) | ||
| 7592 | x -= width - 1; | ||
| 7593 | if (y < 0) | ||
| 7594 | y -= height - 1; | ||
| 7595 | 7639 | ||
| 7596 | last_mouse_glyph.width = width; | 7640 | /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to |
| 7597 | last_mouse_glyph.height = height; | 7641 | round down even for negative values. */ |
| 7598 | last_mouse_glyph.x = (x + width - 1) / width * width; | 7642 | if (gx < 0) |
| 7599 | last_mouse_glyph.y = (y + height - 1) / height * height; | 7643 | gx -= width - 1; |
| 7600 | } | 7644 | if (y < 0) |
| 7601 | #endif | 7645 | gy -= height - 1; |
| 7646 | gx = (gx + width - 1) / width * width; | ||
| 7647 | gy = (gy + height - 1) / height * height; | ||
| 7648 | |||
| 7649 | last_mouse_glyph.width = width; | ||
| 7650 | last_mouse_glyph.height = height; | ||
| 7651 | last_mouse_glyph.x = gx; | ||
| 7652 | last_mouse_glyph.y = gy; | ||
| 7653 | } | ||
| 7602 | 7654 | ||
| 7603 | *bar_window = Qnil; | 7655 | *bar_window = Qnil; |
| 7604 | *part = 0; | 7656 | *part = 0; |