summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2014-11-01 11:05:30 -0700
committerGlenn Morris <rgm@gnu.org>2014-11-01 11:05:30 -0700
commitd5d8ca30e5f481a32414c42bcc3b5a042061ff07 (patch)
treefebc223f19801e8e01b9498c5ba9d6c7bfcfa091 /src
parente54c5e4e25098be9df9d9c46d32165887b0ff9d3 (diff)
parentb99e8f833671a2b52be654eb477830294c624a97 (diff)
downloademacs-d5d8ca30e5f481a32414c42bcc3b5a042061ff07.tar.gz
Merge from emacs-24; up to 117656
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog30
-rw-r--r--src/emacs.c8
-rw-r--r--src/macfont.m7
-rw-r--r--src/nsfns.m32
-rw-r--r--src/nsterm.h10
-rw-r--r--src/nsterm.m55
-rw-r--r--src/xdisp.c9
7 files changed, 97 insertions, 54 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d2cfa0dbfc3..4fb50118444 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,33 @@
+2014-11-01 Jan Djärv <jan.h.d@swipnet.se>
+
+ * macfont.m (macfont_glyph_extents): Turn off synthetic bold
+ if force_integral_p (i.e. no antialias).
+ (macfont_draw): Check ns_antialias_text, also turn off synthetic
+ bold if no antialias (Bug#18876).
+
+ * emacs.c (main): Don't chdir to $HOME on Cocoa if --chdir
+ was given (Bug#18846).
+
+ * 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.
+ (ns_output): Make icon_top/left int.
+
+ * nsfns.m (x_icon): icon_top/left is int.
+
+ * nsterm.m (ns_mouse_position): Remove unused code.
+ (initFrame:window:, dealloc): Use window instead of win.
+ (getMouseMotionPart:window:x:y:): Remove, unused.
+ (sendScrollEventAtLoc:fromEvent:): Make Lisp_Object win from window.
+
2014-11-01 Eli Zaretskii <eliz@gnu.org>
* keyboard.c (readable_events): When FLAGS include
diff --git a/src/emacs.c b/src/emacs.c
index 90182e53e70..62f03c6ea12 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -721,7 +721,7 @@ main (int argc, char **argv)
#ifdef DAEMON_MUST_EXEC
char dname_arg2[80];
#endif
- char *ch_to_dir;
+ char *ch_to_dir = 0;
/* If we use --chdir, this records the original directory. */
char *original_pwd = 0;
@@ -1230,19 +1230,19 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
/* Started from GUI? */
/* FIXME: Do the right thing if getenv returns NULL, or if
chdir fails. */
- if (! inhibit_window_system && ! isatty (0))
+ if (! inhibit_window_system && ! isatty (0) && ! ch_to_dir)
chdir (getenv ("HOME"));
if (skip_args < argc)
{
if (!strncmp (argv[skip_args], "-psn", 4))
{
skip_args += 1;
- chdir (getenv ("HOME"));
+ if (! ch_to_dir) chdir (getenv ("HOME"));
}
else if (skip_args+1 < argc && !strncmp (argv[skip_args+1], "-psn", 4))
{
skip_args += 2;
- chdir (getenv ("HOME"));
+ if (! ch_to_dir) chdir (getenv ("HOME"));
}
}
#endif /* COCOA */
diff --git a/src/macfont.m b/src/macfont.m
index 366d087f8c2..c29ecc03f23 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -1086,7 +1086,7 @@ macfont_glyph_extents (struct font *font, CGGlyph glyph,
bounds.size =
CGSizeApplyAffineTransform (bounds.size, synthetic_italic_atfm);
}
- if (macfont_info->synthetic_bold_p)
+ if (macfont_info->synthetic_bold_p && ! force_integral_p)
{
CGFloat d =
- synthetic_bold_factor * mac_font_get_size (macfont) / 2;
@@ -2692,7 +2692,8 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y,
CGPoint *positions;
CGFloat font_size = mac_font_get_size (macfont_info->macfont);
bool no_antialias_p =
- (macfont_info->antialias == MACFONT_ANTIALIAS_OFF
+ (NILP (ns_antialias_text)
+ || macfont_info->antialias == MACFONT_ANTIALIAS_OFF
|| (macfont_info->antialias == MACFONT_ANTIALIAS_DEFAULT
&& font_size <= macfont_antialias_threshold));
int len = to - from;
@@ -2755,7 +2756,7 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y,
atfm = synthetic_italic_atfm;
else
atfm = CGAffineTransformIdentity;
- if (macfont_info->synthetic_bold_p)
+ if (macfont_info->synthetic_bold_p && ! no_antialias_p))
{
CGContextSetTextDrawingMode (context, kCGTextFillStroke);
CGContextSetLineWidth (context, synthetic_bold_factor * font_size);
diff --git a/src/nsfns.m b/src/nsfns.m
index a93b2724403..ce859e8333d 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -629,18 +629,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 ();
}
@@ -935,8 +943,8 @@ x_icon (struct frame *f, Lisp_Object parms)
Lisp_Object icon_x, icon_y;
struct ns_display_info *dpyinfo = check_ns_display_info (Qnil);
- f->output_data.ns->icon_top = Qnil;
- f->output_data.ns->icon_left = Qnil;
+ f->output_data.ns->icon_top = -1;
+ f->output_data.ns->icon_left = -1;
/* Set the position of the icon. */
icon_x = x_get_arg (dpyinfo, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER);
@@ -945,8 +953,8 @@ x_icon (struct frame *f, Lisp_Object parms)
{
CHECK_NUMBER (icon_x);
CHECK_NUMBER (icon_y);
- f->output_data.ns->icon_top = icon_y;
- f->output_data.ns->icon_left = icon_x;
+ f->output_data.ns->icon_top = XINT (icon_y);
+ f->output_data.ns->icon_left = XINT (icon_x);
}
else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
error ("Both left and top icon corners of icon must be specified");
diff --git a/src/nsterm.h b/src/nsterm.h
index f59405fe9af..b665ac1dd52 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -373,7 +373,7 @@ typedef float EmacsCGFloat;
@interface EmacsScroller : NSScroller
{
- Lisp_Object win;
+ struct window *window;
struct frame *frame;
NSResponder *prevResponder;
@@ -397,8 +397,6 @@ typedef float EmacsCGFloat;
- setPosition: (int) position portion: (int) portion whole: (int) whole;
- (int) checkSamePosition: (int)position portion: (int)portion
whole: (int)whole;
-- (void) getMouseMotionPart: (int *)part window: (Lisp_Object *)window
- x: (Lisp_Object *)x y: ( Lisp_Object *)y;
- (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e;
- repeatScroll: (NSTimer *)sender;
- condemn;
@@ -667,8 +665,8 @@ struct ns_output
value contains an ID of the fontset, else -1. */
int fontset; /* only used with font_backend */
- Lisp_Object icon_top;
- Lisp_Object icon_left;
+ int icon_top;
+ int icon_left;
/* The size of the extra width currently allotted for vertical
scroll bars, in pixels. */
@@ -817,7 +815,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/nsterm.m b/src/nsterm.m
index 3ae4146dc20..c814e63f12e 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1892,14 +1892,36 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
block_input ();
- if (dpyinfo->last_mouse_scroll_bar != nil && insist == 0)
+ /* Clear the mouse-moved flag for every frame on this display. */
+ FOR_EACH_FRAME (tail, frame)
+ if (FRAME_NS_P (XFRAME (frame))
+ && FRAME_NS_DISPLAY (XFRAME (frame)) == FRAME_NS_DISPLAY (*fp))
+ XFRAME (frame)->mouse_moved = 0;
+
+ dpyinfo->last_mouse_scroll_bar = nil;
+ if (dpyinfo->last_mouse_frame
+ && FRAME_LIVE_P (dpyinfo->last_mouse_frame))
+ f = dpyinfo->last_mouse_frame;
+ else
+ f = dpyinfo->x_focus_frame ? dpyinfo->x_focus_frame : SELECTED_FRAME ();
+
+ if (f && FRAME_NS_P (f))
{
- /* TODO: we do not use this path at the moment because drag events will
- go directly to the EmacsScroller. Leaving code in for now. */
- [dpyinfo->last_mouse_scroll_bar
- getMouseMotionPart: (int *)part window: bar_window x: x y: y];
+ view = FRAME_NS_VIEW (*fp);
+
+ position = [[view window] mouseLocationOutsideOfEventStream];
+ position = [view convertPoint: position fromView: nil];
+ remember_mouse_glyph (f, position.x, position.y,
+ &dpyinfo->last_mouse_glyph);
+/*fprintf (stderr, "ns_mouse_position: %.0f, %.0f\n", position.x, position.y); */
+
+ if (bar_window) *bar_window = Qnil;
+ if (part) *part = 0; /*scroll_bar_handle; */
+
+ if (x) XSETINT (*x, lrint (position.x));
+ if (y) XSETINT (*y, lrint (position.y));
if (time)
- *time = dpyinfo->last_mouse_movement_time;
+ *time = dpyinfo->last_mouse_movement_time;
dpyinfo->last_mouse_scroll_bar = nil;
}
else
@@ -7164,13 +7186,13 @@ if (cols > 0 && rows > 0)
[self setAutoresizingMask: NSViewMinXMargin | NSViewHeightSizable];
#endif
- win = nwin;
+ window = XWINDOW (nwin);
condemned = NO;
pixel_height = NSHeight (r);
if (pixel_height == 0) pixel_height = 1;
min_portion = 20 / pixel_height;
- frame = XFRAME (XWINDOW (win)->frame);
+ frame = XFRAME (window->frame);
if (FRAME_LIVE_P (frame))
{
int i;
@@ -7302,30 +7324,17 @@ if (cols > 0 && rows > 0)
return self;
}
-/* FIXME: unused at moment (see ns_mouse_position) at the moment because
- drag events will go directly to the EmacsScroller. Leaving in for now. */
--(void)getMouseMotionPart: (int *)part window: (Lisp_Object *)window
- x: (Lisp_Object *)x y: ( Lisp_Object *)y
-{
- *part = last_hit_part;
- *window = win;
- XSETINT (*y, pixel_height);
- if ([self floatValue] > 0.999F)
- XSETINT (*x, pixel_height);
- else
- XSETINT (*x, pixel_height * [self floatValue]);
-}
-
-
/* set up emacs_event */
- (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e
{
+ Lisp_Object win;
if (!emacs_event)
return;
emacs_event->part = last_hit_part;
emacs_event->code = 0;
emacs_event->modifiers = EV_MODIFIERS (e) | down_modifier;
+ XSETWINDOW (win, window);
emacs_event->frame_or_window = win;
emacs_event->timestamp = EV_TIMESTAMP (e);
emacs_event->kind = SCROLL_BAR_CLICK_EVENT;
diff --git a/src/xdisp.c b/src/xdisp.c
index d27d76d8f5b..228b6cb586d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11785,12 +11785,6 @@ prepare_menu_bars (void)
#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;
}
@@ -14121,6 +14115,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 ();