aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in25
-rw-r--r--src/autodeps.mk5
-rw-r--r--src/deps.mk2
-rw-r--r--src/lisp.mk6
-rw-r--r--src/macfont.h6
-rw-r--r--src/nsfns.m31
-rw-r--r--src/nsimage.m9
-rw-r--r--src/nsmenu.m6
-rw-r--r--src/nsterm.h1
-rw-r--r--src/nsterm.m106
10 files changed, 123 insertions, 74 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 1c03b27c2c3..51a5b982474 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -323,10 +323,15 @@ am__v_at_0 = @
323am__v_at_1 = 323am__v_at_1 =
324 324
325DEPDIR=deps 325DEPDIR=deps
326## -MMD -MF $(DEPDIR)/$*.d if AUTO_DEPEND; else empty. 326AUTO_DEPEND = @AUTO_DEPEND@
327DEPFLAGS=@DEPFLAGS@ 327
328## ${MKDIR_P} ${DEPDIR} (if AUTO_DEPEND); else ':'. 328ifeq ($(AUTO_DEPEND),yes)
329MKDEPDIR=@MKDEPDIR@ 329DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP
330MKDEPDIR = ${MKDIR_P} ${DEPDIR}
331else
332DEPFLAGS =
333MKDEPDIR = :
334endif
330 335
331## DO NOT use -R. There is a special hack described in lastfile.c 336## DO NOT use -R. There is a special hack described in lastfile.c
332## which is used instead. Some initialized data areas are modified 337## which is used instead. Some initialized data areas are modified
@@ -413,9 +418,7 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
413FIRSTFILE_OBJ=@FIRSTFILE_OBJ@ 418FIRSTFILE_OBJ=@FIRSTFILE_OBJ@
414ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj) 419ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj)
415 420
416## Configure inserts the file lisp.mk at this point, defining $lisp. 421include $(srcdir)/lisp.mk
417@lisp_frag@
418
419 422
420## Construct full set of libraries to be linked. 423## Construct full set of libraries to be linked.
421LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \ 424LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
@@ -667,8 +670,10 @@ endif
667 @: Compile some files earlier to speed up further compilation. 670 @: Compile some files earlier to speed up further compilation.
668 $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" 671 $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
669 672
670## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk. 673ifeq ($(AUTO_DEPEND),yes)
671@deps_frag@ 674-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
672 675else
676include $(srcdir)/deps.mk
677endif
673 678
674### Makefile.in ends here 679### Makefile.in ends here
diff --git a/src/autodeps.mk b/src/autodeps.mk
deleted file mode 100644
index 8b014a7508c..00000000000
--- a/src/autodeps.mk
+++ /dev/null
@@ -1,5 +0,0 @@
1### autodeps.mk --- src/Makefile fragment for GNU Emacs
2
3## This is inserted in src/Makefile if AUTO_DEPEND=yes.
4
5-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
diff --git a/src/deps.mk b/src/deps.mk
index 71a5f42d22e..23789384fdb 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -20,7 +20,7 @@
20 20
21## Commentary: 21## Commentary:
22## 22##
23## This file is inserted in src/Makefile if AUTO_DEPEND=no. 23## This file is included in src/Makefile if AUTO_DEPEND=no.
24## It defines static dependencies between the various source files. 24## It defines static dependencies between the various source files.
25 25
26## FIXME some of these dependencies are platform-specific. 26## FIXME some of these dependencies are platform-specific.
diff --git a/src/lisp.mk b/src/lisp.mk
index 8eb86b7429e..0a431a59d7d 100644
--- a/src/lisp.mk
+++ b/src/lisp.mk
@@ -34,10 +34,6 @@
34## that does not have an explicit .el extension, but beware of any 34## that does not have an explicit .el extension, but beware of any
35## no-byte-compile ones. 35## no-byte-compile ones.
36 36
37## Confusingly, international/cp51932 and international/eucjp-ms are
38## unconditionally loaded from language/japanese, instead of being
39## loaded directly from loadup.el; FIXME.
40
41## Note that this list should not include lisp files which might not 37## Note that this list should not include lisp files which might not
42## be present, like site-load.el and site-init.el; this makefile 38## be present, like site-load.el and site-init.el; this makefile
43## expects them all to be either present or buildable. 39## expects them all to be either present or buildable.
@@ -96,9 +92,9 @@ lisp = \
96 $(lispsource)/language/romanian.elc \ 92 $(lispsource)/language/romanian.elc \
97 $(lispsource)/language/greek.elc \ 93 $(lispsource)/language/greek.elc \
98 $(lispsource)/language/hebrew.elc \ 94 $(lispsource)/language/hebrew.elc \
99 $(lispsource)/language/japanese.elc \
100 $(lispsource)/international/cp51932.el \ 95 $(lispsource)/international/cp51932.el \
101 $(lispsource)/international/eucjp-ms.el \ 96 $(lispsource)/international/eucjp-ms.el \
97 $(lispsource)/language/japanese.elc \
102 $(lispsource)/language/korean.elc \ 98 $(lispsource)/language/korean.elc \
103 $(lispsource)/language/lao.elc \ 99 $(lispsource)/language/lao.elc \
104 $(lispsource)/language/tai-viet.elc \ 100 $(lispsource)/language/tai-viet.elc \
diff --git a/src/macfont.h b/src/macfont.h
index f311577f051..403be94e332 100644
--- a/src/macfont.h
+++ b/src/macfont.h
@@ -48,7 +48,7 @@ struct mac_glyph_layout
48typedef CTFontDescriptorRef FontDescriptorRef; 48typedef CTFontDescriptorRef FontDescriptorRef;
49typedef CTFontRef FontRef; 49typedef CTFontRef FontRef;
50typedef CTFontSymbolicTraits FontSymbolicTraits; 50typedef CTFontSymbolicTraits FontSymbolicTraits;
51typedef CTCharacterCollection CharacterCollection; 51typedef NSCharacterCollection CharacterCollection;
52 52
53#define MAC_FONT_NAME_ATTRIBUTE kCTFontNameAttribute 53#define MAC_FONT_NAME_ATTRIBUTE kCTFontNameAttribute
54#define MAC_FONT_FAMILY_NAME_ATTRIBUTE kCTFontFamilyNameAttribute 54#define MAC_FONT_FAMILY_NAME_ATTRIBUTE kCTFontFamilyNameAttribute
@@ -79,8 +79,8 @@ enum {
79}; 79};
80 80
81enum { 81enum {
82 MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING = kCTIdentityMappingCharacterCollection, 82 MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING = NSIdentityMappingCharacterCollection,
83 MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1 = kCTAdobeJapan1CharacterCollection 83 MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1 = NSAdobeJapan1CharacterCollection
84}; 84};
85 85
86#define mac_font_descriptor_create_with_attributes \ 86#define mac_font_descriptor_create_with_attributes \
diff --git a/src/nsfns.m b/src/nsfns.m
index f8863e6d400..8a3c6ccf2b0 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1075,7 +1075,6 @@ This function is an internal primitive--use `make-frame' instead. */)
1075 Lisp_Object name; 1075 Lisp_Object name;
1076 int minibuffer_only = 0; 1076 int minibuffer_only = 0;
1077 long window_prompting = 0; 1077 long window_prompting = 0;
1078 int width, height;
1079 ptrdiff_t count = specpdl_ptr - specpdl; 1078 ptrdiff_t count = specpdl_ptr - specpdl;
1080 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 1079 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
1081 Lisp_Object display; 1080 Lisp_Object display;
@@ -1455,6 +1454,15 @@ ns_run_file_dialog (void)
1455 ns_fd_data.panel = nil; 1454 ns_fd_data.panel = nil;
1456} 1455}
1457 1456
1457#ifdef NS_IMPL_COCOA
1458#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_9
1459#define MODAL_OK_RESPONSE NSModalResponseOK
1460#endif
1461#endif
1462#ifndef MODAL_OK_RESPONSE
1463#define MODAL_OK_RESPONSE NSOKButton
1464#endif
1465
1458DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 5, 0, 1466DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 5, 0,
1459 doc: /* Use a graphical panel to read a file name, using prompt PROMPT. 1467 doc: /* Use a graphical panel to read a file name, using prompt PROMPT.
1460Optional arg DIR, if non-nil, supplies a default directory. 1468Optional arg DIR, if non-nil, supplies a default directory.
@@ -1466,10 +1474,9 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1466 Lisp_Object init, Lisp_Object dir_only_p) 1474 Lisp_Object init, Lisp_Object dir_only_p)
1467{ 1475{
1468 static id fileDelegate = nil; 1476 static id fileDelegate = nil;
1469 BOOL ret;
1470 BOOL isSave = NILP (mustmatch) && NILP (dir_only_p); 1477 BOOL isSave = NILP (mustmatch) && NILP (dir_only_p);
1471 id panel; 1478 id panel;
1472 Lisp_Object fname; 1479 Lisp_Object fname = Qnil;
1473 1480
1474 NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil : 1481 NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
1475 [NSString stringWithUTF8String: SSDATA (prompt)]; 1482 [NSString stringWithUTF8String: SSDATA (prompt)];
@@ -1549,20 +1556,17 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1549 while (ns_fd_data.panel != nil) 1556 while (ns_fd_data.panel != nil)
1550 [NSApp run]; 1557 [NSApp run];
1551 1558
1552 ret = (ns_fd_data.ret == NSOKButton); 1559 if (ns_fd_data.ret == MODAL_OK_RESPONSE)
1553
1554 if (ret)
1555 { 1560 {
1556 NSString *str = ns_filename_from_panel (panel); 1561 NSString *str = ns_filename_from_panel (panel);
1557 if (! str) str = ns_directory_from_panel (panel); 1562 if (! str) str = ns_directory_from_panel (panel);
1558 if (! str) ret = NO; 1563 if (str) fname = build_string ([str UTF8String]);
1559 else fname = build_string ([str UTF8String]);
1560 } 1564 }
1561 1565
1562 [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; 1566 [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
1563 unblock_input (); 1567 unblock_input ();
1564 1568
1565 return ret ? fname : Qnil; 1569 return fname;
1566} 1570}
1567 1571
1568const char * 1572const char *
@@ -2677,7 +2681,16 @@ compute_tip_xy (struct frame *f,
2677 pt.y = dpyinfo->last_mouse_motion_y; 2681 pt.y = dpyinfo->last_mouse_motion_y;
2678 /* Convert to screen coordinates */ 2682 /* Convert to screen coordinates */
2679 pt = [view convertPoint: pt toView: nil]; 2683 pt = [view convertPoint: pt toView: nil];
2684#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
2680 pt = [[view window] convertBaseToScreen: pt]; 2685 pt = [[view window] convertBaseToScreen: pt];
2686#else
2687 {
2688 NSRect r = NSMakeRect (pt.x, pt.y, 0, 0);
2689 r = [[view window] convertRectToScreen: r];
2690 pt.x = r.origin.x;
2691 pt.y = r.origin.y;
2692 }
2693#endif
2681 } 2694 }
2682 else 2695 else
2683 { 2696 {
diff --git a/src/nsimage.m b/src/nsimage.m
index 3e90226cbf6..9302cd2f212 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -187,7 +187,11 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
187 187
188 /* The next two lines cause the DPI of the image to be ignored. 188 /* The next two lines cause the DPI of the image to be ignored.
189 This seems to be the behavior users expect. */ 189 This seems to be the behavior users expect. */
190#ifdef NS_IMPL_COCOA
191#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
190 [image setScalesWhenResized: YES]; 192 [image setScalesWhenResized: YES];
193#endif
194#endif
191 [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; 195 [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])];
192 196
193 [image setName: [NSString stringWithUTF8String: SSDATA (file)]]; 197 [image setName: [NSString stringWithUTF8String: SSDATA (file)]];
@@ -207,7 +211,6 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
207- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h 211- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
208 fg: (unsigned long)fg bg: (unsigned long)bg 212 fg: (unsigned long)fg bg: (unsigned long)bg
209{ 213{
210 int bpr = (w + 7) / 8;
211 unsigned char *planes[5]; 214 unsigned char *planes[5];
212 215
213 [self initWithSize: NSMakeSize (w, h)]; 216 [self initWithSize: NSMakeSize (w, h)];
@@ -353,7 +356,11 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
353 356
354 /* The next two lines cause the DPI of the image to be ignored. 357 /* The next two lines cause the DPI of the image to be ignored.
355 This seems to be the behavior users expect. */ 358 This seems to be the behavior users expect. */
359#ifdef NS_IMPL_COCOA
360#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
356 [self setScalesWhenResized: YES]; 361 [self setScalesWhenResized: YES];
362#endif
363#endif
357 [self setSize: NSMakeSize([bmr pixelsWide], [bmr pixelsHigh])]; 364 [self setSize: NSMakeSize([bmr pixelsWide], [bmr pixelsHigh])];
358 365
359 break; 366 break;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 26fe26e5e0d..b5cb64d68e5 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1418,7 +1418,7 @@ Lisp_Object
1418ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) 1418ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
1419{ 1419{
1420 id dialog; 1420 id dialog;
1421 Lisp_Object window, tem, title; 1421 Lisp_Object tem, title;
1422 NSPoint p; 1422 NSPoint p;
1423 BOOL isQ; 1423 BOOL isQ;
1424 NSAutoreleasePool *pool; 1424 NSAutoreleasePool *pool;
@@ -1506,7 +1506,11 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
1506 area.size.width = ICONSIZE; 1506 area.size.width = ICONSIZE;
1507 area.size.height= ICONSIZE; 1507 area.size.height= ICONSIZE;
1508 img = [[NSImage imageNamed: @"NSApplicationIcon"] copy]; 1508 img = [[NSImage imageNamed: @"NSApplicationIcon"] copy];
1509#ifdef NS_IMPL_COCOA
1510#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
1509 [img setScalesWhenResized: YES]; 1511 [img setScalesWhenResized: YES];
1512#endif
1513#endif
1510 [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)]; 1514 [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)];
1511 imgView = [[NSImageView alloc] initWithFrame: area]; 1515 imgView = [[NSImageView alloc] initWithFrame: area];
1512 [imgView setImage: img]; 1516 [imgView setImage: img];
diff --git a/src/nsterm.h b/src/nsterm.h
index d8ffd93a71b..c06b7c49a6d 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -396,6 +396,7 @@ typedef float EmacsCGFloat;
396- condemn; 396- condemn;
397- reprieve; 397- reprieve;
398- (bool)judge; 398- (bool)judge;
399+ (CGFloat)scrollerWidth;
399@end 400@end
400 401
401 402
diff --git a/src/nsterm.m b/src/nsterm.m
index 6a4d0a6ad23..67a03898d13 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1538,7 +1538,7 @@ ns_get_color (const char *name, NSColor **col)
1538{ 1538{
1539 NSColor *new = nil; 1539 NSColor *new = nil;
1540 static char hex[20]; 1540 static char hex[20];
1541 int scaling; 1541 int scaling = 0;
1542 float r = -1.0, g, b; 1542 float r = -1.0, g, b;
1543 NSString *nsname = [NSString stringWithUTF8String: name]; 1543 NSString *nsname = [NSString stringWithUTF8String: name];
1544 1544
@@ -2093,6 +2093,18 @@ ns_clear_frame_area (struct frame *f, int x, int y, int width, int height)
2093 return; 2093 return;
2094} 2094}
2095 2095
2096static void
2097ns_copy_bits (struct frame *f, NSRect src, NSRect dest)
2098{
2099 if (FRAME_NS_VIEW (f))
2100 {
2101 ns_focus (f, &dest, 1);
2102 [FRAME_NS_VIEW (f) scrollRect: src
2103 by: NSMakeSize (dest.origin.x - src.origin.x,
2104 dest.origin.y - src.origin.y)];
2105 ns_unfocus (f);
2106 }
2107}
2096 2108
2097static void 2109static void
2098ns_scroll_run (struct window *w, struct run *run) 2110ns_scroll_run (struct window *w, struct run *run)
@@ -2145,11 +2157,8 @@ ns_scroll_run (struct window *w, struct run *run)
2145 { 2157 {
2146 NSRect srcRect = NSMakeRect (x, from_y, width, height); 2158 NSRect srcRect = NSMakeRect (x, from_y, width, height);
2147 NSRect dstRect = NSMakeRect (x, to_y, width, height); 2159 NSRect dstRect = NSMakeRect (x, to_y, width, height);
2148 NSPoint dstOrigin = NSMakePoint (x, to_y);
2149 2160
2150 ns_focus (f, &dstRect, 1); 2161 ns_copy_bits (f, srcRect , dstRect);
2151 NSCopyBits (0, srcRect , dstOrigin);
2152 ns_unfocus (f);
2153 } 2162 }
2154 2163
2155 unblock_input (); 2164 unblock_input ();
@@ -2205,13 +2214,10 @@ ns_shift_glyphs_for_insert (struct frame *f,
2205{ 2214{
2206 NSRect srcRect = NSMakeRect (x, y, width, height); 2215 NSRect srcRect = NSMakeRect (x, y, width, height);
2207 NSRect dstRect = NSMakeRect (x+shift_by, y, width, height); 2216 NSRect dstRect = NSMakeRect (x+shift_by, y, width, height);
2208 NSPoint dstOrigin = dstRect.origin;
2209 2217
2210 NSTRACE (ns_shift_glyphs_for_insert); 2218 NSTRACE (ns_shift_glyphs_for_insert);
2211 2219
2212 ns_focus (f, &dstRect, 1); 2220 ns_copy_bits (f, srcRect, dstRect);
2213 NSCopyBits (0, srcRect, dstOrigin);
2214 ns_unfocus (f);
2215} 2221}
2216 2222
2217 2223
@@ -2459,6 +2465,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
2459 2465
2460 switch (cursor_type) 2466 switch (cursor_type)
2461 { 2467 {
2468 case DEFAULT_CURSOR:
2462 case NO_CURSOR: 2469 case NO_CURSOR:
2463 break; 2470 break;
2464 case FILLED_BOX_CURSOR: 2471 case FILLED_BOX_CURSOR:
@@ -3957,7 +3964,6 @@ ns_set_horizontal_scroll_bar (struct window *window,
3957 EmacsScroller *bar; 3964 EmacsScroller *bar;
3958 int top, height, left, width; 3965 int top, height, left, width;
3959 int window_x, window_width; 3966 int window_x, window_width;
3960 int pixel_width = WINDOW_PIXEL_WIDTH (window);
3961 BOOL update_p = YES; 3967 BOOL update_p = YES;
3962 3968
3963 /* optimization; display engine sends WAY too many of these.. */ 3969 /* optimization; display engine sends WAY too many of these.. */
@@ -4315,6 +4321,7 @@ ns_create_terminal (struct ns_display_info *dpyinfo)
4315 terminal->menu_show_hook = ns_menu_show; 4321 terminal->menu_show_hook = ns_menu_show;
4316 terminal->popup_dialog_hook = ns_popup_dialog; 4322 terminal->popup_dialog_hook = ns_popup_dialog;
4317 terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar; 4323 terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar;
4324 terminal->set_horizontal_scroll_bar_hook = ns_set_horizontal_scroll_bar;
4318 terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars; 4325 terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars;
4319 terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar; 4326 terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar;
4320 terminal->judge_scroll_bars_hook = ns_judge_scroll_bars; 4327 terminal->judge_scroll_bars_hook = ns_judge_scroll_bars;
@@ -4599,7 +4606,7 @@ ns_term_shutdown (int sig)
4599 4606
4600- (id)init 4607- (id)init
4601{ 4608{
4602 if (self = [super init]) 4609 if ((self = [super init]))
4603 { 4610 {
4604#ifdef NS_IMPL_COCOA 4611#ifdef NS_IMPL_COCOA
4605 self->isFirst = YES; 4612 self->isFirst = YES;
@@ -4886,21 +4893,43 @@ ns_term_shutdown (int sig)
4886 EV_TRAILER ((id)nil); 4893 EV_TRAILER ((id)nil);
4887} 4894}
4888 4895
4896static bool
4897runAlertPanel(NSString *title,
4898 NSString *msgFormat,
4899 NSString *defaultButton,
4900 NSString *alternateButton)
4901{
4902#if !defined (NS_IMPL_COCOA) || \
4903 MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
4904 return NSRunAlertPanel(title, msgFormat, defaultButton, alternateButton, nil)
4905 == NSAlertDefaultReturn;
4906#else
4907 NSAlert *alert = [[NSAlert alloc] init];
4908 [alert setAlertStyle: NSCriticalAlertStyle];
4909 [alert setMessageText: msgFormat];
4910 [alert addButtonWithTitle: defaultButton];
4911 [alert addButtonWithTitle: alternateButton];
4912 NSInteger ret = [alert runModal];
4913 [alert release];
4914 return ret == NSAlertFirstButtonReturn;
4915#endif
4916}
4917
4889 4918
4890- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender 4919- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender
4891{ 4920{
4892 int ret; 4921 bool ret;
4893 4922
4894 if (NILP (ns_confirm_quit)) // || ns_shutdown_properly --> TO DO 4923 if (NILP (ns_confirm_quit)) // || ns_shutdown_properly --> TO DO
4895 return NSTerminateNow; 4924 return NSTerminateNow;
4896 4925
4897 ret = NSRunAlertPanel(ns_app_name, 4926 ret = runAlertPanel(ns_app_name,
4898 @"Exit requested. Would you like to Save Buffers and Exit, or Cancel the request?", 4927 @"Exit requested. Would you like to Save Buffers and Exit, or Cancel the request?",
4899 @"Save Buffers and Exit", @"Cancel", nil); 4928 @"Save Buffers and Exit", @"Cancel");
4900 4929
4901 if (ret == NSAlertDefaultReturn) 4930 if (ret)
4902 return NSTerminateNow; 4931 return NSTerminateNow;
4903 else if (ret == NSAlertAlternateReturn) 4932 else
4904 return NSTerminateCancel; 4933 return NSTerminateCancel;
4905 return NSTerminateNow; /* just in case */ 4934 return NSTerminateNow; /* just in case */
4906} 4935}
@@ -5244,9 +5273,6 @@ not_in_argv (NSString *arg)
5244 int code; 5273 int code;
5245 unsigned fnKeysym = 0; 5274 unsigned fnKeysym = 0;
5246 static NSMutableArray *nsEvArray; 5275 static NSMutableArray *nsEvArray;
5247#ifdef NS_IMPL_GNUSTEP
5248 static BOOL firstTime = YES;
5249#endif
5250 int left_is_none; 5276 int left_is_none;
5251 unsigned int flags = [theEvent modifierFlags]; 5277 unsigned int flags = [theEvent modifierFlags];
5252 5278
@@ -5475,18 +5501,6 @@ not_in_argv (NSString *arg)
5475 } 5501 }
5476 5502
5477 5503
5478#ifdef NS_IMPL_GNUSTEP
5479 /* if we get here we should send the key for input manager processing */
5480 /* Disable warning, there is nothing a user can do about it anyway, and
5481 it does not seem to matter. */
5482#if 0
5483 if (firstTime && [[NSInputManager currentInputManager]
5484 wantsToDelayTextChangeNotifications] == NO)
5485 fprintf (stderr,
5486 "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n");
5487#endif
5488 firstTime = NO;
5489#endif
5490 if (NS_KEYLOG && !processingCompose) 5504 if (NS_KEYLOG && !processingCompose)
5491 fprintf (stderr, "keyDown: Begin compose sequence.\n"); 5505 fprintf (stderr, "keyDown: Begin compose sequence.\n");
5492 5506
@@ -6251,8 +6265,10 @@ if (cols > 0 && rows > 0)
6251 6265
6252 [win setAcceptsMouseMovedEvents: YES]; 6266 [win setAcceptsMouseMovedEvents: YES];
6253 [win setDelegate: self]; 6267 [win setDelegate: self];
6268#if !defined (NS_IMPL_COCOA) || \
6269 MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
6254 [win useOptimizedDrawing: YES]; 6270 [win useOptimizedDrawing: YES];
6255 6271#endif
6256 sz.width = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f); 6272 sz.width = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f);
6257 sz.height = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f); 6273 sz.height = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f);
6258 [win setResizeIncrements: sz]; 6274 [win setResizeIncrements: sz];
@@ -6313,8 +6329,10 @@ if (cols > 0 && rows > 0)
6313 if ([col alphaComponent] != (EmacsCGFloat) 1.0) 6329 if ([col alphaComponent] != (EmacsCGFloat) 1.0)
6314 [win setOpaque: NO]; 6330 [win setOpaque: NO];
6315 6331
6332#if !defined (NS_IMPL_COCOA) || \
6333 MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
6316 [self allocateGState]; 6334 [self allocateGState];
6317 6335#endif
6318 [NSApp registerServicesMenuSendTypes: ns_send_types 6336 [NSApp registerServicesMenuSendTypes: ns_send_types
6319 returnTypes: nil]; 6337 returnTypes: nil];
6320 6338
@@ -6369,7 +6387,7 @@ if (cols > 0 && rows > 0)
6369 } 6387 }
6370 else if (next_maximized == FULLSCREEN_HEIGHT 6388 else if (next_maximized == FULLSCREEN_HEIGHT
6371 || (next_maximized == -1 6389 || (next_maximized == -1
6372 && abs (defaultFrame.size.height - result.size.height) 6390 && abs ((int)(defaultFrame.size.height - result.size.height))
6373 > FRAME_LINE_HEIGHT (emacsframe))) 6391 > FRAME_LINE_HEIGHT (emacsframe)))
6374 { 6392 {
6375 /* first click */ 6393 /* first click */
@@ -6392,7 +6410,7 @@ if (cols > 0 && rows > 0)
6392 } 6410 }
6393 else if (next_maximized == FULLSCREEN_MAXIMIZED 6411 else if (next_maximized == FULLSCREEN_MAXIMIZED
6394 || (next_maximized == -1 6412 || (next_maximized == -1
6395 && abs (defaultFrame.size.width - result.size.width) 6413 && abs ((int)(defaultFrame.size.width - result.size.width))
6396 > FRAME_COLUMN_WIDTH (emacsframe))) 6414 > FRAME_COLUMN_WIDTH (emacsframe)))
6397 { 6415 {
6398 result = defaultFrame; /* second click */ 6416 result = defaultFrame; /* second click */
@@ -6639,7 +6657,10 @@ if (cols > 0 && rows > 0)
6639 [fw setTitle:[w title]]; 6657 [fw setTitle:[w title]];
6640 [fw setDelegate:self]; 6658 [fw setDelegate:self];
6641 [fw setAcceptsMouseMovedEvents: YES]; 6659 [fw setAcceptsMouseMovedEvents: YES];
6660#if !defined (NS_IMPL_COCOA) || \
6661 MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
6642 [fw useOptimizedDrawing: YES]; 6662 [fw useOptimizedDrawing: YES];
6663#endif
6643 [fw setResizeIncrements: sz]; 6664 [fw setResizeIncrements: sz];
6644 [fw setBackgroundColor: col]; 6665 [fw setBackgroundColor: col];
6645 if ([col alphaComponent] != (EmacsCGFloat) 1.0) 6666 if ([col alphaComponent] != (EmacsCGFloat) 1.0)
@@ -6882,7 +6903,7 @@ if (cols > 0 && rows > 0)
6882/* NSDraggingDestination protocol methods. Actually this is not really a 6903/* NSDraggingDestination protocol methods. Actually this is not really a
6883 protocol, but a category of Object. O well... */ 6904 protocol, but a category of Object. O well... */
6884 6905
6885-(NSUInteger) draggingEntered: (id <NSDraggingInfo>) sender 6906-(NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender
6886{ 6907{
6887 NSTRACE (draggingEntered); 6908 NSTRACE (draggingEntered);
6888 return NSDragOperationGeneric; 6909 return NSDragOperationGeneric;
@@ -7167,7 +7188,6 @@ if (cols > 0 && rows > 0)
7167 one screen, we want to constrain. Other times not. */ 7188 one screen, we want to constrain. Other times not. */
7168 NSArray *screens = [NSScreen screens]; 7189 NSArray *screens = [NSScreen screens];
7169 NSUInteger nr_screens = [screens count], nr_eff_screens = 0, i; 7190 NSUInteger nr_screens = [screens count], nr_eff_screens = 0, i;
7170 struct frame *f = ((EmacsView *)[self delegate])->emacsframe;
7171 NSTRACE (constrainFrameRect); 7191 NSTRACE (constrainFrameRect);
7172 NSTRACE_RECT ("input", frameRect); 7192 NSTRACE_RECT ("input", frameRect);
7173 7193
@@ -7263,7 +7283,15 @@ if (cols > 0 && rows > 0)
7263{ 7283{
7264 /* TODO: if we want to allow variable widths, this is the place to do it, 7284 /* TODO: if we want to allow variable widths, this is the place to do it,
7265 however neither GNUstep nor Cocoa support it very well */ 7285 however neither GNUstep nor Cocoa support it very well */
7266 return [NSScroller scrollerWidth]; 7286 CGFloat r;
7287#if !defined (NS_IMPL_COCOA) || \
7288 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
7289 r = [NSScroller scrollerWidth];
7290#else
7291 r = [NSScroller scrollerWidthForControlSize: NSRegularControlSize
7292 scrollerStyle: NSScrollerStyleLegacy];
7293#endif
7294 return r;
7267} 7295}
7268 7296
7269 7297