comparison src/window.c @ 34097:0225d8e15f2c

(coordinates_in_window): Handle computations for positions on the vertical bar and fringes differently for window-system frames. Consider some pixels near the vertical bar as on the bar if the frame doesn't have vertical scroll bars. Associate positions between mode or header lines with the right window, the left one.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 01 Dec 2000 20:44:31 +0000
parents 7721faa485ea
children c50a8c8171b7
comparison
equal deleted inserted replaced
34096:56e23f5563bf 34097:0225d8e15f2c
536 scroll bars. */ 536 scroll bars. */
537 537
538 if (WINDOW_WANTS_MODELINE_P (w) 538 if (WINDOW_WANTS_MODELINE_P (w)
539 && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) 539 && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w))
540 { 540 {
541 if (XFASTINT (w->left) > 0 541 if (!WINDOW_RIGHTMOST_P (w)
542 && (abs (*x - XFASTINT (w->left) * CANON_X_UNIT (f)) 542 && (abs (*x - ((XFASTINT (w->left) + XFASTINT (w->width))
543 * CANON_X_UNIT (f)))
543 < CANON_X_UNIT (f) / 2)) 544 < CANON_X_UNIT (f) / 2))
544 return ON_VERTICAL_BORDER; 545 return ON_VERTICAL_BORDER;
545 return ON_MODE_LINE; 546 return ON_MODE_LINE;
546 } 547 }
547 548
548 if (WINDOW_WANTS_HEADER_LINE_P (w) 549 if (WINDOW_WANTS_HEADER_LINE_P (w)
549 && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) 550 && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w))
550 { 551 {
551 if (XFASTINT (w->left) > 0 552 if (!WINDOW_RIGHTMOST_P (w)
552 && (abs (*x - XFASTINT (w->left) * CANON_X_UNIT (f)) 553 && (abs (*x - ((XFASTINT (w->left) + XFASTINT (w->width))
554 * CANON_X_UNIT (f)))
553 < CANON_X_UNIT (f) / 2)) 555 < CANON_X_UNIT (f) / 2))
554 return ON_VERTICAL_BORDER; 556 return ON_VERTICAL_BORDER;
555 return ON_HEADER_LINE; 557 return ON_HEADER_LINE;
556 } 558 }
559
560 if (FRAME_WINDOW_P (f))
561 {
562 if (!w->pseudo_window_p
563 && !FRAME_HAS_VERTICAL_SCROLL_BARS (f)
564 && !WINDOW_RIGHTMOST_P (w)
565 && (abs (*x - right_x - flags_area_width) < CANON_X_UNIT (f) / 2))
566 return ON_VERTICAL_BORDER;
567
568 if (*x < left_x || *x > right_x)
569 {
570 /* Other lines than the mode line don't include flags areas and
571 scroll bars on the left. */
572
573 /* Convert X and Y to window-relative pixel coordinates. */
574 *x -= left_x;
575 *y -= top_y;
576 return *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE;
577 }
578 }
579 else
580 {
581 /* Need to say "*x > right_x" rather than >=, since on character
582 terminals, the vertical line's x coordinate is right_x. */
583 if (*x < left_x || *x > right_x)
584 {
585 /* Other lines than the mode line don't include flags areas and
586 scroll bars on the left. */
587
588 /* Convert X and Y to window-relative pixel coordinates. */
589 *x -= left_x;
590 *y -= top_y;
591 return *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE;
592 }
557 593
558 /* Need to say "*x > right_x" rather than >=, since on character 594 /* Here, too, "*x > right_x" is because of character terminals. */
559 terminals, the vertical line's x coordinate is right_x. */ 595 if (!w->pseudo_window_p
560 if (*x < left_x || *x > right_x) 596 && !WINDOW_RIGHTMOST_P (w)
561 { 597 && *x > right_x - CANON_X_UNIT (f))
562 /* Other lines than the mode line don't include flags areas and 598 /* On the border on the right side of the window? Assume that
563 scroll bars on the left. */ 599 this area begins at RIGHT_X minus a canonical char width. */
564 600 return ON_VERTICAL_BORDER;
565 /* Convert X and Y to window-relative pixel coordinates. */ 601 }
566 *x -= left_x;
567 *y -= top_y;
568 return *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE;
569 }
570
571 /* Here, too, "*x > right_x" is because of character terminals. */
572 if (!w->pseudo_window_p
573 && !WINDOW_RIGHTMOST_P (w)
574 && *x > right_x - CANON_X_UNIT (f))
575 /* On the border on the right side of the window? Assume that
576 this area begins at RIGHT_X minus a canonical char width. */
577 return ON_VERTICAL_BORDER;
578 602
579 /* Convert X and Y to window-relative pixel coordinates. */ 603 /* Convert X and Y to window-relative pixel coordinates. */
580 *x -= left_x; 604 *x -= left_x;
581 *y -= top_y; 605 *y -= top_y;
582 return ON_TEXT; 606 return ON_TEXT;