Commit f1310128 authored by Jan Djärv's avatar Jan Djärv

* nsfns.m, nsmenu.m, msterm.m: Adopt to struct frame/FVAR changes.

parent a3827a43
2012-07-31 Jan Djärv <jan.h.d@swipnet.se>
* nsfns.m, nsmenu.m, msterm.m: Adopt to struct frame/FVAR changes.
2012-07-31 Dmitry Antipov <dmantipov@yandex.ru>
Generalize INTERNAL_FIELD between buffers, keyboards and frames.
......
......@@ -448,16 +448,16 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
return;
f->icon_name = arg;
FVAR (f, icon_name) = arg;
if (NILP (arg))
{
if (!NILP (f->title))
arg = f->title;
if (!NILP (FVAR (f, title)))
arg = FVAR (f, title);
else
/* explicit name and no icon-name -> explicit_name */
if (f->explicit_name)
arg = f->name;
arg = FVAR (f, name);
else
{
/* no explicit name and no icon-name ->
......@@ -496,10 +496,10 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
if (! [[[view window] title] isEqualToString: str])
[[view window] setTitle: str];
if (!STRINGP (f->icon_name))
if (!STRINGP (FVAR (f, icon_name)))
encoded_icon_name = encoded_name;
else
encoded_icon_name = ENCODE_UTF_8 (f->icon_name);
encoded_icon_name = ENCODE_UTF_8 (FVAR (f, icon_name));
str = [NSString stringWithUTF8String: SSDATA (encoded_icon_name)];
......@@ -537,14 +537,14 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
CHECK_STRING (name);
/* Don't change the name if it's already NAME. */
if (! NILP (Fstring_equal (name, f->name)))
if (! NILP (Fstring_equal (name, FVAR (f, name))))
return;
f->name = name;
FVAR (f, name) = name;
/* title overrides explicit name */
if (! NILP (f->title))
name = f->title;
if (! NILP (FVAR (f, title)))
name = FVAR (f, title);
ns_set_name_internal (f, name);
}
......@@ -594,7 +594,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
FVAR (f, title) = name;
if (NILP (name))
name = f->name;
name = FVAR (f, name);
else
CHECK_STRING (name);
......@@ -607,7 +607,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
{
NSView *view;
Lisp_Object name, filename;
Lisp_Object buf = XWINDOW (f->selected_window)->buffer;
Lisp_Object buf = XWINDOW (FVAR (f, selected_window))->buffer;
const char *title;
NSAutoreleasePool *pool;
struct gcpro gcpro1;
......@@ -615,7 +615,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
NSString *str;
NSTRACE (ns_set_name_as_filename);
if (f->explicit_name || ! NILP (f->title) || ns_in_resize)
if (f->explicit_name || ! NILP (FVAR (f, title)) || ns_in_resize)
return;
BLOCK_INPUT;
......@@ -677,7 +677,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
[[view window] setRepresentedFilename: fstr];
[[view window] setTitle: str];
f->name = name;
FVAR (f, name) = name;
}
[pool release];
......@@ -690,7 +690,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
{
NSView *view = FRAME_NS_VIEW (f);
NSAutoreleasePool *pool;
if (!MINI_WINDOW_P (XWINDOW (f->selected_window)))
if (!MINI_WINDOW_P (XWINDOW (FVAR (f, selected_window))))
{
BLOCK_INPUT;
pool = [[NSAutoreleasePool alloc] init];
......@@ -777,7 +777,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
BLOCK_INPUT;
pool = [[NSAutoreleasePool alloc] init];
if (f->output_data.ns->miniimage
&& [[NSString stringWithUTF8String: SSDATA (f->name)]
&& [[NSString stringWithUTF8String: SSDATA (FVAR (f, name))]
isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]])
{
[pool release];
......@@ -785,7 +785,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
return;
}
tem = assq_no_quit (Qicon_type, f->param_alist);
tem = assq_no_quit (Qicon_type, FVAR (f, param_alist));
if (CONSP (tem) && ! NILP (XCDR (tem)))
{
[pool release];
......@@ -799,17 +799,17 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
{
elt = XCAR (chain);
/* special case: 't' means go by file type */
if (SYMBOLP (elt) && EQ (elt, Qt) && SSDATA (f->name)[0] == '/')
if (SYMBOLP (elt) && EQ (elt, Qt) && SSDATA (FVAR (f, name))[0] == '/')
{
NSString *str
= [NSString stringWithUTF8String: SSDATA (f->name)];
= [NSString stringWithUTF8String: SSDATA (FVAR (f, name))];
if ([[NSFileManager defaultManager] fileExistsAtPath: str])
image = [[[NSWorkspace sharedWorkspace] iconForFile: str] retain];
}
else if (CONSP (elt) &&
STRINGP (XCAR (elt)) &&
STRINGP (XCDR (elt)) &&
fast_string_match (XCAR (elt), f->name) >= 0)
fast_string_match (XCAR (elt), FVAR (f, name)) >= 0)
{
image = [EmacsImage allocInitFromFile: XCDR (elt)];
if (image == nil)
......@@ -1205,10 +1205,11 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
FRAME_FONTSET (f) = -1;
f->icon_name = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
FVAR (f, icon_name) = x_get_arg (dpyinfo, parms, Qicon_name,
"iconName", "Title",
RES_TYPE_STRING);
if (! STRINGP (f->icon_name))
f->icon_name = Qnil;
if (! STRINGP (FVAR (f, icon_name)))
FVAR (f, icon_name) = Qnil;
FRAME_NS_DISPLAY_INFO (f) = dpyinfo;
......@@ -1231,12 +1232,12 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
be set. */
if (EQ (name, Qunbound) || NILP (name) || ! STRINGP (name))
{
f->name = build_string ([ns_app_name UTF8String]);
FVAR (f, name) = build_string ([ns_app_name UTF8String]);
f->explicit_name = 0;
}
else
{
f->name = name;
FVAR (f, name) = name;
f->explicit_name = 1;
specbind (Qx_resource_name, name);
}
......@@ -1397,7 +1398,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
by x_get_arg and friends, now go in the misc. alist of the frame. */
for (tem = parms; CONSP (tem); tem = XCDR (tem))
if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
f->param_alist = Fcons (XCAR (tem), f->param_alist);
FVAR (f, param_alist) = Fcons (XCAR (tem), FVAR (f, param_alist));
UNGCPRO;
......
......@@ -222,13 +222,13 @@
/* Save the frame's previous menu bar contents data */
if (previous_menu_items_used)
memcpy (previous_items, &AREF (f->menu_bar_vector, 0),
memcpy (previous_items, &AREF (FVAR (f, menu_bar_vector), 0),
previous_menu_items_used * sizeof (Lisp_Object));
/* parse stage 1: extract from lisp */
save_menu_items ();
menu_items = f->menu_bar_vector;
menu_items = FVAR (f, menu_bar_vector);
menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
submenu_start = alloca (ASIZE (items) * sizeof *submenu_start);
submenu_end = alloca (ASIZE (items) * sizeof *submenu_end);
......@@ -341,7 +341,7 @@
}
/* The menu items are different, so store them in the frame */
/* FIXME: this is not correct for single-submenu case */
f->menu_bar_vector = menu_items;
FVAR (f, menu_bar_vector) = menu_items;
f->menu_bar_items_used = menu_items_used;
/* Calls restore_menu_items, etc., as they were outside */
......@@ -1041,7 +1041,7 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
/* update EmacsToolbar as in GtkUtils, build items list */
for (i = 0; i < f->n_tool_bar_items; ++i)
{
#define TOOLPROP(IDX) AREF (f->tool_bar_items, \
#define TOOLPROP(IDX) AREF (FVAR (f, tool_bar_items), \
i * TOOL_BAR_ITEM_NSLOTS + (IDX))
BOOL enabled_p = !NILP (TOOLPROP (TOOL_BAR_ITEM_ENABLED_P));
......
......@@ -1306,7 +1306,7 @@ Free a pool and temporary objects it refers to (callable from C)
FRAME_PIXEL_HEIGHT (f) = pixelheight;
/* SET_FRAME_GARBAGED (f); // this short-circuits expose call in drawRect */
mark_window_cursors_off (XWINDOW (f->root_window));
mark_window_cursors_off (XWINDOW (FVAR (f, root_window)));
cancel_mouse_face (f);
UNBLOCK_INPUT;
......@@ -5535,7 +5535,7 @@ - (BOOL)isOpaque
if (ns_drag_types)
[self registerForDraggedTypes: ns_drag_types];
tem = f->name;
tem = FVAR (f, name);
name = [NSString stringWithUTF8String:
NILP (tem) ? "Emacs" : SSDATA (tem)];
[win setTitle: name];
......@@ -5553,7 +5553,7 @@ - (BOOL)isOpaque
#endif
FRAME_TOOLBAR_HEIGHT (f) = 0;
tem = f->icon_name;
tem = FVAR (f, icon_name);
if (!NILP (tem))
[win setMiniwindowTitle:
[NSString stringWithUTF8String: SSDATA (tem)]];
......@@ -5734,7 +5734,7 @@ - (void)mouseExited: (NSEvent *)theEvent
{
NSInteger tag = [sender tag];
find_and_call_menu_selection (emacsframe, emacsframe->menu_bar_items_used,
emacsframe->menu_bar_vector,
FVAR (emacsframe, menu_bar_vector),
(void *)tag);
}
......@@ -5768,7 +5768,7 @@ - (EmacsToolbar *)toolbar
emacs_event->kind = TOOL_BAR_EVENT;
/* XSETINT (emacs_event->code, 0); */
emacs_event->arg = AREF (emacsframe->tool_bar_items,
emacs_event->arg = AREF (FVAR (emacsframe, tool_bar_items),
idx + TOOL_BAR_ITEM_KEY);
emacs_event->modifiers = EV_MODIFIERS (theEvent);
EV_TRAILER (theEvent);
......@@ -6056,7 +6056,8 @@ - (id)accessibilityAttributeValue:(NSString *)attribute
{
Lisp_Object str = Qnil;
struct frame *f = SELECTED_FRAME ();
struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->buffer);
struct buffer *curbuf
= XBUFFER (XWINDOW (FVAR (f, selected_window))->buffer);
if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
return NSAccessibilityTextFieldRole;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment