/* Functions for the NeXT/Open/GNUstep and MacOSX window system.
- Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009
+ Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GNU Emacs.
/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
-#include "config.h"
+#include <config.h>
#include <signal.h>
#include <math.h>
extern Lisp_Object Qunderline, Qundefined;
extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth;
extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle;
+extern Lisp_Object Qnone;
+extern Lisp_Object Vframe_title_format;
+
+/* The below are defined in frame.c. */
+
+extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
-Lisp_Object Qnone;
Lisp_Object Qbuffered;
Lisp_Object Qfontsize;
else
{
struct ns_display_info *dpyinfo = terminal->display_info.ns;
- f = (dpyinfo->x_focus_frame || dpyinfo->x_highlight_frame);
+ f = dpyinfo->x_focus_frame
+ ? dpyinfo->x_focus_frame : dpyinfo->x_highlight_frame;
}
return ((f && FRAME_NS_P (f)) ? [[FRAME_NS_VIEW (f) window] screen]
NSTRACE (x_implicitly_set_name);
if (FRAME_ICONIFIED_P (f))
ns_set_name_iconic (f, arg, 0);
+ else if (FRAME_NS_P (f) && EQ (Vframe_title_format, Qt))
+ ns_set_name_as_filename (f);
else
ns_set_name (f, arg, 0);
}
BLOCK_INPUT;
pool = [[NSAutoreleasePool alloc] init];
- name =XBUFFER (buf)->filename;
+ name = XBUFFER (buf)->filename;
if (NILP (name) || FRAME_ICONIFIED_P (f)) name =XBUFFER (buf)->name;
if (FRAME_ICONIFIED_P (f) && !NILP (f->icon_name))
name = f->icon_name;
if (NILP (name))
- name = build_string([ns_app_name UTF8String]);
+ name = build_string ([ns_app_name UTF8String]);
else
CHECK_STRING (name);
void
-ns_set_doc_edited (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+ns_set_doc_edited (struct frame *f, Lisp_Object arg)
{
NSView *view = FRAME_NS_VIEW (f);
NSAutoreleasePool *pool;
- BLOCK_INPUT;
- pool = [[NSAutoreleasePool alloc] init];
- [[view window] setDocumentEdited: !NILP (arg)];
- [pool release];
- UNBLOCK_INPUT;
+ if (!MINI_WINDOW_P (XWINDOW (f->selected_window)))
+ {
+ BLOCK_INPUT;
+ pool = [[NSAutoreleasePool alloc] init];
+ [[view window] setDocumentEdited: !NILP (arg)];
+ [pool release];
+ UNBLOCK_INPUT;
+ }
}
f->output_method = output_ns;
f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns));
- bzero (f->output_data.ns, sizeof (*(f->output_data.ns)));
+ memset (f->output_data.ns, 0, sizeof (*(f->output_data.ns)));
FRAME_FONTSET (f) = -1;
init_frame_faces (f);
- x_default_parameter (f, parms, Qmenu_bar_lines, make_number (0), "menuBar",
- "menuBar", RES_TYPE_NUMBER);
- x_default_parameter (f, parms, Qtool_bar_lines, make_number (0), "toolBar",
- "toolBar", RES_TYPE_NUMBER);
+ /* The X resources controlling the menu-bar and tool-bar are
+ processed specially at startup, and reflected in the mode
+ variables; ignore them here. */
+ x_default_parameter (f, parms, Qmenu_bar_lines,
+ NILP (Vmenu_bar_mode)
+ ? make_number (0) : make_number (1),
+ NULL, NULL, RES_TYPE_NUMBER);
+ x_default_parameter (f, parms, Qtool_bar_lines,
+ NILP (Vtool_bar_mode)
+ ? make_number (0) : make_number (1),
+ NULL, NULL, RES_TYPE_NUMBER);
+
x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate",
"BufferPredicate", RES_TYPE_SYMBOL);
x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title",
(display)
Lisp_Object display;
{
+ struct ns_display_info *dpyinfo;
check_ns ();
- struct ns_display_info *dpyinfo = check_ns_display_info (display);
-
+
+ dpyinfo = check_ns_display_info (display);
/* We force 24+ bit depths to 24-bit to prevent an overflow. */
return make_number (1 << min (dpyinfo->n_planes, 24));
}
/* Start with user-specified or mouse position. */
left = Fcdr (Fassq (Qleft, parms));
- if (INTEGERP (left))
- pt.x = XINT (left);
- else
- pt.x = last_mouse_motion_position.x;
top = Fcdr (Fassq (Qtop, parms));
- if (INTEGERP (top))
- pt.y = XINT (top);
- else
- pt.y = last_mouse_motion_position.y;
-
- /* Convert to screen coordinates */
- pt = [view convertPoint: pt toView: nil];
- pt = [[view window] convertBaseToScreen: pt];
+ if (!INTEGERP (left) || !INTEGERP (top))
+ {
+ pt = last_mouse_motion_position;
+ /* Convert to screen coordinates */
+ pt = [view convertPoint: pt toView: nil];
+ pt = [[view window] convertBaseToScreen: pt];
+ }
+ else
+ {
+ /* Absolute coordinates. */
+ pt.x = XINT (left);
+ pt.y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - XINT (top)
+ - height;
+ }
+
/* Ensure in bounds. (Note, screen origin = lower left.) */
- if (pt.x + XINT (dx) <= 0)
+ if (INTEGERP (left))
+ *root_x = pt.x;
+ else if (pt.x + XINT (dx) <= 0)
*root_x = 0; /* Can happen for negative dx */
else if (pt.x + XINT (dx) + width
<= x_display_pixel_width (FRAME_NS_DISPLAY_INFO (f)))
/* Put it left justified on the screen -- it ought to fit that way. */
*root_x = 0;
- if (pt.y - XINT (dy) - height >= 0)
+ if (INTEGERP (top))
+ *root_y = pt.y;
+ else if (pt.y - XINT (dy) - height >= 0)
/* It fits below the pointer. */
*root_y = pt.y - height - XINT (dy);
else if (pt.y + XINT (dy) + height
{
int i;
- Qnone = intern ("none");
- staticpro (&Qnone);
Qfontsize = intern ("fontsize");
staticpro (&Qfontsize);