#undef USG /* ####KLUDGE for Solaris 2.2 and up */
#include <X11/Xos.h>
#define USG
+#ifdef USG /* Pacify gcc -Wunused-macros. */
+#endif
#else
#include <X11/Xos.h>
#endif
#if !defined(NO_EDITRES)
#define HACK_EDITRES
-extern void _XEditResCheckMessages ();
+extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *);
#endif /* not defined NO_EDITRES */
/* Unique id counter for widgets created by the Lucid Widget Library. */
extern LWLIB_ID widget_id_tick;
-extern void free_frame_menubar ();
-extern double atof ();
-
#ifdef USE_MOTIF
#endif /* USE_MOTIF */
static int x_in_use;
-Lisp_Object Qnone;
-Lisp_Object Qsuppress_icon;
-Lisp_Object Qundefined_color;
-Lisp_Object Qcompound_text, Qcancel_timer;
+static Lisp_Object Qnone;
+static Lisp_Object Qsuppress_icon;
+static Lisp_Object Qundefined_color;
+static Lisp_Object Qcompound_text, Qcancel_timer;
Lisp_Object Qfont_param;
#if GLYPH_DEBUG
-int image_cache_refcount, dpyinfo_refcount;
+static ptrdiff_t image_cache_refcount;
+static int dpyinfo_refcount;
#endif
#if defined (USE_GTK) && defined (HAVE_FREETYPE)
-char *x_last_font_name;
+static char *x_last_font_name;
#endif
+static struct x_display_info *x_display_info_for_name (Lisp_Object);
+
\f
/* Error if we are not connected to X. */
struct terminal *t = get_terminal (object, 1);
if (t->type != output_x_window)
- error ("Terminal %d is not an X display", XINT (object));
+ error ("Terminal %"pI"d is not an X display", XINT (object));
dpyinfo = t->display_info.x;
}
\f
-static void x_default_font_parameter (struct frame *, Lisp_Object);
-
-static Lisp_Object unwind_create_frame (Lisp_Object);
-static Lisp_Object unwind_create_tip_frame (Lisp_Object);
-
-void x_set_foreground_color (struct frame *, Lisp_Object, Lisp_Object);
-static void x_set_wait_for_wm (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_background_color (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_mouse_color (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_cursor_color (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_border_color (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_icon_type (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_icon_name (struct frame *, Lisp_Object, Lisp_Object);
-void x_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_title (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_scroll_bar_foreground (struct frame *, Lisp_Object,
- Lisp_Object);
-void x_set_scroll_bar_background (struct frame *, Lisp_Object,
- Lisp_Object);
-static Lisp_Object x_default_scroll_bar_color_parameter (struct frame *,
- Lisp_Object,
- Lisp_Object,
- const char *, const char *,
- int);
-\f
-
/* Store the screen positions of frame F into XPTR and YPTR.
These are the positions of the containing window manager window,
not Emacs's own window. */
void
x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
{
- int win_x, win_y, outer_x, outer_y;
+ int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0);
int real_x = 0, real_y = 0;
int had_errors = 0;
Window win = f->output_data.x->parent_desc;
In that case, just record the parameter's new value
in the standard place; do not attempt to change the window. */
-void
+static void
x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
struct x_output *x = f->output_data.x;
unload_color (f, old_fg);
}
-void
+static void
x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
struct x_output *x = f->output_data.x;
static char const no_data[] = { 0 };
Pixmap pix;
XColor col;
- Cursor c;
+ Cursor c = 0;
x_catch_errors (dpy);
pix = XCreateBitmapFromData (dpy, FRAME_X_DISPLAY_INFO (f)->root_window,
no_data, 1, 1);
if (! x_had_errors_p (dpy) && pix != None)
{
+ Cursor pixc;
col.pixel = 0;
col.red = col.green = col.blue = 0;
col.flags = DoRed | DoGreen | DoBlue;
- c = XCreatePixmapCursor (dpy, pix, pix, &col, &col, 0, 0);
- if (x_had_errors_p (dpy) || c == None)
- c = 0;
+ pixc = XCreatePixmapCursor (dpy, pix, pix, &col, &col, 0, 0);
+ if (! x_had_errors_p (dpy) && pixc != None)
+ c = pixc;
XFreePixmap (dpy, pix);
}
return c;
}
-void
+static void
x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
struct x_output *x = f->output_data.x;
update_face_from_frame_parameter (f, Qmouse_color, arg);
}
-void
+static void
x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
unsigned long fore_pixel, pixel;
Note that this does not fully take effect if done before
F has an x-window. */
-void
+static void
x_set_border_pixel (struct frame *f, int pix)
{
unload_color (f, f->output_data.x->border_pixel);
if (FRAME_X_WINDOW (f) != 0 && f->border_width > 0)
{
BLOCK_INPUT;
- XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- (unsigned long)pix);
+ XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), pix);
UNBLOCK_INPUT;
if (FRAME_VISIBLE_P (f))
Note: under X11, this is normally the province of the window manager,
and so emacs' border colors may be overridden. */
-void
+static void
x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
int pix;
}
-void
+static void
x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
{
set_frame_cursor_types (f, arg);
cursor_type_changed = 1;
}
\f
-void
+static void
x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
int result;
UNBLOCK_INPUT;
}
-void
+static void
x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
int result;
}
#else /* not USE_X_TOOLKIT && not USE_GTK */
FRAME_MENU_BAR_LINES (f) = nlines;
- change_window_heights (f->root_window, nlines - olines);
+ resize_frame_windows (f, FRAME_LINES (f), 0);
/* If the menu bar height gets changed, the internal border below
the top margin has to be cleared. Also, if the menu bar gets
}
#endif /* not USE_X_TOOLKIT && not USE_GTK */
adjust_glyphs (f);
+ run_window_configuration_change_hook (f);
}
}
FRAME_TOOL_BAR_LINES (f) = nlines;
- change_window_heights (root_window, delta);
+ resize_frame_windows (f, FRAME_LINES (f), 0);
adjust_glyphs (f);
/* We also have to make sure that the internal border at the top of
if (WINDOWP (f->tool_bar_window))
clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
}
+
+ run_window_configuration_change_hook (f);
+
}
isn't a valid color name, do nothing. OLDVAL is the old value of
the frame parameter. */
-void
+static void
x_set_scroll_bar_foreground (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
unsigned long pixel;
valid color name, do nothing. OLDVAL is the old value of the frame
parameter. */
-void
+static void
x_set_scroll_bar_background (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
unsigned long pixel;
/* This function should be called when the user's lisp code has
specified a name for the frame; the name will override any set by the
redisplay code. */
-void
+static void
x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
{
x_set_name (f, arg, 1);
/* Change the title of frame F to NAME.
If NAME is nil, use the frame name as the title. */
-void
+static void
x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
{
/* Don't change the title if it's already NAME. */
x_set_scroll_bar_default_width (struct frame *f)
{
int wid = FRAME_COLUMN_WIDTH (f);
-
#ifdef USE_TOOLKIT_SCROLL_BARS
+#ifdef USE_GTK
+ int minw = xg_get_default_scrollbar_width ();
+#else
+ int minw = 16;
+#endif
/* A minimum width of 14 doesn't look good for toolkit scroll bars. */
- int width = 16 + 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM;
+ int width = minw + 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM;
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (width + wid - 1) / wid;
FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = width;
#else
};
+#if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
/* Create an X fontset on frame F with base font name BASE_FONTNAME. */
-const char xic_defaut_fontset[] = "-*-*-*-r-normal--14-*-*-*-*-*-*-*";
+static const char xic_defaut_fontset[] = "-*-*-*-r-normal--14-*-*-*-*-*-*-*";
/* Create an Xt fontset spec from the name of a base font.
If `motif' is True use the Motif syntax. */
/* Make a fontset name from the base font name. */
if (xic_defaut_fontset == base_fontname)
{ /* There is no base font name, use the default. */
- int len = strlen (base_fontname) + 2;
+ ptrdiff_t len = strlen (base_fontname) + 2;
fontsetname = xmalloc (len);
memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname);
- the base font where the charset spec is replaced by -*-*.
- the same but with the family also replaced with -*-*-. */
const char *p = base_fontname;
- int i;
+ ptrdiff_t i;
for (i = 0; *p; p++)
if (*p == '-') i++;
{ /* As the font name doesn't conform to XLFD, we can't
modify it to generalize it to allcs and allfamilies.
Use the specified font plus the default. */
- int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 3;
+ ptrdiff_t len =
+ strlen (base_fontname) + strlen (xic_defaut_fontset) + 3;
fontsetname = xmalloc (len);
memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname);
}
else
{
- int len;
+ ptrdiff_t len;
const char *p1 = NULL, *p2 = NULL, *p3 = NULL;
char *font_allcs = NULL;
char *font_allfamilies = NULL;
wildcard. */
if (*p3 != '*')
{
- int diff = (p2 - p3) - 2;
+ ptrdiff_t diff = (p2 - p3) - 2;
base = alloca (strlen (base_fontname) + 1);
memcpy (base, base_fontname, p3 - base_fontname);
strcat (fontsetname, ":");
return fontsetname;
}
+#endif /* HAVE_X_WINDOWS && USE_X_TOOLKIT */
#ifdef DEBUG_XIC_FONTSET
static void
-print_fontset_result (xfs, name, missing_list, missing_count)
- XFontSet xfs;
- char *name;
- char **missing_list;
- int missing_count;
+print_fontset_result (XFontSet xfs, char *name, char **missing_list,
+ int missing_count)
{
if (xfs)
fprintf (stderr, "XIC Fontset created: %s\n", name);
/* Do some needed geometry management. */
{
- int len;
+ ptrdiff_t len;
char *tem, shell_position[32];
- Arg al[10];
- int ac = 0;
+ Arg gal[10];
+ int gac = 0;
int extra_borders = 0;
int menubar_size
= (f->output_data.x->menubar_widget
If Emacs had just one program position, we could set it in
fallback resources, but since each make-frame call can specify
different program positions, this is easier. */
- XtSetArg (al[ac], XtNx, left); ac++;
- XtSetArg (al[ac], XtNy, top); ac++;
+ XtSetArg (gal[gac], XtNx, left); gac++;
+ XtSetArg (gal[gac], XtNy, top); gac++;
}
}
when the frame is deleted. */
tem = (char *) xmalloc (len);
strncpy (tem, shell_position, len);
- XtSetArg (al[ac], XtNgeometry, tem); ac++;
- XtSetValues (shell_widget, al, ac);
+ XtSetArg (gal[gac], XtNgeometry, tem); gac++;
+ XtSetValues (shell_widget, gal, gac);
}
XtManageChild (pane_widget);
/* If frame is ``official'', nothing to do. */
if (!CONSP (Vframe_list) || !EQ (XCAR (Vframe_list), frame))
{
-#if GLYPH_DEBUG
+#if GLYPH_DEBUG && XASSERTS
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
#endif
{
char *name = xstrdup (system_font);
font = font_open_by_name (f, name);
- free (name);
+ xfree (name);
}
}
/* With FRAME_X_DISPLAY_INFO set up, this unwind-protect is safe. */
record_unwind_protect (unwind_create_frame, frame);
-#if GLYPH_DEBUG
- image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount;
- dpyinfo_refcount = dpyinfo->reference_count;
-#endif /* GLYPH_DEBUG */
/* These colors will be set anyway later, but it's important
to get the color reference counts right, so initialize them! */
happen. */
init_frame_faces (f);
+#if GLYPH_DEBUG
+ image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount;
+ dpyinfo_refcount = dpyinfo->reference_count;
+#endif /* GLYPH_DEBUG */
+
/* The X resources controlling the menu-bar and tool-bar are
processed specially at startup, and reflected in the mode
variables; ignore them here. */
return FRAME_LINE_HEIGHT (f);
}
-int
-x_screen_planes (register struct frame *f)
-{
- return FRAME_X_DISPLAY_INFO (f)->n_planes;
-}
-
\f
/************************************************************************
/* Return the X display structure for the display named NAME.
Open a new connection if necessary. */
-struct x_display_info *
+static struct x_display_info *
x_display_info_for_name (Lisp_Object name)
{
Lisp_Object names;
if (! NILP (source))
{
- if (NUMBERP (source))
- {
- if (FLOATP (source))
- target_window = (Window) XFLOAT (source);
- else
- target_window = XFASTINT (source);
-
- if (target_window == 0)
- target_window = FRAME_X_DISPLAY_INFO (f)->root_window;
- }
- else if (CONSP (source))
- target_window = cons_to_long (source);
+ CONS_TO_INTEGER (source, Window, target_window);
+ if (! target_window)
+ target_window = FRAME_X_DISPLAY_INFO (f)->root_window;
}
BLOCK_INPUT;
property and those are indeed in 32 bit quantities if format is
32. */
- if (actual_format == 32 && actual_format < BITS_PER_LONG)
+ if (32 < BITS_PER_LONG && actual_format == 32)
{
unsigned long i;
int *idata = (int *) tmp_data;
/* If non-nil, a timer started that hides the last tooltip when it
fires. */
-Lisp_Object tip_timer;
+static Lisp_Object tip_timer;
Window tip_window;
/* If non-nil, a vector of 3 elements containing the last args
with which x-show-tip was called. See there. */
-Lisp_Object last_show_tip_args;
+static Lisp_Object last_show_tip_args;
static Lisp_Object
struct frame *f;
Lisp_Object frame;
Lisp_Object name;
- long window_prompting = 0;
int width, height;
int count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3;
#endif /* USE_TOOLKIT_SCROLL_BARS */
f->icon_name = Qnil;
FRAME_X_DISPLAY_INFO (f) = dpyinfo;
-#if GLYPH_DEBUG
- image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount;
- dpyinfo_refcount = dpyinfo->reference_count;
-#endif /* GLYPH_DEBUG */
f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
f->output_data.x->explicit_parent = 0;
happen. */
init_frame_faces (f);
+#if GLYPH_DEBUG
+ image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount;
+ dpyinfo_refcount = dpyinfo->reference_count;
+#endif /* GLYPH_DEBUG */
+
f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
- window_prompting = x_figure_window_size (f, parms, 0);
+ x_figure_window_size (f, parms, 0);
{
XSetWindowAttributes attrs;
int count;
Lisp_Object deleted, frame, timer;
struct gcpro gcpro1, gcpro2;
- struct frame *f;
/* Return quickly if nothing to do. */
if (NILP (tip_timer) && NILP (tip_frame))
call1 (Qcancel_timer, timer);
#ifdef USE_GTK
- /* When using system tooltip, tip_frame is the Emacs frame on which
- the tip is shown. */
- f = XFRAME (frame);
- if (FRAME_LIVE_P (f) && xg_hide_tooltip (f))
- frame = Qnil;
+ {
+ /* When using system tooltip, tip_frame is the Emacs frame on which
+ the tip is shown. */
+ struct frame *f = XFRAME (frame);
+ if (FRAME_LIVE_P (f) && xg_hide_tooltip (f))
+ frame = Qnil;
+ }
#endif
if (FRAMEP (frame))
items is unmapped. Redisplay the menu manually... */
{
Widget w;
- f = SELECTED_FRAME ();
+ struct frame *f = SELECTED_FRAME ();
w = f->output_data.x->menubar_widget;
if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen)
/* Get the result. */
if (result == XmCR_OK)
{
- XmString text;
+ XmString text_string;
String data;
- XtVaGetValues (dialog, XmNtextString, &text, NULL);
- XmStringGetLtoR (text, XmFONTLIST_DEFAULT_TAG, &data);
- XmStringFree (text);
+ XtVaGetValues (dialog, XmNtextString, &text_string, NULL);
+ XmStringGetLtoR (text_string, XmFONTLIST_DEFAULT_TAG, &data);
+ XmStringFree (text_string);
file = build_string (data);
XtFree (data);
}
/* 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 &&&*/
- Qnone = intern_c_string ("none");
- staticpro (&Qnone);
- Qsuppress_icon = intern_c_string ("suppress-icon");
- staticpro (&Qsuppress_icon);
- Qundefined_color = intern_c_string ("undefined-color");
- staticpro (&Qundefined_color);
- Qcompound_text = intern_c_string ("compound-text");
- staticpro (&Qcompound_text);
- Qcancel_timer = intern_c_string ("cancel-timer");
- staticpro (&Qcancel_timer);
- Qfont_param = intern_c_string ("font-parameter");
- staticpro (&Qfont_param);
+ DEFSYM (Qnone, "none");
+ DEFSYM (Qsuppress_icon, "suppress-icon");
+ DEFSYM (Qundefined_color, "undefined-color");
+ DEFSYM (Qcompound_text, "compound-text");
+ DEFSYM (Qcancel_timer, "cancel-timer");
+ DEFSYM (Qfont_param, "font-parameter");
/* This is the end of symbol initialization. */
- /* Text property `display' should be nonsticky by default. */
- Vtext_property_default_nonsticky
- = Fcons (Fcons (Qdisplay, Qt), Vtext_property_default_nonsticky);
-
-
Fput (Qundefined_color, Qerror_conditions,
pure_cons (Qundefined_color, pure_cons (Qerror, Qnil)));
Fput (Qundefined_color, Qerror_message,