* 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).
This commit is contained in:
Jan Djärv 2014-10-30 20:15:38 +01:00
parent b7bf631c80
commit c465f1c27f
4 changed files with 28 additions and 15 deletions

View file

@ -1,5 +1,13 @@
2014-10-30 Jan Djärv <jan.h.d@swipnet.se>
* 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.

View file

@ -631,18 +631,26 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
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 ();
}

View file

@ -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,

View file

@ -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 ();