summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2016-01-11 22:48:10 -0800
committerJohn Wiegley <johnw@newartisans.com>2016-01-11 22:48:10 -0800
commit4b739f70a54579b134ab6da313a3d665640a6a3f (patch)
treea5c8bba0bd10e8c4b2de062d6a5f905ac139f121 /src
parent540bfa7680268a55fc617ffb822e962cb9fb6c59 (diff)
parent43662a240b682de94299e797452ba56d01a04883 (diff)
downloademacs-4b739f70a54579b134ab6da313a3d665640a6a3f.tar.gz
emacs-4b739f70a54579b134ab6da313a3d665640a6a3f.tar.bz2
emacs-4b739f70a54579b134ab6da313a3d665640a6a3f.zip
Merge from origin/emacs-25
43662a2 ; Clarify that xref is still experimental 0a6e6ca ; * admin/release-process: Remove some obsolete records. c2e9e3d * lisp/progmodes/fortran.el (fortran-make-syntax-propertize-function): 8637f3d (semantic-symref-derive-find-filepatterns): Return a list 0a7ad07 ; Re-arrange xref-related entries in NEWS. fe903ef Fix xref-find-references on MS-Windows 55a28d8 ; Fixed visual bell artifact problem on NextStep. d064034 Document new features of tildify-mode 964bea7 Document new features of Whitespace mode cd68f47 Improve documentation of new Hide-IfDef features 723b8bf Fix regression in font-locking cl-assert and cl-check-type
Diffstat (limited to 'src')
-rw-r--r--src/nsterm.m35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index 0510f8e0e91..b270e0e58b5 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1150,9 +1150,11 @@ ns_clip_to_row (struct window *w, struct glyph_row *row,
{
// Number of currently active bell:s.
unsigned int nestCount;
+ bool isAttached;
}
- (void)show:(NSView *)view;
- (void)hide;
+- (void)remove;
@end
@implementation EmacsBell
@@ -1162,6 +1164,7 @@ ns_clip_to_row (struct window *w, struct glyph_row *row,
if ((self = [super init]))
{
nestCount = 0;
+ isAttached = false;
self.image = [NSImage imageNamed:NSImageNameCaution];
}
return self;
@@ -1183,6 +1186,7 @@ ns_clip_to_row (struct window *w, struct glyph_row *row,
[self setFrameOrigin:pos];
[self setFrameSize:self.image.size];
+ isAttached = true;
[[[view window] contentView] addSubview:self
positioned:NSWindowAbove
relativeTo:nil];
@@ -1199,17 +1203,31 @@ ns_clip_to_row (struct window *w, struct glyph_row *row,
// Note: Trace output from this method isn't shown, reason unknown.
// NSTRACE ("[EmacsBell hide]");
- --nestCount;
+ if (nestCount > 0)
+ --nestCount;
// Remove the image once the last bell became inactive.
if (nestCount == 0)
{
+ [self remove];
+ }
+}
+
+
+-(void)remove
+{
+ if (isAttached)
+ {
[self removeFromSuperview];
+ isAttached = false;
}
}
@end
+
+static EmacsBell * bell_view = nil;
+
static void
ns_ring_bell (struct frame *f)
/* --------------------------------------------------------------------------
@@ -1222,7 +1240,6 @@ ns_ring_bell (struct frame *f)
struct frame *frame = SELECTED_FRAME ();
NSView *view;
- static EmacsBell * bell_view = nil;
if (bell_view == nil)
{
bell_view = [[EmacsBell alloc] init];
@@ -1246,6 +1263,18 @@ ns_ring_bell (struct frame *f)
}
+static void hide_bell ()
+/* --------------------------------------------------------------------------
+ Ensure the bell is hidden.
+ -------------------------------------------------------------------------- */
+{
+ if (bell_view != nil)
+ {
+ [bell_view remove];
+ }
+}
+
+
/* ==========================================================================
Frame / window manager related functions
@@ -2328,6 +2357,8 @@ ns_copy_bits (struct frame *f, NSRect src, NSRect dest)
{
if (FRAME_NS_VIEW (f))
{
+ hide_bell(); // Ensure the bell image isn't scrolled.
+
ns_focus (f, &dest, 1);
[FRAME_NS_VIEW (f) scrollRect: src
by: NSMakeSize (dest.origin.x - src.origin.x,