#include <stdio.h>
#include <math.h>
#include <setjmp.h>
-#include <ctype.h>
#include <unistd.h>
/* This makes the fields of a Display accessible, in Xlib header files. */
#ifdef HAVE_X_WINDOWS
-#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
int x_in_use;
-static Lisp_Object Qnone;
static Lisp_Object Qsuppress_icon;
static Lisp_Object Qundefined_color;
static Lisp_Object Qcompound_text, Qcancel_timer;
static int dpyinfo_refcount;
#endif
-#if defined (USE_GTK) && defined (HAVE_FREETYPE)
-static char *x_last_font_name;
-#endif
-
static struct x_display_info *x_display_info_for_name (Lisp_Object);
\f
#ifdef USE_GTK
if (xg_change_toolbar_position (f, new_value))
- FSET (f, tool_bar_position, new_value);
+ fset_tool_bar_position (f, new_value);
#endif
}
BLOCK_INPUT;
if (NILP (arg))
result = x_text_icon (f,
- SSDATA ((!NILP (FGET (f, icon_name))
- ? FGET (f, icon_name)
- : FGET (f, name))));
+ SSDATA ((!NILP (f->icon_name)
+ ? f->icon_name
+ : f->name)));
else
result = x_bitmap_icon (f, arg);
else if (!NILP (arg) || NILP (oldval))
return;
- FSET (f, icon_name, arg);
+ fset_icon_name (f, arg);
if (f->output_data.x->icon_bitmap != 0)
return;
BLOCK_INPUT;
result = x_text_icon (f,
- SSDATA ((!NILP (FGET (f, icon_name))
- ? FGET (f, icon_name)
- : !NILP (FGET (f, title))
- ? FGET (f, title)
- : FGET (f, name))));
+ SSDATA ((!NILP (f->icon_name)
+ ? f->icon_name
+ : !NILP (f->title)
+ ? f->title
+ : f->name)));
if (result)
{
UNBLOCK_INPUT;
}
- if (nlines == 0 && WINDOWP (FGET (f, menu_bar_window)))
- clear_glyph_matrix (XWINDOW (FGET (f, menu_bar_window))->current_matrix);
+ if (nlines == 0 && WINDOWP (f->menu_bar_window))
+ clear_glyph_matrix (XWINDOW (f->menu_bar_window)->current_matrix);
}
#endif /* not USE_X_TOOLKIT && not USE_GTK */
adjust_glyphs (f);
UNBLOCK_INPUT;
}
- if (WINDOWP (FGET (f, tool_bar_window)))
- clear_glyph_matrix (XWINDOW (FGET (f, tool_bar_window))->current_matrix);
+ if (WINDOWP (f->tool_bar_window))
+ clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
}
run_window_configuration_change_hook (f);
if (text.nitems != bytes)
error ("Window name too large");
- if (!STRINGP (FGET (f, icon_name)))
+ if (!STRINGP (f->icon_name))
{
icon = text;
encoded_icon_name = encoded_name;
else
{
/* See the above comment "Note: Encoding strategy". */
- icon.value = x_encode_text (FGET (f, icon_name), coding_system, 0,
+ icon.value = x_encode_text (f->icon_name, coding_system, 0,
&bytes, &stringp, &do_free_icon_value);
icon.encoding = (stringp ? XA_STRING
: FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
if (icon.nitems != bytes)
error ("Icon name too large");
- encoded_icon_name = ENCODE_UTF_8 (FGET (f, icon_name));
+ encoded_icon_name = ENCODE_UTF_8 (f->icon_name);
}
#ifdef USE_GTK
/* Check for no change needed in this very common case
before we do any consing. */
if (!strcmp (FRAME_X_DISPLAY_INFO (f)->x_id_name,
- SSDATA (FGET (f, name))))
+ SSDATA (f->name)))
return;
name = build_string (FRAME_X_DISPLAY_INFO (f)->x_id_name);
}
CHECK_STRING (name);
/* Don't change the name if it's already NAME. */
- if (! NILP (Fstring_equal (name, FGET (f, name))))
+ if (! NILP (Fstring_equal (name, f->name)))
return;
- FSET (f, name, name);
+ fset_name (f, name);
/* For setting the frame title, the title parameter should override
the name parameter. */
- if (! NILP (FGET (f, title)))
- name = FGET (f, title);
+ if (! NILP (f->title))
+ name = f->title;
x_set_name_internal (f, name);
}
x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
{
/* Don't change the title if it's already NAME. */
- if (EQ (name, FGET (f, title)))
+ if (EQ (name, f->title))
return;
update_mode_lines = 1;
- FSET (f, title, name);
+ fset_title (f, name);
if (NILP (name))
- name = FGET (f, name);
+ name = f->name;
else
CHECK_STRING (name);
void
xic_set_preeditarea (struct window *w, int x, int y)
{
- struct frame *f = XFRAME (WVAR (w, frame));
+ struct frame *f = XFRAME (w->frame);
XVaNestedList attr;
XPoint spot;
int explicit = f->explicit_name;
f->explicit_name = 0;
- name = FGET (f, name);
- FSET (f, name, Qnil);
+ name = f->name;
+ fset_name (f, Qnil);
x_set_name (f, name, explicit);
}
int explicit = f->explicit_name;
f->explicit_name = 0;
- name = FGET (f, name);
- FSET (f, name, Qnil);
+ name = f->name;
+ fset_name (f, Qnil);
x_set_name (f, name, explicit);
}
: NormalState));
#endif
- x_text_icon (f, SSDATA ((!NILP (FGET (f, icon_name))
- ? FGET (f, icon_name)
- : FGET (f, name))));
+ x_text_icon (f, SSDATA ((!NILP (f->icon_name)
+ ? f->icon_name
+ : f->name)));
UNBLOCK_INPUT;
}
f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
#endif /* USE_TOOLKIT_SCROLL_BARS */
- FSET (f, icon_name,
- x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
- RES_TYPE_STRING));
- if (! STRINGP (FGET (f, icon_name)))
- FSET (f, icon_name, Qnil);
+ fset_icon_name (f,
+ x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
+ RES_TYPE_STRING));
+ if (! STRINGP (f->icon_name))
+ fset_icon_name (f, Qnil);
FRAME_X_DISPLAY_INFO (f) = dpyinfo;
be set. */
if (EQ (name, Qunbound) || NILP (name))
{
- FSET (f, name, build_string (dpyinfo->x_id_name));
+ fset_name (f, build_string (dpyinfo->x_id_name));
f->explicit_name = 0;
}
else
{
- FSET (f, name, name);
+ fset_name (f, name);
f->explicit_name = 1;
/* use the frame's title when getting resources for this frame. */
specbind (Qx_resource_name, name);
x_default_parameter (f, parms, Qfullscreen, Qnil,
"fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
x_default_parameter (f, parms, Qtool_bar_position,
- FGET (f, tool_bar_position), 0, 0, RES_TYPE_SYMBOL);
+ f->tool_bar_position, 0, 0, RES_TYPE_SYMBOL);
/* Compute the size of the X window. */
window_prompting = x_figure_window_size (f, parms, 1);
if (FRAME_HAS_MINIBUF_P (f)
&& (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
|| !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
- KVAR (kb, Vdefault_minibuffer_frame) = frame;
+ kset_default_minibuffer_frame (kb, frame);
/* All remaining specified parameters, which have not been "used"
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))))
- FSET (f, param_alist, Fcons (XCAR (tem), FGET (f, param_alist)));
+ fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
UNGCPRO;
XSETFRAME (frame, f);
buffer = Fget_buffer_create (build_string (" *tip*"));
- Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
+ /* Use set_window_buffer instead of Fset_window_buffer (see
+ discussion of bug#11984, bug#12025, bug#12026). */
+ set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0);
old_buffer = current_buffer;
set_buffer_internal_1 (XBUFFER (buffer));
- BVAR (current_buffer, truncate_lines) = Qnil;
+ bset_truncate_lines (current_buffer, Qnil);
specbind (Qinhibit_read_only, Qt);
specbind (Qinhibit_modification_hooks, Qt);
Ferase_buffer ();
f->output_data.x->scroll_bar_top_shadow_pixel = -1;
f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
#endif /* USE_TOOLKIT_SCROLL_BARS */
- FSET (f, icon_name, Qnil);
+ fset_icon_name (f, Qnil);
FRAME_X_DISPLAY_INFO (f) = dpyinfo;
f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
f->output_data.x->explicit_parent = 0;
be set. */
if (EQ (name, Qunbound) || NILP (name))
{
- FSET (f, name, build_string (dpyinfo->x_id_name));
+ fset_name (f, build_string (dpyinfo->x_id_name));
f->explicit_name = 0;
}
else
{
- FSET (f, name, name);
+ fset_name (f, name);
f->explicit_name = 1;
/* use the frame's title when getting resources for this frame. */
specbind (Qx_resource_name, name);
/* Set up the frame's root window. */
w = XWINDOW (FRAME_ROOT_WINDOW (f));
- WVAR (w, left_col) = WVAR (w, top_line) = make_number (0);
+ wset_left_col (w, make_number (0));
+ wset_top_line (w, make_number (0));
if (CONSP (Vx_max_tooltip_size)
&& RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
&& RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
{
- WVAR (w, total_cols) = XCAR (Vx_max_tooltip_size);
- WVAR (w, total_lines) = XCDR (Vx_max_tooltip_size);
+ wset_total_cols (w, XCAR (Vx_max_tooltip_size));
+ wset_total_lines (w, XCDR (Vx_max_tooltip_size));
}
else
{
- WVAR (w, total_cols) = make_number (80);
- WVAR (w, total_lines) = make_number (40);
+ wset_total_cols (w, make_number (80));
+ wset_total_lines (w, make_number (40));
}
- FRAME_TOTAL_COLS (f) = XINT (WVAR (w, total_cols));
+ FRAME_TOTAL_COLS (f) = XINT (w->total_cols);
adjust_glyphs (f);
w->pseudo_window_p = 1;
/* Display the tooltip text in a temporary buffer. */
old_buffer = current_buffer;
- set_buffer_internal_1 (XBUFFER (WVAR (XWINDOW (FRAME_ROOT_WINDOW (f)), buffer)));
- BVAR (current_buffer, truncate_lines) = Qnil;
+ set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
+ bset_truncate_lines (current_buffer, Qnil);
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
/* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
not in pixels. */
width /= WINDOW_FRAME_COLUMN_WIDTH (w);
- WVAR (w, total_cols) = make_number (width);
+ wset_total_cols (w, make_number (width));
FRAME_TOTAL_COLS (f) = width;
adjust_glyphs (f);
clear_glyph_matrix (w->desired_matrix);
#ifdef HAVE_FREETYPE
DEFUN ("x-select-font", Fx_select_font, Sx_select_font, 0, 2, 0,
- doc: /* Read a font name using a GTK font selection dialog.
-Return a GTK-style font string corresponding to the selection.
+ doc: /* Read a font using a GTK dialog.
+Return either a font spec (for GTK versions >= 3.2) or a string
+containing a GTK-style font name.
-If FRAME is omitted or nil, it defaults to the selected frame. */)
+FRAME is the frame on which to pop up the font chooser. If omitted or
+nil, it defaults to the selected frame. */)
(Lisp_Object frame, Lisp_Object ignored)
{
FRAME_PTR f = check_x_frame (frame);
- char *name;
Lisp_Object font;
Lisp_Object font_param;
char *default_name = NULL;
default_name = xstrdup (SSDATA (font_param));
}
- if (default_name == NULL && x_last_font_name != NULL)
- default_name = xstrdup (x_last_font_name);
-
- /* Convert fontconfig names to Gtk names, i.e. remove - before number */
- if (default_name)
- {
- char *p = strrchr (default_name, '-');
- if (p)
- {
- char *ep = p+1;
- while (isdigit (*ep))
- ++ep;
- if (*ep == '\0') *p = ' ';
- }
- }
-
- name = xg_get_font_name (f, default_name);
+ font = xg_get_font (f, default_name);
xfree (default_name);
- if (name)
- {
- font = build_string (name);
- g_free (x_last_font_name);
- x_last_font_name = name;
- }
-
UNBLOCK_INPUT;
if (NILP (font))
/* The section below is built by the lisp expression at the top of the file,
just above where these variables are declared. */
/*&&& init symbols here &&&*/
- DEFSYM (Qnone, "none");
DEFSYM (Qsuppress_icon, "suppress-icon");
DEFSYM (Qundefined_color, "undefined-color");
DEFSYM (Qcompound_text, "compound-text");
#if defined (USE_GTK) && defined (HAVE_FREETYPE)
defsubr (&Sx_select_font);
- x_last_font_name = NULL;
#endif
}