2012-07-13 Jan Djärv <jan.h.d@swipnet.se>
+ * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP.
+ (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE.
+ (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init)
+ (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA
+ where appropriate.
+ (ns_exec_path, ns_load_path, changeFont): Put () around assignment used
+ as boolean expression.
+ (x_set_window_size): Remove unused variable toolbar.
+ (ns_get_color_default, ns_mod_to_lisp): Remove.
+ (ns_mouse_position): Remove unused variables xchar and ychar.
+ (ns_compute_glyph_string_overhangs): Remove unused variable face.
+ (ns_set_vertical_scroll_bar): Remove unused variable count.
+ (ns_delete_terminal): Remove unused variable i.
+ (ns_term_init): Remove unused variables r, g and b.
+ (mouseDown): Remove unused variable window.
+ (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP.
+ (initFrameFromEmacs): Remove unused variable vbextra.
+ (mouseEntered): Remove unused variables p and dpyinfo.
+ (mouseExited): Remove unused variables p and r.
+ (ns_define_frame_cursor, ns_clear_frame_area)
+ (ns_draw_window_cursor, ns_initialize_display_info): Make static.
+ (menuDown): Assign [sender tag] to variable and cast the variable.
+
+ * nsterm.h (menuDown): Add id as type to argument sender.
+ (ns_display_info_for_name): Add Lisp_Object argument.
+ (ns_term_init): Add Lisp_Object argument.
+ (ns_map_event_to_object): Add void argument.
+ (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct
+ prototype with arguments and only declare if __OBJC__.
+ (nxatoms_of_nsselect): Add void argument.
+ (ns_lisp_to_cursor_type): Add Lisp_Object argument.
+ (ns_alloc_autorelease_pool): Add void argument.
+ (ns_release_autorelease_pool): Add void* argument.
+ (ns_get_defaults_value): Add const char* argument.
+
+ * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog)
+ (initFromContents): Use SSDATA where appropriate.
+ (ns_update_menubar): Add braces to ambigous if-else.
+ (initWithTitle): Put () around assignment in if statement.
+ (ns_menu_show): Remove unused variables window and keymap.
+ (update_frame_tool_bar): Remove unused variable selected_p.
+ (initWithContentRect): Remove unused variable this_cmd_name.
+
+ * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where
+ appropriate.
+ (setXBMColor): Remove unused variable len.
+ (setPixmapData): Put () around assignment in loop statement.
+
+ * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script)
+ (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA
+ where appropriate.
+ (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put ()
+ around assignment in loop statement.
+ (nsfont_open): Remove unused variable i.
+ (nsfont_open): Remove unused variable len.
+ (nsfont_draw): Remove unused variable cs.
+
+ * nsfns.m (x_set_icon_name, ns_set_name_internal)
+ (ns_set_name_as_filename, ns_implicitly_set_icon_type)
+ (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name)
+ (Fns_get_resource, Fns_set_resource, Fx_open_connection)
+ (Fns_font_name, Fns_perform_service)
+ (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript)
+ (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate.
+ (ns_set_name): Remove unused variable view.
+ (x_set_menu_bar_lines): Remove unused variable olines.
+ (x_set_tool_bar_lines): Remove unused variable root_window.
+ (Fns_list_colors): Put () around assignment in while statement.
+ (Fns_perform_service): Remove unused variable len.
+ (Fns_display_usable_bounds): Remove unused variable top.
+ (syms_of_nsfns): Remove unused variable i.
+
* nsmenu.m (ns_update_menubar): Exchange place of argument 2 and 3 to
memcpy (Bug#11907).
if ([[view window] miniwindowTitle] &&
([[[view window] miniwindowTitle]
isEqualToString: [NSString stringWithUTF8String:
- SDATA (arg)]]))
+ SSDATA (arg)]]))
return;
[[view window] setMiniwindowTitle:
- [NSString stringWithUTF8String: SDATA (arg)]];
+ [NSString stringWithUTF8String: SSDATA (arg)]];
}
static void
encoded_name = ENCODE_UTF_8 (name);
UNGCPRO;
- str = [NSString stringWithUTF8String: SDATA (encoded_name)];
+ str = [NSString stringWithUTF8String: SSDATA (encoded_name)];
/* Don't change the name if it's already NAME. */
if (! [[[view window] title] isEqualToString: str])
else
encoded_icon_name = ENCODE_UTF_8 (f->icon_name);
- str = [NSString stringWithUTF8String: SDATA (encoded_icon_name)];
+ str = [NSString stringWithUTF8String: SSDATA (encoded_icon_name)];
if ([[view window] miniwindowTitle] &&
! [[[view window] miniwindowTitle] isEqualToString: str])
static void
ns_set_name (struct frame *f, Lisp_Object name, int explicit)
{
- NSView *view;
NSTRACE (ns_set_name);
if (ns_in_resize)
title = FRAME_ICONIFIED_P (f) ? [[[view window] miniwindowTitle] UTF8String]
: [[[view window] title] UTF8String];
- if (title && (! strcmp (title, SDATA (encoded_name))))
+ if (title && (! strcmp (title, SSDATA (encoded_name))))
{
[pool release];
UNBLOCK_INPUT;
return;
}
- str = [NSString stringWithUTF8String: SDATA (encoded_name)];
+ str = [NSString stringWithUTF8String: SSDATA (encoded_name)];
if (str == nil) str = @"Bad coding";
if (FRAME_ICONIFIED_P (f))
encoded_filename = ENCODE_UTF_8 (filename);
UNGCPRO;
- fstr = [NSString stringWithUTF8String: SDATA (encoded_filename)];
+ fstr = [NSString stringWithUTF8String: SSDATA (encoded_filename)];
if (fstr == nil) fstr = @"";
#ifdef NS_IMPL_COCOA
/* work around a bug observed on 10.3 and later where
x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
int nlines;
- int olines = FRAME_MENU_BAR_LINES (f);
if (FRAME_MINIBUF_ONLY_P (f))
return;
x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
int nlines;
- Lisp_Object root_window;
if (FRAME_MINIBUF_ONLY_P (f))
return;
BLOCK_INPUT;
pool = [[NSAutoreleasePool alloc] init];
if (f->output_data.ns->miniimage
- && [[NSString stringWithUTF8String: SDATA (f->name)]
+ && [[NSString stringWithUTF8String: SSDATA (f->name)]
isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]])
{
[pool release];
{
elt = XCAR (chain);
/* special case: 't' means go by file type */
- if (SYMBOLP (elt) && EQ (elt, Qt) && SDATA (f->name)[0] == '/')
+ if (SYMBOLP (elt) && EQ (elt, Qt) && SSDATA (f->name)[0] == '/')
{
NSString *str
- = [NSString stringWithUTF8String: SDATA (f->name)];
+ = [NSString stringWithUTF8String: SSDATA (f->name)];
if ([[NSFileManager defaultManager] fileExistsAtPath: str])
image = [[[NSWorkspace sharedWorkspace] iconForFile: str] retain];
}
if (image == nil)
image = [[NSImage imageNamed:
[NSString stringWithUTF8String:
- SDATA (XCDR (elt))]] retain];
+ SSDATA (XCDR (elt))]] retain];
}
}
if (!NILP (arg) && SYMBOLP (arg))
{
- arg =build_string (SDATA (SYMBOL_NAME (arg)));
+ arg =build_string (SSDATA (SYMBOL_NAME (arg)));
store_frame_param (f, Qicon_type, arg);
}
image = [EmacsImage allocInitFromFile: arg];
if (image == nil)
image =[NSImage imageNamed: [NSString stringWithUTF8String:
- SDATA (arg)]];
+ SSDATA (arg)]];
if (image == nil)
{
{
char *str;
if (XTYPE (arg) == Lisp_String)
- str = SDATA (arg);
+ str = SSDATA (arg);
else if (XTYPE (arg) == Lisp_Symbol)
- str = SDATA (SYMBOL_NAME (arg));
+ str = SSDATA (SYMBOL_NAME (arg));
else return -1;
if (!strcmp (str, "box")) return FILLED_BOX_CURSOR;
if (!strcmp (str, "hollow")) return HOLLOW_BOX_CURSOR;
Lisp_Object fname;
NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
- [NSString stringWithUTF8String: SDATA (prompt)];
+ [NSString stringWithUTF8String: SSDATA (prompt)];
NSString *dirS = NILP (dir) || !STRINGP (dir) ?
- [NSString stringWithUTF8String: SDATA (BVAR (current_buffer, directory))] :
- [NSString stringWithUTF8String: SDATA (dir)];
+ [NSString stringWithUTF8String: SSDATA (BVAR (current_buffer, directory))] :
+ [NSString stringWithUTF8String: SSDATA (dir)];
NSString *initS = NILP (init) || !STRINGP (init) ? nil :
- [NSString stringWithUTF8String: SDATA (init)];
+ [NSString stringWithUTF8String: SSDATA (init)];
check_ns ();
if (NILP (owner))
owner = build_string([ns_app_name UTF8String]);
CHECK_STRING (name);
-/*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SDATA (name)); */
+/*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SSDATA (name)); */
- value = ns_get_defaults_value (SDATA (name));
+ value = ns_get_defaults_value (SSDATA (name));
if (value)
return build_string (value);
if (NILP (value))
{
[[NSUserDefaults standardUserDefaults] removeObjectForKey:
- [NSString stringWithUTF8String: SDATA (name)]];
+ [NSString stringWithUTF8String: SSDATA (name)]];
}
else
{
CHECK_STRING (value);
[[NSUserDefaults standardUserDefaults] setObject:
- [NSString stringWithUTF8String: SDATA (value)]
+ [NSString stringWithUTF8String: SSDATA (value)]
forKey: [NSString stringWithUTF8String:
- SDATA (name)]];
+ SSDATA (name)]];
}
return Qnil;
{
if (!NILP (must_succeed))
fatal ("OpenStep on %s not responding.\n",
- SDATA (display));
+ SSDATA (display));
else
error ("OpenStep on %s not responding.\n",
- SDATA (display));
+ SSDATA (display));
}
/* Register our external input/output types, used for determining
{
char *nm;
CHECK_STRING (name);
- nm = SDATA (name);
+ nm = SSDATA (name);
if (nm[0] != '-')
return name;
if (strstr (nm, "fontset") && !strstr (nm, "fontset-startup"))
return name;
- return build_string (ns_xlfd_to_fontname (SDATA (name)));
+ return build_string (ns_xlfd_to_fontname (SSDATA (name)));
}
BLOCK_INPUT;
colorlists = [[NSColorList availableColorLists] objectEnumerator];
- while (clist = [colorlists nextObject])
+ while ((clist = [colorlists nextObject]))
{
if ([[clist name] length] < 7 ||
[[clist name] rangeOfString: @"PANTONE"].location == 0)
{
NSEnumerator *cnames = [[clist allKeys] reverseObjectEnumerator];
NSString *cname;
- while (cname = [cnames nextObject])
+ while ((cname = [cnames nextObject]))
list = Fcons (build_string ([cname UTF8String]), list);
/* for (i = [[clist allKeys] count] - 1; i >= 0; i--)
list = Fcons (build_string ([[[clist allKeys] objectAtIndex: i]
id pb;
NSString *svcName;
char *utfStr;
- int len;
CHECK_STRING (service);
check_ns ();
- utfStr = SDATA (service);
+ utfStr = SSDATA (service);
svcName = [NSString stringWithUTF8String: utfStr];
pb =[NSPasteboard pasteboardWithUniqueName];
NSString *utfStr;
CHECK_STRING (str);
- utfStr = [NSString stringWithUTF8String: SDATA (str)];
+ utfStr = [NSString stringWithUTF8String: SSDATA (str)];
if (![utfStr respondsToSelector:
@selector (precomposedStringWithCanonicalMapping)])
{
NSAppleScript* scriptObject =
[[NSAppleScript alloc] initWithSource:
- [NSString stringWithUTF8String: SDATA (script)]];
+ [NSString stringWithUTF8String: SSDATA (script)]];
returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
[scriptObject release];
else if (!STRINGP (result))
error ("AppleScript error %d", status);
else
- error ("%s", SDATA (result));
+ error ("%s", SSDATA (result));
}
#endif
that stands for the selected frame's display. */)
(Lisp_Object display)
{
- int top;
NSScreen *screen;
NSRect vScreen;
GCPRO4 (string, parms, frame, timeout);
CHECK_STRING (string);
- str = SDATA (string);
+ str = SSDATA (string);
f = check_x_frame (frame);
if (NILP (timeout))
timeout = make_number (5);
void
syms_of_nsfns (void)
{
- int i;
-
Qfontsize = intern_c_string ("fontsize");
staticpro (&Qfontsize);
return nil;
else
{
- char *tmp = xstrdup (SDATA (SYMBOL_NAME (tem)));
+ char *tmp = xstrdup (SSDATA (SYMBOL_NAME (tem)));
NSString *family;
ns_unescape_name (tmp);
family = [NSString stringWithUTF8String: tmp];
static NSString
*ns_lang_to_script (Lisp_Object lang)
{
- if (!strcmp (SDATA (SYMBOL_NAME (lang)), "ja"))
+ if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "ja"))
return @"han";
/* NOTE: ja given for any hanzi that's also a kanji, but Chinese fonts
have more characters. */
- else if (!strcmp (SDATA (SYMBOL_NAME (lang)), "zh"))
+ else if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "zh"))
return @"han";
- else if (!strcmp (SDATA (SYMBOL_NAME (lang)), "ko"))
+ else if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "ko"))
return @"hangul";
else
return @"";
{
Lisp_Object script = assq_no_quit (XCAR (otf), Votf_script_alist);
return CONSP (script)
- ? [NSString stringWithUTF8String: SDATA (SYMBOL_NAME (XCDR ((script))))]
+ ? [NSString stringWithUTF8String: SSDATA (SYMBOL_NAME (XCDR ((script))))]
: @"";
}
while CONSP (rts)
{
r = XCAR (XCAR (rts));
- if (!strncmp(SDATA(r), reg, strlen(SDATA(r))))
+ if (!strncmp(SSDATA(r), reg, strlen(SSDATA(r))))
{
script = XCDR (XCAR (rts));
- return [NSString stringWithUTF8String: SDATA (SYMBOL_NAME (script))];
+ return [NSString stringWithUTF8String: SSDATA (SYMBOL_NAME (script))];
}
rts = XCDR (rts);
}
Lisp_Object key = XCAR (tmp), val = XCDR (tmp);
if (EQ (key, QCscript) && SYMBOLP (val))
return [NSString stringWithUTF8String:
- SDATA (SYMBOL_NAME (val))];
+ SSDATA (SYMBOL_NAME (val))];
if (EQ (key, QClang) && SYMBOLP (val))
return ns_lang_to_script (val);
if (EQ (key, QCotf) && CONSP (val) && SYMBOLP (XCAR (val)))
if (EQ (reg, Qiso10646_1))
reg = Qiso8859_1;
#endif
- return ns_registry_to_script (SDATA (SYMBOL_NAME (reg)));
+ return ns_registry_to_script (SSDATA (SYMBOL_NAME (reg)));
}
return @"";
while (1)
{
NSEnumerator *allFamiliesEnum = [allFamilies objectEnumerator];
- while (family = [allFamiliesEnum nextObject])
+ while ((family = [allFamiliesEnum nextObject]))
{
NSCharacterSet *fset = [[fontMgr fontWithFamily: family
traits: 0 weight: 5 size: 12.0] coveredCharacterSet];
NSLog(@"Got desc %@ and found %d matching fonts from it: ", fdesc,
[matchingDescs count]);
- for (dEnum = [matchingDescs objectEnumerator]; desc = [dEnum nextObject]; )
+ for (dEnum = [matchingDescs objectEnumerator]; (desc = [dEnum nextObject]);)
{
if (![cFamilies containsObject:
[desc objectForKey: NSFontFamilyAttribute]])
[[[NSFontManager sharedFontManager] availableFontFamilies]
objectEnumerator];
NSString *family;
- while (family = [families nextObject])
+ while ((family = [families nextObject]))
list = Fcons (intern ([family UTF8String]), list);
/* FIXME: escape the name? */
Lisp_Object tem;
NSRect brect;
Lisp_Object font_object;
- int i;
int fixLeopardBug;
static NSMutableDictionary *fontCache = nil;
NSNumber *cached;
}
tem = AREF (font_entity, FONT_ADSTYLE_INDEX);
- synthItal = !NILP (tem) && !strncmp ("synthItal", SDATA (SYMBOL_NAME (tem)),
+ synthItal = !NILP (tem) && !strncmp ("synthItal", SSDATA (SYMBOL_NAME (tem)),
9);
family = ns_get_family (font_entity);
if (family == nil)
{
const char *fontName = [[nsfont fontName] UTF8String];
- int len = strlen (fontName);
/* The values specified by fonts are not always exact. For
* example, a 6x8 font could specify that the descender is
NS to render the string, it will come out differently from the individual
character widths added up because of layout processing. */
{
- XCharStruct *cs;
int cwidth, twidth = 0;
int hi, lo;
/* FIXME: composition: no vertical displacement is considered. */
{
NSData *data;
- data = [NSData dataWithBytes: SDATA (spec_data)
+ data = [NSData dataWithBytes: SSDATA (spec_data)
length: SBYTES (spec_data)];
eImg = [[EmacsImage alloc] initWithData: data];
[eImg setPixmapData];
/* look for an existing image of the same name */
while (image != nil &&
- [[image name] compare: [NSString stringWithUTF8String: SDATA (file)]]
+ [[image name] compare: [NSString stringWithUTF8String: SSDATA (file)]]
!= NSOrderedSame)
image = [image imageListNext];
return nil;
image = [[EmacsImage alloc] initByReferencingFile:
- [NSString stringWithUTF8String: SDATA (found)]];
+ [NSString stringWithUTF8String: SSDATA (found)]];
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]];
[image setScalesWhenResized: YES];
[image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])];
- [image setName: [NSString stringWithUTF8String: SDATA (file)]];
+ [image setName: [NSString stringWithUTF8String: SSDATA (file)]];
[image reference];
ImageList = [image imageListSetNext: ImageList];
- setXBMColor: (NSColor *)color
{
NSSize s = [self size];
- int len = (int) s.width * s.height;
unsigned char *planes[5];
CGFloat r, g, b, a;
NSColor *rgbColor;
NSImageRep *rep;
reps = [[self representations] objectEnumerator];
- while (rep = (NSImageRep *) [reps nextObject])
+ while ((rep = (NSImageRep *) [reps nextObject]))
{
if ([rep respondsToSelector: @selector (getBitmapDataPlanes:)])
{
/* FIXME: we'd like to only parse the needed submenu, but this
was causing crashes in the _common parsing code.. need to make
sure proper initialization done.. */
-/* if (submenu && strcmp (submenuTitle, SDATA (string)))
+/* if (submenu && strcmp (submenuTitle, SSDATA (string)))
continue; */
submenu_start[i] = menu_items_used;
if (!EQ (previous_items[i], AREF (menu_items, i)))
if (!(STRINGP (previous_items[i])
&& STRINGP (AREF (menu_items, i))
- && !strcmp (SDATA (previous_items[i]),
- SDATA (AREF (menu_items, i)))))
+ && !strcmp (SSDATA (previous_items[i]),
+ SSDATA (AREF (menu_items, i)))))
break;
if (i == previous_menu_items_used)
{
string = AREF (items, i + 1);
if (NILP (string))
break;
-/* if (submenu && strcmp (submenuTitle, SDATA (string)))
+/* if (submenu && strcmp (submenuTitle, SSDATA (string)))
continue; */
wv->name = SSDATA (string);
if (EQ (string, make_number (0))) // FIXME: Why??? --Stef
continue;
if (NILP (string))
- if (previous_strings[i][0])
- break;
- else
- continue;
- if (memcmp (previous_strings[i], SDATA (string),
+ {
+ if (previous_strings[i][0])
+ break;
+ else
+ continue;
+ }
+ else if (memcmp (previous_strings[i], SDATA (string),
min (10, SBYTES (string) + 1)))
break;
}
/* override designated initializer */
- initWithTitle: (NSString *)title
{
- if (self = [super initWithTitle: title])
+ if ((self = [super initWithTitle: title]))
[self setAutoenablesItems: NO];
return self;
}
{
EmacsMenu *pmenu;
NSPoint p;
- Lisp_Object window, tem, keymap;
+ Lisp_Object tem;
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
widget_value *wv, *first_wv = 0;
}
pmenu = [[EmacsMenu alloc] initWithTitle:
- [NSString stringWithUTF8String: SDATA (title)]];
+ [NSString stringWithUTF8String: SSDATA (title)]];
[pmenu fillWithWidgetValue: first_wv->contents];
free_menubar_widget_value_tree (first_wv);
unbind_to (specpdl_count, Qnil);
i * TOOL_BAR_ITEM_NSLOTS + (IDX))
BOOL enabled_p = !NILP (TOOLPROP (TOOL_BAR_ITEM_ENABLED_P));
- BOOL selected_p = !NILP (TOOLPROP (TOOL_BAR_ITEM_SELECTED_P));
int idx;
ptrdiff_t img_id;
struct image *img;
{
NSSize spacing = {SPACER, SPACER};
NSRect area;
- char this_cmd_name[80];
id cell;
static NSImageView *imgView;
static FlippedView *contentView;
item = XCAR (list);
if (XTYPE (item) == Lisp_String)
{
- [window addString: SDATA (item) row: row++];
+ [window addString: SSDATA (item) row: row++];
}
else if (XTYPE (item) == Lisp_Cons)
{
- [window addButton: SDATA (XCAR (item))
+ [window addButton: SSDATA (XCAR (item))
value: XCDR (item) row: row++];
}
else if (NILP (item))
if (XTYPE (head) == Lisp_String)
[title setStringValue:
- [NSString stringWithUTF8String: SDATA (head)]];
+ [NSString stringWithUTF8String: SSDATA (head)]];
else if (isQ == YES)
[title setStringValue: @"Question"];
else
}
/* AppKit-side interface */
-- menuDown: sender;
+- menuDown: (id)sender;
- toolbarClicked: (id)item;
- toggleToolbar: (id)sender;
- (void)keyDown: (NSEvent *)theEvent;
extern struct ns_display_info *x_display_list;
extern Lisp_Object ns_display_name_list;
-extern struct ns_display_info *ns_display_info_for_name ();
+extern struct ns_display_info *ns_display_info_for_name (Lisp_Object name);
struct ns_display_info *check_x_display_info (Lisp_Object frame);
FRAME_PTR check_x_frame (Lisp_Object frame);
(! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \
: FRAME_SCROLL_BAR_COLS (f))
-extern struct ns_display_info *ns_term_init ();
+extern struct ns_display_info *ns_term_init (Lisp_Object display_name);
extern void ns_term_shutdown (int sig);
/* constants for text rendering */
extern const char *ns_xlfd_to_fontname (const char *xlfd);
extern void check_ns (void);
-extern Lisp_Object ns_map_event_to_object ();
-extern Lisp_Object ns_string_from_pasteboard ();
-extern void ns_string_to_pasteboard ();
+extern Lisp_Object ns_map_event_to_object (void);
+#ifdef __OBJC__
+extern Lisp_Object ns_string_from_pasteboard (id pb);
+extern void ns_string_to_pasteboard (id pb, Lisp_Object str);
+#endif
extern Lisp_Object ns_get_local_selection (Lisp_Object selection_name,
Lisp_Object target_type);
-extern void nxatoms_of_nsselect ();
-extern int ns_lisp_to_cursor_type ();
+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 Lisp_Object Qnone;
extern void ns_set_name_as_filename (struct frame *f);
/* C access to ObjC functionality */
extern void ns_release_object (void *obj);
extern void ns_retain_object (void *obj);
-extern void *ns_alloc_autorelease_pool ();
-extern void ns_release_autorelease_pool ();
-extern const char *ns_get_defaults_value ();
+extern void *ns_alloc_autorelease_pool (void);
+extern void ns_release_autorelease_pool (void *);
+extern const char *ns_get_defaults_value (const char *key);
/* in nsmenu */
extern void update_frame_tool_bar (FRAME_PTR f);
extern void x_activate_menubar (struct frame *);
extern void free_frame_menubar (struct frame *);
extern void x_free_frame_resources (struct frame *);
+extern void x_destroy_window (struct frame *);
#define NSAPP_DATA2_RUNASSCRIPT 10
extern void ns_run_ascript (void);
static struct frame *ns_updating_frame;
static NSView *focus_view = NULL;
static int ns_window_num = 0;
+#ifdef NS_IMPL_GNUSTEP
static NSRect uRect;
+#endif
static BOOL gsaved = NO;
BOOL ns_in_resize = NO;
static BOOL ns_fake_keydown = NO;
pathEnum = [paths objectEnumerator];
resourcePaths = @"";
- while (resourcePath = [pathEnum nextObject])
+ while ((resourcePath = [pathEnum nextObject]))
{
if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
if (isDir)
/* Hack to skip site-lisp. */
if (no_site_lisp) resourcePath = [pathEnum nextObject];
- while (resourcePath = [pathEnum nextObject])
+ while ((resourcePath = [pathEnum nextObject]))
{
if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
if (isDir)
NSView *view = FRAME_NS_VIEW (f);
struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
- NSTRACE (x_destroy_window);
+ NSTRACE (x_free_frame_resources);
check_ns ();
[(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */
-------------------------------------------------------------------------- */
{
EmacsView *view = FRAME_NS_VIEW (f);
- EmacsToolbar *toolbar = [view toolbar];
NSWindow *window = [view window];
NSRect wr = [window frame];
int tb = FRAME_EXTERNAL_TOOL_BAR (f);
}
-static NSColor *
-ns_get_color_default (const char *name, NSColor *dflt)
-/* --------------------------------------------------------------------------
- Parse a color or use a default value
- -------------------------------------------------------------------------- */
-{
- NSColor * col;
-
- if (ns_get_color (name, &col))
- return dflt;
- else
- return col;
-}
-
-
int
ns_lisp_to_color (Lisp_Object color, NSColor **col)
/* --------------------------------------------------------------------------
{
NSTRACE (ns_lisp_to_color);
if (STRINGP (color))
- return ns_get_color (SDATA (color), col);
+ return ns_get_color (SSDATA (color), col);
else if (SYMBOLP (color))
- return ns_get_color (SDATA (SYMBOL_NAME (color)), col);
+ return ns_get_color (SSDATA (SYMBOL_NAME (color)), col);
return 1;
}
{
id view;
NSPoint position;
- int xchar, ychar;
Lisp_Object frame, tail;
struct frame *f;
struct ns_display_info *dpyinfo;
}
-void
+static void
ns_define_frame_cursor (struct frame *f, Cursor cursor)
/* --------------------------------------------------------------------------
External (RIF): set frame mouse pointer type.
}
-void
+static void
ns_clear_frame_area (struct frame *f, int x, int y, int width, int height)
/* --------------------------------------------------------------------------
External (RIF): Clear section of frame
External (RIF); compute left/right overhang of whole string and set in s
-------------------------------------------------------------------------- */
{
- struct face *face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
- struct font *font = s->font; /*face->font; */
+ struct font *font = s->font;
if (s->char2b)
{
}
-void
+static void
ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
int x, int y, int cursor_type, int cursor_width,
int on_p, int active_p)
BOOL barOnVeryLeft, barOnVeryRight;
int top, left, height, width, sb_width, sb_left;
EmacsScroller *bar;
-static int count = 0;
/* optimization; display engine sends WAY too many of these.. */
if (!NILP (window->vertical_scroll_bar))
Convert modifier name to lisp symbol
-------------------------------------------------------------------------- */
{
- if (!strncmp (SDATA (SYMBOL_NAME (Qmeta)), s, 10))
+ if (!strncmp (SSDATA (SYMBOL_NAME (Qmeta)), s, 10))
return Qmeta;
- else if (!strncmp (SDATA (SYMBOL_NAME (Qsuper)), s, 10))
+ else if (!strncmp (SSDATA (SYMBOL_NAME (Qsuper)), s, 10))
return Qsuper;
- else if (!strncmp (SDATA (SYMBOL_NAME (Qcontrol)), s, 10))
+ else if (!strncmp (SSDATA (SYMBOL_NAME (Qcontrol)), s, 10))
return Qcontrol;
- else if (!strncmp (SDATA (SYMBOL_NAME (Qalt)), s, 10))
+ else if (!strncmp (SSDATA (SYMBOL_NAME (Qalt)), s, 10))
return Qalt;
- else if (!strncmp (SDATA (SYMBOL_NAME (Qhyper)), s, 10))
+ else if (!strncmp (SSDATA (SYMBOL_NAME (Qhyper)), s, 10))
return Qhyper;
- else if (!strncmp (SDATA (SYMBOL_NAME (Qnone)), s, 10))
+ else if (!strncmp (SSDATA (SYMBOL_NAME (Qnone)), s, 10))
return Qnone;
else
return Qnil;
}
-static Lisp_Object ns_mod_to_lisp (int m)
-/* --------------------------------------------------------------------------
- Convert modifier code (see lisp.h) to lisp symbol
- -------------------------------------------------------------------------- */
-{
- if (m == CHAR_META)
- return Qmeta;
- else if (m == CHAR_SUPER)
- return Qsuper;
- else if (m == CHAR_CTL)
- return Qcontrol;
- else if (m == CHAR_ALT)
- return Qalt;
- else if (m == CHAR_HYPER)
- return Qhyper;
- else /* if (m == 0) */
- return Qnone;
-}
-
-
static void
ns_default (const char *parameter, Lisp_Object *result,
Lisp_Object yesval, Lisp_Object noval,
}
-void
+static void
ns_initialize_display_info (struct ns_display_info *dpyinfo)
/* --------------------------------------------------------------------------
Initialize global info and storage for display.
ns_delete_terminal (struct terminal *terminal)
{
struct ns_display_info *dpyinfo = terminal->display_info.ns;
- int i;
/* Protect against recursive calls. delete_frame in
delete_terminal calls us back when it deletes our last frame. */
if ( cl == nil )
{
Lisp_Object color_file, color_map, color;
- int r,g,b;
unsigned long c;
char *name;
for ( ; CONSP (color_map); color_map = XCDR (color_map))
{
color = XCAR (color_map);
- name = SDATA (XCAR (color));
+ name = SSDATA (XCAR (color));
c = XINT (XCDR (color));
[cl setColor:
[NSColor colorWithCalibratedRed: RED_FROM_ULONG (c) / 255.0
/* code not reached in emacs.c after this is called by shut_down_emacs: */
if (STRINGP (Vauto_save_list_file_name))
- unlink (SDATA (Vauto_save_list_file_name));
+ unlink (SSDATA (Vauto_save_list_file_name));
if (sig == 0 || sig == SIGTERM)
{
{
[ns_pending_service_names addObject: userData];
[ns_pending_service_args addObject: [NSString stringWithUTF8String:
- SDATA (ns_string_from_pasteboard (pboard))]];
+ SSDATA (ns_string_from_pasteboard (pboard))]];
}
if (!emacs_event)
return;
- if (newFont = [sender convertFont:
- ((struct nsfont_info *)face->font)->nsfont])
+ if ((newFont = [sender convertFont:
+ ((struct nsfont_info *)face->font)->nsfont]))
{
SET_FRAME_GARBAGED (emacsframe); /* now needed as of 2008/10 */
- (void)mouseDown: (NSEvent *)theEvent
{
NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
- Lisp_Object window;
NSTRACE (mouseDown);
- (void)windowDidResize: (NSNotification *)notification
{
+#ifdef NS_IMPL_GNUSTEP
NSWindow *theWindow = [notification object];
-#ifdef NS_IMPL_GNUSTEP
/* in GNUstep, at least currently, it's possible to get a didResize
without getting a willResize.. therefore we need to act as if we got
the willResize now */
Lisp_Object tem;
NSWindow *win;
NSButton *toggleButton;
- int vbextra = NS_SCROLL_BAR_WIDTH (f);
NSSize sz;
NSColor *col;
NSString *name;
tem = f->name;
name = [NSString stringWithUTF8String:
- NILP (tem) ? (unsigned char *)"Emacs" : SDATA (tem)];
+ NILP (tem) ? "Emacs" : SSDATA (tem)];
[win setTitle: name];
/* toolbar support */
tem = f->icon_name;
if (!NILP (tem))
[win setMiniwindowTitle:
- [NSString stringWithUTF8String: SDATA (tem)]];
+ [NSString stringWithUTF8String: SSDATA (tem)]];
{
NSScreen *screen = [win screen];
- (void)mouseEntered: (NSEvent *)theEvent
{
- NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
- struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe);
NSTRACE (mouseEntered);
-
last_mouse_movement_time = EV_TIMESTAMP (theEvent);
}
- (void)mouseExited: (NSEvent *)theEvent
{
- NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
- NSRect r;
Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL;
NSTRACE (mouseExited);
NSTRACE (menuDown);
if (context_menu_value == -1)
context_menu_value = [sender tag];
- else
- find_and_call_menu_selection (emacsframe, emacsframe->menu_bar_items_used,
- emacsframe->menu_bar_vector,
- (void *)[sender tag]);
+ else
+ {
+ NSInteger tag = [sender tag];
+ find_and_call_menu_selection (emacsframe, emacsframe->menu_bar_items_used,
+ emacsframe->menu_bar_vector,
+ (void *)tag);
+ }
+
ns_send_appdefined (-1);
return self;
}