aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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 @@
12014-11-01 Jan Djärv <jan.h.d@swipnet.se>
2
3 * macfont.m (macfont_glyph_extents): Turn off synthetic bold
4 if force_integral_p (i.e. no antialias).
5 (macfont_draw): Check ns_antialias_text, also turn off synthetic
6 bold if no antialias (Bug#18876).
7
8 * emacs.c (main): Don't chdir to $HOME on Cocoa if --chdir
9 was given (Bug#18846).
10
11 * nsterm.h (ns_set_doc_edited): Declare taking no args.
12
13 * nsfns.m (ns_set_doc_edited): Do all logic (check frames) here
14 instead of in xdisp.c, function now takes void. (Bug#18884).
15
16 * xdisp.c (prepare_menu_bars): Remove HAVE_NS code.
17 (redisplay_internal): Call ns_set_doc_edited if HAVE_NS (Bug#18884).
18
19 * nsterm.h (EmacsScroller): Replace Lisp_Object win with
20 struct window* (Bug#18889).
21 Remove getMouseMotionPart.
22 (ns_output): Make icon_top/left int.
23
24 * nsfns.m (x_icon): icon_top/left is int.
25
26 * nsterm.m (ns_mouse_position): Remove unused code.
27 (initFrame:window:, dealloc): Use window instead of win.
28 (getMouseMotionPart:window:x:y:): Remove, unused.
29 (sendScrollEventAtLoc:fromEvent:): Make Lisp_Object win from window.
30
12014-11-01 Eli Zaretskii <eliz@gnu.org> 312014-11-01 Eli Zaretskii <eliz@gnu.org>
2 32
3 * keyboard.c (readable_events): When FLAGS include 33 * 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)
721#ifdef DAEMON_MUST_EXEC 721#ifdef DAEMON_MUST_EXEC
722 char dname_arg2[80]; 722 char dname_arg2[80];
723#endif 723#endif
724 char *ch_to_dir; 724 char *ch_to_dir = 0;
725 725
726 /* If we use --chdir, this records the original directory. */ 726 /* If we use --chdir, this records the original directory. */
727 char *original_pwd = 0; 727 char *original_pwd = 0;
@@ -1230,19 +1230,19 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1230 /* Started from GUI? */ 1230 /* Started from GUI? */
1231 /* FIXME: Do the right thing if getenv returns NULL, or if 1231 /* FIXME: Do the right thing if getenv returns NULL, or if
1232 chdir fails. */ 1232 chdir fails. */
1233 if (! inhibit_window_system && ! isatty (0)) 1233 if (! inhibit_window_system && ! isatty (0) && ! ch_to_dir)
1234 chdir (getenv ("HOME")); 1234 chdir (getenv ("HOME"));
1235 if (skip_args < argc) 1235 if (skip_args < argc)
1236 { 1236 {
1237 if (!strncmp (argv[skip_args], "-psn", 4)) 1237 if (!strncmp (argv[skip_args], "-psn", 4))
1238 { 1238 {
1239 skip_args += 1; 1239 skip_args += 1;
1240 chdir (getenv ("HOME")); 1240 if (! ch_to_dir) chdir (getenv ("HOME"));
1241 } 1241 }
1242 else if (skip_args+1 < argc && !strncmp (argv[skip_args+1], "-psn", 4)) 1242 else if (skip_args+1 < argc && !strncmp (argv[skip_args+1], "-psn", 4))
1243 { 1243 {
1244 skip_args += 2; 1244 skip_args += 2;
1245 chdir (getenv ("HOME")); 1245 if (! ch_to_dir) chdir (getenv ("HOME"));
1246 } 1246 }
1247 } 1247 }
1248#endif /* COCOA */ 1248#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,
1086 bounds.size = 1086 bounds.size =
1087 CGSizeApplyAffineTransform (bounds.size, synthetic_italic_atfm); 1087 CGSizeApplyAffineTransform (bounds.size, synthetic_italic_atfm);
1088 } 1088 }
1089 if (macfont_info->synthetic_bold_p) 1089 if (macfont_info->synthetic_bold_p && ! force_integral_p)
1090 { 1090 {
1091 CGFloat d = 1091 CGFloat d =
1092 - synthetic_bold_factor * mac_font_get_size (macfont) / 2; 1092 - 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,
2692 CGPoint *positions; 2692 CGPoint *positions;
2693 CGFloat font_size = mac_font_get_size (macfont_info->macfont); 2693 CGFloat font_size = mac_font_get_size (macfont_info->macfont);
2694 bool no_antialias_p = 2694 bool no_antialias_p =
2695 (macfont_info->antialias == MACFONT_ANTIALIAS_OFF 2695 (NILP (ns_antialias_text)
2696 || macfont_info->antialias == MACFONT_ANTIALIAS_OFF
2696 || (macfont_info->antialias == MACFONT_ANTIALIAS_DEFAULT 2697 || (macfont_info->antialias == MACFONT_ANTIALIAS_DEFAULT
2697 && font_size <= macfont_antialias_threshold)); 2698 && font_size <= macfont_antialias_threshold));
2698 int len = to - from; 2699 int len = to - from;
@@ -2755,7 +2756,7 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y,
2755 atfm = synthetic_italic_atfm; 2756 atfm = synthetic_italic_atfm;
2756 else 2757 else
2757 atfm = CGAffineTransformIdentity; 2758 atfm = CGAffineTransformIdentity;
2758 if (macfont_info->synthetic_bold_p) 2759 if (macfont_info->synthetic_bold_p && ! no_antialias_p))
2759 { 2760 {
2760 CGContextSetTextDrawingMode (context, kCGTextFillStroke); 2761 CGContextSetTextDrawingMode (context, kCGTextFillStroke);
2761 CGContextSetLineWidth (context, synthetic_bold_factor * font_size); 2762 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)
629 629
630 630
631void 631void
632ns_set_doc_edited (struct frame *f, Lisp_Object arg) 632ns_set_doc_edited (void)
633{ 633{
634 NSView *view = FRAME_NS_VIEW (f);
635 NSAutoreleasePool *pool; 634 NSAutoreleasePool *pool;
636 if (!MINI_WINDOW_P (XWINDOW (f->selected_window))) 635 Lisp_Object tail, frame;
636 block_input ();
637 pool = [[NSAutoreleasePool alloc] init];
638 FOR_EACH_FRAME (tail, frame)
637 { 639 {
638 block_input (); 640 BOOL edited = NO;
639 pool = [[NSAutoreleasePool alloc] init]; 641 struct frame *f = XFRAME (frame);
640 [[view window] setDocumentEdited: !NILP (arg)]; 642 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
641 [pool release]; 643 NSView *view = FRAME_NS_VIEW (f);
642 unblock_input (); 644 if (!MINI_WINDOW_P (w))
645 edited = ! NILP (Fbuffer_modified_p (w->contents)) &&
646 ! NILP (Fbuffer_file_name (w->contents));
647 [[view window] setDocumentEdited: edited];
643 } 648 }
649
650 [pool release];
651 unblock_input ();
644} 652}
645 653
646 654
@@ -935,8 +943,8 @@ x_icon (struct frame *f, Lisp_Object parms)
935 Lisp_Object icon_x, icon_y; 943 Lisp_Object icon_x, icon_y;
936 struct ns_display_info *dpyinfo = check_ns_display_info (Qnil); 944 struct ns_display_info *dpyinfo = check_ns_display_info (Qnil);
937 945
938 f->output_data.ns->icon_top = Qnil; 946 f->output_data.ns->icon_top = -1;
939 f->output_data.ns->icon_left = Qnil; 947 f->output_data.ns->icon_left = -1;
940 948
941 /* Set the position of the icon. */ 949 /* Set the position of the icon. */
942 icon_x = x_get_arg (dpyinfo, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); 950 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)
945 { 953 {
946 CHECK_NUMBER (icon_x); 954 CHECK_NUMBER (icon_x);
947 CHECK_NUMBER (icon_y); 955 CHECK_NUMBER (icon_y);
948 f->output_data.ns->icon_top = icon_y; 956 f->output_data.ns->icon_top = XINT (icon_y);
949 f->output_data.ns->icon_left = icon_x; 957 f->output_data.ns->icon_left = XINT (icon_x);
950 } 958 }
951 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) 959 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
952 error ("Both left and top icon corners of icon must be specified"); 960 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;
373 373
374@interface EmacsScroller : NSScroller 374@interface EmacsScroller : NSScroller
375 { 375 {
376 Lisp_Object win; 376 struct window *window;
377 struct frame *frame; 377 struct frame *frame;
378 NSResponder *prevResponder; 378 NSResponder *prevResponder;
379 379
@@ -397,8 +397,6 @@ typedef float EmacsCGFloat;
397- setPosition: (int) position portion: (int) portion whole: (int) whole; 397- setPosition: (int) position portion: (int) portion whole: (int) whole;
398- (int) checkSamePosition: (int)position portion: (int)portion 398- (int) checkSamePosition: (int)position portion: (int)portion
399 whole: (int)whole; 399 whole: (int)whole;
400- (void) getMouseMotionPart: (int *)part window: (Lisp_Object *)window
401 x: (Lisp_Object *)x y: ( Lisp_Object *)y;
402- (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e; 400- (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e;
403- repeatScroll: (NSTimer *)sender; 401- repeatScroll: (NSTimer *)sender;
404- condemn; 402- condemn;
@@ -667,8 +665,8 @@ struct ns_output
667 value contains an ID of the fontset, else -1. */ 665 value contains an ID of the fontset, else -1. */
668 int fontset; /* only used with font_backend */ 666 int fontset; /* only used with font_backend */
669 667
670 Lisp_Object icon_top; 668 int icon_top;
671 Lisp_Object icon_left; 669 int icon_left;
672 670
673 /* The size of the extra width currently allotted for vertical 671 /* The size of the extra width currently allotted for vertical
674 scroll bars, in pixels. */ 672 scroll bars, in pixels. */
@@ -817,7 +815,7 @@ extern void nxatoms_of_nsselect (void);
817extern int ns_lisp_to_cursor_type (Lisp_Object arg); 815extern int ns_lisp_to_cursor_type (Lisp_Object arg);
818extern Lisp_Object ns_cursor_type_to_lisp (int arg); 816extern Lisp_Object ns_cursor_type_to_lisp (int arg);
819extern void ns_set_name_as_filename (struct frame *f); 817extern void ns_set_name_as_filename (struct frame *f);
820extern void ns_set_doc_edited (struct frame *f, Lisp_Object arg); 818extern void ns_set_doc_edited (void);
821 819
822extern bool 820extern bool
823ns_defined_color (struct frame *f, 821ns_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,
1892 1892
1893 block_input (); 1893 block_input ();
1894 1894
1895 if (dpyinfo->last_mouse_scroll_bar != nil && insist == 0) 1895 /* Clear the mouse-moved flag for every frame on this display. */
1896 FOR_EACH_FRAME (tail, frame)
1897 if (FRAME_NS_P (XFRAME (frame))
1898 && FRAME_NS_DISPLAY (XFRAME (frame)) == FRAME_NS_DISPLAY (*fp))
1899 XFRAME (frame)->mouse_moved = 0;
1900
1901 dpyinfo->last_mouse_scroll_bar = nil;
1902 if (dpyinfo->last_mouse_frame
1903 && FRAME_LIVE_P (dpyinfo->last_mouse_frame))
1904 f = dpyinfo->last_mouse_frame;
1905 else
1906 f = dpyinfo->x_focus_frame ? dpyinfo->x_focus_frame : SELECTED_FRAME ();
1907
1908 if (f && FRAME_NS_P (f))
1896 { 1909 {
1897 /* TODO: we do not use this path at the moment because drag events will 1910 view = FRAME_NS_VIEW (*fp);
1898 go directly to the EmacsScroller. Leaving code in for now. */ 1911
1899 [dpyinfo->last_mouse_scroll_bar 1912 position = [[view window] mouseLocationOutsideOfEventStream];
1900 getMouseMotionPart: (int *)part window: bar_window x: x y: y]; 1913 position = [view convertPoint: position fromView: nil];
1914 remember_mouse_glyph (f, position.x, position.y,
1915 &dpyinfo->last_mouse_glyph);
1916/*fprintf (stderr, "ns_mouse_position: %.0f, %.0f\n", position.x, position.y); */
1917
1918 if (bar_window) *bar_window = Qnil;
1919 if (part) *part = 0; /*scroll_bar_handle; */
1920
1921 if (x) XSETINT (*x, lrint (position.x));
1922 if (y) XSETINT (*y, lrint (position.y));
1901 if (time) 1923 if (time)
1902 *time = dpyinfo->last_mouse_movement_time; 1924 *time = dpyinfo->last_mouse_movement_time;
1903 dpyinfo->last_mouse_scroll_bar = nil; 1925 dpyinfo->last_mouse_scroll_bar = nil;
1904 } 1926 }
1905 else 1927 else
@@ -7164,13 +7186,13 @@ if (cols > 0 && rows > 0)
7164 [self setAutoresizingMask: NSViewMinXMargin | NSViewHeightSizable]; 7186 [self setAutoresizingMask: NSViewMinXMargin | NSViewHeightSizable];
7165#endif 7187#endif
7166 7188
7167 win = nwin; 7189 window = XWINDOW (nwin);
7168 condemned = NO; 7190 condemned = NO;
7169 pixel_height = NSHeight (r); 7191 pixel_height = NSHeight (r);
7170 if (pixel_height == 0) pixel_height = 1; 7192 if (pixel_height == 0) pixel_height = 1;
7171 min_portion = 20 / pixel_height; 7193 min_portion = 20 / pixel_height;
7172 7194
7173 frame = XFRAME (XWINDOW (win)->frame); 7195 frame = XFRAME (window->frame);
7174 if (FRAME_LIVE_P (frame)) 7196 if (FRAME_LIVE_P (frame))
7175 { 7197 {
7176 int i; 7198 int i;
@@ -7302,30 +7324,17 @@ if (cols > 0 && rows > 0)
7302 return self; 7324 return self;
7303} 7325}
7304 7326
7305/* FIXME: unused at moment (see ns_mouse_position) at the moment because
7306 drag events will go directly to the EmacsScroller. Leaving in for now. */
7307-(void)getMouseMotionPart: (int *)part window: (Lisp_Object *)window
7308 x: (Lisp_Object *)x y: ( Lisp_Object *)y
7309{
7310 *part = last_hit_part;
7311 *window = win;
7312 XSETINT (*y, pixel_height);
7313 if ([self floatValue] > 0.999F)
7314 XSETINT (*x, pixel_height);
7315 else
7316 XSETINT (*x, pixel_height * [self floatValue]);
7317}
7318
7319
7320/* set up emacs_event */ 7327/* set up emacs_event */
7321- (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e 7328- (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e
7322{ 7329{
7330 Lisp_Object win;
7323 if (!emacs_event) 7331 if (!emacs_event)
7324 return; 7332 return;
7325 7333
7326 emacs_event->part = last_hit_part; 7334 emacs_event->part = last_hit_part;
7327 emacs_event->code = 0; 7335 emacs_event->code = 0;
7328 emacs_event->modifiers = EV_MODIFIERS (e) | down_modifier; 7336 emacs_event->modifiers = EV_MODIFIERS (e) | down_modifier;
7337 XSETWINDOW (win, window);
7329 emacs_event->frame_or_window = win; 7338 emacs_event->frame_or_window = win;
7330 emacs_event->timestamp = EV_TIMESTAMP (e); 7339 emacs_event->timestamp = EV_TIMESTAMP (e);
7331 emacs_event->kind = SCROLL_BAR_CLICK_EVENT; 7340 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)
11785#ifdef HAVE_WINDOW_SYSTEM 11785#ifdef HAVE_WINDOW_SYSTEM
11786 update_tool_bar (f, 0); 11786 update_tool_bar (f, 0);
11787#endif 11787#endif
11788#ifdef HAVE_NS
11789 if (windows_or_buffers_changed
11790 && FRAME_NS_P (f))
11791 ns_set_doc_edited
11792 (f, Fbuffer_modified_p (XWINDOW (f->selected_window)->contents));
11793#endif
11794 UNGCPRO; 11788 UNGCPRO;
11795 } 11789 }
11796 11790
@@ -14121,6 +14115,9 @@ redisplay_internal (void)
14121#endif /* HAVE_WINDOW_SYSTEM */ 14115#endif /* HAVE_WINDOW_SYSTEM */
14122 14116
14123 end_of_redisplay: 14117 end_of_redisplay:
14118#ifdef HAVE_NS
14119 ns_set_doc_edited ();
14120#endif
14124 if (interrupt_input && interrupts_deferred) 14121 if (interrupt_input && interrupts_deferred)
14125 request_sigio (); 14122 request_sigio ();
14126 14123