From: Jan Djärv Date: Thu, 30 Oct 2014 19:15:38 +0000 (+0100) Subject: * nsfns.m (ns_set_doc_edited): Do all logic (check frames) here X-Git-Tag: emacs-24.4.90~300 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c465f1c27f538c0ef2afa01f179e1f472bd9f097;p=emacs.git * nsfns.m (ns_set_doc_edited): Do all logic (check frames) here instead of in xdisp.c, function now takes void. * nsterm.h (ns_set_doc_edited): Declare taking no args. * xdisp.c (prepare_menu_bars): Remove HAVE_NS code. (redisplay_internal): Call ns_set_doc_edited if HAVE_NS (Bug#18884). --- diff --git a/src/ChangeLog b/src/ChangeLog index a66026fa091..584207802b4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2014-10-30 Jan Djärv + * nsterm.h (ns_set_doc_edited): Declare taking no args. + + * nsfns.m (ns_set_doc_edited): Do all logic (check frames) here + instead of in xdisp.c, function now takes void. (Bug#18884). + + * xdisp.c (prepare_menu_bars): Remove HAVE_NS code. + (redisplay_internal): Call ns_set_doc_edited if HAVE_NS (Bug#18884). + * nsterm.h (EmacsScroller): Replace Lisp_Object win with struct window* (Bug#18889). Remove getMouseMotionPart. diff --git a/src/nsfns.m b/src/nsfns.m index 9d9f5416c86..4fa62f56851 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -631,18 +631,26 @@ ns_set_name_as_filename (struct frame *f) void -ns_set_doc_edited (struct frame *f, Lisp_Object arg) +ns_set_doc_edited (void) { - NSView *view = FRAME_NS_VIEW (f); NSAutoreleasePool *pool; - if (!MINI_WINDOW_P (XWINDOW (f->selected_window))) + Lisp_Object tail, frame; + block_input (); + pool = [[NSAutoreleasePool alloc] init]; + FOR_EACH_FRAME (tail, frame) { - block_input (); - pool = [[NSAutoreleasePool alloc] init]; - [[view window] setDocumentEdited: !NILP (arg)]; - [pool release]; - unblock_input (); + BOOL edited = NO; + struct frame *f = XFRAME (frame); + struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); + NSView *view = FRAME_NS_VIEW (f); + if (!MINI_WINDOW_P (w)) + edited = ! NILP (Fbuffer_modified_p (w->contents)) && + ! NILP (Fbuffer_file_name (w->contents)); + [[view window] setDocumentEdited: edited]; } + + [pool release]; + unblock_input (); } diff --git a/src/nsterm.h b/src/nsterm.h index a6081e8da57..eb2165a89d3 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -818,7 +818,7 @@ extern void nxatoms_of_nsselect (void); extern int ns_lisp_to_cursor_type (Lisp_Object arg); extern Lisp_Object ns_cursor_type_to_lisp (int arg); extern void ns_set_name_as_filename (struct frame *f); -extern void ns_set_doc_edited (struct frame *f, Lisp_Object arg); +extern void ns_set_doc_edited (void); extern bool ns_defined_color (struct frame *f, diff --git a/src/xdisp.c b/src/xdisp.c index f0726ecce70..c12ef753a45 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11778,12 +11778,6 @@ prepare_menu_bars (void) menu_bar_hooks_run = update_menu_bar (f, 0, menu_bar_hooks_run); #ifdef HAVE_WINDOW_SYSTEM update_tool_bar (f, 0); -#endif -#ifdef HAVE_NS - if (windows_or_buffers_changed - && FRAME_NS_P (f)) - ns_set_doc_edited - (f, Fbuffer_modified_p (XWINDOW (f->selected_window)->contents)); #endif UNGCPRO; } @@ -14149,6 +14143,9 @@ redisplay_internal (void) #endif /* HAVE_WINDOW_SYSTEM */ end_of_redisplay: +#ifdef HAVE_NS + ns_set_doc_edited (); +#endif if (interrupt_input && interrupts_deferred) request_sigio ();