aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/macterm.c114
1 files changed, 102 insertions, 12 deletions
diff --git a/src/macterm.c b/src/macterm.c
index 6b37b190b1a..ff4dde4c74b 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -715,6 +715,23 @@ atsu_get_text_layout_with_text_ptr (text, text_length, style, text_layout)
715#endif 715#endif
716 716
717static void 717static void
718mac_invert_rectangle (display, w, x, y, width, height)
719 Display *display;
720 WindowPtr w;
721 int x, y;
722 unsigned int width, height;
723{
724 Rect r;
725
726 SetPortWindowPort (w);
727
728 SetRect (&r, x, y, x + width, y + height);
729
730 InvertRect (&r);
731}
732
733
734static void
718mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, 735mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode,
719 bytes_per_char) 736 bytes_per_char)
720 Display *display; 737 Display *display;
@@ -3486,9 +3503,57 @@ void
3486XTflash (f) 3503XTflash (f)
3487 struct frame *f; 3504 struct frame *f;
3488{ 3505{
3506 /* Get the height not including a menu bar widget. */
3507 int height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, FRAME_LINES (f));
3508 /* Height of each line to flash. */
3509 int flash_height = FRAME_LINE_HEIGHT (f);
3510 /* These will be the left and right margins of the rectangles. */
3511 int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
3512 int flash_right = FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f);
3513
3514 int width;
3515
3516 /* Don't flash the area between a scroll bar and the frame
3517 edge it is next to. */
3518 switch (FRAME_VERTICAL_SCROLL_BAR_TYPE (f))
3519 {
3520 case vertical_scroll_bar_left:
3521 flash_left += VERTICAL_SCROLL_BAR_WIDTH_TRIM;
3522 break;
3523
3524 case vertical_scroll_bar_right:
3525 flash_right -= VERTICAL_SCROLL_BAR_WIDTH_TRIM;
3526 break;
3527
3528 default:
3529 break;
3530 }
3531
3532 width = flash_right - flash_left;
3533
3489 BLOCK_INPUT; 3534 BLOCK_INPUT;
3490 3535
3491 FlashMenuBar (0); 3536 /* If window is tall, flash top and bottom line. */
3537 if (height > 3 * FRAME_LINE_HEIGHT (f))
3538 {
3539 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3540 flash_left,
3541 (FRAME_INTERNAL_BORDER_WIDTH (f)
3542 + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)),
3543 width, flash_height);
3544 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3545 flash_left,
3546 (height - flash_height
3547 - FRAME_INTERNAL_BORDER_WIDTH (f)),
3548 width, flash_height);
3549 }
3550 else
3551 /* If it is short, flash it all. */
3552 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3553 flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
3554 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
3555
3556 x_flush (f);
3492 3557
3493 { 3558 {
3494 struct timeval wakeup; 3559 struct timeval wakeup;
@@ -3500,24 +3565,49 @@ XTflash (f)
3500 wakeup.tv_sec += (wakeup.tv_usec / 1000000); 3565 wakeup.tv_sec += (wakeup.tv_usec / 1000000);
3501 wakeup.tv_usec %= 1000000; 3566 wakeup.tv_usec %= 1000000;
3502 3567
3503 /* Keep waiting until past the time wakeup. */ 3568 /* Keep waiting until past the time wakeup or any input gets
3504 while (1) 3569 available. */
3570 while (! detect_input_pending ())
3505 { 3571 {
3506 struct timeval timeout; 3572 struct timeval current;
3573 struct timeval timeout;
3507 3574
3508 EMACS_GET_TIME (timeout); 3575 EMACS_GET_TIME (current);
3509 3576
3510 /* In effect, timeout = wakeup - timeout. 3577 /* Break if result would be negative. */
3511 Break if result would be negative. */ 3578 if (timeval_subtract (&current, wakeup, current))
3512 if (timeval_subtract (&timeout, wakeup, timeout)) 3579 break;
3513 break; 3580
3581 /* How long `select' should wait. */
3582 timeout.tv_sec = 0;
3583 timeout.tv_usec = 10000;
3514 3584
3515 /* Try to wait that long--but we might wake up sooner. */ 3585 /* Try to wait that long--but we might wake up sooner. */
3516 select (0, NULL, NULL, NULL, &timeout); 3586 select (0, NULL, NULL, NULL, &timeout);
3517 } 3587 }
3518 } 3588 }
3519 3589
3520 FlashMenuBar (0); 3590 /* If window is tall, flash top and bottom line. */
3591 if (height > 3 * FRAME_LINE_HEIGHT (f))
3592 {
3593 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3594 flash_left,
3595 (FRAME_INTERNAL_BORDER_WIDTH (f)
3596 + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)),
3597 width, flash_height);
3598 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3599 flash_left,
3600 (height - flash_height
3601 - FRAME_INTERNAL_BORDER_WIDTH (f)),
3602 width, flash_height);
3603 }
3604 else
3605 /* If it is short, flash it all. */
3606 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3607 flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
3608 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
3609
3610 x_flush (f);
3521 3611
3522 UNBLOCK_INPUT; 3612 UNBLOCK_INPUT;
3523} 3613}