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-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
#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>
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);
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.");
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;
}
/* 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. */
/* 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
/* 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 */
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));
"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. */);
(((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 *);
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;
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;
}
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.
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",
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;
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");
/* 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. */
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);
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;
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;
}
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. */
{
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)
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. */
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;
{
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");
/* 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. */
/* 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 *);