/* Functions for the X window system.
- Copyright (C) 1989, 1992 Free Software Foundation.
+ Copyright (C) 1989, 1992, 1993 Free Software Foundation.
This file is part of GNU Emacs.
#include "window.h"
#include "buffer.h"
#include "dispextern.h"
-#include "xscrollbar.h"
#include "keyboard.h"
+#include "blockinput.h"
#ifdef HAVE_X_WINDOWS
extern void abort ();
+#ifndef VMS
+#if 1 /* Used to be #ifdef EMACS_BITMAP_FILES, but this should always work. */
+#include "bitmaps/gray.xbm"
+#else
+#include <X11/bitmaps/gray>
+#endif
+#else
+#include "[.bitmaps]gray.xbm"
+#endif
+
#define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b))
/* The class of this X application. */
#define EMACS_CLASS "Emacs"
+#ifdef HAVE_X11R4
+#define MAXREQUEST(dpy) (XMaxRequestSize (dpy))
+#else
+#define MAXREQUEST(dpy) ((dpy)->max_request_size)
+#endif
+
+/* The name we're using in resource queries. */
+Lisp_Object Vx_resource_name;
+
/* Title name and application name for X stuff. */
extern char *x_id_name;
-extern Lisp_Object invocation_name;
/* The background and shape of the mouse pointer, and shape when not
over text or in the modeline. */
/* Color of chars displayed in cursor box. */
Lisp_Object Vx_cursor_fore_pixel;
-/* If non-nil, use vertical bar cursor. */
-Lisp_Object Vbar_cursor;
+/* The screen being used. */
+static Screen *x_screen;
/* The X Visual we are using for X windows (the default) */
Visual *screen_visual;
-/* How many screens this X display has. */
-int x_screen_count;
-
-/* The vendor supporting this X server. */
-Lisp_Object Vx_vendor;
-
-/* The vendor's release number for this X server. */
-int x_release;
-
/* Height of this X screen in pixels. */
int x_screen_height;
-/* Height of this X screen in millimeters. */
-int x_screen_height_mm;
-
/* Width of this X screen in pixels. */
int x_screen_width;
-/* Width of this X screen in millimeters. */
-int x_screen_width_mm;
-
-/* Does this X screen do backing store? */
-Lisp_Object Vx_backing_store;
-
-/* Does this X screen do save-unders? */
-int x_save_under;
-
/* Number of planes for this screen. */
int x_screen_planes;
-/* X Visual type of this screen. */
-Lisp_Object Vx_screen_visual;
-
/* Non nil if no window manager is in use. */
Lisp_Object Vx_no_window_manager;
-static char *x_visual_strings[] =
- {
- "StaticGray",
- "GrayScale",
- "StaticColor",
- "PseudoColor",
- "TrueColor",
- "DirectColor"
- };
-
/* `t' if a mouse button is depressed. */
Lisp_Object Vmouse_depressed;
extern unsigned int x_mouse_x, x_mouse_y, x_mouse_grabbed;
-extern Lisp_Object unread_command_char;
/* Atom for indicating window state to the window manager. */
-Atom Xatom_wm_change_state;
-
-/* When emacs became the selection owner. */
-extern Time x_begin_selection_own;
-
-/* The value of the current emacs selection. */
-extern Lisp_Object Vx_selection_value;
-
-/* Emacs' selection property identifier. */
-extern Atom Xatom_emacs_selection;
-
-/* Clipboard selection atom. */
-extern Atom Xatom_clipboard_selection;
-
-/* Clipboard atom. */
-extern Atom Xatom_clipboard;
-
-/* Atom for indicating incremental selection transfer. */
-extern Atom Xatom_incremental;
-
-/* Atom for indicating multiple selection request list */
-extern Atom Xatom_multiple;
-
-/* Atom for what targets emacs handles. */
-extern Atom Xatom_targets;
-
-/* Atom for indicating timstamp selection request */
-extern Atom Xatom_timestamp;
-
-/* Atom requesting we delete our selection. */
-extern Atom Xatom_delete;
-
-/* Selection magic. */
-extern Atom Xatom_insert_selection;
-
-/* Type of property for INSERT_SELECTION. */
-extern Atom Xatom_pair;
-
-/* More selection magic. */
-extern Atom Xatom_insert_property;
-
-/* Atom for indicating property type TEXT */
-extern Atom Xatom_text;
+extern Atom Xatom_wm_change_state;
/* Communication with window managers. */
extern Atom Xatom_wm_protocols;
#else /* X10 */
-/* Default size of an Emacs window without scroll bar. */
+/* Default size of an Emacs window. */
static char *default_window = "=80x24+0+0";
#define MAXICID 80
Lisp_Object Qauto_raise;
Lisp_Object Qauto_lower;
Lisp_Object Qbackground_color;
+Lisp_Object Qbar;
Lisp_Object Qborder_color;
Lisp_Object Qborder_width;
+Lisp_Object Qbox;
Lisp_Object Qcursor_color;
+Lisp_Object Qcursor_type;
Lisp_Object Qfont;
Lisp_Object Qforeground_color;
Lisp_Object Qgeometry;
-Lisp_Object Qhorizontal_scroll_bar;
+/* Lisp_Object Qicon; */
Lisp_Object Qicon_left;
Lisp_Object Qicon_top;
Lisp_Object Qicon_type;
-Lisp_Object Qiconic_startup;
Lisp_Object Qinternal_border_width;
Lisp_Object Qleft;
Lisp_Object Qmouse_color;
+Lisp_Object Qnone;
Lisp_Object Qparent_id;
Lisp_Object Qsuppress_icon;
-Lisp_Object Qsuppress_initial_map;
Lisp_Object Qtop;
Lisp_Object Qundefined_color;
-Lisp_Object Qvertical_scroll_bar;
+Lisp_Object Qvertical_scroll_bars;
+Lisp_Object Qvisibility;
Lisp_Object Qwindow_id;
Lisp_Object Qx_frame_parameter;
/* The below are defined in frame.c. */
-extern Lisp_Object Qheight, Qminibuffer, Qname, Qnone, Qonly, Qwidth;
-extern Lisp_Object Qunsplittable;
+extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth;
+extern Lisp_Object Qunsplittable, Qmenu_bar_lines;
extern Lisp_Object Vwindow_system_version;
-/* Mouse map for clicks in windows. */
-extern Lisp_Object Vglobal_mouse_map;
-
-/* Points to table of defined typefaces. */
-struct face *x_face_table[MAX_FACES_AND_GLYPHS];
\f
+/* Error if we are not connected to X. */
+static void
+check_x ()
+{
+ if (x_current_display == 0)
+ error ("X windows are not in use or not initialized");
+}
+
/* Return the Emacs frame-object corresponding to an X window.
It could be the frame's main window or an icon window. */
+/* This function can be called during GC, so use XGCTYPE. */
+
struct frame *
x_window_to_frame (wdesc)
int wdesc;
Lisp_Object tail, frame;
struct frame *f;
- for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
+ for (tail = Vframe_list; XGCTYPE (tail) == Lisp_Cons;
+ tail = XCONS (tail)->cdr)
{
frame = XCONS (tail)->car;
- if (XTYPE (frame) != Lisp_Frame)
+ if (XGCTYPE (frame) != Lisp_Frame)
continue;
f = XFRAME (frame);
if (FRAME_X_WINDOW (f) == wdesc
return 0;
}
-/* Map an X window that implements a scroll bar to the Emacs frame it
- belongs to. Also store in *PART a symbol identifying which part of
- the scroll bar it is. */
-
-struct frame *
-x_window_to_scrollbar (wdesc, part_ptr, prefix_ptr)
- int wdesc;
- Lisp_Object *part_ptr;
- enum scroll_bar_prefix *prefix_ptr;
-{
- Lisp_Object tail, frame;
- struct frame *f;
-
- for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
- {
- frame = XCONS (tail)->car;
- if (XTYPE (frame) != Lisp_Frame)
- continue;
-
- f = XFRAME (frame);
- if (part_ptr == 0 && prefix_ptr == 0)
- return f;
-
- if (f->display.x->v_scrollbar == wdesc)
- {
- *part_ptr = Qvscrollbar_part;
- *prefix_ptr = VSCROLL_BAR_PREFIX;
- return f;
- }
- else if (f->display.x->v_slider == wdesc)
- {
- *part_ptr = Qvslider_part;
- *prefix_ptr = VSCROLL_SLIDER_PREFIX;
- return f;
- }
- else if (f->display.x->v_thumbup == wdesc)
- {
- *part_ptr = Qvthumbup_part;
- *prefix_ptr = VSCROLL_THUMBUP_PREFIX;
- return f;
- }
- else if (f->display.x->v_thumbdown == wdesc)
- {
- *part_ptr = Qvthumbdown_part;
- *prefix_ptr = VSCROLL_THUMBDOWN_PREFIX;
- return f;
- }
- else if (f->display.x->h_scrollbar == wdesc)
- {
- *part_ptr = Qhscrollbar_part;
- *prefix_ptr = HSCROLL_BAR_PREFIX;
- return f;
- }
- else if (f->display.x->h_slider == wdesc)
- {
- *part_ptr = Qhslider_part;
- *prefix_ptr = HSCROLL_SLIDER_PREFIX;
- return f;
- }
- else if (f->display.x->h_thumbleft == wdesc)
- {
- *part_ptr = Qhthumbleft_part;
- *prefix_ptr = HSCROLL_THUMBLEFT_PREFIX;
- return f;
- }
- else if (f->display.x->h_thumbright == wdesc)
- {
- *part_ptr = Qhthumbright_part;
- *prefix_ptr = HSCROLL_THUMBRIGHT_PREFIX;
- return f;
- }
- }
- return 0;
-}
\f
/* Connect the frame-parameter names for X frames
to the ways of passing the parameter values to the window system.
X_PARM_NAME,
X_PARM_AUTORAISE,
X_PARM_AUTOLOWER,
- X_PARM_VERT_SCROLLBAR,
- X_PARM_HORIZ_SCROLLBAR,
+ X_PARM_VERT_SCROLL_BAR,
+ X_PARM_VISIBILITY,
+ X_PARM_MENU_BAR_LINES
};
void x_set_mouse_color ();
void x_set_cursor_color ();
void x_set_border_color ();
+void x_set_cursor_type ();
void x_set_icon_type ();
void x_set_font ();
void x_set_border_width ();
void x_explicitly_set_name ();
void x_set_autoraise ();
void x_set_autolower ();
-void x_set_vertical_scrollbar ();
-void x_set_horizontal_scrollbar ();
+void x_set_vertical_scroll_bars ();
+void x_set_visibility ();
+void x_set_menu_bar_lines ();
static struct x_frame_parm_table x_frame_parms[] =
{
"mouse-color", x_set_mouse_color,
"cursor-color", x_set_cursor_color,
"border-color", x_set_border_color,
+ "cursor-type", x_set_cursor_type,
"icon-type", x_set_icon_type,
"font", x_set_font,
"border-width", x_set_border_width,
"internal-border-width", x_set_internal_border_width,
"name", x_explicitly_set_name,
- "autoraise", x_set_autoraise,
- "autolower", x_set_autolower,
- "vertical-scrollbar", x_set_vertical_scrollbar,
- "horizontal-scrollbar", x_set_horizontal_scrollbar,
+ "auto-raise", x_set_autoraise,
+ "auto-lower", x_set_autolower,
+ "vertical-scroll-bars", x_set_vertical_scroll_bars,
+ "visibility", x_set_visibility,
+ "menu-bar-lines", x_set_menu_bar_lines,
};
/* Attach the `x-frame-parameter' properties to
{
int i;
- for (i = 0; i < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]); i++)
+ for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++)
Fput (intern (x_frame_parms[i].name), Qx_frame_parameter,
make_number (i));
}
\f
-#if 1
/* Change the parameters of FRAME as specified by ALIST.
If a parameter is not specially recognized, do nothing;
otherwise call the `x_set_...' function for that parameter. */
+
void
x_set_frame_parameters (f, alist)
FRAME_PTR f;
/* Same here. */
Lisp_Object left, top;
+
+ /* Record in these vectors all the parms specified. */
+ Lisp_Object *parms;
+ Lisp_Object *values;
+ int i;
- XSET (width, Lisp_Int, FRAME_WIDTH (f));
- XSET (height, Lisp_Int, FRAME_HEIGHT (f));
+ i = 0;
+ for (tail = alist; CONSP (tail); tail = Fcdr (tail))
+ i++;
- XSET (top, Lisp_Int, f->display.x->top_pos);
- XSET (left, Lisp_Int, f->display.x->left_pos);
+ parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
+ values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
+ /* Extract parm names and values into those vectors. */
+
+ i = 0;
for (tail = alist; CONSP (tail); tail = Fcdr (tail))
{
Lisp_Object elt, prop, val;
elt = Fcar (tail);
- prop = Fcar (elt);
- val = Fcdr (elt);
+ parms[i] = Fcar (elt);
+ values[i] = Fcdr (elt);
+ i++;
+ }
+
+ width = height = top = left = Qunbound;
+
+ /* Now process them in reverse of specified order. */
+ for (i--; i >= 0; i--)
+ {
+ Lisp_Object prop, val;
+
+ prop = parms[i];
+ val = values[i];
if (EQ (prop, Qwidth))
width = val;
left = val;
else
{
- register Lisp_Object tem;
- tem = Fget (prop, Qx_frame_parameter);
- if (XTYPE (tem) == Lisp_Int
- && XINT (tem) >= 0
- && XINT (tem) < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))
- (*x_frame_parms[XINT (tem)].setter)(f, val,
- get_frame_param (f, prop));
+ register Lisp_Object param_index = Fget (prop, Qx_frame_parameter);
+ register Lisp_Object old_value = get_frame_param (f, prop);
+
store_frame_param (f, prop, val);
+ if (XTYPE (param_index) == Lisp_Int
+ && XINT (param_index) >= 0
+ && (XINT (param_index)
+ < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))
+ (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);
}
}
- /* Don't call these unless they've changed; the window may not actually
- exist yet. */
+ /* Don't set these parameters these unless they've been explicitly
+ specified. The window might be mapped or resized while we're in
+ this function, and we don't want to override that unless the lisp
+ code has asked for it.
+
+ Don't set these parameters unless they actually differ from the
+ window's current parameters; the window may not actually exist
+ yet. */
{
Lisp_Object frame;
XSET (frame, Lisp_Frame, f);
- if (XINT (width) != FRAME_WIDTH (f)
- || XINT (height) != FRAME_HEIGHT (f))
+ if ((NUMBERP (width) && XINT (width) != FRAME_WIDTH (f))
+ || (NUMBERP (height) && XINT (height) != FRAME_HEIGHT (f)))
Fset_frame_size (frame, width, height);
- if (XINT (left) != f->display.x->left_pos
- || XINT (top) != f->display.x->top_pos)
+ if ((NUMBERP (left) && XINT (left) != f->display.x->left_pos)
+ || (NUMBERP (top) && XINT (top) != f->display.x->top_pos))
Fset_frame_position (frame, left, top);
}
}
-#else
-/* Report to X that a frame parameter of frame F is being set or changed.
- PARAM is the symbol that says which parameter.
- VAL is the new value.
- OLDVAL is the old value.
- If the parameter is not specially recognized, do nothing;
- otherwise the `x_set_...' function for this parameter. */
-void
-x_set_frame_param (f, param, val, oldval)
- register struct frame *f;
- Lisp_Object param;
- register Lisp_Object val;
- register Lisp_Object oldval;
-{
- register Lisp_Object tem;
- tem = Fget (param, Qx_frame_parameter);
- if (XTYPE (tem) == Lisp_Int
- && XINT (tem) >= 0
- && XINT (tem) < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))
- (*x_frame_parms[XINT (tem)].setter)(f, val, oldval);
-}
-#endif
/* Insert a description of internally-recorded parameters of frame X
into the parameter alist *ALISTPTR that is to be given to the user.
Only parameters that are specific to the X window system
sprintf (buf, "%d", FRAME_X_WINDOW (f));
store_in_alist (alistptr, Qwindow_id,
build_string (buf));
+ store_in_alist (alistptr, Qvisibility,
+ (FRAME_VISIBLE_P (f) ? Qt
+ : FRAME_ICONIFIED_P (f) ? Qicon : Qnil));
}
\f
/* Decide if color named COLOR is valid for the display
return WHITE_PIX_DEFAULT;
#ifdef HAVE_X11
- if (XFASTINT (x_screen_planes) == 1)
+ if (x_screen_planes == 1)
return def;
#else
if (DISPLAY_CELLS == 1)
f->display.x->foreground_pixel);
XSetBackground (x_current_display, f->display.x->reverse_gc,
f->display.x->foreground_pixel);
- if (f->display.x->v_scrollbar)
- {
- Pixmap up_arrow_pixmap, down_arrow_pixmap, slider_pixmap;
-
- XSetWindowBorder (x_current_display, f->display.x->v_scrollbar,
- f->display.x->foreground_pixel);
-
- slider_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- gray_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
- up_arrow_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- up_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
- down_arrow_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- down_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbup,
- up_arrow_pixmap);
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbdown,
- down_arrow_pixmap);
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_slider,
- slider_pixmap);
-
- XClearWindow (XDISPLAY f->display.x->v_thumbup);
- XClearWindow (XDISPLAY f->display.x->v_thumbdown);
- XClearWindow (XDISPLAY f->display.x->v_slider);
-
- XFreePixmap (x_current_display, down_arrow_pixmap);
- XFreePixmap (x_current_display, up_arrow_pixmap);
- XFreePixmap (x_current_display, slider_pixmap);
- }
- if (f->display.x->h_scrollbar)
- {
- Pixmap left_arrow_pixmap, right_arrow_pixmap, slider_pixmap;
-
- XSetWindowBorder (x_current_display, f->display.x->h_scrollbar,
- f->display.x->foreground_pixel);
-
- slider_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- gray_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- left_arrow_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- up_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
- right_arrow_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- down_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_slider,
- slider_pixmap);
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbleft,
- left_arrow_pixmap);
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbright,
- right_arrow_pixmap);
-
- XClearWindow (XDISPLAY f->display.x->h_thumbleft);
- XClearWindow (XDISPLAY f->display.x->h_thumbright);
- XClearWindow (XDISPLAY f->display.x->h_slider);
-
- XFreePixmap (x_current_display, slider_pixmap);
- XFreePixmap (x_current_display, left_arrow_pixmap);
- XFreePixmap (x_current_display, right_arrow_pixmap);
- }
UNBLOCK_INPUT;
#endif /* HAVE_X11 */
- if (f->visible)
+ recompute_basic_faces (f);
+ if (FRAME_VISIBLE_P (f))
redraw_frame (f);
}
}
XSetWindowBackground (x_current_display, FRAME_X_WINDOW (f),
f->display.x->background_pixel);
- /* Scroll bars. */
- if (f->display.x->v_scrollbar)
- {
- Pixmap up_arrow_pixmap, down_arrow_pixmap, slider_pixmap;
-
- XSetWindowBackground (x_current_display, f->display.x->v_scrollbar,
- f->display.x->background_pixel);
-
- slider_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- gray_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
- up_arrow_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- up_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
- down_arrow_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- down_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbup,
- up_arrow_pixmap);
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbdown,
- down_arrow_pixmap);
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_slider,
- slider_pixmap);
-
- XClearWindow (XDISPLAY f->display.x->v_thumbup);
- XClearWindow (XDISPLAY f->display.x->v_thumbdown);
- XClearWindow (XDISPLAY f->display.x->v_slider);
-
- XFreePixmap (x_current_display, down_arrow_pixmap);
- XFreePixmap (x_current_display, up_arrow_pixmap);
- XFreePixmap (x_current_display, slider_pixmap);
- }
- if (f->display.x->h_scrollbar)
- {
- Pixmap left_arrow_pixmap, right_arrow_pixmap, slider_pixmap;
-
- XSetWindowBackground (x_current_display, f->display.x->h_scrollbar,
- f->display.x->background_pixel);
-
- slider_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- gray_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- left_arrow_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- up_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
- right_arrow_pixmap =
- XCreatePixmapFromBitmapData (XDISPLAY FRAME_X_WINDOW (f),
- down_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_slider,
- slider_pixmap);
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbleft,
- left_arrow_pixmap);
- XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbright,
- right_arrow_pixmap);
-
- XClearWindow (XDISPLAY f->display.x->h_thumbleft);
- XClearWindow (XDISPLAY f->display.x->h_thumbright);
- XClearWindow (XDISPLAY f->display.x->h_slider);
-
- XFreePixmap (x_current_display, slider_pixmap);
- XFreePixmap (x_current_display, left_arrow_pixmap);
- XFreePixmap (x_current_display, right_arrow_pixmap);
- }
#else
temp = XMakeTile (f->display.x->background_pixel);
XChangeBackground (FRAME_X_WINDOW (f), temp);
#endif /* not HAVE_X11 */
UNBLOCK_INPUT;
- if (f->visible)
+ recompute_basic_faces (f);
+
+ if (FRAME_VISIBLE_P (f))
redraw_frame (f);
}
}
BLOCK_INPUT;
#ifdef HAVE_X11
- /* It's not okay to crash if the user selects a screwey cursor. */
+ /* It's not okay to crash if the user selects a screwy cursor. */
x_catch_errors ();
if (!EQ (Qnil, Vx_pointer_shape))
}
else
cursor = XCreateFontCursor (x_current_display, XC_xterm);
+ x_check_errors ("bad text pointer cursor: %s");
if (!EQ (Qnil, Vx_nontext_pointer_shape))
{
}
else
nontext_cursor = XCreateFontCursor (x_current_display, XC_left_ptr);
+ x_check_errors ("bad nontext pointer cursor: %s");
if (!EQ (Qnil, Vx_mode_pointer_shape))
{
if (f->display.x->cursor_pixel == fore_pixel)
fore_pixel = f->display.x->background_pixel;
}
+ f->display.x->cursor_foreground_pixel = fore_pixel;
if (FRAME_X_WINDOW (f) != 0)
{
UNBLOCK_INPUT;
#endif /* HAVE_X11 */
- if (f->visible)
+ if (FRAME_VISIBLE_P (f))
{
x_display_cursor (f, 0);
x_display_cursor (f, 1);
#ifdef HAVE_X11
XSetWindowBorder (x_current_display, FRAME_X_WINDOW (f),
pix);
- if (f->display.x->h_scrollbar)
- XSetWindowBorder (x_current_display, f->display.x->h_slider,
- pix);
- if (f->display.x->v_scrollbar)
- XSetWindowBorder (x_current_display, f->display.x->v_slider,
- pix);
#else
if (pix < 0)
- temp = XMakePixmap ((Bitmap) XStoreBitmap (16, 16, gray_bits),
+ temp = XMakePixmap ((Bitmap) XStoreBitmap (gray_width, gray_height,
+ gray_bits),
BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT);
else
temp = XMakeTile (pix);
#endif /* not HAVE_X11 */
UNBLOCK_INPUT;
- if (f->visible)
+ if (FRAME_VISIBLE_P (f))
redraw_frame (f);
}
}
+void
+x_set_cursor_type (f, arg, oldval)
+ FRAME_PTR f;
+ Lisp_Object arg, oldval;
+{
+ if (EQ (arg, Qbar))
+ FRAME_DESIRED_CURSOR (f) = bar_cursor;
+ else
+#if 0
+ if (EQ (arg, Qbox))
+#endif
+ FRAME_DESIRED_CURSOR (f) = filled_box_cursor;
+ /* Error messages commented out because people have trouble fixing
+ .Xdefaults with Emacs, when it has something bad in it. */
+#if 0
+ else
+ error
+ ("the `cursor-type' frame parameter should be either `bar' or `box'");
+#endif
+
+ /* Make sure the cursor gets redrawn. This is overkill, but how
+ often do people change cursor types? */
+ update_mode_lines++;
+}
+
void
x_set_icon_type (f, arg, oldval)
struct frame *f;
if (NILP (arg))
result = x_text_icon (f, 0);
else
- result = x_bitmap_icon (f, 0);
+ result = x_bitmap_icon (f);
if (result)
{
/* If the window was unmapped (and its icon was mapped),
the new icon is not mapped, so map the window in its stead. */
- if (f->visible)
+ if (FRAME_VISIBLE_P (f))
XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
XFlushQueue ();
UNBLOCK_INPUT;
}
+extern Lisp_Object x_new_font ();
+
void
x_set_font (f, arg, oldval)
struct frame *f;
Lisp_Object arg, oldval;
{
- unsigned char *name;
- int result;
+ Lisp_Object result;
CHECK_STRING (arg, 1);
- name = XSTRING (arg)->data;
BLOCK_INPUT;
- result = x_new_font (f, name);
+ result = x_new_font (f, XSTRING (arg)->data);
UNBLOCK_INPUT;
- if (result)
- error ("Font \"%s\" is not defined", name);
+ if (EQ (result, Qnil))
+ error ("Font \"%s\" is not defined", XSTRING (arg)->data);
+ else if (EQ (result, Qt))
+ error ("the characters of the given font have varying widths");
+ else if (STRINGP (result))
+ {
+ recompute_basic_faces (f);
+ store_frame_param (f, Qfont, result);
+ }
+ else
+ abort ();
}
void
}
}
-void x_user_set_name (f, arg, oldval)
+void
+x_set_visibility (f, value, oldval)
struct frame *f;
- Lisp_Object arg, oldval;
+ Lisp_Object value, oldval;
+{
+ Lisp_Object frame;
+ XSET (frame, Lisp_Frame, f);
+
+ if (NILP (value))
+ Fmake_frame_invisible (frame);
+ else if (EQ (value, Qicon))
+ Ficonify_frame (frame);
+ else
+ Fmake_frame_visible (frame);
+}
+
+static void
+x_set_menu_bar_lines_1 (window, n)
+ Lisp_Object window;
+ int n;
+{
+ struct window *w = XWINDOW (window);
+
+ XFASTINT (w->top) += n;
+ XFASTINT (w->height) -= n;
+
+ /* Handle just the top child in a vertical split. */
+ if (!NILP (w->vchild))
+ x_set_menu_bar_lines_1 (w->vchild, n);
+
+ /* Adjust all children in a horizontal split. */
+ for (window = w->hchild; !NILP (window); window = w->next)
+ {
+ w = XWINDOW (window);
+ x_set_menu_bar_lines_1 (window, n);
+ }
+}
+
+void
+x_set_menu_bar_lines (f, value, oldval)
+ struct frame *f;
+ Lisp_Object value, oldval;
{
+ int nlines;
+ int olines = FRAME_MENU_BAR_LINES (f);
+
+ /* Right now, menu bars don't work properly in minibuf-only frames;
+ most of the commands try to apply themselves to the minibuffer
+ frame itslef, and get an error because you can't switch buffers
+ in or split the minibuffer window. */
+ if (FRAME_MINIBUF_ONLY_P (f))
+ return;
+
+ if (XTYPE (value) == Lisp_Int)
+ nlines = XINT (value);
+ else
+ nlines = 0;
+
+ FRAME_MENU_BAR_LINES (f) = nlines;
+ x_set_menu_bar_lines_1 (f->root_window, nlines - olines);
}
/* Change the name of frame F to ARG. If ARG is nil, set F's name to
/* If we're switching from explicit to implicit, we had better
update the mode lines and thereby update the title. */
if (f->explicit_name && NILP (name))
- update_mode_lines;
+ update_mode_lines = 1;
f->explicit_name = ! NILP (name);
}
{
f->auto_lower = !EQ (Qnil, arg);
}
-\f
-#ifdef HAVE_X11
-int n_faces;
-#if 0
-/* I believe this function is obsolete with respect to the new face display
- changes. */
-x_set_face (scr, font, background, foreground, stipple)
- struct frame *scr;
- XFontStruct *font;
- unsigned long background, foreground;
- Pixmap stipple;
+void
+x_set_vertical_scroll_bars (f, arg, oldval)
+ struct frame *f;
+ Lisp_Object arg, oldval;
{
- XGCValues gc_values;
- GC temp_gc;
- unsigned long gc_mask;
- struct face *new_face;
- unsigned int width = 16;
- unsigned int height = 16;
-
- if (n_faces == MAX_FACES_AND_GLYPHS)
- return 1;
-
- /* Create the Graphics Context. */
- gc_values.font = font->fid;
- gc_values.foreground = foreground;
- gc_values.background = background;
- gc_values.line_width = 0;
- gc_mask = GCLineWidth | GCFont | GCForeground | GCBackground;
- if (stipple)
+ if (NILP (arg) != ! FRAME_HAS_VERTICAL_SCROLL_BARS (f))
{
- gc_values.stipple
- = XCreateBitmapFromData (x_current_display, ROOT_WINDOW,
- (char *) stipple, width, height);
- gc_mask |= GCStipple;
- }
+ FRAME_HAS_VERTICAL_SCROLL_BARS (f) = ! NILP (arg);
- temp_gc = XCreateGC (x_current_display, FRAME_X_WINDOW (scr),
- gc_mask, &gc_values);
- if (!temp_gc)
- return 1;
- new_face = (struct face *) xmalloc (sizeof (struct face));
- if (!new_face)
- {
- XFreeGC (x_current_display, temp_gc);
- return 1;
+ /* We set this parameter before creating the X window for the
+ frame, so we can get the geometry right from the start.
+ However, if the window hasn't been created yet, we shouldn't
+ call x_set_window_size. */
+ if (FRAME_X_WINDOW (f))
+ x_set_window_size (f, FRAME_WIDTH (f), FRAME_HEIGHT (f));
}
-
- new_face->font = font;
- new_face->foreground = foreground;
- new_face->background = background;
- new_face->face_gc = temp_gc;
- if (stipple)
- new_face->stipple = gc_values.stipple;
-
- x_face_table[++n_faces] = new_face;
- return 1;
-}
-#endif
-
-x_set_glyph (scr, glyph)
-{
}
+\f
+/* Subroutines of creating an X frame. */
-#if 0
-DEFUN ("x-set-face-font", Fx_set_face_font, Sx_set_face_font, 4, 2, 0,
- "Specify face table entry FACE-CODE to be the font named by FONT,\n\
- in colors FOREGROUND and BACKGROUND.")
- (face_code, font_name, foreground, background)
- Lisp_Object face_code;
- Lisp_Object font_name;
- Lisp_Object foreground;
- Lisp_Object background;
-{
- register struct face *fp; /* Current face info. */
- register int fn; /* Face number. */
- register FONT_TYPE *f; /* Font data structure. */
- unsigned char *newname;
- int fg, bg;
- GC temp_gc;
- XGCValues gc_values;
-
- /* Need to do something about this. */
- Drawable drawable = FRAME_X_WINDOW (selected_frame);
-
- CHECK_NUMBER (face_code, 1);
- CHECK_STRING (font_name, 2);
-
- if (EQ (foreground, Qnil) || EQ (background, Qnil))
- {
- fg = selected_frame->display.x->foreground_pixel;
- bg = selected_frame->display.x->background_pixel;
- }
- else
- {
- CHECK_NUMBER (foreground, 0);
- CHECK_NUMBER (background, 1);
-
- fg = x_decode_color (XINT (foreground), BLACK_PIX_DEFAULT);
- bg = x_decode_color (XINT (background), WHITE_PIX_DEFAULT);
- }
-
- fn = XINT (face_code);
- if ((fn < 1) || (fn > 255))
- error ("Invalid face code, %d", fn);
-
- newname = XSTRING (font_name)->data;
- BLOCK_INPUT;
- f = (*newname == 0 ? 0 : XGetFont (newname));
- UNBLOCK_INPUT;
- if (f == 0)
- error ("Font \"%s\" is not defined", newname);
-
- fp = x_face_table[fn];
- if (fp == 0)
- {
- x_face_table[fn] = fp = (struct face *) xmalloc (sizeof (struct face));
- bzero (fp, sizeof (struct face));
- fp->face_type = x_pixmap;
- }
- else if (FACE_IS_FONT (fn))
- {
- BLOCK_INPUT;
- XFreeGC (FACE_FONT (fn));
- UNBLOCK_INPUT;
- }
- else if (FACE_IS_IMAGE (fn)) /* This should not happen... */
- {
- BLOCK_INPUT;
- XFreePixmap (x_current_display, FACE_IMAGE (fn));
- fp->face_type = x_font;
- UNBLOCK_INPUT;
- }
- else
- abort ();
+#ifdef HAVE_X11
- fp->face_GLYPH.font_desc.font = f;
- gc_values.font = f->fid;
- gc_values.foreground = fg;
- gc_values.background = bg;
- fp->face_GLYPH.font_desc.face_gc = XCreateGC (x_current_display,
- drawable, GCFont | GCForeground
- | GCBackground, &gc_values);
- fp->face_GLYPH.font_desc.font_width = FONT_WIDTH (f);
- fp->face_GLYPH.font_desc.font_height = FONT_HEIGHT (f);
-
- return face_code;
-}
-#endif
-#else /* X10 */
-DEFUN ("x-set-face", Fx_set_face, Sx_set_face, 4, 4, 0,
- "Specify face table entry FACE-CODE to be the font named by FONT,\n\
- in colors FOREGROUND and BACKGROUND.")
- (face_code, font_name, foreground, background)
- Lisp_Object face_code;
- Lisp_Object font_name;
- Lisp_Object foreground;
- Lisp_Object background;
+/* Make sure that Vx_resource_name is set to a reasonable value. */
+static void
+validate_x_resource_name ()
{
- register struct face *fp; /* Current face info. */
- register int fn; /* Face number. */
- register FONT_TYPE *f; /* Font data structure. */
- unsigned char *newname;
-
- CHECK_NUMBER (face_code, 1);
- CHECK_STRING (font_name, 2);
-
- fn = XINT (face_code);
- if ((fn < 1) || (fn > 255))
- error ("Invalid face code, %d", fn);
-
- /* Ask the server to find the specified font. */
- newname = XSTRING (font_name)->data;
- BLOCK_INPUT;
- f = (*newname == 0 ? 0 : XGetFont (newname));
- UNBLOCK_INPUT;
- if (f == 0)
- error ("Font \"%s\" is not defined", newname);
-
- /* Get the face structure for face_code in the face table.
- Make sure it exists. */
- fp = x_face_table[fn];
- if (fp == 0)
- {
- x_face_table[fn] = fp = (struct face *) xmalloc (sizeof (struct face));
- bzero (fp, sizeof (struct face));
- }
-
- /* If this face code already exists, get rid of the old font. */
- if (fp->font != 0 && fp->font != f)
- {
- BLOCK_INPUT;
- XLoseFont (fp->font);
- UNBLOCK_INPUT;
- }
-
- /* Store the specified information in FP. */
- fp->fg = x_decode_color (foreground, BLACK_PIX_DEFAULT);
- fp->bg = x_decode_color (background, WHITE_PIX_DEFAULT);
- fp->font = f;
-
- return face_code;
+ if (! STRINGP (Vx_resource_name))
+ Vx_resource_name = make_string ("emacs", 5);
}
-#endif /* X10 */
-
-#if 0
-/* This is excluded because there is no painless way
- to get or to remember the name of the font. */
-
-DEFUN ("x-get-face", Fx_get_face, Sx_get_face, 1, 1, 0,
- "Get data defining face code FACE. FACE is an integer.\n\
-The value is a list (FONT FG-COLOR BG-COLOR).")
- (face)
- Lisp_Object face;
-{
- register struct face *fp; /* Current face info. */
- register int fn; /* Face number. */
- CHECK_NUMBER (face, 1);
- fn = XINT (face);
- if ((fn < 1) || (fn > 255))
- error ("Invalid face code, %d", fn);
- /* Make sure the face table exists and this face code is defined. */
- if (x_face_table == 0 || x_face_table[fn] == 0)
- return Qnil;
-
- fp = x_face_table[fn];
-
- return Fcons (build_string (fp->name),
- Fcons (make_number (fp->fg),
- Fcons (make_number (fp->bg), Qnil)));
-}
-#endif /* 0 */
-\f
-/* Subroutines of creating an X frame. */
-
-#ifdef HAVE_X11
extern char *x_get_string_resource ();
extern XrmDatabase x_load_resources ();
-DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 1, 3, 0,
- "Retrieve the value of ATTRIBUTE from the X defaults database. This\n\
-searches using a key of the form \"INSTANCE.ATTRIBUTE\", with class\n\
-\"Emacs\", where INSTANCE is the name under which Emacs was invoked.\n\
+DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0,
+ "Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.\n\
+This uses `NAME.ATTRIBUTE' as the key and `Emacs.CLASS' as the\n\
+class, where INSTANCE is the name under which Emacs was invoked, or\n\
+the name specified by the `-name' or `-rn' command-line arguments.\n\
\n\
-Optional arguments COMPONENT and CLASS specify the component for which\n\
-we should look up ATTRIBUTE. When specified, Emacs searches using a\n\
-key of the form INSTANCE.COMPONENT.ATTRIBUTE, with class \"Emacs.CLASS\".")
- (attribute, name, class)
- Lisp_Object attribute, name, class;
+The optional arguments COMPONENT and SUBCLASS add to the key and the\n\
+class, respectively. You must specify both of them or neither.\n\
+If you specify them, the key is `NAME.COMPONENT.ATTRIBUTE'\n\
+and the class is `Emacs.CLASS.SUBCLASS'.")
+ (attribute, class, component, subclass)
+ Lisp_Object attribute, class, component, subclass;
{
register char *value;
char *name_key;
char *class_key;
+ check_x ();
+
CHECK_STRING (attribute, 0);
- if (!NILP (name))
- CHECK_STRING (name, 1);
- if (!NILP (class))
- CHECK_STRING (class, 2);
- if (NILP (name) != NILP (class))
- error ("x-get-resource: must specify both NAME and CLASS or neither");
+ CHECK_STRING (class, 0);
- if (NILP (name))
+ if (!NILP (component))
+ CHECK_STRING (component, 1);
+ if (!NILP (subclass))
+ CHECK_STRING (subclass, 2);
+ if (NILP (component) != NILP (subclass))
+ error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
+
+ validate_x_resource_name ();
+
+ if (NILP (component))
{
- name_key = (char *) alloca (XSTRING (invocation_name)->size + 1
- + XSTRING (attribute)->size + 1);
+ /* Allocate space for the components, the dots which separate them,
+ and the final '\0'. */
+ name_key = (char *) alloca (XSTRING (Vx_resource_name)->size
+ + XSTRING (attribute)->size
+ + 2);
+ class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
+ + XSTRING (class)->size
+ + 2);
sprintf (name_key, "%s.%s",
- XSTRING (invocation_name)->data,
+ XSTRING (Vx_resource_name)->data,
XSTRING (attribute)->data);
- class_key = EMACS_CLASS;
+ sprintf (class_key, "%s.%s",
+ EMACS_CLASS,
+ XSTRING (class)->data);
}
else
{
- name_key = (char *) alloca (XSTRING (invocation_name)->size + 1
- + XSTRING (name)->size + 1
- + XSTRING (attribute)->size + 1);
+ name_key = (char *) alloca (XSTRING (Vx_resource_name)->size
+ + XSTRING (component)->size
+ + XSTRING (attribute)->size
+ + 3);
- class_key = (char *) alloca (sizeof (EMACS_CLASS)
- + XSTRING (class)->size + 1);
+ class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
+ + XSTRING (class)->size
+ + XSTRING (subclass)->size
+ + 3);
sprintf (name_key, "%s.%s.%s",
- XSTRING (invocation_name)->data,
- XSTRING (name)->data,
+ XSTRING (Vx_resource_name)->data,
+ XSTRING (component)->data,
XSTRING (attribute)->data);
- sprintf (class_key, "%s.%s",
- XSTRING (invocation_name)->data,
- XSTRING (class)->data);
+ sprintf (class_key, "%s.%s.%s",
+ EMACS_CLASS,
+ XSTRING (class)->data,
+ XSTRING (subclass)->data);
}
value = x_get_string_resource (xrdb, name_key, class_key);
return Qnil;
}
+/* Used when C code wants a resource value. */
+
+char *
+x_get_resource_string (attribute, class)
+ char *attribute, *class;
+{
+ register char *value;
+ char *name_key;
+ char *class_key;
+
+ /* Allocate space for the components, the dots which separate them,
+ and the final '\0'. */
+ name_key = (char *) alloca (XSTRING (Vinvocation_name)->size
+ + strlen (attribute) + 2);
+ class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
+ + strlen (class) + 2);
+
+ sprintf (name_key, "%s.%s",
+ XSTRING (Vinvocation_name)->data,
+ attribute);
+ sprintf (class_key, "%s.%s", EMACS_CLASS, class);
+
+ return x_get_string_resource (xrdb, name_key, class_key);
+}
+
#else /* X10 */
DEFUN ("x-get-default", Fx_get_default, Sx_get_default, 1, 1, 0,
CHECK_STRING (arg, 1);
value = (unsigned char *) XGetDefault (XDISPLAY
- XSTRING (invocation_name)->data,
+ XSTRING (Vinvocation_name)->data,
XSTRING (arg)->data);
if (value == 0)
/* Try reversing last two args, in case this is the buggy version of X. */
value = (unsigned char *) XGetDefault (XDISPLAY
XSTRING (arg)->data,
- XSTRING (invocation_name)->data);
+ XSTRING (Vinvocation_name)->data);
if (value != 0)
return build_string (value);
else
return (Qnil);
}
-#define Fx_get_resource(attribute, name, class) Fx_get_default(attribute)
+#define Fx_get_resource(attribute, class, component, subclass) \
+ Fx_get_default(attribute)
#endif /* X10 */
/* Return the value of parameter PARAM.
First search ALIST, then Vdefault_frame_alist, then the X defaults
- database, using ATTRIBUTE as the attribute name.
+ database, using ATTRIBUTE as the attribute name and CLASS as its class.
Convert the resource to the type specified by desired_type.
and don't let it get stored in any lisp-visible variables! */
static Lisp_Object
-x_get_arg (alist, param, attribute, type)
+x_get_arg (alist, param, attribute, class, type)
Lisp_Object alist, param;
char *attribute;
+ char *class;
enum resource_types type;
{
register Lisp_Object tem;
if (attribute)
{
- tem = Fx_get_resource (build_string (attribute), Qnil, Qnil);
+ tem = Fx_get_resource (build_string (attribute),
+ build_string (class),
+ Qnil, Qnil);
if (NILP (tem))
return Qunbound;
return tem;
case symbol:
- return intern (tem);
+ /* As a special case, we map the values `true' and `on'
+ to Qt, and `false' and `off' to Qnil. */
+ {
+ Lisp_Object lower = Fdowncase (tem);
+ if (!strcmp (XSTRING (tem)->data, "on")
+ || !strcmp (XSTRING (tem)->data, "true"))
+ return Qt;
+ else if (!strcmp (XSTRING (tem)->data, "off")
+ || !strcmp (XSTRING (tem)->data, "false"))
+ return Qnil;
+ else
+ return Fintern (tem, Qnil);
+ }
default:
abort ();
If that is not found either, use the value DEFLT. */
static Lisp_Object
-x_default_parameter (f, alist, prop, deflt, xprop, type)
+x_default_parameter (f, alist, prop, deflt, xprop, xclass, type)
struct frame *f;
Lisp_Object alist;
Lisp_Object prop;
Lisp_Object deflt;
char *xprop;
+ char *xclass;
enum resource_types type;
{
Lisp_Object tem;
- tem = x_get_arg (alist, prop, xprop, type);
+ tem = x_get_arg (alist, prop, xprop, xclass, type);
if (EQ (tem, Qunbound))
tem = deflt;
x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil));
return tem;
}
\f
-DEFUN ("x-geometry", Fx_geometry, Sx_geometry, 1, 1, 0,
+DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0,
"Parse an X-style geometry string STRING.\n\
Returns an alist of the form ((top . TOP), (left . LEFT) ... ).")
(string)
+ Lisp_Object string;
{
int geometry, x, y;
unsigned int width, height;
window manager prompting. */
f->width = DEFAULT_COLS;
f->height = DEFAULT_ROWS;
- f->display.x->top_pos = 1;
- f->display.x->left_pos = 1;
+ /* Window managers expect that if program-specified
+ positions are not (0,0), they're intentional, not defaults. */
+ f->display.x->top_pos = 0;
+ f->display.x->left_pos = 0;
- tem0 = x_get_arg (parms, Qheight, 0, number);
- tem1 = x_get_arg (parms, Qwidth, 0, number);
+ tem0 = x_get_arg (parms, Qheight, 0, 0, number);
+ tem1 = x_get_arg (parms, Qwidth, 0, 0, number);
if (! EQ (tem0, Qunbound) && ! EQ (tem1, Qunbound))
{
CHECK_NUMBER (tem0, 0);
else if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
error ("Must specify *both* height and width");
- f->display.x->pixel_width = (FONT_WIDTH (f->display.x->font) * f->width
- + 2 * f->display.x->internal_border_width);
- f->display.x->pixel_height = (FONT_HEIGHT (f->display.x->font) * f->height
- + 2 * f->display.x->internal_border_width);
+ f->display.x->vertical_scroll_bar_extra
+ = (FRAME_HAS_VERTICAL_SCROLL_BARS (f)
+ ? VERTICAL_SCROLL_BAR_PIXEL_WIDTH (f)
+ : 0);
+ f->display.x->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width);
+ f->display.x->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height);
- tem0 = x_get_arg (parms, Qtop, 0, number);
- tem1 = x_get_arg (parms, Qleft, 0, number);
+ tem0 = x_get_arg (parms, Qtop, 0, 0, number);
+ tem1 = x_get_arg (parms, Qleft, 0, 0, number);
if (! EQ (tem0, Qunbound) && ! EQ (tem1, Qunbound))
{
CHECK_NUMBER (tem0, 0);
else if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
error ("Must specify *both* top and left corners");
+#if 0 /* PPosition and PSize mean "specified explicitly,
+ by the program rather than by the user". So it is wrong to
+ set them if nothing was specified. */
switch (window_prompting)
{
case USSize | USPosition:
put there. */
abort ();
}
+#endif
+ return window_prompting;
}
static void
screen_visual, /* set in Fx_open_connection */
attribute_mask, &attributes);
- class_hints.res_name = (char *) XSTRING (f->name)->data;
+ validate_x_resource_name ();
+ class_hints.res_name = (char *) XSTRING (Vx_resource_name)->data;
class_hints.res_class = EMACS_CLASS;
XSetClassHint (x_current_display, FRAME_X_WINDOW (f), &class_hints);
+ /* This indicates that we use the "Passive Input" input model.
+ Unless we do this, we don't get the Focus{In,Out} events that we
+ need to draw the cursor correctly. Accursed bureaucrats.
+ XWhipsAndChains (x_current_display, IronMaiden, &TheRack); */
+
+ f->display.x->wm_hints.input = True;
+ f->display.x->wm_hints.flags |= InputHint;
+ XSetWMHints (x_current_display, FRAME_X_WINDOW (f), &f->display.x->wm_hints);
+
/* x_set_name normally ignores requests to set the name if the
requested name is the same as the current name. This is the one
place where that assumption isn't correct; f->name is set, but
the X server hasn't been told. */
{
Lisp_Object name = f->name;
+ int explicit = f->explicit_name;
f->name = Qnil;
- x_implicitly_set_name (f, name, Qnil);
+ f->explicit_name = 0;
+ x_set_name (f, name, explicit);
}
XDefineCursor (XDISPLAY FRAME_X_WINDOW (f),
/* Set the position of the icon. Note that twm groups all
icons in an icon window. */
- icon_x = x_get_arg (parms, Qicon_left, 0, number);
- icon_y = x_get_arg (parms, Qicon_top, 0, number);
+ icon_x = x_get_arg (parms, Qicon_left, 0, 0, number);
+ icon_y = x_get_arg (parms, Qicon_top, 0, 0, number);
if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
{
CHECK_NUMBER (icon_x, 0);
x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
/* Start up iconic or window? */
- x_wm_set_window_state (f,
- (EQ (x_get_arg (parms, Qiconic_startup, 0, boolean),
- Qt)
- ? IconicState
- : NormalState));
+ x_wm_set_window_state
+ (f, (EQ (x_get_arg (parms, Qvisibility, 0, 0, symbol), Qicon)
+ ? IconicState
+ : NormalState));
UNBLOCK_INPUT;
}
GC temp_gc;
XImage tileimage;
+ BLOCK_INPUT;
+
/* Create the GC's of this frame.
Note that many default values are used. */
/* Create the gray border tile used when the pointer is not in
the frame. Since this depends on the frame's pixel values,
this must be done on a per-frame basis. */
- f->display.x->border_tile =
- XCreatePixmap (x_current_display, ROOT_WINDOW, 16, 16,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
- gc_values.foreground = f->display.x->foreground_pixel;
- gc_values.background = f->display.x->background_pixel;
- temp_gc = XCreateGC (x_current_display,
- (Drawable) f->display.x->border_tile,
- GCForeground | GCBackground, &gc_values);
-
- /* These are things that should be determined by the server, in
- Fx_open_connection */
- tileimage.height = 16;
- tileimage.width = 16;
- tileimage.xoffset = 0;
- tileimage.format = XYBitmap;
- tileimage.data = gray_bits;
- tileimage.byte_order = LSBFirst;
- tileimage.bitmap_unit = 8;
- tileimage.bitmap_bit_order = LSBFirst;
- tileimage.bitmap_pad = 8;
- tileimage.bytes_per_line = (16 + 7) >> 3;
- tileimage.depth = 1;
- XPutImage (x_current_display, f->display.x->border_tile, temp_gc,
- &tileimage, 0, 0, 0, 0, 16, 16);
- XFreeGC (x_current_display, temp_gc);
+ f->display.x->border_tile
+ = (XCreatePixmapFromBitmapData
+ (x_current_display, ROOT_WINDOW,
+ gray_bits, gray_width, gray_height,
+ f->display.x->foreground_pixel,
+ f->display.x->background_pixel,
+ DefaultDepth (x_current_display, XDefaultScreen (x_current_display))));
+
+ UNBLOCK_INPUT;
}
#endif /* HAVE_X11 */
long window_prompting = 0;
int width, height;
- if (x_current_display == 0)
- error ("X windows are not in use or not initialized");
+ check_x ();
- name = x_get_arg (parms, Qname, "Title", string);
- if (EQ (name, Qunbound) || NILP (name))
- name = build_string (x_id_name);
- if (XTYPE (name) != Lisp_String)
+ name = x_get_arg (parms, Qname, "title", "Title", string);
+ if (XTYPE (name) != Lisp_String
+ && ! EQ (name, Qunbound)
+ && ! NILP (name))
error ("x-create-frame: name parameter must be a string");
- tem = x_get_arg (parms, Qminibuffer, 0, symbol);
+ tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol);
if (EQ (tem, Qnone) || NILP (tem))
f = make_frame_without_minibuffer (Qnil);
else if (EQ (tem, Qonly))
else
f = make_frame (1);
- /* Set the name; the functions to which we pass f expect the
- name to be set. */
- XSET (f->name, Lisp_String, name);
+ /* Note that X Windows does support scroll bars. */
+ FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
+
+ /* Set the name; the functions to which we pass f expect the name to
+ be set. */
+ if (EQ (name, Qunbound) || NILP (name))
+ {
+ f->name = build_string (x_id_name);
+ f->explicit_name = 0;
+ }
+ else
+ {
+ f->name = name;
+ f->explicit_name = 1;
+ }
XSET (frame, Lisp_Frame, f);
f->output_method = output_x_window;
/* Extract the window parameters from the supplied values
that are needed to determine window geometry. */
- x_default_parameter (f, parms, Qfont,
- build_string ("9x15"), "font", string);
- x_default_parameter (f, parms, Qbackground_color,
- build_string ("white"), "background", string);
- x_default_parameter (f, parms, Qborder_width,
- make_number (2), "BorderWidth", number);
- /* This defaults to 2 in order to match XTerms. */
- x_default_parameter (f, parms, Qinternal_border_width,
- make_number (2), "InternalBorderWidth", number);
+ {
+ Lisp_Object font;
+
+ font = x_get_arg (parms, Qfont, "font", "Font", string);
+ BLOCK_INPUT;
+ /* First, try whatever font the caller has specified. */
+ if (STRINGP (font))
+ font = x_new_font (f, XSTRING (font)->data);
+ /* Try out a font which we hope has bold and italic variations. */
+ if (!STRINGP (font))
+ font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-120-*-*-c-*-iso8859-1");
+ if (! STRINGP (font))
+ font = x_new_font (f, "-*-*-medium-r-normal-*-*-120-*-*-c-*-iso8859-1");
+ if (! STRINGP (font))
+ /* This was formerly the first thing tried, but it finds too many fonts
+ and takes too long. */
+ font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");
+ /* If those didn't work, look for something which will at least work. */
+ if (! STRINGP (font))
+ font = x_new_font (f, "-*-fixed-*-*-*-*-*-120-*-*-c-*-iso8859-1");
+ UNBLOCK_INPUT;
+ if (! STRINGP (font))
+ font = build_string ("fixed");
+
+ x_default_parameter (f, parms, Qfont, font,
+ "font", "Font", string);
+ }
+ x_default_parameter (f, parms, Qborder_width, make_number (2),
+ "borderwidth", "BorderWidth", number);
+ /* This defaults to 2 in order to match xterm. We recognize either
+ internalBorderWidth or internalBorder (which is what xterm calls
+ it). */
+ if (NILP (Fassq (Qinternal_border_width, parms)))
+ {
+ Lisp_Object value;
+
+ value = x_get_arg (parms, Qinternal_border_width,
+ "internalBorder", "BorderWidth", number);
+ if (! EQ (value, Qunbound))
+ parms = Fcons (Fcons (Qinternal_border_width, value),
+ parms);
+ }
+ x_default_parameter (f, parms, Qinternal_border_width, make_number (2),
+ "internalBorderWidth", "BorderWidth", number);
+ x_default_parameter (f, parms, Qvertical_scroll_bars, Qt,
+ "verticalScrollBars", "ScrollBars", boolean);
/* Also do the stuff which must be set before the window exists. */
- x_default_parameter (f, parms, Qforeground_color,
- build_string ("black"), "foreground", string);
- x_default_parameter (f, parms, Qmouse_color,
- build_string ("black"), "mouse", string);
- x_default_parameter (f, parms, Qcursor_color,
- build_string ("black"), "cursor", string);
- x_default_parameter (f, parms, Qborder_color,
- build_string ("black"), "border", string);
-
- /* When XSetWMHints eventually gets called, this will indicate that
- we use the "Passive Input" input model. Unless we do this, we
- don't get the Focus{In,Out} events that we need to draw the
- cursor correctly. Accursed bureaucrats.
-
- We set this here and leave it, because we know, being decidedly
- non-humble programmers (nay, weigh'd low by our hubris!), that
- Fx_create_frame calls x_icon which begat x_wm_set_window_state
- which begat XSetWMHints, which will get this information to the
- right parties. -JimB
-
- XWhipsAndChains (x_current_display, IronMaiden, &TheRack); */
-
- f->display.x->wm_hints.input = True;
- f->display.x->wm_hints.flags |= InputHint;
+ x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
+ "foreground", "Foreground", string);
+ x_default_parameter (f, parms, Qbackground_color, build_string ("white"),
+ "background", "Background", string);
+ x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
+ "pointerColor", "Foreground", string);
+ x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
+ "cursorColor", "Foreground", string);
+ x_default_parameter (f, parms, Qborder_color, build_string ("black"),
+ "borderColor", "BorderColor", string);
f->display.x->parent_desc = ROOT_WINDOW;
window_prompting = x_figure_window_size (f, parms);
x_window (f);
x_icon (f, parms);
x_make_gc (f);
+ init_frame_faces (f);
/* We need to do this after creating the X window, so that the
icon-creation functions can say whose icon they're describing. */
- x_default_parameter (f, parms, Qicon_type, Qnil, "IconType", symbol);
+ x_default_parameter (f, parms, Qicon_type, Qnil,
+ "bitmapIcon", "BitmapIcon", symbol);
- x_default_parameter (f, parms, Qauto_raise, Qnil, "AutoRaise", boolean);
- x_default_parameter (f, parms, Qauto_lower, Qnil, "AutoLower", boolean);
+ x_default_parameter (f, parms, Qauto_raise, Qnil,
+ "autoRaise", "AutoRaiseLower", boolean);
+ x_default_parameter (f, parms, Qauto_lower, Qnil,
+ "autoLower", "AutoRaiseLower", boolean);
+ x_default_parameter (f, parms, Qcursor_type, Qbox,
+ "cursorType", "CursorType", symbol);
/* Dimensions, especially f->height, must be done via change_frame_size.
Change will not be effected unless different from the current
height = f->height;
f->height = f->width = 0;
change_frame_size (f, height, width, 1, 0);
+
+ x_default_parameter (f, parms, Qmenu_bar_lines, make_number (0),
+ "menuBarLines", "MenuBarLines", number);
+
BLOCK_INPUT;
x_wm_set_size_hint (f, window_prompting);
UNBLOCK_INPUT;
- tem = x_get_arg (parms, Qunsplittable, 0, boolean);
+ tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean);
f->no_split = minibuffer_only || EQ (tem, Qt);
- /* Now handle the rest of the parameters. */
- x_default_parameter (f, parms, Qhorizontal_scroll_bar,
- Qnil, "HScrollBar", boolean);
- x_default_parameter (f, parms, Qvertical_scroll_bar,
- Qnil, "VScrollBar", boolean);
-
- /* Make the window appear on the frame and enable display. */
- if (!EQ (x_get_arg (parms, Qsuppress_initial_map, 0, boolean), Qt))
- x_make_frame_visible (f);
+ /* Make the window appear on the frame and enable display,
+ unless the caller says not to. */
+ {
+ Lisp_Object visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol);
+
+ if (EQ (visibility, Qunbound))
+ visibility = Qt;
+
+ if (EQ (visibility, Qicon))
+ x_iconify_frame (f);
+ else if (! NILP (visibility))
+ x_make_frame_visible (f);
+ else
+ /* Must have been Qnil. */
+ ;
+ }
return frame;
#else /* X10 */
name = Fassq (Qname, parms);
- tem = x_get_arg (parms, Qminibuffer, 0, symbol);
+ tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol);
if (EQ (tem, Qnone))
f = make_frame_without_minibuffer (Qnil);
else if (EQ (tem, Qonly))
f->display.x = (struct x_display *) xmalloc (sizeof (struct x_display));
bzero (f->display.x, sizeof (struct x_display));
- /* Some temprorary default values for height and width. */
+ /* Some temporary default values for height and width. */
width = 80;
height = 40;
f->display.x->left_pos = -1;
/* Extract some window parameters from the supplied values.
These are the parameters that affect window geometry. */
- tem = x_get_arg (parms, Qfont, "BodyFont", string);
+ tem = x_get_arg (parms, Qfont, "BodyFont", 0, string);
if (EQ (tem, Qunbound))
tem = build_string ("9x15");
x_set_font (f, tem, Qnil);
x_default_parameter (f, parms, Qborder_color,
- build_string ("black"), "Border", string);
+ build_string ("black"), "Border", 0, string);
x_default_parameter (f, parms, Qbackground_color,
- build_string ("white"), "Background", string);
+ build_string ("white"), "Background", 0, string);
x_default_parameter (f, parms, Qforeground_color,
- build_string ("black"), "Foreground", string);
+ build_string ("black"), "Foreground", 0, string);
x_default_parameter (f, parms, Qmouse_color,
- build_string ("black"), "Mouse", string);
+ build_string ("black"), "Mouse", 0, string);
x_default_parameter (f, parms, Qcursor_color,
- build_string ("black"), "Cursor", string);
+ build_string ("black"), "Cursor", 0, string);
x_default_parameter (f, parms, Qborder_width,
- make_number (2), "BorderWidth", number);
+ make_number (2), "BorderWidth", 0, number);
x_default_parameter (f, parms, Qinternal_border_width,
- make_number (4), "InternalBorderWidth", number);
+ make_number (4), "InternalBorderWidth", 0, number);
x_default_parameter (f, parms, Qauto_raise,
- Qnil, "AutoRaise", boolean);
+ Qnil, "AutoRaise", 0, boolean);
- hscroll = EQ (x_get_arg (parms, Qhorizontal_scroll_bar, 0, boolean), Qt);
- vscroll = EQ (x_get_arg (parms, Qvertical_scroll_bar, 0, boolean), Qt);
+ hscroll = EQ (x_get_arg (parms, Qhorizontal_scroll_bar, 0, 0, boolean), Qt);
+ vscroll = EQ (x_get_arg (parms, Qvertical_scroll_bar, 0, 0, boolean), Qt);
if (f->display.x->internal_border_width < 0)
f->display.x->internal_border_width = 0;
- tem = x_get_arg (parms, Qwindow_id, 0, number);
+ tem = x_get_arg (parms, Qwindow_id, 0, 0, number);
if (!EQ (tem, Qunbound))
{
WINDOWINFO_TYPE wininfo;
BLOCK_INPUT;
XGetWindowInfo (FRAME_X_WINDOW (f), &wininfo);
XQueryTree (FRAME_X_WINDOW (f), &parent, &nchildren, &children);
- free (children);
+ xfree (children);
UNBLOCK_INPUT;
- height = (wininfo.height - 2 * f->display.x->internal_border_width)
- / FONT_HEIGHT (f->display.x->font);
- width = (wininfo.width - 2 * f->display.x->internal_border_width)
- / FONT_WIDTH (f->display.x->font);
+ height = PIXEL_TO_CHAR_HEIGHT (f, wininfo.height);
+ width = PIXEL_TO_CHAR_WIDTH (f, wininfo.width);
f->display.x->left_pos = wininfo.x;
f->display.x->top_pos = wininfo.y;
- f->visible = wininfo.mapped != 0;
+ FRAME_SET_VISIBILITY (f, wininfo.mapped != 0);
f->display.x->border_width = wininfo.bdrwidth;
f->display.x->parent_desc = parent;
}
else
{
- tem = x_get_arg (parms, Qparent_id, 0, number);
+ tem = x_get_arg (parms, Qparent_id, 0, 0, number);
if (!EQ (tem, Qunbound))
{
CHECK_NUMBER (tem, 0);
parent = (Window) XINT (tem);
}
f->display.x->parent_desc = parent;
- tem = x_get_arg (parms, Qheight, 0, number);
+ tem = x_get_arg (parms, Qheight, 0, 0, number);
if (EQ (tem, Qunbound))
{
- tem = x_get_arg (parms, Qwidth, 0, number);
+ tem = x_get_arg (parms, Qwidth, 0, 0, number);
if (EQ (tem, Qunbound))
{
- tem = x_get_arg (parms, Qtop, 0, number);
+ tem = x_get_arg (parms, Qtop, 0, 0, number);
if (EQ (tem, Qunbound))
- tem = x_get_arg (parms, Qleft, 0, number);
+ tem = x_get_arg (parms, Qleft, 0, 0, number);
}
}
/* Now TEM is Qunbound if no edge or size was specified.
In that case, we must do rubber-banding. */
if (EQ (tem, Qunbound))
{
- tem = x_get_arg (parms, Qgeometry, 0, number);
+ tem = x_get_arg (parms, Qgeometry, 0, 0, number);
x_rubber_band (f,
&f->display.x->left_pos, &f->display.x->top_pos,
&width, &height,
{
/* Here if at least one edge or size was specified.
Demand that they all were specified, and use them. */
- tem = x_get_arg (parms, Qheight, 0, number);
+ tem = x_get_arg (parms, Qheight, 0, 0, number);
if (EQ (tem, Qunbound))
error ("Height not specified");
CHECK_NUMBER (tem, 0);
height = XINT (tem);
- tem = x_get_arg (parms, Qwidth, 0, number);
+ tem = x_get_arg (parms, Qwidth, 0, 0, number);
if (EQ (tem, Qunbound))
error ("Width not specified");
CHECK_NUMBER (tem, 0);
width = XINT (tem);
- tem = x_get_arg (parms, Qtop, 0, number);
+ tem = x_get_arg (parms, Qtop, 0, 0, number);
if (EQ (tem, Qunbound))
error ("Top position not specified");
CHECK_NUMBER (tem, 0);
f->display.x->left_pos = XINT (tem);
- tem = x_get_arg (parms, Qleft, 0, number);
+ tem = x_get_arg (parms, Qleft, 0, 0, number);
if (EQ (tem, Qunbound))
error ("Left position not specified");
CHECK_NUMBER (tem, 0);
f->display.x->top_pos = XINT (tem);
}
- pixelwidth = (width * FONT_WIDTH (f->display.x->font)
- + 2 * f->display.x->internal_border_width
- + (!NILP (vscroll) ? VSCROLL_WIDTH : 0));
- pixelheight = (height * FONT_HEIGHT (f->display.x->font)
- + 2 * f->display.x->internal_border_width
- + (!NILP (hscroll) ? HSCROLL_HEIGHT : 0));
+ pixelwidth = CHAR_TO_PIXEL_WIDTH (f, width);
+ pixelheight = CHAR_TO_PIXEL_HEIGHT (f, height);
BLOCK_INPUT;
FRAME_X_WINDOW (f)
/* Now override the defaults with all the rest of the specified
parms. */
- tem = x_get_arg (parms, Qunsplittable, 0, boolean);
+ tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean);
f->no_split = minibuffer_only || EQ (tem, Qt);
/* Do not create an icon window if the caller says not to */
- if (!EQ (x_get_arg (parms, Qsuppress_icon, 0, boolean), Qt)
+ if (!EQ (x_get_arg (parms, Qsuppress_icon, 0, 0, boolean), Qt)
|| f->display.x->parent_desc != ROOT_WINDOW)
{
x_text_icon (f, iconidentity);
x_default_parameter (f, parms, Qicon_type, Qnil,
- "BitmapIcon", symbol);
+ "BitmapIcon", 0, symbol);
}
/* Tell the X server the previously set values of the
Fmodify_frame_parameters (frame, parms);
- if (!NILP (vscroll))
- install_vertical_scrollbar (f, pixelwidth, pixelheight);
- if (!NILP (hscroll))
- install_horizontal_scrollbar (f, pixelwidth, pixelheight);
-
/* Make the window appear on the frame and enable display. */
+ {
+ Lisp_Object visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol);
+
+ if (EQ (visibility, Qunbound))
+ visibility = Qt;
+
+ if (! EQ (visibility, Qicon)
+ && ! NILP (visibility))
+ x_make_window_visible (f);
+ }
- if (!EQ (x_get_arg (parms, Qsuppress_initial_map, 0, boolean), Qt))
- x_make_window_visible (f);
- FRAME_GARBAGED (f);
+ SET_FRAME_GARBAGED (f);
return frame;
#endif /* X10 */
*x -= wininfo.x;
*y -= wininfo.y;
XQueryTree (tempwindow, &tempwindow, &nchildren, &children);
- free (children);
+ xfree (children);
}
UNBLOCK_INPUT;
}
#endif /* not HAVE_X11 */
\f
-/* Set whether frame F has a horizontal scroll bar.
- VAL is t or nil to specify it. */
-
-static void
-x_set_horizontal_scrollbar (f, val, oldval)
- struct frame *f;
- Lisp_Object val, oldval;
-{
- if (!NILP (val))
+DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 3, 0,
+ "Return a list of the names of available fonts matching PATTERN.\n\
+If optional arguments FACE and FRAME are specified, return only fonts\n\
+the same size as FACE on FRAME.\n\
+\n\
+PATTERN is a string, perhaps with wildcard characters;\n\
+ the * character matches any substring, and\n\
+ the ? character matches any single character.\n\
+ PATTERN is case-insensitive.\n\
+FACE is a face name - a symbol.\n\
+\n\
+The return value is a list of strings, suitable as arguments to\n\
+set-face-font.\n\
+\n\
+The list does not include fonts Emacs can't use (i.e. proportional\n\
+fonts), even if they match PATTERN and FACE.")
+ (pattern, face, frame)
+ Lisp_Object pattern, face, frame;
+{
+ int num_fonts;
+ char **names;
+ XFontStruct *info;
+ XFontStruct *size_ref;
+ Lisp_Object list;
+
+ CHECK_STRING (pattern, 0);
+ if (!NILP (face))
+ CHECK_SYMBOL (face, 1);
+ if (!NILP (frame))
+ CHECK_LIVE_FRAME (frame, 2);
+
+ if (NILP (face))
+ size_ref = 0;
+ else
{
- if (FRAME_X_WINDOW (f) != 0)
+ FRAME_PTR f = NILP (frame) ? selected_frame : XFRAME (frame);
+ int face_id = face_name_id_number (f, face);
+
+ if (face_id < 0 || face_id >= FRAME_N_PARAM_FACES (f)
+ || FRAME_PARAM_FACES (f) [face_id] == 0)
+ size_ref = f->display.x->font;
+ else
{
- BLOCK_INPUT;
- f->display.x->h_scrollbar_height = HSCROLL_HEIGHT;
- x_set_window_size (f, f->width, f->height);
- install_horizontal_scrollbar (f);
- SET_FRAME_GARBAGED (f);
- UNBLOCK_INPUT;
+ size_ref = FRAME_PARAM_FACES (f) [face_id]->font;
+ if (size_ref == (XFontStruct *) (~0))
+ size_ref = f->display.x->font;
}
}
- else
- if (f->display.x->h_scrollbar)
- {
- BLOCK_INPUT;
- f->display.x->h_scrollbar_height = 0;
- XDestroyWindow (XDISPLAY f->display.x->h_scrollbar);
- f->display.x->h_scrollbar = 0;
- x_set_window_size (f, f->width, f->height);
- f->garbaged++;
- frame_garbaged++;
- BLOCK_INPUT;
- }
-}
-/* Set whether frame F has a vertical scroll bar.
- VAL is t or nil to specify it. */
+ BLOCK_INPUT;
+ names = XListFontsWithInfo (x_current_display,
+ XSTRING (pattern)->data,
+ 2000, /* maxnames */
+ &num_fonts, /* count_return */
+ &info); /* info_return */
+ UNBLOCK_INPUT;
-static void
-x_set_vertical_scrollbar (f, val, oldval)
- struct frame *f;
- Lisp_Object val, oldval;
-{
- if (!NILP (val))
+ list = Qnil;
+
+ if (names)
{
- if (FRAME_X_WINDOW (f) != 0)
- {
- BLOCK_INPUT;
- f->display.x->v_scrollbar_width = VSCROLL_WIDTH;
- x_set_window_size (f, f->width, f->height);
- install_vertical_scrollbar (f);
- SET_FRAME_GARBAGED (f);
- UNBLOCK_INPUT;
- }
+ Lisp_Object *tail;
+ int i;
+
+ tail = &list;
+ for (i = 0; i < num_fonts; i++)
+ if (! size_ref
+ || same_size_fonts (&info[i], size_ref))
+ {
+ *tail = Fcons (build_string (names[i]), Qnil);
+ tail = &XCONS (*tail)->cdr;
+ }
+
+ XFreeFontInfo (names, info, num_fonts);
}
- else
- if (f->display.x->v_scrollbar != 0)
- {
- BLOCK_INPUT;
- f->display.x->v_scrollbar_width = 0;
- XDestroyWindow (XDISPLAY f->display.x->v_scrollbar);
- f->display.x->v_scrollbar = 0;
- x_set_window_size (f, f->width, f->height);
- SET_FRAME_GARBAGED (f);
- UNBLOCK_INPUT;
- }
+
+ return list;
}
-\f
-/* Create the X windows for a vertical scroll bar
- for a frame X that already has an X window but no scroll bar. */
-static void
-install_vertical_scrollbar (f)
- struct frame *f;
+\f
+DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 1, 0,
+ "Return t if the current X display supports the color named COLOR.")
+ (color)
+ Lisp_Object color;
{
- int ibw = f->display.x->internal_border_width;
- Window parent;
- XColor fore_color, back_color;
- Pixmap up_arrow_pixmap, down_arrow_pixmap, slider_pixmap;
- int pix_x, pix_y, width, height, border;
-
- height = f->display.x->pixel_height - ibw - 2;
- width = VSCROLL_WIDTH - 2;
- pix_x = f->display.x->pixel_width - ibw/2;
- pix_y = ibw / 2;
- border = 1;
-
-#ifdef HAVE_X11
- up_arrow_pixmap =
- XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f),
- up_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- down_arrow_pixmap =
- XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f),
- down_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- slider_pixmap =
- XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f),
- gray_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- /* These cursor shapes will be installed when the mouse enters
- the appropriate window. */
-
- up_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_up_arrow);
- down_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_down_arrow);
- v_double_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_v_double_arrow);
-
- f->display.x->v_scrollbar =
- XCreateSimpleWindow (x_current_display, FRAME_X_WINDOW (f),
- pix_x, pix_y, width, height, border,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel);
- XFlush (x_current_display);
- XDefineCursor (x_current_display, f->display.x->v_scrollbar,
- v_double_arrow_cursor);
-
- /* Create slider window */
- f->display.x->v_slider =
- XCreateSimpleWindow (x_current_display, f->display.x->v_scrollbar,
- 0, VSCROLL_WIDTH - 2,
- VSCROLL_WIDTH - 4, VSCROLL_WIDTH - 4,
- 1, f->display.x->border_pixel,
- f->display.x->foreground_pixel);
- XFlush (x_current_display);
- XDefineCursor (x_current_display, f->display.x->v_slider,
- v_double_arrow_cursor);
- XSetWindowBackgroundPixmap (x_current_display, f->display.x->v_slider,
- slider_pixmap);
-
- f->display.x->v_thumbup =
- XCreateSimpleWindow (x_current_display, f->display.x->v_scrollbar,
- 0, 0,
- VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2,
- 0, f->display.x->foreground_pixel,
- f->display.x-> background_pixel);
- XFlush (x_current_display);
- XDefineCursor (x_current_display, f->display.x->v_thumbup,
- up_arrow_cursor);
- XSetWindowBackgroundPixmap (x_current_display, f->display.x->v_thumbup,
- up_arrow_pixmap);
-
- f->display.x->v_thumbdown =
- XCreateSimpleWindow (x_current_display, f->display.x->v_scrollbar,
- 0, height - VSCROLL_WIDTH + 2,
- VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2,
- 0, f->display.x->foreground_pixel,
- f->display.x->background_pixel);
- XFlush (x_current_display);
- XDefineCursor (x_current_display, f->display.x->v_thumbdown,
- down_arrow_cursor);
- XSetWindowBackgroundPixmap (x_current_display, f->display.x->v_thumbdown,
- down_arrow_pixmap);
+ Color foo;
- fore_color.pixel = f->display.x->mouse_pixel;
- back_color.pixel = f->display.x->background_pixel;
- XQueryColor (x_current_display,
- DefaultColormap (x_current_display,
- DefaultScreen (x_current_display)),
- &fore_color);
- XQueryColor (x_current_display,
- DefaultColormap (x_current_display,
- DefaultScreen (x_current_display)),
- &back_color);
- XRecolorCursor (x_current_display, up_arrow_cursor,
- &fore_color, &back_color);
- XRecolorCursor (x_current_display, down_arrow_cursor,
- &fore_color, &back_color);
- XRecolorCursor (x_current_display, v_double_arrow_cursor,
- &fore_color, &back_color);
-
- XFreePixmap (x_current_display, slider_pixmap);
- XFreePixmap (x_current_display, up_arrow_pixmap);
- XFreePixmap (x_current_display, down_arrow_pixmap);
- XFlush (x_current_display);
-
- XSelectInput (x_current_display, f->display.x->v_scrollbar,
- ButtonPressMask | ButtonReleaseMask
- | PointerMotionMask | PointerMotionHintMask
- | EnterWindowMask);
- XSelectInput (x_current_display, f->display.x->v_slider,
- ButtonPressMask | ButtonReleaseMask);
- XSelectInput (x_current_display, f->display.x->v_thumbdown,
- ButtonPressMask | ButtonReleaseMask);
- XSelectInput (x_current_display, f->display.x->v_thumbup,
- ButtonPressMask | ButtonReleaseMask);
- XFlush (x_current_display);
+ check_x ();
+ CHECK_STRING (color, 0);
- /* This should be done at the same time as the main window. */
- XMapWindow (x_current_display, f->display.x->v_scrollbar);
- XMapSubwindows (x_current_display, f->display.x->v_scrollbar);
- XFlush (x_current_display);
-#else /* not HAVE_X11 */
- Bitmap b;
- Pixmap fore_tile, back_tile, bord_tile;
- static short up_arrow_bits[] = {
- 0x0000, 0x0180, 0x03c0, 0x07e0,
- 0x0ff0, 0x1ff8, 0x3ffc, 0x7ffe,
- 0x0180, 0x0180, 0x0180, 0x0180,
- 0x0180, 0x0180, 0x0180, 0xffff};
- static short down_arrow_bits[] = {
- 0xffff, 0x0180, 0x0180, 0x0180,
- 0x0180, 0x0180, 0x0180, 0x0180,
- 0x7ffe, 0x3ffc, 0x1ff8, 0x0ff0,
- 0x07e0, 0x03c0, 0x0180, 0x0000};
-
- fore_tile = XMakeTile (f->display.x->foreground_pixel);
- back_tile = XMakeTile (f->display.x->background_pixel);
- bord_tile = XMakeTile (f->display.x->border_pixel);
-
- b = XStoreBitmap (VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2, up_arrow_bits);
- up_arrow_pixmap = XMakePixmap (b,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel);
- XFreeBitmap (b);
-
- b = XStoreBitmap (VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2, down_arrow_bits);
- down_arrow_pixmap = XMakePixmap (b,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel);
- XFreeBitmap (b);
-
- ibw = f->display.x->internal_border_width;
-
- f->display.x->v_scrollbar = XCreateWindow (FRAME_X_WINDOW (f),
- width - VSCROLL_WIDTH - ibw/2,
- ibw/2,
- VSCROLL_WIDTH - 2,
- height - ibw - 2,
- 1, bord_tile, back_tile);
-
- f->display.x->v_scrollbar_width = VSCROLL_WIDTH;
-
- f->display.x->v_thumbup = XCreateWindow (f->display.x->v_scrollbar,
- 0, 0,
- VSCROLL_WIDTH - 2,
- VSCROLL_WIDTH - 2,
- 0, 0, up_arrow_pixmap);
- XTileAbsolute (f->display.x->v_thumbup);
-
- f->display.x->v_thumbdown = XCreateWindow (f->display.x->v_scrollbar,
- 0,
- height - ibw - VSCROLL_WIDTH,
- VSCROLL_WIDTH - 2,
- VSCROLL_WIDTH - 2,
- 0, 0, down_arrow_pixmap);
- XTileAbsolute (f->display.x->v_thumbdown);
-
- f->display.x->v_slider = XCreateWindow (f->display.x->v_scrollbar,
- 0, VSCROLL_WIDTH - 2,
- VSCROLL_WIDTH - 4,
- VSCROLL_WIDTH - 4,
- 1, back_tile, fore_tile);
-
- XSelectInput (f->display.x->v_scrollbar,
- (ButtonPressed | ButtonReleased | KeyPressed));
- XSelectInput (f->display.x->v_thumbup,
- (ButtonPressed | ButtonReleased | KeyPressed));
-
- XSelectInput (f->display.x->v_thumbdown,
- (ButtonPressed | ButtonReleased | KeyPressed));
-
- XMapWindow (f->display.x->v_thumbup);
- XMapWindow (f->display.x->v_thumbdown);
- XMapWindow (f->display.x->v_slider);
- XMapWindow (f->display.x->v_scrollbar);
-
- XFreePixmap (fore_tile);
- XFreePixmap (back_tile);
- XFreePixmap (up_arrow_pixmap);
- XFreePixmap (down_arrow_pixmap);
-#endif /* not HAVE_X11 */
-}
+ if (defined_color (XSTRING (color)->data, &foo))
+ return Qt;
+ else
+ return Qnil;
+}
-static void
-install_horizontal_scrollbar (f)
- struct frame *f;
+DEFUN ("x-display-color-p", Fx_display_color_p, Sx_display_color_p, 0, 0, 0,
+ "Return t if the X screen currently in use supports color.")
+ ()
{
- int ibw = f->display.x->internal_border_width;
- Window parent;
- Pixmap left_arrow_pixmap, right_arrow_pixmap, slider_pixmap;
- int pix_x, pix_y;
- int width;
+ check_x ();
- pix_x = ibw;
- pix_y = PIXEL_HEIGHT (f) - HSCROLL_HEIGHT - ibw ;
- width = PIXEL_WIDTH (f) - 2 * ibw;
- if (f->display.x->v_scrollbar_width)
- width -= (f->display.x->v_scrollbar_width + 1);
+ if (x_screen_planes <= 2)
+ return Qnil;
-#ifdef HAVE_X11
- left_arrow_pixmap =
- XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f),
- left_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- right_arrow_pixmap =
- XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f),
- right_arrow_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- slider_pixmap =
- XCreatePixmapFromBitmapData (x_current_display, FRAME_X_WINDOW (f),
- gray_bits, 16, 16,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- left_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_left_arrow);
- right_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_right_arrow);
- h_double_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_h_double_arrow);
-
- f->display.x->h_scrollbar =
- XCreateSimpleWindow (x_current_display, FRAME_X_WINDOW (f),
- pix_x, pix_y,
- width - ibw - 2, HSCROLL_HEIGHT - 2, 1,
- f->display.x->foreground_pixel,
- f->display.x->background_pixel);
- XDefineCursor (x_current_display, f->display.x->h_scrollbar,
- h_double_arrow_cursor);
-
- f->display.x->h_slider =
- XCreateSimpleWindow (x_current_display, f->display.x->h_scrollbar,
- 0, 0,
- HSCROLL_HEIGHT - 4, HSCROLL_HEIGHT - 4,
- 1, f->display.x->foreground_pixel,
- f->display.x->background_pixel);
- XDefineCursor (x_current_display, f->display.x->h_slider,
- h_double_arrow_cursor);
- XSetWindowBackgroundPixmap (x_current_display, f->display.x->h_slider,
- slider_pixmap);
-
- f->display.x->h_thumbleft =
- XCreateSimpleWindow (x_current_display, f->display.x->h_scrollbar,
- 0, 0,
- HSCROLL_HEIGHT - 2, HSCROLL_HEIGHT - 2,
- 0, f->display.x->foreground_pixel,
- f->display.x->background_pixel);
- XDefineCursor (x_current_display, f->display.x->h_thumbleft,
- left_arrow_cursor);
- XSetWindowBackgroundPixmap (x_current_display, f->display.x->h_thumbleft,
- left_arrow_pixmap);
-
- f->display.x->h_thumbright =
- XCreateSimpleWindow (x_current_display, f->display.x->h_scrollbar,
- width - ibw - HSCROLL_HEIGHT, 0,
- HSCROLL_HEIGHT - 2, HSCROLL_HEIGHT -2,
- 0, f->display.x->foreground_pixel,
- f->display.x->background_pixel);
- XDefineCursor (x_current_display, f->display.x->h_thumbright,
- right_arrow_cursor);
- XSetWindowBackgroundPixmap (x_current_display, f->display.x->h_thumbright,
- right_arrow_pixmap);
-
- XFreePixmap (x_current_display, slider_pixmap);
- XFreePixmap (x_current_display, left_arrow_pixmap);
- XFreePixmap (x_current_display, right_arrow_pixmap);
-
- XSelectInput (x_current_display, f->display.x->h_scrollbar,
- ButtonPressMask | ButtonReleaseMask
- | PointerMotionMask | PointerMotionHintMask
- | EnterWindowMask);
- XSelectInput (x_current_display, f->display.x->h_slider,
- ButtonPressMask | ButtonReleaseMask);
- XSelectInput (x_current_display, f->display.x->h_thumbright,
- ButtonPressMask | ButtonReleaseMask);
- XSelectInput (x_current_display, f->display.x->h_thumbleft,
- ButtonPressMask | ButtonReleaseMask);
-
- XMapWindow (x_current_display, f->display.x->h_scrollbar);
- XMapSubwindows (x_current_display, f->display.x->h_scrollbar);
-#else /* not HAVE_X11 */
- Bitmap b;
- Pixmap fore_tile, back_tile, bord_tile;
-#endif
-}
-\f
-#ifndef HAVE_X11 /* X10 */
-#define XMoveResizeWindow XConfigureWindow
-#endif /* not HAVE_X11 */
+ switch (screen_visual->class)
+ {
+ case StaticColor:
+ case PseudoColor:
+ case TrueColor:
+ case DirectColor:
+ return Qt;
-/* Adjust the displayed position in the scroll bar for window W. */
+ default:
+ return Qnil;
+ }
+}
-void
-adjust_scrollbars (f)
- struct frame *f;
+DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
+ 0, 1, 0,
+ "Returns the width in pixels of the display FRAME is on.")
+ (frame)
+ Lisp_Object frame;
{
- int pos;
- int first_char_in_window, char_beyond_window, chars_in_window;
- int chars_in_buffer, buffer_size;
- struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
+ Display *dpy = x_current_display;
+ check_x ();
+ return make_number (DisplayWidth (dpy, DefaultScreen (dpy)));
+}
- if (! FRAME_X_P (f))
- return;
+DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
+ Sx_display_pixel_height, 0, 1, 0,
+ "Returns the height in pixels of the display FRAME is on.")
+ (frame)
+ Lisp_Object frame;
+{
+ Display *dpy = x_current_display;
+ check_x ();
+ return make_number (DisplayHeight (dpy, DefaultScreen (dpy)));
+}
- if (f->display.x->v_scrollbar != 0)
- {
- int h, height;
- struct buffer *b = XBUFFER (w->buffer);
+DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
+ 0, 1, 0,
+ "Returns the number of bitplanes of the display FRAME is on.")
+ (frame)
+ Lisp_Object frame;
+{
+ Display *dpy = x_current_display;
+ check_x ();
+ return make_number (DisplayPlanes (dpy, DefaultScreen (dpy)));
+}
- buffer_size = Z - BEG;
- chars_in_buffer = ZV - BEGV;
- first_char_in_window = marker_position (w->start);
- char_beyond_window = buffer_size + 1 - XFASTINT (w->window_end_pos);
- chars_in_window = char_beyond_window - first_char_in_window;
+DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
+ 0, 1, 0,
+ "Returns the number of color cells of the display FRAME is on.")
+ (frame)
+ Lisp_Object frame;
+{
+ Display *dpy = x_current_display;
+ check_x ();
+ return make_number (DisplayCells (dpy, DefaultScreen (dpy)));
+}
- /* Calculate height of scrollbar area */
+DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
+ Sx_server_max_request_size,
+ 0, 1, 0,
+ "Returns the maximum request size of the X server FRAME is using.")
+ (frame)
+ Lisp_Object frame;
+{
+ Display *dpy = x_current_display;
+ check_x ();
+ return make_number (MAXREQUEST (dpy));
+}
- height = f->height * FONT_HEIGHT (f->display.x->font)
- + f->display.x->internal_border_width
- - 2 * (f->display.x->v_scrollbar_width);
+DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
+ "Returns the vendor ID string of the X server FRAME is on.")
+ (frame)
+ Lisp_Object frame;
+{
+ Display *dpy = x_current_display;
+ char *vendor;
+ check_x ();
+ vendor = ServerVendor (dpy);
+ if (! vendor) vendor = "";
+ return build_string (vendor);
+}
- /* Figure starting position for the scrollbar slider */
+DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
+ "Returns the version numbers of the X server in use.\n\
+The value is a list of three integers: the major and minor\n\
+version numbers of the X Protocol in use, and the vendor-specific release\n\
+number. See also the variable `x-server-vendor'.")
+ (frame)
+ Lisp_Object frame;
+{
+ Display *dpy = x_current_display;
- if (chars_in_buffer <= 0)
- pos = 0;
- else
- pos = ((first_char_in_window - BEGV - BEG) * height
- / chars_in_buffer);
- pos = max (0, pos);
- pos = min (pos, height - 2);
+ check_x ();
+ return Fcons (make_number (ProtocolVersion (dpy)),
+ Fcons (make_number (ProtocolRevision (dpy)),
+ Fcons (make_number (VendorRelease (dpy)), Qnil)));
+}
- /* Figure length of the slider */
+DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
+ "Returns the number of screens on the X server FRAME is on.")
+ (frame)
+ Lisp_Object frame;
+{
+ check_x ();
+ return make_number (ScreenCount (x_current_display));
+}
- if (chars_in_buffer <= 0)
- h = height;
- else
- h = (chars_in_window * height) / chars_in_buffer;
- h = min (h, height - pos);
- h = max (h, 1);
+DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0,
+ "Returns the height in millimeters of the X screen FRAME is on.")
+ (frame)
+ Lisp_Object frame;
+{
+ check_x ();
+ return make_number (HeightMMOfScreen (x_screen));
+}
- /* Add thumbup offset to starting position of slider */
+DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
+ "Returns the width in millimeters of the X screen FRAME is on.")
+ (frame)
+ Lisp_Object frame;
+{
+ check_x ();
+ return make_number (WidthMMOfScreen (x_screen));
+}
- pos += (f->display.x->v_scrollbar_width - 2);
+DEFUN ("x-display-backing-store", Fx_display_backing_store,
+ Sx_display_backing_store, 0, 1, 0,
+ "Returns an indication of whether the X screen FRAME is on does backing store.\n\
+The value may be `always', `when-mapped', or `not-useful'.")
+ (frame)
+ Lisp_Object frame;
+{
+ check_x ();
- XMoveResizeWindow (XDISPLAY
- f->display.x->v_slider,
- 0, pos,
- f->display.x->v_scrollbar_width - 4, h);
- }
-
- if (f->display.x->h_scrollbar != 0)
+ switch (DoesBackingStore (x_screen))
{
- int l, length; /* Length of the scrollbar area */
-
- length = f->width * FONT_WIDTH (f->display.x->font)
- + f->display.x->internal_border_width
- - 2 * (f->display.x->h_scrollbar_height);
-
- /* Starting position for horizontal slider */
- if (! w->hscroll)
- pos = 0;
- else
- pos = (w->hscroll * length) / (w->hscroll + f->width);
- pos = max (0, pos);
- pos = min (pos, length - 2);
+ case Always:
+ return intern ("always");
- /* Length of slider */
- l = length - pos;
+ case WhenMapped:
+ return intern ("when-mapped");
- /* Add thumbup offset */
- pos += (f->display.x->h_scrollbar_height - 2);
+ case NotUseful:
+ return intern ("not-useful");
- XMoveResizeWindow (XDISPLAY
- f->display.x->h_slider,
- pos, 0,
- l, f->display.x->h_scrollbar_height - 4);
+ default:
+ error ("Strange value for BackingStore parameter of screen");
}
}
-\f
-/* Adjust the size of the scroll bars of frame F,
- when the frame size has changed. */
-void
-x_resize_scrollbars (f)
- struct frame *f;
+DEFUN ("x-display-visual-class", Fx_display_visual_class,
+ Sx_display_visual_class, 0, 1, 0,
+ "Returns the visual class of the display `screen' is on.\n\
+The value is one of the symbols `static-gray', `gray-scale',\n\
+`static-color', `pseudo-color', `true-color', or `direct-color'.")
+ (screen)
+ Lisp_Object screen;
{
- int ibw = f->display.x->internal_border_width;
- int pixelwidth, pixelheight;
-
- if (f == 0
- || f->display.x == 0
- || (f->display.x->v_scrollbar == 0
- && f->display.x->h_scrollbar == 0))
- return;
+ check_x ();
- /* Get the size of the frame. */
- pixelwidth = (f->width * FONT_WIDTH (f->display.x->font)
- + 2 * ibw + f->display.x->v_scrollbar_width);
- pixelheight = (f->height * FONT_HEIGHT (f->display.x->font)
- + 2 * ibw + f->display.x->h_scrollbar_height);
-
- if (f->display.x->v_scrollbar_width && f->display.x->v_scrollbar)
+ switch (screen_visual->class)
{
- BLOCK_INPUT;
- XMoveResizeWindow (XDISPLAY
- f->display.x->v_scrollbar,
- pixelwidth - f->display.x->v_scrollbar_width - ibw/2,
- ibw/2,
- f->display.x->v_scrollbar_width - 2,
- pixelheight - ibw - 2);
- XMoveWindow (XDISPLAY
- f->display.x->v_thumbdown, 0,
- pixelheight - ibw - f->display.x->v_scrollbar_width);
- UNBLOCK_INPUT;
+ case StaticGray: return (intern ("static-gray"));
+ case GrayScale: return (intern ("gray-scale"));
+ case StaticColor: return (intern ("static-color"));
+ case PseudoColor: return (intern ("pseudo-color"));
+ case TrueColor: return (intern ("true-color"));
+ case DirectColor: return (intern ("direct-color"));
+ default:
+ error ("Display has an unknown visual class");
}
+}
- if (f->display.x->h_scrollbar_height && f->display.x->h_scrollbar)
- {
- if (f->display.x->v_scrollbar_width)
- pixelwidth -= f->display.x->v_scrollbar_width + 1;
+DEFUN ("x-display-save-under", Fx_display_save_under,
+ Sx_display_save_under, 0, 1, 0,
+ "Returns t if the X screen FRAME is on supports the save-under feature.")
+ (frame)
+ Lisp_Object frame;
+{
+ check_x ();
- BLOCK_INPUT;
- XMoveResizeWindow (XDISPLAY
- f->display.x->h_scrollbar,
- ibw / 2,
- pixelheight - f->display.x->h_scrollbar_height - ibw / 2,
- pixelwidth - ibw - 2,
- f->display.x->h_scrollbar_height - 2);
- XMoveWindow (XDISPLAY
- f->display.x->h_thumbright,
- pixelwidth - ibw - f->display.x->h_scrollbar_height, 0);
- UNBLOCK_INPUT;
- }
+ if (DoesSaveUnders (x_screen) == True)
+ return Qt;
+ else
+ return Qnil;
}
-
+\f
x_pixel_width (f)
register struct frame *f;
{
{
return PIXEL_HEIGHT (f);
}
-\f
-DEFUN ("x-defined-color", Fx_defined_color, Sx_defined_color, 1, 1, 0,
- "Return t if the current X display supports the color named COLOR.")
- (color)
- Lisp_Object color;
-{
- Color foo;
-
- CHECK_STRING (color, 0);
- if (defined_color (XSTRING (color)->data, &foo))
- return Qt;
- else
- return Qnil;
-}
-
-DEFUN ("x-color-display-p", Fx_color_display_p, Sx_color_display_p, 0, 0, 0,
- "Return t if the X display used currently supports color.")
- ()
-{
- if (XINT (x_screen_planes) <= 2)
- return Qnil;
-
- switch (screen_visual->class)
- {
- case StaticColor:
- case PseudoColor:
- case TrueColor:
- case DirectColor:
- return Qt;
-
- default:
- return Qnil;
- }
-}
-
-DEFUN ("x-pixel-width", Fx_pixel_width, Sx_pixel_width, 1, 1, 0,
- "Return the width in pixels of FRAME.")
- (frame)
- Lisp_Object frame;
+x_char_width (f)
+ register struct frame *f;
{
- CHECK_LIVE_FRAME (frame, 0);
- return make_number (XFRAME (frame)->display.x->pixel_width);
+ return FONT_WIDTH (f->display.x->font);
}
-DEFUN ("x-pixel-height", Fx_pixel_height, Sx_pixel_height, 1, 1, 0,
- "Return the height in pixels of FRAME.")
- (frame)
- Lisp_Object frame;
+x_char_height (f)
+ register struct frame *f;
{
- CHECK_LIVE_FRAME (frame, 0);
- return make_number (XFRAME (frame)->display.x->pixel_height);
+ return FONT_HEIGHT (f->display.x->font);
}
\f
#if 0 /* These no longer seem like the right way to do things. */
}
}
-/* Erase the top horzontal lines of the contour, and then extend
+/* Erase the top horizontal lines of the contour, and then extend
the contour upwards. */
static void
}
}
- unread_command_char = obj;
+ unread_command_event = obj;
if (mouse_below_point)
{
contour_begin_x = point_x;
XDrawLine (x_current_display, FRAME_X_WINDOW (f),
erase_gc, left, line, right, line);
UNBLOCK_INPUT;
- unread_command_char = obj;
+ unread_command_event = obj;
#if 0
XFreeGC (x_current_display, line_gc);
XFreeGC (x_current_display, erase_gc);
BLOCK_INPUT;
}
while (XTYPE (obj) == Lisp_Cons /* Mouse event */
- && EQ (Fcar (Fcdr (Fcdr (obj))), Qnil) /* Not scrollbar */
+ && EQ (Fcar (Fcdr (Fcdr (obj))), Qnil) /* Not scroll bar */
&& EQ (Vmouse_depressed, Qnil) /* Only motion events */
&& EQ (Vmouse_window, selected_window) /* In this window */
&& x_mouse_frame);
- unread_command_char = obj;
+ unread_command_event = obj;
if (mouse_track_width)
{
f->display.x->normal_gc, 0, 0, width, height, x, y);
}
#endif
-\f
-#if 0
-
-#ifdef HAVE_X11
-#define XMouseEvent XEvent
-#define WhichMouseButton xbutton.button
-#define MouseWindow xbutton.window
-#define MouseX xbutton.x
-#define MouseY xbutton.y
-#define MouseTime xbutton.time
-#define ButtonReleased ButtonRelease
-#define ButtonPressed ButtonPress
-#else
-#define XMouseEvent XButtonEvent
-#define WhichMouseButton detail
-#define MouseWindow window
-#define MouseX x
-#define MouseY y
-#define MouseTime time
-#endif /* X11 */
-
-DEFUN ("x-mouse-events", Fx_mouse_events, Sx_mouse_events, 0, 0, 0,
- "Return number of pending mouse events from X window system.")
- ()
-{
- return make_number (queue_event_count (&x_mouse_queue));
-}
-
-/* Encode the mouse button events in the form expected by the
- mouse code in Lisp. For X11, this means moving the masks around. */
-
-static int
-encode_mouse_button (mouse_event)
- XMouseEvent mouse_event;
-{
- register int event_code;
- register char key_mask;
-
- event_code = mouse_event.detail & 3;
- key_mask = (mouse_event.detail >> 8) & 0xf0;
- event_code |= key_mask >> 1;
- if (mouse_event.type == ButtonReleased) event_code |= 0x04;
- return event_code;
-}
-
-DEFUN ("x-get-mouse-event", Fx_get_mouse_event, Sx_get_mouse_event,
- 0, 1, 0,
- "Get next mouse event out of mouse event buffer.\n\
-Optional ARG non-nil means return nil immediately if no pending event;\n\
-otherwise, wait for an event. Returns a four-part list:\n\
- ((X-POS Y-POS) WINDOW FRAME-PART KEYSEQ TIMESTAMP).\n\
-Normally X-POS and Y-POS are the position of the click on the frame\n\
- (measured in characters and lines), and WINDOW is the window clicked in.\n\
-KEYSEQ is a string, the key sequence to be looked up in the mouse maps.\n\
-If FRAME-PART is non-nil, the event was on a scrollbar;\n\
-then Y-POS is really the total length of the scrollbar, while X-POS is\n\
-the relative position of the scrollbar's value within that total length,\n\
-and a third element OFFSET appears in that list: the height of the thumb-up\n\
-area at the top of the scroll bar.\n\
-FRAME-PART is one of the following symbols:\n\
- `vertical-scrollbar', `vertical-thumbup', `vertical-thumbdown',\n\
- `horizontal-scrollbar', `horizontal-thumbleft', `horizontal-thumbright'.\n\
-TIMESTAMP is the lower 23 bits of the X-server's timestamp for\n\
-the mouse event.")
- (arg)
- Lisp_Object arg;
-{
- XMouseEvent xrep;
- register int com_letter;
- register Lisp_Object tempx;
- register Lisp_Object tempy;
- Lisp_Object part, pos, timestamp;
- int prefix;
- struct frame *f;
-
- int tem;
-
- while (1)
- {
- BLOCK_INPUT;
- tem = dequeue_event (&xrep, &x_mouse_queue);
- UNBLOCK_INPUT;
-
- if (tem)
- {
- switch (xrep.type)
- {
- case ButtonPressed:
- case ButtonReleased:
-
- com_letter = encode_mouse_button (xrep);
- mouse_timestamp = xrep.MouseTime;
-
- if ((f = x_window_to_frame (xrep.MouseWindow)) != 0)
- {
- Lisp_Object frame;
-
- if (f->display.x->icon_desc == xrep.MouseWindow)
- {
- x_make_frame_visible (f);
- continue;
- }
-
- XSET (tempx, Lisp_Int,
- min (f->width-1, max (0, (xrep.MouseX - f->display.x->internal_border_width)/FONT_WIDTH (f->display.x->font))));
- XSET (tempy, Lisp_Int,
- min (f->height-1, max (0, (xrep.MouseY - f->display.x->internal_border_width)/FONT_HEIGHT (f->display.x->font))));
- XSET (timestamp, Lisp_Int, (xrep.MouseTime & 0x7fffff));
- XSET (frame, Lisp_Frame, f);
-
- pos = Fcons (tempx, Fcons (tempy, Qnil));
- Vmouse_window
- = Flocate_window_from_coordinates (frame, pos);
-
- Vmouse_event
- = Fcons (pos,
- Fcons (Vmouse_window,
- Fcons (Qnil,
- Fcons (Fchar_to_string (make_number (com_letter)),
- Fcons (timestamp, Qnil)))));
- return Vmouse_event;
- }
- else if ((f = x_window_to_scrollbar (xrep.MouseWindow, &part, &prefix)) != 0)
- {
- int pos, len;
- Lisp_Object keyseq;
- char *partname;
-
- keyseq = concat2 (Fchar_to_string (make_number (prefix)),
- Fchar_to_string (make_number (com_letter)));
-
- pos = xrep.MouseY - (f->display.x->v_scrollbar_width - 2);
- XSET (tempx, Lisp_Int, pos);
- len = ((FONT_HEIGHT (f->display.x->font) * f->height)
- + f->display.x->internal_border_width
- - (2 * (f->display.x->v_scrollbar_width - 2)));
- XSET (tempy, Lisp_Int, len);
- XSET (timestamp, Lisp_Int, (xrep.MouseTime & 0x7fffff));
- Vmouse_window = f->selected_window;
- Vmouse_event
- = Fcons (Fcons (tempx, Fcons (tempy,
- Fcons (make_number (f->display.x->v_scrollbar_width - 2),
- Qnil))),
- Fcons (Vmouse_window,
- Fcons (intern (part),
- Fcons (keyseq, Fcons (timestamp,
- Qnil)))));
- return Vmouse_event;
- }
- else
- continue;
-
-#ifdef HAVE_X11
- case MotionNotify:
-
- com_letter = x11_encode_mouse_button (xrep);
- if ((f = x_window_to_frame (xrep.MouseWindow)) != 0)
- {
- Lisp_Object frame;
-
- XSET (tempx, Lisp_Int,
- min (f->width-1,
- max (0, (xrep.MouseX - f->display.x->internal_border_width)
- / FONT_WIDTH (f->display.x->font))));
- XSET (tempy, Lisp_Int,
- min (f->height-1,
- max (0, (xrep.MouseY - f->display.x->internal_border_width)
- / FONT_HEIGHT (f->display.x->font))));
-
- XSET (frame, Lisp_Frame, f);
- XSET (timestamp, Lisp_Int, (xrep.MouseTime & 0x7fffff));
-
- pos = Fcons (tempx, Fcons (tempy, Qnil));
- Vmouse_window
- = Flocate_window_from_coordinates (frame, pos);
-
- Vmouse_event
- = Fcons (pos,
- Fcons (Vmouse_window,
- Fcons (Qnil,
- Fcons (Fchar_to_string (make_number (com_letter)),
- Fcons (timestamp, Qnil)))));
- return Vmouse_event;
- }
-
- break;
-#endif /* HAVE_X11 */
-
- default:
- if (f = x_window_to_frame (xrep.MouseWindow))
- Vmouse_window = f->selected_window;
- else if (f = x_window_to_scrollbar (xrep.MouseWindow, &part, &prefix))
- Vmouse_window = f->selected_window;
- return Vmouse_event = Qnil;
- }
- }
-
- if (!NILP (arg))
- return Qnil;
-
- /* Wait till we get another mouse event. */
- wait_reading_process_input (0, 0, 2, 0);
- }
-}
-#endif
-
\f
#ifndef HAVE_X11
DEFUN ("x-store-cut-buffer", Fx_store_cut_buffer, Sx_store_cut_buffer,
register KeySym keysym;
KeySym modifier_list[16];
+ check_x ();
CHECK_STRING (x_keysym, 1);
CHECK_STRING (newstring, 3);
mod = Fcar (rest);
CHECK_STRING (mod, 3);
modifier_list[i] = XStringToKeysym ((char *) XSTRING (mod)->data);
+#ifndef HAVE_X11R5
+ if (modifier_list[i] == NoSymbol
+ || !(IsModifierKey (modifier_list[i])
+ || ((unsigned)(modifier_list[i]) == XK_Mode_switch)
+ || ((unsigned)(modifier_list[i]) == XK_Num_Lock)))
+#else
if (modifier_list[i] == NoSymbol
|| !IsModifierKey (modifier_list[i]))
+#endif
error ("Element is not a modifier keysym");
i++;
}
int strsize;
register unsigned i;
+ check_x ();
CHECK_NUMBER (keycode, 1);
CHECK_CONS (strings, 2);
rawkey = (KeySym) ((unsigned) (XINT (keycode))) & 255;
}
return Qnil;
}
-#else
-DEFUN ("x-rebind-key", Fx_rebind_key, Sx_rebind_key, 3, 3, 0,
- "Rebind KEYCODE, with shift bits SHIFT-MASK, to new string NEWSTRING.\n\
-KEYCODE and SHIFT-MASK should be numbers representing the X keyboard code\n\
-and shift mask respectively. NEWSTRING is an arbitrary string of keystrokes.\n\
-If SHIFT-MASK is nil, then KEYCODE's key will be bound to NEWSTRING for\n\
-all shift combinations.\n\
-Shift Lock 1 Shift 2\n\
-Meta 4 Control 8\n\
-\n\
-For values of KEYCODE, see /usr/lib/Xkeymap.txt (remember that the codes\n\
-in that file are in octal!)\n\
-\n\
-NOTE: due to an X bug, this function will not take effect unless one has\n\
-a `~/.Xkeymap' file. (See the documentation for the `keycomp' program.)\n\
-This problem will be fixed in X version 11.")
-
- (keycode, shift_mask, newstring)
- register Lisp_Object keycode;
- register Lisp_Object shift_mask;
- register Lisp_Object newstring;
-{
- char *rawstring;
- int keysym, rawshift;
- int i, strsize;
-
- CHECK_NUMBER (keycode, 1);
- if (!NILP (shift_mask))
- CHECK_NUMBER (shift_mask, 2);
- CHECK_STRING (newstring, 3);
- strsize = XSTRING (newstring)->size;
- rawstring = (char *) xmalloc (strsize);
- bcopy (XSTRING (newstring)->data, rawstring, strsize);
-
- keysym = ((unsigned) (XINT (keycode))) & 255;
-
- if (NILP (shift_mask))
- {
- for (i = 0; i <= 15; i++)
- XRebindCode (keysym, i<<11, rawstring, strsize);
- }
- else
- {
- rawshift = (((unsigned) (XINT (shift_mask))) & 15) << 11;
- XRebindCode (keysym, rawshift, rawstring, strsize);
- }
- return Qnil;
-}
-
-DEFUN ("x-rebind-keys", Fx_rebind_keys, Sx_rebind_keys, 2, 2, 0,
- "Rebind KEYCODE to list of strings STRINGS.\n\
-STRINGS should be a list of 16 elements, one for each shift combination.\n\
-nil as element means don't change.\n\
-See the documentation of `x-rebind-key' for more information.")
- (keycode, strings)
- register Lisp_Object keycode;
- register Lisp_Object strings;
-{
- register Lisp_Object item;
- register char *rawstring;
- KeySym rawkey, modifier[1];
- int strsize;
- register unsigned i;
-
- CHECK_NUMBER (keycode, 1);
- CHECK_CONS (strings, 2);
- rawkey = (KeySym) ((unsigned) (XINT (keycode))) & 255;
- for (i = 0; i <= 15; strings = Fcdr (strings), i++)
- {
- item = Fcar (strings);
- if (!NILP (item))
- {
- CHECK_STRING (item, 2);
- strsize = XSTRING (item)->size;
- rawstring = (char *) xmalloc (strsize);
- bcopy (XSTRING (item)->data, rawstring, strsize);
- XRebindCode (rawkey, i << 11, rawstring, strsize);
- }
- }
- return Qnil;
-}
-#endif /* not HAVE_X11 */
+#endif /* HAVE_X11 */
\f
#ifdef HAVE_X11
Visual *
#ifdef HAVE_X11R4
vinfo_template.visualid = XVisualIDFromVisual (v);
#else
- vinfo_template.visualid = x->visualid;
+ vinfo_template.visualid = v->visualid;
#endif
- vinfo = XGetVisualInfo (x_current_display, VisualIDMask, &vinfo_template,
+ vinfo_template.screen = XScreenNumberOfScreen (screen);
+
+ vinfo = XGetVisualInfo (x_current_display,
+ VisualIDMask | VisualScreenMask, &vinfo_template,
&n_visuals);
if (n_visuals != 1)
fatal ("Can't get proper X visual info");
DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
1, 2, 0, "Open a connection to an X server.\n\
-DISPLAY is the name of the display to connect to. Optional second\n\
-arg XRM_STRING is a string of resources in xrdb format.")
+DISPLAY is the name of the display to connect to.\n\
+Optional second arg XRM_STRING is a string of resources in xrdb format.")
(display, xrm_string)
Lisp_Object display, xrm_string;
{
unsigned int n_planes;
- register Screen *x_screen;
unsigned char *xrm_option;
CHECK_STRING (display, 0);
if (x_current_display != 0)
error ("X server connection is already initialized");
+ if (! NILP (xrm_string))
+ CHECK_STRING (xrm_string, 1);
/* This is what opens the connection and sets x_current_display.
This also initializes many symbols, such as those used for input. */
#ifdef HAVE_X11
XFASTINT (Vwindow_system_version) = 11;
- if (!EQ (xrm_string, Qnil))
- {
- CHECK_STRING (xrm_string, 1);
- xrm_option = (unsigned char *) XSTRING (xrm_string);
- }
+ if (! NILP (xrm_string))
+ xrm_option = (unsigned char *) XSTRING (xrm_string)->data;
else
xrm_option = (unsigned char *) 0;
- xrdb = x_load_resources (x_current_display, xrm_option, EMACS_CLASS);
- x_current_display->db = xrdb;
-
- x_screen = DefaultScreenOfDisplay (x_current_display);
-
- x_screen_count = make_number (ScreenCount (x_current_display));
- Vx_vendor = build_string (ServerVendor (x_current_display));
- x_release = make_number (VendorRelease (x_current_display));
-
- x_screen_height = make_number (HeightOfScreen (x_screen));
- x_screen_height_mm = make_number (HeightMMOfScreen (x_screen));
- x_screen_width = make_number (WidthOfScreen (x_screen));
- x_screen_width_mm = make_number (WidthMMOfScreen (x_screen));
-
- switch (DoesBackingStore (x_screen))
- {
- case Always:
- Vx_backing_store = intern ("Always");
- break;
- case WhenMapped:
- Vx_backing_store = intern ("WhenMapped");
- break;
+ validate_x_resource_name ();
- case NotUseful:
- Vx_backing_store = intern ("NotUseful");
- break;
-
- default:
- error ("Strange value for BackingStore.");
- break;
- }
+ BLOCK_INPUT;
+ xrdb = x_load_resources (x_current_display, xrm_option,
+ (char *) XSTRING (Vx_resource_name)->data,
+ EMACS_CLASS);
+ UNBLOCK_INPUT;
+#if defined (HAVE_X11R5)
+ XrmSetDatabase (x_current_display, xrdb);
+#else
+ x_current_display->db = xrdb;
+#endif
- if (DoesSaveUnders (x_screen) == True)
- x_save_under = Qt;
- else
- x_save_under = Qnil;
+ x_screen = DefaultScreenOfDisplay (x_current_display);
screen_visual = select_visual (x_screen, &n_planes);
- x_screen_planes = make_number (n_planes);
- Vx_screen_visual = intern (x_visual_strings [screen_visual->class]);
+ x_screen_planes = n_planes;
+ x_screen_height = HeightOfScreen (x_screen);
+ x_screen_width = WidthOfScreen (x_screen);
/* X Atoms used by emacs. */
+ Xatoms_of_xselect ();
BLOCK_INPUT;
- Xatom_emacs_selection = XInternAtom (x_current_display, "_EMACS_SELECTION_",
- False);
- Xatom_clipboard = XInternAtom (x_current_display, "CLIPBOARD",
- False);
- Xatom_clipboard_selection = XInternAtom (x_current_display, "_EMACS_CLIPBOARD_",
- False);
- Xatom_wm_change_state = XInternAtom (x_current_display, "WM_CHANGE_STATE",
- False);
- Xatom_incremental = XInternAtom (x_current_display, "INCR",
- False);
- Xatom_multiple = XInternAtom (x_current_display, "MULTIPLE",
- False);
- Xatom_targets = XInternAtom (x_current_display, "TARGETS",
- False);
- Xatom_timestamp = XInternAtom (x_current_display, "TIMESTAMP",
- False);
- Xatom_delete = XInternAtom (x_current_display, "DELETE",
- False);
- Xatom_insert_selection = XInternAtom (x_current_display, "INSERT_SELECTION",
- False);
- Xatom_pair = XInternAtom (x_current_display, "XA_ATOM_PAIR",
- False);
- Xatom_insert_property = XInternAtom (x_current_display, "INSERT_PROPERTY",
- False);
- Xatom_text = XInternAtom (x_current_display, "TEXT",
- False);
Xatom_wm_protocols = XInternAtom (x_current_display, "WM_PROTOCOLS",
False);
Xatom_wm_take_focus = XInternAtom (x_current_display, "WM_TAKE_FOCUS",
BLOCK_INPUT;
XSetCloseDownMode (x_current_display, DestroyAll);
XCloseDisplay (x_current_display);
+ x_current_display = 0;
}
else
fatal ("No current X display connection to close\n");
(on)
Lisp_Object on;
{
+ check_x ();
+
XSynchronize (x_current_display, !EQ (on, Qnil));
return Qnil;
staticpro (&Qauto_lower);
Qbackground_color = intern ("background-color");
staticpro (&Qbackground_color);
+ Qbar = intern ("bar");
+ staticpro (&Qbar);
Qborder_color = intern ("border-color");
staticpro (&Qborder_color);
Qborder_width = intern ("border-width");
staticpro (&Qborder_width);
+ Qbox = intern ("box");
+ staticpro (&Qbox);
Qcursor_color = intern ("cursor-color");
staticpro (&Qcursor_color);
+ Qcursor_type = intern ("cursor-type");
+ staticpro (&Qcursor_type);
Qfont = intern ("font");
staticpro (&Qfont);
Qforeground_color = intern ("foreground-color");
staticpro (&Qforeground_color);
Qgeometry = intern ("geometry");
staticpro (&Qgeometry);
- Qhorizontal_scroll_bar = intern ("horizontal-scroll-bar");
- staticpro (&Qhorizontal_scroll_bar);
Qicon_left = intern ("icon-left");
staticpro (&Qicon_left);
Qicon_top = intern ("icon-top");
staticpro (&Qicon_top);
Qicon_type = intern ("icon-type");
staticpro (&Qicon_type);
- Qiconic_startup = intern ("iconic-startup");
- staticpro (&Qiconic_startup);
Qinternal_border_width = intern ("internal-border-width");
staticpro (&Qinternal_border_width);
Qleft = intern ("left");
staticpro (&Qleft);
Qmouse_color = intern ("mouse-color");
staticpro (&Qmouse_color);
+ Qnone = intern ("none");
+ staticpro (&Qnone);
Qparent_id = intern ("parent-id");
staticpro (&Qparent_id);
Qsuppress_icon = intern ("suppress-icon");
staticpro (&Qsuppress_icon);
- Qsuppress_initial_map = intern ("suppress-initial-map");
- staticpro (&Qsuppress_initial_map);
Qtop = intern ("top");
staticpro (&Qtop);
Qundefined_color = intern ("undefined-color");
staticpro (&Qundefined_color);
- Qvertical_scroll_bar = intern ("vertical-scroll-bar");
- staticpro (&Qvertical_scroll_bar);
+ Qvertical_scroll_bars = intern ("vertical-scroll-bars");
+ staticpro (&Qvertical_scroll_bars);
+ Qvisibility = intern ("visibility");
+ staticpro (&Qvisibility);
Qwindow_id = intern ("window-id");
staticpro (&Qwindow_id);
Qx_frame_parameter = intern ("x-frame-parameter");
init_x_parm_symbols ();
- DEFVAR_INT ("mouse-x-position", &x_mouse_x,
- "The X coordinate of the mouse position, in characters.");
- x_mouse_x = Qnil;
-
- DEFVAR_INT ("mouse-y-position", &x_mouse_y,
- "The Y coordinate of the mouse position, in characters.");
- x_mouse_y = Qnil;
-
DEFVAR_INT ("mouse-buffer-offset", &mouse_buffer_offset,
- "The buffer offset of the character under the pointer.");
- mouse_buffer_offset = Qnil;
+ "The buffer offset of the character under the pointer.");
+ mouse_buffer_offset = 0;
DEFVAR_INT ("x-pointer-shape", &Vx_pointer_shape,
- "The shape of the pointer when over text.");
+ "The shape of the pointer when over text.\n\
+Changing the value does not affect existing frames\n\
+unless you set the mouse color.");
Vx_pointer_shape = Qnil;
+ DEFVAR_LISP ("x-resource-name", &Vx_resource_name,
+ "The name Emacs uses to look up X resources; for internal use only.\n\
+`x-get-resource' uses this as the first component of the instance name\n\
+when requesting resource values.\n\
+Emacs initially sets `x-resource-name' to the name under which Emacs\n\
+was invoked, or to the value specified with the `-name' or `-rn'\n\
+switches, if present.");
+ Vx_resource_name = Qnil;
+ staticpro (&Vx_resource_name);
+
+#if 0
DEFVAR_INT ("x-nontext-pointer-shape", &Vx_nontext_pointer_shape,
"The shape of the pointer when not over text.");
+#endif
Vx_nontext_pointer_shape = Qnil;
+#if 0
DEFVAR_INT ("x-mode-pointer-shape", &Vx_mode_pointer_shape,
"The shape of the pointer when over the mode line.");
+#endif
Vx_mode_pointer_shape = Qnil;
- DEFVAR_LISP ("x-bar-cursor", &Vbar_cursor,
- "*If non-nil, use a vertical bar cursor. Otherwise, use the traditional box.");
- Vbar_cursor = Qnil;
-
DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel,
"A string indicating the foreground color of the cursor box.");
Vx_cursor_fore_pixel = Qnil;
"Non-nil if a mouse button is currently depressed.");
Vmouse_depressed = Qnil;
- DEFVAR_INT ("x-screen-count", &x_screen_count,
- "The number of screens associated with the current display.");
- DEFVAR_INT ("x-release", &x_release,
- "The release number of the X server in use.");
- DEFVAR_LISP ("x-vendor", &Vx_vendor,
- "The vendor supporting the X server in use.");
- DEFVAR_INT ("x-screen-height", &x_screen_height,
- "The height of this X screen in pixels.");
- DEFVAR_INT ("x-screen-height-mm", &x_screen_height_mm,
- "The height of this X screen in millimeters.");
- DEFVAR_INT ("x-screen-width", &x_screen_width,
- "The width of this X screen in pixels.");
- DEFVAR_INT ("x-screen-width-mm", &x_screen_width_mm,
- "The width of this X screen in millimeters.");
- DEFVAR_LISP ("x-backing-store", &Vx_backing_store,
- "The backing store capability of this screen.\n\
-Values can be the symbols Always, WhenMapped, or NotUseful.");
- DEFVAR_BOOL ("x-save-under", &x_save_under,
- "*Non-nil means this X screen supports the SaveUnder feature.");
- DEFVAR_INT ("x-screen-planes", &x_screen_planes,
- "The number of planes this monitor supports.");
- DEFVAR_LISP ("x-screen-visual", &Vx_screen_visual,
- "The default X visual for this X screen.");
DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
"t if no X window manager is in use.");
#ifdef HAVE_X11
defsubr (&Sx_get_resource);
- defsubr (&Sx_pixel_width);
- defsubr (&Sx_pixel_height);
#if 0
defsubr (&Sx_draw_rectangle);
defsubr (&Sx_erase_rectangle);
defsubr (&Sx_contour_region);
defsubr (&Sx_uncontour_region);
#endif
- defsubr (&Sx_color_display_p);
- defsubr (&Sx_defined_color);
+ defsubr (&Sx_display_color_p);
+ defsubr (&Sx_list_fonts);
+ defsubr (&Sx_color_defined_p);
+ defsubr (&Sx_server_max_request_size);
+ defsubr (&Sx_server_vendor);
+ defsubr (&Sx_server_version);
+ defsubr (&Sx_display_pixel_width);
+ defsubr (&Sx_display_pixel_height);
+ defsubr (&Sx_display_mm_width);
+ defsubr (&Sx_display_mm_height);
+ defsubr (&Sx_display_screens);
+ defsubr (&Sx_display_planes);
+ defsubr (&Sx_display_color_cells);
+ defsubr (&Sx_display_visual_class);
+ defsubr (&Sx_display_backing_store);
+ defsubr (&Sx_display_save_under);
+ defsubr (&Sx_rebind_key);
+ defsubr (&Sx_rebind_keys);
#if 0
defsubr (&Sx_track_pointer);
defsubr (&Sx_grab_pointer);
defsubr (&Sx_get_default);
defsubr (&Sx_store_cut_buffer);
defsubr (&Sx_get_cut_buffer);
- defsubr (&Sx_set_face);
#endif
- defsubr (&Sx_geometry);
+ defsubr (&Sx_parse_geometry);
defsubr (&Sx_create_frame);
defsubr (&Sfocus_frame);
defsubr (&Sunfocus_frame);
#if 0
defsubr (&Sx_horizontal_line);
#endif
- defsubr (&Sx_rebind_key);
- defsubr (&Sx_rebind_keys);
defsubr (&Sx_open_connection);
defsubr (&Sx_close_current_connection);
defsubr (&Sx_synchronize);
-
- /* This was used in the old event interface which used a separate
- event queue.*/
-#if 0
- defsubr (&Sx_mouse_events);
- defsubr (&Sx_get_mouse_event);
-#endif
}
#endif /* HAVE_X_WINDOWS */