; Fixed visual bell artifact problem on NextStep.
* src/nsterm.m (EmacsBell): Add feature to remove visual bell unconditionally. (hide_bell): New function. (ns_copy_bits): Hide visible bell before scrolling the frame content.
This commit is contained in:
parent
d064034c1c
commit
55a28d8a1b
1 changed files with 33 additions and 2 deletions
33
src/nsterm.m
33
src/nsterm.m
|
@ -1150,9 +1150,11 @@ @interface EmacsBell : NSImageView
|
||||||
{
|
{
|
||||||
// Number of currently active bell:s.
|
// Number of currently active bell:s.
|
||||||
unsigned int nestCount;
|
unsigned int nestCount;
|
||||||
|
bool isAttached;
|
||||||
}
|
}
|
||||||
- (void)show:(NSView *)view;
|
- (void)show:(NSView *)view;
|
||||||
- (void)hide;
|
- (void)hide;
|
||||||
|
- (void)remove;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation EmacsBell
|
@implementation EmacsBell
|
||||||
|
@ -1162,6 +1164,7 @@ - (id)init;
|
||||||
if ((self = [super init]))
|
if ((self = [super init]))
|
||||||
{
|
{
|
||||||
nestCount = 0;
|
nestCount = 0;
|
||||||
|
isAttached = false;
|
||||||
self.image = [NSImage imageNamed:NSImageNameCaution];
|
self.image = [NSImage imageNamed:NSImageNameCaution];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
@ -1183,6 +1186,7 @@ - (void)show:(NSView *)view
|
||||||
[self setFrameOrigin:pos];
|
[self setFrameOrigin:pos];
|
||||||
[self setFrameSize:self.image.size];
|
[self setFrameSize:self.image.size];
|
||||||
|
|
||||||
|
isAttached = true;
|
||||||
[[[view window] contentView] addSubview:self
|
[[[view window] contentView] addSubview:self
|
||||||
positioned:NSWindowAbove
|
positioned:NSWindowAbove
|
||||||
relativeTo:nil];
|
relativeTo:nil];
|
||||||
|
@ -1199,17 +1203,31 @@ - (void)hide
|
||||||
// Note: Trace output from this method isn't shown, reason unknown.
|
// Note: Trace output from this method isn't shown, reason unknown.
|
||||||
// NSTRACE ("[EmacsBell hide]");
|
// NSTRACE ("[EmacsBell hide]");
|
||||||
|
|
||||||
|
if (nestCount > 0)
|
||||||
--nestCount;
|
--nestCount;
|
||||||
|
|
||||||
// Remove the image once the last bell became inactive.
|
// Remove the image once the last bell became inactive.
|
||||||
if (nestCount == 0)
|
if (nestCount == 0)
|
||||||
|
{
|
||||||
|
[self remove];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-(void)remove
|
||||||
|
{
|
||||||
|
if (isAttached)
|
||||||
{
|
{
|
||||||
[self removeFromSuperview];
|
[self removeFromSuperview];
|
||||||
|
isAttached = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
static EmacsBell * bell_view = nil;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ns_ring_bell (struct frame *f)
|
ns_ring_bell (struct frame *f)
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
|
@ -1222,7 +1240,6 @@ - (void)hide
|
||||||
struct frame *frame = SELECTED_FRAME ();
|
struct frame *frame = SELECTED_FRAME ();
|
||||||
NSView *view;
|
NSView *view;
|
||||||
|
|
||||||
static EmacsBell * bell_view = nil;
|
|
||||||
if (bell_view == nil)
|
if (bell_view == nil)
|
||||||
{
|
{
|
||||||
bell_view = [[EmacsBell alloc] init];
|
bell_view = [[EmacsBell alloc] init];
|
||||||
|
@ -1246,6 +1263,18 @@ - (void)hide
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void hide_bell ()
|
||||||
|
/* --------------------------------------------------------------------------
|
||||||
|
Ensure the bell is hidden.
|
||||||
|
-------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
if (bell_view != nil)
|
||||||
|
{
|
||||||
|
[bell_view remove];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ==========================================================================
|
/* ==========================================================================
|
||||||
|
|
||||||
Frame / window manager related functions
|
Frame / window manager related functions
|
||||||
|
@ -2328,6 +2357,8 @@ - (void)hide
|
||||||
{
|
{
|
||||||
if (FRAME_NS_VIEW (f))
|
if (FRAME_NS_VIEW (f))
|
||||||
{
|
{
|
||||||
|
hide_bell(); // Ensure the bell image isn't scrolled.
|
||||||
|
|
||||||
ns_focus (f, &dest, 1);
|
ns_focus (f, &dest, 1);
|
||||||
[FRAME_NS_VIEW (f) scrollRect: src
|
[FRAME_NS_VIEW (f) scrollRect: src
|
||||||
by: NSMakeSize (dest.origin.x - src.origin.x,
|
by: NSMakeSize (dest.origin.x - src.origin.x,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue