diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/nsterm.m | 65 |
2 files changed, 19 insertions, 50 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 22647f3977d..7321b63ed07 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2010-02-18 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * nsterm.m (ns_ring_bell): Revert last change (Bug#5569). | ||
| 4 | |||
| 1 | 2010-02-18 Glenn Morris <rgm@gnu.org> | 5 | 2010-02-18 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * callint.c (Finteractive): Doc fix. | 7 | * callint.c (Finteractive): Doc fix. |
diff --git a/src/nsterm.m b/src/nsterm.m index 8f3233f9fde..a4d06f82d97 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -808,58 +808,23 @@ ns_ring_bell () | |||
| 808 | view = FRAME_NS_VIEW (frame); | 808 | view = FRAME_NS_VIEW (frame); |
| 809 | if (view != nil) | 809 | if (view != nil) |
| 810 | { | 810 | { |
| 811 | /* Get the bounds of our NSView */ | 811 | NSRect r, surr; |
| 812 | NSRect viewBounds = [view bounds]; | 812 | NSPoint dim = NSMakePoint (128, 128); |
| 813 | 813 | ||
| 814 | /* Height of each line to flash. */ | 814 | r = [view bounds]; |
| 815 | int flash_height = FRAME_LINE_HEIGHT (frame); | 815 | r.origin.x += (r.size.width - dim.x) / 2; |
| 816 | int width = FRAME_PIXEL_WIDTH (frame) | 816 | r.origin.y += (r.size.height - dim.y) / 2; |
| 817 | - NS_SCROLL_BAR_WIDTH (frame); | 817 | r.size.width = dim.x; |
| 818 | 818 | r.size.height = dim.y; | |
| 819 | /* Get the GraphicsContext */ | 819 | surr = NSInsetRect (r, -2, -2); |
| 820 | CGContextRef ctxt = [[NSGraphicsContext currentContext] graphicsPort]; | 820 | ns_focus (frame, &surr, 1); |
| 821 | CGRect lowerLine, upperLine; | 821 | [[view window] cacheImageInRect: [view convertRect: surr toView:nil]]; |
| 822 | lowerLine = | 822 | [ns_lookup_indexed_color (NS_FACE_FOREGROUND |
| 823 | CGRectMake(viewBounds.origin.x, viewBounds.origin.y, | 823 | (FRAME_DEFAULT_FACE (frame)), frame) set]; |
| 824 | width + NS_SCROLL_BAR_WIDTH(frame), | 824 | NSRectFill (r); |
| 825 | flash_height + FRAME_INTERNAL_BORDER_WIDTH (frame)); | ||
| 826 | upperLine = | ||
| 827 | CGRectMake(viewBounds.origin.x, | ||
| 828 | viewBounds.origin.y + viewBounds.size.height | ||
| 829 | - (flash_height + FRAME_INTERNAL_BORDER_WIDTH (frame)), | ||
| 830 | width, | ||
| 831 | flash_height + FRAME_INTERNAL_BORDER_WIDTH (frame)); | ||
| 832 | |||
| 833 | /* Invert the colors using a difference blend. */ | ||
| 834 | CGContextSetBlendMode(ctxt, kCGBlendModeDifference); | ||
| 835 | CGContextSetGrayFillColor(ctxt, 1, 1); | ||
| 836 | |||
| 837 | /* If window is tall, flash top and bottom line. */ | ||
| 838 | if (viewBounds.size.height > 3 * FRAME_LINE_HEIGHT (frame)) | ||
| 839 | { | ||
| 840 | CGContextFillRect(ctxt, upperLine); | ||
| 841 | CGContextFillRect(ctxt, lowerLine); | ||
| 842 | } | ||
| 843 | else | ||
| 844 | /* If it is short, flash it all. */ | ||
| 845 | CGContextFillRect(ctxt, NSRectToCGRect([view bounds])); | ||
| 846 | |||
| 847 | /* Bounce Dock icon. Maybe we can allow some configuration here. */ | ||
| 848 | [NSApp requestUserAttention: NSInformationalRequest]; | ||
| 849 | |||
| 850 | [[view window] flushWindow]; | 825 | [[view window] flushWindow]; |
| 851 | ns_timeout (150000); | 826 | ns_timeout (150000); |
| 852 | 827 | [[view window] restoreCachedImage]; | |
| 853 | /* If window is tall, flash top and bottom line. */ | ||
| 854 | if (viewBounds.size.height > 3 * FRAME_LINE_HEIGHT (frame)) | ||
| 855 | { | ||
| 856 | CGContextFillRect(ctxt, upperLine); | ||
| 857 | CGContextFillRect(ctxt, lowerLine); | ||
| 858 | } | ||
| 859 | else | ||
| 860 | /* If it is short, flash it all. */ | ||
| 861 | CGContextFillRect(ctxt, NSRectToCGRect([view bounds])); | ||
| 862 | |||
| 863 | [[view window] flushWindow]; | 828 | [[view window] flushWindow]; |
| 864 | ns_unfocus (frame); | 829 | ns_unfocus (frame); |
| 865 | } | 830 | } |