diff options
| author | Jan Djärv | 2014-12-02 14:05:27 +0100 |
|---|---|---|
| committer | Jan Djärv | 2014-12-02 14:05:27 +0100 |
| commit | d9d383147219f8e6a90d4c177e1b454e19acfac9 (patch) | |
| tree | ed7ea37dad858b96674c8462275e9073ec114c91 /src | |
| parent | 02d462b291ae4494d4935d4e21332b7d205a82ce (diff) | |
| download | emacs-d9d383147219f8e6a90d4c177e1b454e19acfac9.tar.gz emacs-d9d383147219f8e6a90d4c177e1b454e19acfac9.zip | |
More flicker fixes for OSX, related to bug 18757.
* nsfns.m (ns_set_name_as_filename): Don't set represented filename
at once, call ns_set_represented_filename instead.
* nsterm.h: Declare ns_set_represented_filename.
* nsterm.m (represented_filename, represented_frame): New variables.
(ns_set_represented_filename): New function.
(sendEvent:): Set represented filename here to avoid flicker,
related to Bug#18757.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 12 | ||||
| -rw-r--r-- | src/nsfns.m | 9 | ||||
| -rw-r--r-- | src/nsterm.h | 6 | ||||
| -rw-r--r-- | src/nsterm.m | 28 |
4 files changed, 46 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5ecb0220026..952e4abd230 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2014-12-02 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * nsterm.m (represented_filename, represented_frame): New variables. | ||
| 4 | (ns_set_represented_filename): New function. | ||
| 5 | (sendEvent:): Set represented filename here to avoid flicker, | ||
| 6 | related to Bug#18757. | ||
| 7 | |||
| 8 | * nsterm.h: Declare ns_set_represented_filename. | ||
| 9 | |||
| 10 | * nsfns.m (ns_set_name_as_filename): Don't set represented filename | ||
| 11 | at once, call ns_set_represented_filename instead. | ||
| 12 | |||
| 1 | 2014-11-27 Eli Zaretskii <eliz@gnu.org> | 13 | 2014-11-27 Eli Zaretskii <eliz@gnu.org> |
| 2 | 14 | ||
| 3 | * xdisp.c (handle_single_display_spec): When ignoring a fringe | 15 | * xdisp.c (handle_single_display_spec): When ignoring a fringe |
diff --git a/src/nsfns.m b/src/nsfns.m index e0f8cfee14a..ec4761b773a 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -621,18 +621,11 @@ ns_set_name_as_filename (struct frame *f) | |||
| 621 | 621 | ||
| 622 | fstr = [NSString stringWithUTF8String: SSDATA (encoded_filename)]; | 622 | fstr = [NSString stringWithUTF8String: SSDATA (encoded_filename)]; |
| 623 | if (fstr == nil) fstr = @""; | 623 | if (fstr == nil) fstr = @""; |
| 624 | #ifdef NS_IMPL_COCOA | ||
| 625 | /* work around a bug observed on 10.3 and later where | ||
| 626 | setTitleWithRepresentedFilename does not clear out previous state | ||
| 627 | if given filename does not exist */ | ||
| 628 | if (! [[NSFileManager defaultManager] fileExistsAtPath: fstr]) | ||
| 629 | [[view window] setRepresentedFilename: @""]; | ||
| 630 | #endif | ||
| 631 | } | 624 | } |
| 632 | else | 625 | else |
| 633 | fstr = @""; | 626 | fstr = @""; |
| 634 | 627 | ||
| 635 | [[view window] setRepresentedFilename: fstr]; | 628 | ns_set_represented_filename (fstr, f); |
| 636 | [[view window] setTitle: str]; | 629 | [[view window] setTitle: str]; |
| 637 | fset_name (f, name); | 630 | fset_name (f, name); |
| 638 | } | 631 | } |
diff --git a/src/nsterm.h b/src/nsterm.h index 1c3fda82649..115d7ac6779 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -895,11 +895,15 @@ extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 895 | extern unsigned long ns_get_rgb_color (struct frame *f, | 895 | extern unsigned long ns_get_rgb_color (struct frame *f, |
| 896 | float r, float g, float b, float a); | 896 | float r, float g, float b, float a); |
| 897 | 897 | ||
| 898 | /* From nsterm.m, needed in nsfont.m. */ | ||
| 899 | #ifdef __OBJC__ | 898 | #ifdef __OBJC__ |
| 899 | /* From nsterm.m, needed in nsfont.m. */ | ||
| 900 | extern void | 900 | extern void |
| 901 | ns_draw_text_decoration (struct glyph_string *s, struct face *face, | 901 | ns_draw_text_decoration (struct glyph_string *s, struct face *face, |
| 902 | NSColor *defaultCol, CGFloat width, CGFloat x); | 902 | NSColor *defaultCol, CGFloat width, CGFloat x); |
| 903 | /* Needed in nsfns.m. */ | ||
| 904 | extern void | ||
| 905 | ns_set_represented_filename (NSString* fstr, struct frame *f); | ||
| 906 | |||
| 903 | #endif | 907 | #endif |
| 904 | 908 | ||
| 905 | #ifdef NS_IMPL_GNUSTEP | 909 | #ifdef NS_IMPL_GNUSTEP |
diff --git a/src/nsterm.m b/src/nsterm.m index 7e2d4beac6a..656d8668717 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -290,6 +290,9 @@ static struct { | |||
| 290 | NULL, 0, 0 | 290 | NULL, 0, 0 |
| 291 | }; | 291 | }; |
| 292 | 292 | ||
| 293 | static NSString *represented_filename = nil; | ||
| 294 | static struct frame *represented_frame = 0; | ||
| 295 | |||
| 293 | #ifdef NS_IMPL_COCOA | 296 | #ifdef NS_IMPL_COCOA |
| 294 | /* | 297 | /* |
| 295 | * State for pending menu activation: | 298 | * State for pending menu activation: |
| @@ -396,6 +399,14 @@ void x_set_frame_alpha (struct frame *f); | |||
| 396 | 399 | ||
| 397 | ========================================================================== */ | 400 | ========================================================================== */ |
| 398 | 401 | ||
| 402 | void | ||
| 403 | ns_set_represented_filename (NSString* fstr, struct frame *f) | ||
| 404 | { | ||
| 405 | represented_filename = [fstr retain]; | ||
| 406 | represented_frame = f; | ||
| 407 | } | ||
| 408 | |||
| 409 | |||
| 399 | static void | 410 | static void |
| 400 | hold_event (struct input_event *event) | 411 | hold_event (struct input_event *event) |
| 401 | { | 412 | { |
| @@ -4560,6 +4571,23 @@ ns_term_shutdown (int sig) | |||
| 4560 | } | 4571 | } |
| 4561 | #endif | 4572 | #endif |
| 4562 | 4573 | ||
| 4574 | if (represented_filename != nil && represented_frame) | ||
| 4575 | { | ||
| 4576 | NSString *fstr = represented_filename; | ||
| 4577 | NSView *view = FRAME_NS_VIEW (represented_frame); | ||
| 4578 | #ifdef NS_IMPL_COCOA | ||
| 4579 | /* work around a bug observed on 10.3 and later where | ||
| 4580 | setTitleWithRepresentedFilename does not clear out previous state | ||
| 4581 | if given filename does not exist */ | ||
| 4582 | if (! [[NSFileManager defaultManager] fileExistsAtPath: fstr]) | ||
| 4583 | [[view window] setRepresentedFilename: @""]; | ||
| 4584 | #endif | ||
| 4585 | [[view window] setRepresentedFilename: fstr]; | ||
| 4586 | [represented_filename release]; | ||
| 4587 | represented_filename = nil; | ||
| 4588 | represented_frame = NULL; | ||
| 4589 | } | ||
| 4590 | |||
| 4563 | if (type == NSApplicationDefined) | 4591 | if (type == NSApplicationDefined) |
| 4564 | { | 4592 | { |
| 4565 | switch ([theEvent data2]) | 4593 | switch ([theEvent data2]) |