715 |
#endif |
#endif |
716 |
|
|
717 |
static void |
static void |
718 |
|
mac_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 |
|
|
734 |
|
static void |
735 |
mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, |
mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, |
736 |
bytes_per_char) |
bytes_per_char) |
737 |
Display *display; |
Display *display; |
3503 |
XTflash (f) |
XTflash (f) |
3504 |
struct frame *f; |
struct frame *f; |
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 |
|
|
3534 |
BLOCK_INPUT; |
BLOCK_INPUT; |
3535 |
|
|
3536 |
FlashMenuBar (0); |
/* 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); |
3557 |
|
|
3558 |
{ |
{ |
3559 |
struct timeval wakeup; |
struct timeval wakeup; |
3565 |
wakeup.tv_sec += (wakeup.tv_usec / 1000000); |
wakeup.tv_sec += (wakeup.tv_usec / 1000000); |
3566 |
wakeup.tv_usec %= 1000000; |
wakeup.tv_usec %= 1000000; |
3567 |
|
|
3568 |
/* Keep waiting until past the time wakeup. */ |
/* Keep waiting until past the time wakeup or any input gets |
3569 |
while (1) |
available. */ |
3570 |
|
while (! detect_input_pending ()) |
3571 |
{ |
{ |
3572 |
struct timeval timeout; |
struct timeval current; |
3573 |
|
struct timeval timeout; |
3574 |
|
|
3575 |
EMACS_GET_TIME (timeout); |
EMACS_GET_TIME (current); |
3576 |
|
|
3577 |
/* In effect, timeout = wakeup - timeout. |
/* Break if result would be negative. */ |
3578 |
Break if result would be negative. */ |
if (timeval_subtract (¤t, wakeup, current)) |
3579 |
if (timeval_subtract (&timeout, wakeup, timeout)) |
break; |
|
break; |
|
3580 |
|
|
3581 |
/* Try to wait that long--but we might wake up sooner. */ |
/* How long `select' should wait. */ |
3582 |
select (0, NULL, NULL, NULL, &timeout); |
timeout.tv_sec = 0; |
3583 |
|
timeout.tv_usec = 10000; |
3584 |
|
|
3585 |
|
/* Try to wait that long--but we might wake up sooner. */ |
3586 |
|
select (0, NULL, NULL, NULL, &timeout); |
3587 |
} |
} |
3588 |
} |
} |
3589 |
|
|
3590 |
FlashMenuBar (0); |
/* 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); |
3611 |
|
|
3612 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
3613 |
} |
} |