aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlenn Morris2018-10-27 09:15:32 -0700
committerGlenn Morris2018-10-27 09:15:32 -0700
commit2df74ce79b910c977167e84d4cb37ede1053663f (patch)
treec349e7c462c20b423030b734c461b90eee17f23f /src
parent3e81e9a0e7742197354515f3d3ea55fdb201eb29 (diff)
parentdf64da8eb845c9f07ee93bfbf28af41a01a2e83f (diff)
downloademacs-2df74ce79b910c977167e84d4cb37ede1053663f.tar.gz
emacs-2df74ce79b910c977167e84d4cb37ede1053663f.zip
Merge from origin/emacs-26
df64da8 (origin/emacs-26) * lisp/simple.el (region-extract-function):... 520c486 * lisp/simple.el (region-bounds): Doc fix. (Bug#33168) 9193db0 Improve documentation of 'process-connection-type' 106b9e1 Unify prompt for gnupg passphrase between GNU/Linux and MS-Wi... 2a41616 Doc fix of 'gnus-fetch-old-headers' 29a7644 Deactivate incorrect hyperlinking in gnus-build-sparse-thread... 53ae90f Minor copyedits in cmdargs.texi fc2e65a Improve documentation of X resource loading 13132b3 * lisp/net/tramp-sh.el (tramp-inline-compress-commands): 8361292 ; Fix sorting in admin/MAINTAINERS 92de44f Don't error when indenting malformed Lisp (Bug#30891) c3adbc8 Improve 'isearch-delete-char' documentation (Bug#32990) 6ca71ce ; * lisp/help.el (with-help-window): Remove extra space in doc. f5f9583 Improve XPM load failure message (bug#33126) f3d01d4 Avoid infloop in CPerl mode fontification 71a2d50 Fix minibuffer-help-form for lexical binding 7e8eee6 Fix some NS drawing issues (bug#32932) d72975a * lisp/gnus/mm-util.el (mm-decompress-buffer): Fix split-stri... c97a5f1 * doc/misc/calc.texi (Summary): The +/- key is 'p', not 'P'. # Conflicts: # lisp/gnus/mm-util.el
Diffstat (limited to 'src')
-rw-r--r--src/image.c2
-rw-r--r--src/nsterm.m80
2 files changed, 38 insertions, 44 deletions
diff --git a/src/image.c b/src/image.c
index 24decbc0997..ad4f95ba991 100644
--- a/src/image.c
+++ b/src/image.c
@@ -4309,7 +4309,7 @@ xpm_load_image (struct frame *f,
4309 return 1; 4309 return 1;
4310 4310
4311 failure: 4311 failure:
4312 image_error ("Invalid XPM file (%s)", img->spec); 4312 image_error ("Invalid XPM3 file (%s)", img->spec);
4313 x_destroy_x_image (ximg); 4313 x_destroy_x_image (ximg);
4314 x_destroy_x_image (mask_img); 4314 x_destroy_x_image (mask_img);
4315 x_clear_image (f, img); 4315 x_clear_image (f, img);
diff --git a/src/nsterm.m b/src/nsterm.m
index 1ef7f5ab516..bcc23ffeaff 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -279,7 +279,6 @@ long context_menu_value = 0;
279 279
280/* display update */ 280/* display update */
281static int ns_window_num = 0; 281static int ns_window_num = 0;
282static BOOL gsaved = NO;
283static BOOL ns_fake_keydown = NO; 282static BOOL ns_fake_keydown = NO;
284#ifdef NS_IMPL_COCOA 283#ifdef NS_IMPL_COCOA
285static BOOL ns_menu_bar_is_hidden = NO; 284static BOOL ns_menu_bar_is_hidden = NO;
@@ -1234,7 +1233,6 @@ ns_clip_to_rect (struct frame *f, NSRect *r, int n)
1234 NSRectClipList (r, 2); 1233 NSRectClipList (r, 2);
1235 else 1234 else
1236 NSRectClip (*r); 1235 NSRectClip (*r);
1237 gsaved = YES;
1238 1236
1239 return YES; 1237 return YES;
1240 } 1238 }
@@ -1258,11 +1256,7 @@ ns_reset_clipping (struct frame *f)
1258{ 1256{
1259 NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_reset_clipping"); 1257 NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_reset_clipping");
1260 1258
1261 if (gsaved) 1259 [[NSGraphicsContext currentContext] restoreGraphicsState];
1262 {
1263 [[NSGraphicsContext currentContext] restoreGraphicsState];
1264 gsaved = NO;
1265 }
1266} 1260}
1267 1261
1268 1262
@@ -1288,19 +1282,6 @@ ns_clip_to_row (struct window *w, struct glyph_row *row,
1288 return ns_clip_to_rect (f, &clip_rect, 1); 1282 return ns_clip_to_rect (f, &clip_rect, 1);
1289} 1283}
1290 1284
1291
1292static void
1293ns_flush_display (struct frame *f)
1294/* Force the frame to redisplay. If areas have previously been marked
1295 dirty by setNeedsDisplayInRect (in ns_clip_to_rect), then this will call
1296 draw_rect: which will "expose" those areas. */
1297{
1298 block_input ();
1299 [FRAME_NS_VIEW (f) displayIfNeeded];
1300 unblock_input ();
1301}
1302
1303
1304/* ========================================================================== 1285/* ==========================================================================
1305 1286
1306 Visible bell and beep. 1287 Visible bell and beep.
@@ -2837,6 +2818,8 @@ ns_clear_frame_area (struct frame *f, int x, int y, int width, int height)
2837static void 2818static void
2838ns_copy_bits (struct frame *f, NSRect src, NSRect dest) 2819ns_copy_bits (struct frame *f, NSRect src, NSRect dest)
2839{ 2820{
2821 NSSize delta = NSMakeSize (dest.origin.x - src.origin.x,
2822 dest.origin.y - src.origin.y)
2840 NSTRACE ("ns_copy_bits"); 2823 NSTRACE ("ns_copy_bits");
2841 2824
2842 if (FRAME_NS_VIEW (f)) 2825 if (FRAME_NS_VIEW (f))
@@ -2845,10 +2828,21 @@ ns_copy_bits (struct frame *f, NSRect src, NSRect dest)
2845 2828
2846 /* FIXME: scrollRect:by: is deprecated in macOS 10.14. There is 2829 /* FIXME: scrollRect:by: is deprecated in macOS 10.14. There is
2847 no obvious replacement so we may have to come up with our own. */ 2830 no obvious replacement so we may have to come up with our own. */
2848 [FRAME_NS_VIEW (f) scrollRect: src 2831 [FRAME_NS_VIEW (f) scrollRect: src by: delta];
2849 by: NSMakeSize (dest.origin.x - src.origin.x, 2832
2850 dest.origin.y - src.origin.y)]; 2833#ifdef NS_IMPL_COCOA
2851 [FRAME_NS_VIEW (f) setNeedsDisplay:YES]; 2834 /* As far as I can tell from the documentation, scrollRect:by:,
2835 above, should copy the dirty rectangles from our source
2836 rectangle to our destination, however it appears it clips the
2837 operation to src. As a result we need to use
2838 translateRectsNeedingDisplayInRect:by: below, and we have to
2839 union src and dest so it can pick up the dirty rectangles,
2840 and place them, as it also clips to the rectangle.
2841
2842 FIXME: We need a GNUstep equivalent. */
2843 [FRAME_NS_VIEW (f) translateRectsNeedingDisplayInRect:NSUnionRect (src, dest)
2844 by:delta];
2845#endif
2852 } 2846 }
2853} 2847}
2854 2848
@@ -3233,15 +3227,6 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
3233 else 3227 else
3234 [FRAME_CURSOR_COLOR (f) set]; 3228 [FRAME_CURSOR_COLOR (f) set];
3235 3229
3236#ifdef NS_IMPL_COCOA
3237 /* TODO: This makes drawing of cursor plus that of phys_cursor_glyph
3238 atomic. Cleaner ways of doing this should be investigated.
3239 One way would be to set a global variable DRAWING_CURSOR
3240 when making the call to draw_phys..(), don't focus in that
3241 case, then move the ns_reset_clipping() here after that call. */
3242 NSDisableScreenUpdates ();
3243#endif
3244
3245 switch (cursor_type) 3230 switch (cursor_type)
3246 { 3231 {
3247 case DEFAULT_CURSOR: 3232 case DEFAULT_CURSOR:
@@ -3275,10 +3260,6 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
3275 /* draw the character under the cursor */ 3260 /* draw the character under the cursor */
3276 if (cursor_type != NO_CURSOR) 3261 if (cursor_type != NO_CURSOR)
3277 draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); 3262 draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
3278
3279#ifdef NS_IMPL_COCOA
3280 NSEnableScreenUpdates ();
3281#endif
3282 } 3263 }
3283} 3264}
3284 3265
@@ -5119,7 +5100,7 @@ static struct redisplay_interface ns_redisplay_interface =
5119 ns_after_update_window_line, 5100 ns_after_update_window_line,
5120 ns_update_window_begin, 5101 ns_update_window_begin,
5121 ns_update_window_end, 5102 ns_update_window_end,
5122 ns_flush_display, /* flush_display */ 5103 0, /* flush_display */
5123 x_clear_window_mouse_face, 5104 x_clear_window_mouse_face,
5124 x_get_glyph_overhangs, 5105 x_get_glyph_overhangs,
5125 x_fix_overlapping_area, 5106 x_fix_overlapping_area,
@@ -7114,7 +7095,6 @@ not_in_argv (NSString *arg)
7114 size_title = xmalloc (strlen (old_title) + 40); 7095 size_title = xmalloc (strlen (old_title) + 40);
7115 esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows); 7096 esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows);
7116 [window setTitle: [NSString stringWithUTF8String: size_title]]; 7097 [window setTitle: [NSString stringWithUTF8String: size_title]];
7117 [window display];
7118 xfree (size_title); 7098 xfree (size_title);
7119 } 7099 }
7120 } 7100 }
@@ -8164,8 +8144,8 @@ not_in_argv (NSString *arg)
8164 8144
8165- (void)drawRect: (NSRect)rect 8145- (void)drawRect: (NSRect)rect
8166{ 8146{
8167 int x = NSMinX (rect), y = NSMinY (rect); 8147 const NSRect *rectList;
8168 int width = NSWidth (rect), height = NSHeight (rect); 8148 NSInteger numRects;
8169 8149
8170 NSTRACE ("[EmacsView drawRect:" NSTRACE_FMT_RECT "]", 8150 NSTRACE ("[EmacsView drawRect:" NSTRACE_FMT_RECT "]",
8171 NSTRACE_ARG_RECT(rect)); 8151 NSTRACE_ARG_RECT(rect));
@@ -8173,9 +8153,23 @@ not_in_argv (NSString *arg)
8173 if (!emacsframe || !emacsframe->output_data.ns) 8153 if (!emacsframe || !emacsframe->output_data.ns)
8174 return; 8154 return;
8175 8155
8176 ns_clear_frame_area (emacsframe, x, y, width, height);
8177 block_input (); 8156 block_input ();
8178 expose_frame (emacsframe, x, y, width, height); 8157
8158 /* Get only the precise dirty rectangles to avoid redrawing
8159 potentially large areas of the frame that haven't changed.
8160
8161 I'm not sure this actually provides much of a performance benefit
8162 as it's hard to benchmark, but it certainly doesn't seem to
8163 hurt. */
8164 [self getRectsBeingDrawn:&rectList count:&numRects];
8165 for (int i = 0 ; i < numRects ; i++)
8166 {
8167 NSRect r = rectList[i];
8168 expose_frame (emacsframe,
8169 NSMinX (r), NSMinY (r),
8170 NSWidth (r), NSHeight (r));
8171 }
8172
8179 unblock_input (); 8173 unblock_input ();
8180 8174
8181 /* 8175 /*