Skip to content

Instantly share code, notes, and snippets.

@aaronjensen
Created October 20, 2018 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronjensen/4d0fe6c2de24d14f28d9fbd99fe47530 to your computer and use it in GitHub Desktop.
Save aaronjensen/4d0fe6c2de24d14f28d9fbd99fe47530 to your computer and use it in GitHub Desktop.
---
src/nsterm.m | 41 +++++++++++++++--------------------------
1 file changed, 15 insertions(+), 26 deletions(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index 1ef7f5ab51..f910d606a6 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -279,7 +279,6 @@ - (NSColor *)colorUsingDefaultColorSpace
/* display update */
static int ns_window_num = 0;
-static BOOL gsaved = NO;
static BOOL ns_fake_keydown = NO;
#ifdef NS_IMPL_COCOA
static BOOL ns_menu_bar_is_hidden = NO;
@@ -1234,7 +1233,6 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
NSRectClipList (r, 2);
else
NSRectClip (*r);
- gsaved = YES;
return YES;
}
@@ -1258,11 +1256,7 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
{
NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_reset_clipping");
- if (gsaved)
- {
- [[NSGraphicsContext currentContext] restoreGraphicsState];
- gsaved = NO;
- }
+ [[NSGraphicsContext currentContext] restoreGraphicsState];
}
@@ -1288,19 +1282,6 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
return ns_clip_to_rect (f, &clip_rect, 1);
}
-
-static void
-ns_flush_display (struct frame *f)
-/* Force the frame to redisplay. If areas have previously been marked
- dirty by setNeedsDisplayInRect (in ns_clip_to_rect), then this will call
- draw_rect: which will "expose" those areas. */
-{
- block_input ();
- [FRAME_NS_VIEW (f) displayIfNeeded];
- unblock_input ();
-}
-
-
/* ==========================================================================
Visible bell and beep.
@@ -2837,6 +2818,8 @@ so some key presses (TAB) are swallowed by the system. */
static void
ns_copy_bits (struct frame *f, NSRect src, NSRect dest)
{
+ NSSize delta = NSMakeSize (dest.origin.x - src.origin.x,
+ dest.origin.y - src.origin.y)
NSTRACE ("ns_copy_bits");
if (FRAME_NS_VIEW (f))
@@ -2845,10 +2828,17 @@ so some key presses (TAB) are swallowed by the system. */
/* FIXME: scrollRect:by: is deprecated in macOS 10.14. There is
no obvious replacement so we may have to come up with our own. */
- [FRAME_NS_VIEW (f) scrollRect: src
- by: NSMakeSize (dest.origin.x - src.origin.x,
- dest.origin.y - src.origin.y)];
- [FRAME_NS_VIEW (f) setNeedsDisplay:YES];
+ [FRAME_NS_VIEW (f) scrollRect: src by: delta];
+
+ /* As far as I can tell from the documentation, scrollRect:by:,
+ above, should copy the dirty rectangles from our source
+ rectangle to our destination, however it appears it clips the
+ operation to src. As a result we need to use
+ translateRectsNeedingDisplayInRect:by: below, and we have to
+ union src and dest so it can pick up the dirty rectangles,
+ and place them, as it also clips to the rectangle. */
+ [FRAME_NS_VIEW (f) translateRectsNeedingDisplayInRect:NSUnionRect (src, dest)
+ by:delta];
}
}
@@ -5119,7 +5109,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s)
ns_after_update_window_line,
ns_update_window_begin,
ns_update_window_end,
- ns_flush_display, /* flush_display */
+ 0, /* flush_display */
x_clear_window_mouse_face,
x_get_glyph_overhangs,
x_fix_overlapping_area,
@@ -7114,7 +7104,6 @@ - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
size_title = xmalloc (strlen (old_title) + 40);
esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows);
[window setTitle: [NSString stringWithUTF8String: size_title]];
- [window display];
xfree (size_title);
}
}
--
2.19.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment