Remove port-specific display name lists to avoid extra

complexity and data duplication with display info lists.
* xterm.h (x_display_name_list): Remove declaration.
* xterm.c (x_display_name_list): Remove.
(x_term_init, x_delete_display, syms_of_xterm): Adjust users.
* xfns.c (x_display_info_for_name, Fx_display_list):
Likewise.  Use x_display_list where appropriate.
* w32term.h (w32_display_name_list): Remove declaration.
* w32term.c (w32_display_name_list): Remove.
(w32_initialize_display_info, x_delete_display, syms_of_w32term):
Adjust users.
* w32fns.c (x_display_info_for_name, Fx_display_list):
Likewise.  Use x_display_list where appropriate.
* nsterm.h (ns_display_name_list): Remove declaration.
* nsterm.m (ns_display_name_list): Remove.
(ns_term_init, syms_of_nsterm): Adjust users.
* nsfns.m (ns_display_info_for_name, Fx_display_list):
Likewise.  Use x_display_list where appropriate.
* termhooks.h (TERMINAL_FONT_CACHE): New macro.
* alloc.c (toplevel) [HAVE_WINDOW_SYSTEM]: Include TERM_HEADER.
(mark_terminals): Mark per-terminal font cache.
This commit is contained in:
Dmitry Antipov 2013-10-18 16:57:44 +04:00
parent f0ff1cd576
commit d141d70112
12 changed files with 73 additions and 145 deletions

View file

@ -1,3 +1,27 @@
2013-10-18 Dmitry Antipov <dmantipov@yandex.ru>
Remove port-specific display name lists to avoid extra
complexity and data duplication with display info lists.
* xterm.h (x_display_name_list): Remove declaration.
* xterm.c (x_display_name_list): Remove.
(x_term_init, x_delete_display, syms_of_xterm): Adjust users.
* xfns.c (x_display_info_for_name, Fx_display_list):
Likewise. Use x_display_list where appropriate.
* w32term.h (w32_display_name_list): Remove declaration.
* w32term.c (w32_display_name_list): Remove.
(w32_initialize_display_info, x_delete_display, syms_of_w32term):
Adjust users.
* w32fns.c (x_display_info_for_name, Fx_display_list):
Likewise. Use x_display_list where appropriate.
* nsterm.h (ns_display_name_list): Remove declaration.
* nsterm.m (ns_display_name_list): Remove.
(ns_term_init, syms_of_nsterm): Adjust users.
* nsfns.m (ns_display_info_for_name, Fx_display_list):
Likewise. Use x_display_list where appropriate.
* termhooks.h (TERMINAL_FONT_CACHE): New macro.
* alloc.c (toplevel) [HAVE_WINDOW_SYSTEM]: Include TERM_HEADER.
(mark_terminals): Mark per-terminal font cache.
2013-10-17 Barry O'Reilly <gundaetiapo@gmail.com>
Don't run timers in input-pending-p. Its new check-timers param

View file

@ -42,6 +42,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "frame.h"
#include "blockinput.h"
#include "termhooks.h" /* For struct terminal. */
#ifdef HAVE_WINDOW_SYSTEM
#include TERM_HEADER
#endif /* HAVE_WINDOW_SYSTEM */
#include <verify.h>
@ -6115,6 +6118,9 @@ mark_terminals (void)
it might have been marked already. Make sure the image cache
gets marked. */
mark_image_cache (t->image_cache);
/* FIXME: currently font cache may grow too large
and probably needs special finalization. */
mark_object (TERMINAL_FONT_CACHE (t));
#endif /* HAVE_WINDOW_SYSTEM */
if (!VECTOR_MARKED_P (t))
mark_vectorlike ((struct Lisp_Vector *)t);

View file

@ -175,20 +175,13 @@ Updated by Christian Limpach (chris@nice.ch)
struct ns_display_info *
ns_display_info_for_name (Lisp_Object name)
{
Lisp_Object names;
struct ns_display_info *dpyinfo;
CHECK_STRING (name);
for (dpyinfo = x_display_list, names = ns_display_name_list;
dpyinfo;
dpyinfo = dpyinfo->next, names = XCDR (names))
{
Lisp_Object tem;
tem = Fstring_equal (XCAR (XCAR (names)), name);
if (!NILP (tem))
return dpyinfo;
}
for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
if (!NILP (Fstring_equal (XCAR (dpyinfo->name_list_element), name)))
return dpyinfo;
error ("Emacs for OpenStep does not yet support multi-display.");
@ -1843,11 +1836,11 @@ and GNUstep implementations ("distributor-specific release
doc: /* Return the list of display names that Emacs has connections to. */)
(void)
{
Lisp_Object tail, result;
Lisp_Object result = Qnil;
struct ns_display_info *ndi;
result = Qnil;
for (tail = ns_display_name_list; CONSP (tail); tail = XCDR (tail))
result = Fcons (XCAR (XCAR (tail)), result);
for (ndi = x_display_list; ndi; ndi = ndi->next)
result = Fcons (XCAR (ndi->name_list_element), result);
return result;
}

View file

@ -552,8 +552,7 @@ struct ns_display_info
/* The generic display parameters corresponding to this NS display. */
struct terminal *terminal;
/* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
The same cons cell also appears in ns_display_name_list. */
/* This is a cons cell of the form (NAME . FONT-LIST-CACHE). */
Lisp_Object name_list_element;
/* The number of fonts loaded. */
@ -624,7 +623,6 @@ struct ns_display_info
/* This is a chain of structures for all the NS displays currently in use. */
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 (Lisp_Object name);
struct ns_output

View file

@ -184,7 +184,6 @@ Updated by Christian Limpach (chris@nice.ch)
/* Display variables */
struct ns_display_info *x_display_list; /* Chain of existing displays */
Lisp_Object ns_display_name_list;
long context_menu_value = 0;
/* display update */
@ -4173,10 +4172,7 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes.
dpyinfo->next = x_display_list;
x_display_list = dpyinfo;
/* Put it on ns_display_name_list */
ns_display_name_list = Fcons (Fcons (display_name, Qnil),
ns_display_name_list);
dpyinfo->name_list_element = XCAR (ns_display_name_list);
dpyinfo->name_list_element = Fcons (display_name, Qnil);
terminal->name = xstrdup (SSDATA (display_name));
@ -7460,9 +7456,6 @@ Convert an X font name (XLFD) to an NS font name.
"Whether to confirm application quit using dialog.");
ns_confirm_quit = Qnil;
staticpro (&ns_display_name_list);
ns_display_name_list = Qnil;
DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar,
doc: /* Non-nil means that the menu bar is hidden, but appears when the mouse is near.
Only works on OSX 10.6 or later. */);

View file

@ -623,6 +623,19 @@ extern struct terminal *terminal_list;
(((d)->type != output_termcap && (d)->type != output_msdos_raw) \
|| (d)->display_info.tty->input)
/* Return font cache data for the specified terminal. The historical
name is grossly misleading, actually it is (NAME . FONT-LIST-CACHE). */
#if defined (HAVE_X_WINDOWS)
#define TERMINAL_FONT_CACHE(t) \
(t->type == output_x_window ? t->display_info.x->name_list_element : Qnil)
#elif defined (HAVE_NTGUI)
#define TERMINAL_FONT_CACHE(t) \
(t->type == output_w32 ? t->display_info.w32->name_list_element : Qnil)
#elif defined (HAVE_NS)
#define TERMINAL_FONT_CACHE(t) \
(t->type == output_ns ? t->display_info.ns->name_list_element : Qnil)
#endif
extern struct terminal *get_terminal (Lisp_Object terminal, bool);
extern struct terminal *create_terminal (void);
extern void delete_terminal (struct terminal *);

View file

@ -5126,20 +5126,13 @@ x_screen_planes (register struct frame *f)
struct w32_display_info *
x_display_info_for_name (Lisp_Object name)
{
Lisp_Object names;
struct w32_display_info *dpyinfo;
CHECK_STRING (name);
for (dpyinfo = &one_w32_display_info, names = w32_display_name_list;
dpyinfo && !NILP (w32_display_name_list);
dpyinfo = dpyinfo->next, names = XCDR (names))
{
Lisp_Object tem;
tem = Fstring_equal (XCAR (XCAR (names)), name);
if (!NILP (tem))
return dpyinfo;
}
for (dpyinfo = &one_w32_display_info; dpyinfo; dpyinfo = dpyinfo->next)
if (!NILP (Fstring_equal (XCAR (dpyinfo->name_list_element), name)))
return dpyinfo;
/* Use this general default value to start with. */
Vx_resource_name = Vinvocation_name;
@ -5274,11 +5267,11 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
doc: /* Return the list of display names that Emacs has connections to. */)
(void)
{
Lisp_Object tail, result;
Lisp_Object result = Qnil;
struct w32_display_info *wdi;
result = Qnil;
for (tail = w32_display_name_list; CONSP (tail); tail = XCDR (tail))
result = Fcons (XCAR (XCAR (tail)), result);
for (wdi = x_display_list; wdi; wdi = wdi->next)
result = Fcons (XCAR (wdi->name_list_element), result);
return result;
}

View file

@ -99,13 +99,6 @@ extern Cursor w32_load_cursor (LPCTSTR name);
struct w32_display_info one_w32_display_info;
struct w32_display_info *x_display_list;
/* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE),
one for each element of w32_display_list and in the same order.
NAME is the name of the frame.
FONT-LIST-CACHE records previous values returned by x-list-fonts. */
Lisp_Object w32_display_name_list;
#if _WIN32_WINNT < 0x0500 && !defined(_W64)
/* Pre Windows 2000, this was not available, but define it here so
that Emacs compiled on such a platform will run on newer versions.
@ -6105,11 +6098,7 @@ w32_initialize_display_info (Lisp_Object display_name)
memset (dpyinfo, 0, sizeof (*dpyinfo));
/* Put it on w32_display_name_list. */
w32_display_name_list = Fcons (Fcons (display_name, Qnil),
w32_display_name_list);
dpyinfo->name_list_element = XCAR (w32_display_name_list);
dpyinfo->name_list_element = Fcons (display_name, Qnil);
dpyinfo->w32_id_name = xmalloc (SCHARS (Vinvocation_name)
+ SCHARS (Vsystem_name) + 2);
sprintf (dpyinfo->w32_id_name, "%s@%s",
@ -6357,27 +6346,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
void
x_delete_display (struct w32_display_info *dpyinfo)
{
/* Discard this display from w32_display_name_list and w32_display_list.
We can't use Fdelq because that can quit. */
if (! NILP (w32_display_name_list)
&& EQ (XCAR (w32_display_name_list), dpyinfo->name_list_element))
w32_display_name_list = XCDR (w32_display_name_list);
else
{
Lisp_Object tail;
tail = w32_display_name_list;
while (CONSP (tail) && CONSP (XCDR (tail)))
{
if (EQ (XCAR (XCDR (tail)), dpyinfo->name_list_element))
{
XSETCDR (tail, XCDR (XCDR (tail)));
break;
}
tail = XCDR (tail);
}
}
/* FIXME: the only display info apparently can't be deleted. */
/* free palette table */
{
struct w32_palette_entry * plist;
@ -6515,9 +6484,6 @@ w32_initialize (void)
void
syms_of_w32term (void)
{
staticpro (&w32_display_name_list);
w32_display_name_list = Qnil;
DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms");
DEFSYM (Qadded, "added");

View file

@ -86,8 +86,7 @@ struct w32_display_info
/* The generic display parameters corresponding to this w32 display. */
struct terminal *terminal;
/* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
The same cons cell also appears in x_display_name_list. */
/* This is a cons cell of the form (NAME . FONT-LIST-CACHE). */
Lisp_Object name_list_element;
/* Number of frames that are on this display. */
@ -216,12 +215,6 @@ struct w32_display_info
extern struct w32_display_info *x_display_list;
extern struct w32_display_info one_w32_display_info;
/* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE),
one for each element of w32_display_list and in the same order.
NAME is the name of the frame.
FONT-LIST-CACHE records previous values returned by x-list-fonts. */
extern Lisp_Object w32_display_name_list;
extern struct frame *x_window_to_frame (struct w32_display_info *, HWND);
struct w32_display_info *x_display_info_for_name (Lisp_Object);

View file

@ -4242,20 +4242,13 @@ select_visual (struct x_display_info *dpyinfo)
static struct x_display_info *
x_display_info_for_name (Lisp_Object name)
{
Lisp_Object names;
struct x_display_info *dpyinfo;
CHECK_STRING (name);
for (dpyinfo = x_display_list, names = x_display_name_list;
dpyinfo;
dpyinfo = dpyinfo->next, names = XCDR (names))
{
Lisp_Object tem;
tem = Fstring_equal (XCAR (XCAR (names)), name);
if (!NILP (tem))
return dpyinfo;
}
for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
if (!NILP (Fstring_equal (XCAR (dpyinfo->name_list_element), name)))
return dpyinfo;
/* Use this general default value to start with. */
Vx_resource_name = Vinvocation_name;
@ -4338,11 +4331,11 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
doc: /* Return the list of display names that Emacs has connections to. */)
(void)
{
Lisp_Object tail, result;
Lisp_Object result = Qnil;
struct x_display_info *xdi;
result = Qnil;
for (tail = x_display_name_list; CONSP (tail); tail = XCDR (tail))
result = Fcons (XCAR (XCAR (tail)), result);
for (xdi = x_display_list; xdi; xdi = xdi->next)
result = Fcons (XCAR (xdi->name_list_element), result);
return result;
}

View file

@ -148,13 +148,6 @@ static bool any_help_event_p;
struct x_display_info *x_display_list;
/* This is a list of cons cells, each of the form (NAME
. FONT-LIST-CACHE), one for each element of x_display_list and in
the same order. NAME is the name of the frame. FONT-LIST-CACHE
records previous values returned by x-list-fonts. */
Lisp_Object x_display_name_list;
#ifdef USE_X_TOOLKIT
/* The application context for Xt use. */
@ -9894,11 +9887,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
{
struct x_display_info *share;
Lisp_Object tail;
for (share = x_display_list, tail = x_display_name_list; share;
share = share->next, tail = XCDR (tail))
if (same_x_server (SSDATA (XCAR (XCAR (tail))),
for (share = x_display_list; share; share = share->next)
if (same_x_server (SSDATA (XCAR (share->name_list_element)),
SSDATA (display_name)))
break;
if (share)
@ -9944,11 +9935,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
dpyinfo->next = x_display_list;
x_display_list = dpyinfo;
/* Put it on x_display_name_list as well, to keep them parallel. */
x_display_name_list = Fcons (Fcons (display_name, Qnil),
x_display_name_list);
dpyinfo->name_list_element = XCAR (x_display_name_list);
dpyinfo->name_list_element = Fcons (display_name, Qnil);
dpyinfo->display = dpy;
/* Set the name of the terminal. */
@ -10275,27 +10262,6 @@ x_delete_display (struct x_display_info *dpyinfo)
break;
}
/* Discard this display from x_display_name_list and x_display_list.
We can't use Fdelq because that can quit. */
if (! NILP (x_display_name_list)
&& EQ (XCAR (x_display_name_list), dpyinfo->name_list_element))
x_display_name_list = XCDR (x_display_name_list);
else
{
Lisp_Object tail;
tail = x_display_name_list;
while (CONSP (tail) && CONSP (XCDR (tail)))
{
if (EQ (XCAR (XCDR (tail)), dpyinfo->name_list_element))
{
XSETCDR (tail, XCDR (XCDR (tail)));
break;
}
tail = XCDR (tail);
}
}
if (next_noop_dpyinfo == dpyinfo)
next_noop_dpyinfo = dpyinfo->next;
@ -10565,9 +10531,6 @@ syms_of_xterm (void)
{
x_error_message = NULL;
staticpro (&x_display_name_list);
x_display_name_list = Qnil;
DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms");
DEFSYM (Qlatin_1, "latin-1");

View file

@ -142,8 +142,7 @@ struct x_display_info
/* This says how to access this display in Xlib. */
Display *display;
/* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
The same cons cell also appears in x_display_name_list. */
/* This is a cons cell of the form (NAME . FONT-LIST-CACHE). */
Lisp_Object name_list_element;
/* Number of frames that are on this display. */
@ -412,12 +411,6 @@ extern int use_xim;
/* This is a chain of structures for all the X displays currently in use. */
extern struct x_display_info *x_display_list;
/* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE),
one for each element of x_display_list and in the same order.
NAME is the name of the frame.
FONT-LIST-CACHE records previous values returned by x-list-fonts. */
extern Lisp_Object x_display_name_list;
extern struct x_display_info *x_display_info_for_display (Display *);
extern struct frame *x_top_window_to_frame (struct x_display_info *, int);
extern struct x_display_info *x_term_init (Lisp_Object, char *, char *);