aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Robert2008-08-01 14:01:08 +0000
committerAdrian Robert2008-08-01 14:01:08 +0000
commit150349607cf648e78d34aa16ef1d43d774bc6044 (patch)
tree7d57cf5f3e5163c7ea3019b9527409df771efe42 /src
parent27ec92c98304e2b61dc20a1db65972b0eb00d4cc (diff)
downloademacs-150349607cf648e78d34aa16ef1d43d774bc6044.tar.gz
emacs-150349607cf648e78d34aa16ef1d43d774bc6044.zip
clear warnings and clean up NS port
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog44
-rw-r--r--src/keyboard.h5
-rw-r--r--src/nsfns.m2
-rw-r--r--src/nsfont.m10
-rw-r--r--src/nsgui.h8
-rw-r--r--src/nsmenu.m17
-rw-r--r--src/nsterm.h12
-rw-r--r--src/nsterm.m212
-rw-r--r--src/w32menu.c4
-rw-r--r--src/xfaces.c10
-rw-r--r--src/xmenu.c5
11 files changed, 113 insertions, 216 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1bf57826ca2..f5ecf80af09 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,47 @@
12008-08-01 Adrian Robert <Adrian.B.Robert@gmail.com>
2 Warning clearing and clean-up in NS port.
3 * keyboard.h (xmalloc_widget_value, digest_single_submenu): Add
4 prototypes.
5 * nsgui.h (FACE_DEFAULT): Remove, unused.
6 (XGCValues): Change colors to unsigned long.
7 * nsterm.h (EmacsApp): Add declaration of all methods implemented in
8 nsterm.m.
9 (EmacsMenu -addItemWithWidgetValue:): Change to use NSMenuItem class.
10 (ns_list_fonts): Remove, unused.
11 (ns_font_to_xlfd, ns_fontname_to_xlfd): Drop prototypes.
12 * nsfns.m (interpret_services_menu): Use NSMenuItem class.
13 * nsfont.m (nsfont_open): Fix cast error in glyphs,metrics alloc.
14 (nsfont_draw): Compare face colors to 0, not nil.
15 * nsmenu.m (struct widget_value): Drop unneeded declaration.
16 (EmacsMenu -addItemWithWidgetValue:, -fillWithWidgetValue:)
17 (-addSubmenuWithTitle:): Use NSMenuItem class.
18 (ns_popup_menu): Use NO, not NULL, for enabled setting.
19 * nsterm.m (ns_draw_glyph_string): Don't compare font to ~0.
20 (ns_clip_to_row): Make gc arg a BOOL.
21 (ns_draw_fringe_bitmap, ns_draw_window_cursor): Use YES, NO in
22 ns_clip_to_row() call.
23 (ns_draw_glyph_string): Drop face comparison to ~0 (no longer
24 used). Cast FRAME_FONT assignments.
25 (ns_read_socket): Cast call to EmacsApp-fulfillService:withArg:.
26 (ns_string_to_lispmod): Change arg to const char.
27 (ns_term_init): Use NSMenuItem class.
28 (EmacsApp -openFile:): Move to different section of file.
29 (EmacsApp -application:openFiles:): Don't return a value, call
30 -replyToOpenOrPrint:.
31 (EmacsView -keyDown:): Fix up cast.
32 (EmacsView -converstationIdentifier): Use NSInteger instead of long.
33 (EmacsView -menuDown:): Cast tag in call to
34 find_and_call_menu_selection().
35 (ns_list_fonts): Remove, unused.
36 (ns_font_to_xlfd): Make static. Cast result of UTF8String.
37 (ns_fontname_to_xlfd): Make static.
38 * w32menu.c (xmalloc_widget_value, digest_single_submenu): Remove
39 prototypes (now in keyboard.h).
40 (next_menubar_widget_id): Remove, unused.
41 * xmenu.c (xmalloc_widget_value, digest_single_submenu): Remove
42 prototypes (now in keyboard.h).
43 * xfaces.c (ns_list_fonts, w32_list_fonts): Remove, unused.
44
12008-08-01 Dan Nicolaescu <dann@ics.uci.edu> 452008-08-01 Dan Nicolaescu <dann@ics.uci.edu>
2 46
3 * systty.h: Fix previous change that removed BSD_TERMIOS. Add 47 * systty.h: Fix previous change that removed BSD_TERMIOS. Add
diff --git a/src/keyboard.h b/src/keyboard.h
index d0c3c860072..970ff46b825 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -367,6 +367,11 @@ typedef struct _widget_value
367} widget_value; 367} widget_value;
368#endif 368#endif
369 369
370#if defined (HAVE_NS) || defined (HAVE_NTGUI) || defined (USE_X_TOOLKIT) || defined (USE_GTK)
371extern widget_value *xmalloc_widget_value P_ ((void));
372extern widget_value *digest_single_submenu P_ ((int, int, int));
373#endif
374
370 375
371/* Macros for dealing with lispy events. */ 376/* Macros for dealing with lispy events. */
372 377
diff --git a/src/nsfns.m b/src/nsfns.m
index 40e8791c318..a0cac0254ef 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -280,7 +280,7 @@ interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old)
280 -------------------------------------------------------------------------- */ 280 -------------------------------------------------------------------------- */
281{ 281{
282 int i, count; 282 int i, count;
283 id<NSMenuItem> item; 283 NSMenuItem *item;
284 const char *name; 284 const char *name;
285 Lisp_Object nameStr; 285 Lisp_Object nameStr;
286 unsigned short key; 286 unsigned short key;
diff --git a/src/nsfont.m b/src/nsfont.m
index f206e0d27b2..0fb98d77180 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -597,9 +597,9 @@ fprintf (stderr, "*** CACHE HIT!\n");
597 } 597 }
598#endif 598#endif
599 599
600 font_info->glyphs = (unsigned short *) 600 font_info->glyphs = (unsigned short **)
601 xmalloc (0x100 * sizeof (unsigned short *)); 601 xmalloc (0x100 * sizeof (unsigned short *));
602 font_info->metrics = (struct font_metrics *) 602 font_info->metrics = (struct font_metrics **)
603 xmalloc (0x100 * sizeof (struct font_metrics *)); 603 xmalloc (0x100 * sizeof (struct font_metrics *));
604 if (!font_info->glyphs || !font_info->metrics) 604 if (!font_info->glyphs || !font_info->metrics)
605 return Qnil; 605 return Qnil;
@@ -984,7 +984,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
984 /* set up for character rendering */ 984 /* set up for character rendering */
985 r.origin.y += font->voffset + (s->height - font->height)/2; 985 r.origin.y += font->voffset + (s->height - font->height)/2;
986 986
987 col = (NS_FACE_FOREGROUND (face) != nil 987 col = (NS_FACE_FOREGROUND (face) != 0
988 ? ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f) 988 ? ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f)
989 : FRAME_FOREGROUND_COLOR (s->f)); 989 : FRAME_FOREGROUND_COLOR (s->f));
990 /* FIXME: find another way to pass this */ 990 /* FIXME: find another way to pass this */
@@ -1077,7 +1077,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1077 1077
1078 if (face->underline_p) 1078 if (face->underline_p)
1079 { 1079 {
1080 if (face->underline_color != nil) 1080 if (face->underline_color != 0)
1081 [ns_lookup_indexed_color (face->underline_color, s->f) set]; 1081 [ns_lookup_indexed_color (face->underline_color, s->f) set];
1082 else 1082 else
1083 [col set]; 1083 [col set];
@@ -1087,7 +1087,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1087 CGContextAddLineToPoint (gcontext, r.origin.x + r.size.width, 1087 CGContextAddLineToPoint (gcontext, r.origin.x + r.size.width,
1088 r.origin.y + font->underpos); 1088 r.origin.y + font->underpos);
1089 CGContextStrokePath (gcontext); 1089 CGContextStrokePath (gcontext);
1090 if (face->underline_color != nil) 1090 if (face->underline_color != 0)
1091 [col set]; 1091 [col set];
1092 } 1092 }
1093 else 1093 else
diff --git a/src/nsgui.h b/src/nsgui.h
index 54e336fdf3d..f8d3ae4a3a8 100644
--- a/src/nsgui.h
+++ b/src/nsgui.h
@@ -75,20 +75,16 @@ typedef unichar XChar2b;
75#define XCHAR2B_BYTE2(chp) \ 75#define XCHAR2B_BYTE2(chp) \
76 ((*chp) & 0x00ff) 76 ((*chp) & 0x00ff)
77 77
78#define FACE_DEFAULT (~0)
79
80 78
81/* XXX: xfaces requires these structures, but the question is are we 79/* XXX: xfaces requires these structures, but the question is are we
82 forced to use them? */ 80 forced to use them? */
83typedef struct _XGCValues 81typedef struct _XGCValues
84{ 82{
83 unsigned long foreground;
84 unsigned long background;
85#ifdef __OBJC__ 85#ifdef __OBJC__
86 NSColor *foreground;
87 NSColor *background;
88 struct ns_font *font; 86 struct ns_font *font;
89#else 87#else
90 void *foreground;
91 void *background;
92 void *font; 88 void *font;
93#endif 89#endif
94} XGCValues; 90} XGCValues;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 9d17da43596..822aa94efa9 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -53,8 +53,6 @@ int menu_trace_num = 0;
53#include "nsmenu_common.c" 53#include "nsmenu_common.c"
54#endif 54#endif
55 55
56extern struct widget_value;
57
58extern Lisp_Object Qundefined, Qmenu_enable, Qmenu_bar_update_hook; 56extern Lisp_Object Qundefined, Qmenu_enable, Qmenu_bar_update_hook;
59extern Lisp_Object QCtoggle, QCradio; 57extern Lisp_Object QCtoggle, QCradio;
60 58
@@ -594,9 +592,9 @@ name_is_separator (name)
594 return [NSString stringWithFormat: @"%c", tpos[2]]; 592 return [NSString stringWithFormat: @"%c", tpos[2]];
595} 593}
596 594
597- (id <NSMenuItem>)addItemWithWidgetValue: (void *)wvptr 595- (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr
598{ 596{
599 id <NSMenuItem> item; 597 NSMenuItem *item;
600 widget_value *wv = (widget_value *)wvptr; 598 widget_value *wv = (widget_value *)wvptr;
601 599
602 if (name_is_separator (wv->name)) 600 if (name_is_separator (wv->name))
@@ -663,7 +661,7 @@ name_is_separator (name)
663 /* add new contents */ 661 /* add new contents */
664 for (; wv != NULL; wv = wv->next) 662 for (; wv != NULL; wv = wv->next)
665 { 663 {
666 id <NSMenuItem> item = [self addItemWithWidgetValue: wv]; 664 NSMenuItem *item = [self addItemWithWidgetValue: wv];
667 665
668 if (wv->contents) 666 if (wv->contents)
669 { 667 {
@@ -691,10 +689,9 @@ name_is_separator (name)
691- (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f 689- (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f
692{ 690{
693 NSString *titleStr = [NSString stringWithUTF8String: title]; 691 NSString *titleStr = [NSString stringWithUTF8String: title];
694 id <NSMenuItem> item 692 NSMenuItem *item = [self addItemWithTitle: titleStr
695 = [self addItemWithTitle: titleStr 693 action: nil /*@selector (menuDown:) */
696 action: nil /*@selector (menuDown:) */ 694 keyEquivalent: @""];
697 keyEquivalent: @""];
698 EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f]; 695 EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f];
699 [self setSubmenu: submenu forItem: item]; 696 [self setSubmenu: submenu forItem: item];
700 [submenu release]; 697 [submenu release];
@@ -1107,7 +1104,7 @@ ns_popup_menu (Lisp_Object position, Lisp_Object menu)
1107#endif 1104#endif
1108 1105
1109 wv_title->name = (char *) SDATA (title); 1106 wv_title->name = (char *) SDATA (title);
1110 wv_title->enabled = NULL; 1107 wv_title->enabled = NO;
1111 wv_title->button_type = BUTTON_TYPE_NONE; 1108 wv_title->button_type = BUTTON_TYPE_NONE;
1112 wv_title->help = Qnil; 1109 wv_title->help = Qnil;
1113 wv_title->next = wv_sep; 1110 wv_title->next = wv_sep;
diff --git a/src/nsterm.h b/src/nsterm.h
index bb8beac378c..a9dc32793f4 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -36,8 +36,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
36@interface EmacsApp : NSApplication 36@interface EmacsApp : NSApplication
37{ 37{
38} 38}
39- (void)logNotification: (NSNotification *)notification;
39- (void)sendEvent: (NSEvent *)theEvent; 40- (void)sendEvent: (NSEvent *)theEvent;
40- (void)showPreferencesWindow: (id)sender; 41- (void)showPreferencesWindow: (id)sender;
42- (BOOL) openFile: (NSString *)fileName;
43- (void)fd_handler: (NSTimer *) fdEntry;
44- (void)cursor_blink_handler: (NSTimer *)cursorEntry;
45- (void)timeout_handler: (NSTimer *)timedEntry;
46- (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg;
41@end 47@end
42 48
43 49
@@ -104,7 +110,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
104- (void)setFrame: (struct frame *)f; 110- (void)setFrame: (struct frame *)f;
105- (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */ 111- (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */
106- (NSString *)parseKeyEquiv: (char *)key; 112- (NSString *)parseKeyEquiv: (char *)key;
107- (id <NSMenuItem>)addItemWithWidgetValue: (void *)wvptr; 113- (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr;
108- (void)fillWithWidgetValue: (void *)wvptr; 114- (void)fillWithWidgetValue: (void *)wvptr;
109- (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f; 115- (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f;
110- (void) clear; 116- (void) clear;
@@ -727,10 +733,6 @@ extern Lisp_Object ns_list_fonts (FRAME_PTR f, Lisp_Object pattern,
727 int size, int maxnames); 733 int size, int maxnames);
728extern void ns_clear_frame (struct frame *f); 734extern void ns_clear_frame (struct frame *f);
729 735
730#ifdef __OBJC__
731extern const char *ns_font_to_xlfd (NSFont *font);
732#endif
733extern const char *ns_fontname_to_xlfd (const char *name);
734extern const char *ns_xlfd_to_fontname (const char *xlfd); 736extern const char *ns_xlfd_to_fontname (const char *xlfd);
735 737
736extern void check_ns (void); 738extern void check_ns (void);
diff --git a/src/nsterm.m b/src/nsterm.m
index 0e6c1f33cfd..a67a8e0c3b6 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -785,7 +785,7 @@ ns_unfocus (struct frame *f)
785 785
786 786
787static void 787static void
788ns_clip_to_row (struct window *w, struct glyph_row *row, int area, GC gc) 788ns_clip_to_row (struct window *w, struct glyph_row *row, int area, BOOL gc)
789/* -------------------------------------------------------------------------- 789/* --------------------------------------------------------------------------
790 23: Internal (but parallels other terms): Focus drawing on given row 790 23: Internal (but parallels other terms): Focus drawing on given row
791 -------------------------------------------------------------------------- */ 791 -------------------------------------------------------------------------- */
@@ -2212,7 +2212,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
2212 int oldVH = row->visible_height; 2212 int oldVH = row->visible_height;
2213 row->visible_height = p->h; 2213 row->visible_height = p->h;
2214 row->y -= rowY - p->y; 2214 row->y -= rowY - p->y;
2215 ns_clip_to_row (w, row, -1, NULL); 2215 ns_clip_to_row (w, row, -1, NO);
2216 row->y = oldY; 2216 row->y = oldY;
2217 row->visible_height = oldVH; 2217 row->visible_height = oldVH;
2218 } 2218 }
@@ -2329,7 +2329,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
2329 2329
2330 /* TODO: only needed in rare cases with last-resort font in HELLO.. 2330 /* TODO: only needed in rare cases with last-resort font in HELLO..
2331 should we do this more efficiently? */ 2331 should we do this more efficiently? */
2332 ns_clip_to_row (w, glyph_row, -1, NULL); 2332 ns_clip_to_row (w, glyph_row, -1, NO);
2333/* ns_focus (f, &r, 1); */ 2333/* ns_focus (f, &r, 1); */
2334 2334
2335 if (FRAME_LAST_INACTIVE (f)) 2335 if (FRAME_LAST_INACTIVE (f))
@@ -2943,8 +2943,8 @@ ns_draw_glyph_string (struct glyph_string *s)
2943 (s->for_overlaps ? NS_DUMPGLYPH_FOREGROUND : 2943 (s->for_overlaps ? NS_DUMPGLYPH_FOREGROUND :
2944 NS_DUMPGLYPH_NORMAL)); 2944 NS_DUMPGLYPH_NORMAL));
2945 ns_tmp_font = (struct nsfont_info *)s->face->font; 2945 ns_tmp_font = (struct nsfont_info *)s->face->font;
2946 if (ns_tmp_font == ~0 || ns_tmp_font == NULL) 2946 if (ns_tmp_font == NULL)
2947 ns_tmp_font = FRAME_FONT (s->f); 2947 ns_tmp_font = (struct nsfont_info *)FRAME_FONT (s->f);
2948 2948
2949 ns_tmp_font->font.driver->draw 2949 ns_tmp_font->font.driver->draw
2950 (s, 0, s->nchars, s->x, s->y, 2950 (s, 0, s->nchars, s->x, s->y,
@@ -3078,8 +3078,9 @@ ns_read_socket (struct terminal *terminal, int expected,
3078 } 3078 }
3079 /* Deal with pending service requests. */ 3079 /* Deal with pending service requests. */
3080 else if (ns_pending_service_names && [ns_pending_service_names count] != 0 3080 else if (ns_pending_service_names && [ns_pending_service_names count] != 0
3081 && [NSApp fulfillService: [ns_pending_service_names objectAtIndex: 0] 3081 && [(EmacsApp *)
3082 withArg: [ns_pending_service_args objectAtIndex: 0]]) 3082 NSApp fulfillService: [ns_pending_service_names objectAtIndex: 0]
3083 withArg: [ns_pending_service_args objectAtIndex: 0]])
3083 { 3084 {
3084 [ns_pending_service_names removeObjectAtIndex: 0]; 3085 [ns_pending_service_names removeObjectAtIndex: 0];
3085 [ns_pending_service_args removeObjectAtIndex: 0]; 3086 [ns_pending_service_args removeObjectAtIndex: 0];
@@ -3437,7 +3438,7 @@ x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y)
3437 3438
3438 ========================================================================== */ 3439 ========================================================================== */
3439 3440
3440static Lisp_Object ns_string_to_lispmod (char *s) 3441static Lisp_Object ns_string_to_lispmod (const char *s)
3441/* -------------------------------------------------------------------------- 3442/* --------------------------------------------------------------------------
3442 Convert modifier name to lisp symbol 3443 Convert modifier name to lisp symbol
3443 -------------------------------------------------------------------------- */ 3444 -------------------------------------------------------------------------- */
@@ -3876,7 +3877,7 @@ ns_term_init (Lisp_Object display_name)
3876#ifdef NS_IMPL_COCOA 3877#ifdef NS_IMPL_COCOA
3877 { 3878 {
3878 NSMenu *appMenu; 3879 NSMenu *appMenu;
3879 id<NSMenuItem> item; 3880 NSMenuItem *item;
3880 /* set up the application menu */ 3881 /* set up the application menu */
3881 svcsMenu = [[EmacsMenu alloc] initWithTitle: @"Services"]; 3882 svcsMenu = [[EmacsMenu alloc] initWithTitle: @"Services"];
3882 [svcsMenu setAutoenablesItems: NO]; 3883 [svcsMenu setAutoenablesItems: NO];
@@ -4029,6 +4030,26 @@ ns_term_shutdown (int sig)
4029} 4030}
4030 4031
4031 4032
4033/* Open a file (used by below, after going into queue read by ns_read_socket) */
4034- (BOOL) openFile: (NSString *)fileName
4035{
4036 struct frame *emacsframe = SELECTED_FRAME ();
4037 NSEvent *theEvent = [NSApp currentEvent];
4038
4039 if (!emacs_event)
4040 return NO;
4041
4042 emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
4043 emacs_event->code = KEY_NS_OPEN_FILE_LINE;
4044 ns_input_file = append2 (ns_input_file, build_string ([fileName UTF8String]));
4045 ns_input_line = Qnil; /* can be start or cons start,end */
4046 emacs_event->modifiers =0;
4047 EV_TRAILER (theEvent);
4048
4049 return YES;
4050}
4051
4052
4032/* ************************************************************************** 4053/* **************************************************************************
4033 4054
4034 EmacsApp delegate implementation 4055 EmacsApp delegate implementation
@@ -4080,26 +4101,6 @@ fprintf (stderr, "res = %d\n", EQ (res, Qt)); /* FIXME */
4080} 4101}
4081 4102
4082 4103
4083/* Open a file (used by below, after going into queue read by ns_read_socket) */
4084-(BOOL) openFile: (NSString *)fileName
4085{
4086 struct frame *emacsframe = SELECTED_FRAME ();
4087 NSEvent *theEvent = [NSApp currentEvent];
4088
4089 if (!emacs_event)
4090 return NO;
4091
4092 emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
4093 emacs_event->code = KEY_NS_OPEN_FILE_LINE;
4094 ns_input_file = append2 (ns_input_file, build_string ([fileName UTF8String]));
4095 ns_input_line = Qnil; /* can be start or cons start,end */
4096 emacs_event->modifiers =0;
4097 EV_TRAILER (theEvent);
4098
4099 return YES;
4100}
4101
4102
4103/* Notification from the Workspace to open a file */ 4104/* Notification from the Workspace to open a file */
4104- (BOOL)application: sender openFile: (NSString *)file 4105- (BOOL)application: sender openFile: (NSString *)file
4105{ 4106{
@@ -4131,7 +4132,7 @@ fprintf (stderr, "res = %d\n", EQ (res, Qt)); /* FIXME */
4131 NSString *file; 4132 NSString *file;
4132 while ((file = [files nextObject]) != nil) 4133 while ((file = [files nextObject]) != nil)
4133 [ns_pending_files addObject: file]; 4134 [ns_pending_files addObject: file];
4134 return YES; 4135 [self replyToOpenOrPrint: NSApplicationDelegateReplySuccess];
4135} 4136}
4136 4137
4137/* TODO: these may help w/IO switching btwn terminal and NSApp */ 4138/* TODO: these may help w/IO switching btwn terminal and NSApp */
@@ -4359,7 +4360,7 @@ extern void update_window_cursor (struct window *w, int on);
4359 NSView most recently updated (I guess), which is not the correct one. 4360 NSView most recently updated (I guess), which is not the correct one.
4360 UPDATE: After multi-TTY merge this happens even w/o NO_SOCK_SIGIO */ 4361 UPDATE: After multi-TTY merge this happens even w/o NO_SOCK_SIGIO */
4361 if ([[theEvent window] isKindOfClass: [EmacsWindow class]]) 4362 if ([[theEvent window] isKindOfClass: [EmacsWindow class]])
4362 [[(EmacsView *)[theEvent window] delegate] keyDown: theEvent]; 4363 [(EmacsView *)[[theEvent window] delegate] keyDown: theEvent];
4363 return; 4364 return;
4364 } 4365 }
4365 4366
@@ -4638,9 +4639,9 @@ if (NS_KEYLOG) NSLog (@"firstRectForCharRange request");
4638 return rect; 4639 return rect;
4639} 4640}
4640 4641
4641- (long)conversationIdentifier 4642- (NSInteger)conversationIdentifier
4642{ 4643{
4643 return (long)self; 4644 return (NSInteger)self;
4644} 4645}
4645 4646
4646/* TODO: below here not yet implemented correctly, but may not be needed */ 4647/* TODO: below here not yet implemented correctly, but may not be needed */
@@ -5239,7 +5240,8 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request");
5239 context_menu_value = [sender tag]; 5240 context_menu_value = [sender tag];
5240 else 5241 else
5241 find_and_call_menu_selection (emacsframe, emacsframe->menu_bar_items_used, 5242 find_and_call_menu_selection (emacsframe, emacsframe->menu_bar_items_used,
5242 emacsframe->menu_bar_vector, [sender tag]); 5243 emacsframe->menu_bar_vector,
5244 (void *)[sender tag]);
5243 ns_send_appdefined (-1); 5245 ns_send_appdefined (-1);
5244 return self; 5246 return self;
5245} 5247}
@@ -6156,6 +6158,7 @@ static void selectItemWithTag (NSPopUpButton *popup, int tag)
6156/* ========================================================================== 6158/* ==========================================================================
6157 6159
6158 Font-related functions; these used to be in nsfaces.m 6160 Font-related functions; these used to be in nsfaces.m
6161 The XLFD functions (115 lines) are an abomination that should be removed.
6159 6162
6160 ========================================================================== */ 6163 ========================================================================== */
6161 6164
@@ -6204,141 +6207,9 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
6204} 6207}
6205 6208
6206 6209
6207Lisp_Object
6208ns_list_fonts (FRAME_PTR f, Lisp_Object pattern, int size, int maxnames)
6209/* --------------------------------------------------------------------------
6210 This is used by the xfaces system. It is expected to speak XLFD.
6211 -------------------------------------------------------------------------- */
6212{
6213 Lisp_Object list = Qnil,
6214 rpattern,
6215 key,
6216 tem,
6217 args[2];
6218 struct re_pattern_buffer *bufp;
6219 id fm = [NSFontManager sharedFontManager];
6220 NSEnumerator *fenum, *senum;
6221 NSArray *membInfo;
6222 NSString *fontname;
6223 const char *xlfdName;
6224 char *pattFam;
6225 char *patt;
6226 NSString *famName;
6227
6228 NSTRACE (ns_list_fonts);
6229
6230 CHECK_STRING (pattern);
6231 patt = SDATA (pattern);
6232
6233#if 0
6234/* temporary: for font_backend, we use fontsets, and when these are defined,
6235 the old XLFD-based system is used; eventually this will be replaced by
6236 backend code, but for now we allow specs that are just family names */
6237 /* if pattern is not XLFD, panic now */
6238 if (patt[0] != '-')
6239 error ("ns_list_fonts: X font name (XLFD) expected.");
6240
6241 /* if unicode encoding not requested, also die */
6242 if (!strstr (patt, "iso10646") && patt[strlen (patt)-3] != '*')
6243 return Qnil;
6244#endif /* 0 */
6245
6246 key = f ? Fcons (pattern, make_number (maxnames)) : Qnil;
6247 tem = f ? XCDR (FRAME_NS_DISPLAY_INFO (f)->name_list_element) : Qnil;
6248
6249 /* See if we cached the result for this particular query.
6250 The cache is an alist of the form:
6251 ((((PATTERN . MAXNAMES) FONTNAME) ...) ...)
6252 */
6253 if (f && !NILP (list = Fassoc (key, tem)))
6254 {
6255 list = Fcdr_safe (list);
6256 /* We have a cached list. Don't have to get the list again. */
6257 if (!NILP (list))
6258 return list;
6259 }
6260
6261 if (patt[0] != '-')
6262 pattFam = patt;
6263 else
6264 pattFam = ns_xlfd_to_fontname (patt);
6265 /* XXX: '*' at beginning matches literally.. */
6266 if (pattFam[0] == '*')
6267 pattFam[0] = '.';
6268
6269 /* must start w/family name, but can have other stuff afterwards
6270 (usually bold and italic specifiers) */
6271 args[0] = build_string ("^");
6272 args[1] = build_string (pattFam);
6273 rpattern = Fconcat (2, args);
6274 bufp = compile_pattern (rpattern, 0, Vascii_canon_table, 0, 0);
6275
6276 list = Qnil;
6277 fenum = [[fm availableFontFamilies] objectEnumerator];
6278 while ( (famName = [fenum nextObject]) )
6279 {
6280 NSMutableString *tmp = [famName mutableCopy];
6281 const char *fname;
6282 NSRange r;
6283
6284 /* remove spaces, to look like postscript name */
6285 while ((r = [tmp rangeOfString: @" "]).location != NSNotFound)
6286 [tmp deleteCharactersInRange: r];
6287
6288 fname = [tmp UTF8String];
6289 int len = strlen (fname);
6290 BOOL foundItal;
6291 const char *synthItalFont;
6292
6293 if (re_search (bufp, fname, len, 0, len, 0) >= 0)
6294 {
6295 /* Found a family. Add all variants. If we have no italic variant,
6296 add a synthItal. */
6297 senum =[[fm availableMembersOfFontFamily: famName] objectEnumerator];
6298 foundItal = NO;
6299 synthItalFont = NULL;
6300 while (membInfo = [senum nextObject])
6301 {
6302 xlfdName
6303 = ns_fontname_to_xlfd ([[membInfo objectAtIndex: 0]
6304 UTF8String]);
6305 list = Fcons (build_string (xlfdName), list);
6306 if (!synthItalFont)
6307 {
6308 NSString *synthName
6309 = [[membInfo objectAtIndex: 0]
6310 stringByAppendingString: @"-synthItal"];
6311 synthItalFont = [synthName UTF8String];
6312 }
6313 else if ([[membInfo objectAtIndex: 3] intValue]
6314 & NSItalicFontMask)
6315 foundItal = YES;
6316 }
6317 if (foundItal == NO)
6318 {
6319 xlfdName = ns_fontname_to_xlfd (synthItalFont);
6320 list = Fcons (build_string (xlfdName), list);
6321 }
6322 }
6323 [tmp release];
6324 }
6325
6326 /* fallback */
6327 if (XFASTINT (Flength (list)) == 0)
6328 list = Fcons (build_string (ns_fontname_to_xlfd ("Monaco")), list);
6329
6330 /* store result in cache */
6331 if (f != NULL)
6332 XCDR_AS_LVALUE (FRAME_NS_DISPLAY_INFO (f)->name_list_element)
6333 = Fcons (Fcons (key, list),
6334 XCDR (FRAME_NS_DISPLAY_INFO (f)->name_list_element));
6335 return list;
6336}
6337
6338
6339/* XLFD: -foundry-family-weight-slant-swidth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWidth-rgstry-encoding */ 6210/* XLFD: -foundry-family-weight-slant-swidth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWidth-rgstry-encoding */
6340 6211
6341const char * 6212static const char *
6342ns_font_to_xlfd (NSFont *nsfont) 6213ns_font_to_xlfd (NSFont *nsfont)
6343/* -------------------------------------------------------------------------- 6214/* --------------------------------------------------------------------------
6344 Convert an NS font name to an X font name (XLFD). 6215 Convert an NS font name to an X font name (XLFD).
@@ -6347,7 +6218,7 @@ ns_font_to_xlfd (NSFont *nsfont)
6347{ 6218{
6348 NSFontManager *mgr = [NSFontManager sharedFontManager]; 6219 NSFontManager *mgr = [NSFontManager sharedFontManager];
6349 NSString *sname = [nsfont /*familyName*/fontName]; 6220 NSString *sname = [nsfont /*familyName*/fontName];
6350 char *famName = [sname UTF8String]; 6221 char *famName = (char *)[sname UTF8String];
6351 char *weightStr = [mgr fontNamed: sname hasTraits: NSBoldFontMask] ? 6222 char *weightStr = [mgr fontNamed: sname hasTraits: NSBoldFontMask] ?
6352 "bold" : "medium"; 6223 "bold" : "medium";
6353 char *slantStr = [mgr fontNamed: sname hasTraits: NSItalicFontMask] ? 6224 char *slantStr = [mgr fontNamed: sname hasTraits: NSItalicFontMask] ?
@@ -6358,7 +6229,7 @@ ns_font_to_xlfd (NSFont *nsfont)
6358 int i, len; 6229 int i, len;
6359 6230
6360 /* change '-' to '$' to avoid messing w/XLFD separator */ 6231 /* change '-' to '$' to avoid messing w/XLFD separator */
6361 for (len =strlen (famName), i =0; i<len; i++) 6232 for (len = strlen (famName), i =0; i<len; i++)
6362 if (famName[i] == '-') 6233 if (famName[i] == '-')
6363 { 6234 {
6364 famName[i] = '\0'; 6235 famName[i] = '\0';
@@ -6373,7 +6244,7 @@ ns_font_to_xlfd (NSFont *nsfont)
6373 return xlfd; 6244 return xlfd;
6374} 6245}
6375 6246
6376const char * 6247static const char *
6377ns_fontname_to_xlfd (const char *name) 6248ns_fontname_to_xlfd (const char *name)
6378/* -------------------------------------------------------------------------- 6249/* --------------------------------------------------------------------------
6379 Convert an NS font name to an X font name (XLFD). 6250 Convert an NS font name to an X font name (XLFD).
@@ -6453,6 +6324,7 @@ ns_xlfd_to_fontname (const char *xlfd)
6453 return ret; 6324 return ret;
6454} 6325}
6455 6326
6327
6456void 6328void
6457syms_of_nsterm () 6329syms_of_nsterm ()
6458{ 6330{
diff --git a/src/w32menu.c b/src/w32menu.c
index 4de203c9b39..fb54caf8806 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -103,10 +103,6 @@ static Lisp_Object w32_menu_show P_ ((FRAME_PTR, int, int, int, int,
103 103
104void w32_free_menu_strings P_((HWND)); 104void w32_free_menu_strings P_((HWND));
105 105
106static int next_menubar_widget_id;
107
108extern widget_value *xmalloc_widget_value P_ ((void));
109extern widget_value *digest_single_submenu P_ ((int, int, int));
110 106
111/* This is set nonzero after the user activates the menu bar, and set 107/* This is set nonzero after the user activates the menu bar, and set
112 to zero again after the menu bars are redisplayed by prepare_menu_bar. 108 to zero again after the menu bars are redisplayed by prepare_menu_bar.
diff --git a/src/xfaces.c b/src/xfaces.c
index 6180b899dbb..4d49d9a8f7c 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -234,7 +234,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
234#define x_display_info w32_display_info 234#define x_display_info w32_display_info
235#define FRAME_X_FONT_TABLE FRAME_W32_FONT_TABLE 235#define FRAME_X_FONT_TABLE FRAME_W32_FONT_TABLE
236#define check_x check_w32 236#define check_x check_w32
237#define x_list_fonts w32_list_fonts
238#define GCGraphicsExposures 0 237#define GCGraphicsExposures 0
239#endif /* WINDOWSNT */ 238#endif /* WINDOWSNT */
240 239
@@ -245,7 +244,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
245#define x_display_info ns_display_info 244#define x_display_info ns_display_info
246#define FRAME_X_FONT_TABLE FRAME_NS_FONT_TABLE 245#define FRAME_X_FONT_TABLE FRAME_NS_FONT_TABLE
247#define check_x check_ns 246#define check_x check_ns
248#define x_list_fonts ns_list_fonts
249#define GCGraphicsExposures 0 247#define GCGraphicsExposures 0
250#endif /* HAVE_NS */ 248#endif /* HAVE_NS */
251 249
@@ -557,14 +555,6 @@ static void uncache_face P_ ((struct face_cache *, struct face *));
557static GC x_create_gc P_ ((struct frame *, unsigned long, XGCValues *)); 555static GC x_create_gc P_ ((struct frame *, unsigned long, XGCValues *));
558static void x_free_gc P_ ((struct frame *, GC)); 556static void x_free_gc P_ ((struct frame *, GC));
559 557
560#ifdef WINDOWSNT
561extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int));
562#endif /* WINDOWSNT */
563
564#ifdef HAVE_NS
565extern Lisp_Object ns_list_fonts P_ ((struct frame *, Lisp_Object, int, int));
566#endif /* HAVE_NS */
567
568#ifdef USE_X_TOOLKIT 558#ifdef USE_X_TOOLKIT
569static void x_update_menu_appearance P_ ((struct frame *)); 559static void x_update_menu_appearance P_ ((struct frame *));
570 560
diff --git a/src/xmenu.c b/src/xmenu.c
index c89fe86e3da..199b19baec9 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -146,11 +146,6 @@ static int popup_activated_flag;
146 146
147static int next_menubar_widget_id; 147static int next_menubar_widget_id;
148 148
149#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
150extern widget_value *xmalloc_widget_value P_ ((void));
151extern widget_value *digest_single_submenu P_ ((int, int, int));
152#endif
153
154/* This is set nonzero after the user activates the menu bar, and set 149/* This is set nonzero after the user activates the menu bar, and set
155 to zero again after the menu bars are redisplayed by prepare_menu_bar. 150 to zero again after the menu bars are redisplayed by prepare_menu_bar.
156 While it is nonzero, all calls to set_frame_menubar go deep. 151 While it is nonzero, all calls to set_frame_menubar go deep.