Commit f676886a authored by Jim Blandy's avatar Jim Blandy
Browse files

*** empty log message ***

parent 7708e9bd
......@@ -28,7 +28,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "config.h"
#include "lisp.h"
#include "xterm.h"
#include "screen.h"
#include "frame.h"
#include "window.h"
#include "buffer.h"
#include "dispextern.h"
......@@ -38,7 +38,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef HAVE_X_WINDOWS
extern void abort ();
void x_set_screen_param ();
void x_set_frame_param ();
#define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b))
......@@ -194,7 +194,7 @@ char minibuffer_iconidentity[MAXICID];
Time mouse_timestamp;
Lisp_Object Qundefined_color;
Lisp_Object Qx_screen_parameter;
Lisp_Object Qx_frame_parameter;
extern Lisp_Object Vwindow_system_version;
......@@ -204,112 +204,112 @@ extern Lisp_Object Vglobal_mouse_map;
/* Points to table of defined typefaces. */
struct face *x_face_table[MAX_FACES_AND_GLYPHS];
/* Return the Emacs screen-object corresponding to an X window.
It could be the screen's main window or an icon window. */
/* Return the Emacs frame-object corresponding to an X window.
It could be the frame's main window or an icon window. */
struct screen *
x_window_to_screen (wdesc)
struct frame *
x_window_to_frame (wdesc)
int wdesc;
{
Lisp_Object tail, screen;
struct screen *s;
Lisp_Object tail, frame;
struct frame *f;
for (tail = Vscreen_list; CONSP (tail); tail = XCONS (tail)->cdr)
for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
{
screen = XCONS (tail)->car;
if (XTYPE (screen) != Lisp_Screen)
frame = XCONS (tail)->car;
if (XTYPE (frame) != Lisp_Frame)
continue;
s = XSCREEN (screen);
if (s->display.x->window_desc == wdesc
|| s->display.x->icon_desc == wdesc)
return s;
f = XFRAME (frame);
if (f->display.x->window_desc == wdesc
|| f->display.x->icon_desc == wdesc)
return f;
}
return 0;
}
/* Map an X window that implements a scroll bar to the Emacs screen it
/* 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 screen *
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, screen;
struct screen *s;
Lisp_Object tail, frame;
struct frame *f;
for (tail = Vscreen_list; CONSP (tail); tail = XCONS (tail)->cdr)
for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
{
screen = XCONS (tail)->car;
if (XTYPE (screen) != Lisp_Screen)
frame = XCONS (tail)->car;
if (XTYPE (frame) != Lisp_Frame)
continue;
s = XSCREEN (screen);
f = XFRAME (frame);
if (part_ptr == 0 && prefix_ptr == 0)
return s;
return f;
if (s->display.x->v_scrollbar == wdesc)
if (f->display.x->v_scrollbar == wdesc)
{
*part_ptr = Qvscrollbar_part;
*prefix_ptr = VSCROLL_BAR_PREFIX;
return s;
return f;
}
else if (s->display.x->v_slider == wdesc)
else if (f->display.x->v_slider == wdesc)
{
*part_ptr = Qvslider_part;
*prefix_ptr = VSCROLL_SLIDER_PREFIX;
return s;
return f;
}
else if (s->display.x->v_thumbup == wdesc)
else if (f->display.x->v_thumbup == wdesc)
{
*part_ptr = Qvthumbup_part;
*prefix_ptr = VSCROLL_THUMBUP_PREFIX;
return s;
return f;
}
else if (s->display.x->v_thumbdown == wdesc)
else if (f->display.x->v_thumbdown == wdesc)
{
*part_ptr = Qvthumbdown_part;
*prefix_ptr = VSCROLL_THUMBDOWN_PREFIX;
return s;
return f;
}
else if (s->display.x->h_scrollbar == wdesc)
else if (f->display.x->h_scrollbar == wdesc)
{
*part_ptr = Qhscrollbar_part;
*prefix_ptr = HSCROLL_BAR_PREFIX;
return s;
return f;
}
else if (s->display.x->h_slider == wdesc)
else if (f->display.x->h_slider == wdesc)
{
*part_ptr = Qhslider_part;
*prefix_ptr = HSCROLL_SLIDER_PREFIX;
return s;
return f;
}
else if (s->display.x->h_thumbleft == wdesc)
else if (f->display.x->h_thumbleft == wdesc)
{
*part_ptr = Qhthumbleft_part;
*prefix_ptr = HSCROLL_THUMBLEFT_PREFIX;
return s;
return f;
}
else if (s->display.x->h_thumbright == wdesc)
else if (f->display.x->h_thumbright == wdesc)
{
*part_ptr = Qhthumbright_part;
*prefix_ptr = HSCROLL_THUMBRIGHT_PREFIX;
return s;
return f;
}
}
return 0;
}
/* Connect the screen-parameter names for X screens
/* Connect the frame-parameter names for X frames
to the ways of passing the parameter values to the window system.
The name of a parameter, as a Lisp symbol,
has an `x-screen-parameter' property which is an integer in Lisp
but can be interpreted as an `enum x_screen_parm' in C. */
has an `x-frame-parameter' property which is an integer in Lisp
but can be interpreted as an `enum x_frame_parm' in C. */
enum x_screen_parm
enum x_frame_parm
{
X_PARM_FOREGROUND_COLOR,
X_PARM_BACKGROUND_COLOR,
......@@ -328,10 +328,10 @@ enum x_screen_parm
};
struct x_screen_parm_table
struct x_frame_parm_table
{
char *name;
void (*setter)( /* struct screen *screen, Lisp_Object val, oldval */ );
void (*setter)( /* struct frame *frame, Lisp_Object val, oldval */ );
};
void x_set_foreground_color ();
......@@ -349,7 +349,7 @@ void x_set_autolower ();
void x_set_vertical_scrollbar ();
void x_set_horizontal_scrollbar ();
static struct x_screen_parm_table x_screen_parms[] =
static struct x_frame_parm_table x_frame_parms[] =
{
"foreground-color", x_set_foreground_color,
"background-color", x_set_background_color,
......@@ -367,21 +367,21 @@ static struct x_screen_parm_table x_screen_parms[] =
"horizontal-scrollbar", x_set_horizontal_scrollbar,
};
/* Attach the `x-screen-parameter' properties to
/* Attach the `x-frame-parameter' properties to
the Lisp symbol names of parameters relevant to X. */
init_x_parm_symbols ()
{
int i;
Qx_screen_parameter = intern ("x-screen-parameter");
Qx_frame_parameter = intern ("x-frame-parameter");
for (i = 0; i < sizeof (x_screen_parms)/sizeof (x_screen_parms[0]); i++)
Fput (intern (x_screen_parms[i].name), Qx_screen_parameter,
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));
}
/* Report to X that a screen parameter of screen S is being set or changed.
/* 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.
......@@ -389,45 +389,45 @@ init_x_parm_symbols ()
otherwise the `x_set_...' function for this parameter. */
void
x_set_screen_param (s, param, val, oldval)
register struct screen *s;
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_screen_parameter);
tem = Fget (param, Qx_frame_parameter);
if (XTYPE (tem) == Lisp_Int
&& XINT (tem) >= 0
&& XINT (tem) < sizeof (x_screen_parms)/sizeof (x_screen_parms[0]))
(*x_screen_parms[XINT (tem)].setter)(s, val, oldval);
&& XINT (tem) < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))
(*x_frame_parms[XINT (tem)].setter)(f, val, oldval);
}
/* Insert a description of internally-recorded parameters of screen X
/* 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
and whose values are not correctly recorded in the screen's
and whose values are not correctly recorded in the frame's
param_alist need to be considered here. */
x_report_screen_params (s, alistptr)
struct screen *s;
x_report_frame_params (f, alistptr)
struct frame *f;
Lisp_Object *alistptr;
{
char buf[16];
store_in_alist (alistptr, "left", make_number (s->display.x->left_pos));
store_in_alist (alistptr, "top", make_number (s->display.x->top_pos));
store_in_alist (alistptr, "left", make_number (f->display.x->left_pos));
store_in_alist (alistptr, "top", make_number (f->display.x->top_pos));
store_in_alist (alistptr, "border-width",
make_number (s->display.x->border_width));
make_number (f->display.x->border_width));
store_in_alist (alistptr, "internal-border-width",
make_number (s->display.x->internal_border_width));
sprintf (buf, "%d", s->display.x->window_desc);
make_number (f->display.x->internal_border_width));
sprintf (buf, "%d", f->display.x->window_desc);
store_in_alist (alistptr, "window-id",
build_string (buf));
}
/* Decide if color named COLOR is valid for the display
associated with the selected screen. */
associated with the selected frame. */
int
defined_color (color, color_def)
char *color;
......@@ -456,8 +456,8 @@ defined_color (color, color_def)
}
/* Given a string ARG naming a color, compute a pixel value from it
suitable for screen S.
If S is not a color screen, return DEF (default) regardless of what
suitable for screen F.
If F is not a color screen, return DEF (default) regardless of what
ARG says. */
int
......@@ -488,112 +488,112 @@ x_decode_color (arg, def)
Fsignal (Qundefined_color, Fcons (arg, Qnil));
}
/* Functions called only from `x_set_screen_param'
/* Functions called only from `x_set_frame_param'
to set individual parameters.
If s->display.x->window_desc is 0,
the screen is being created and its X-window does not exist yet.
If f->display.x->window_desc is 0,
the frame is being created and its X-window does not exist yet.
In that case, just record the parameter's new value
in the standard place; do not attempt to change the window. */
void
x_set_foreground_color (s, arg, oldval)
struct screen *s;
x_set_foreground_color (f, arg, oldval)
struct frame *f;
Lisp_Object arg, oldval;
{
s->display.x->foreground_pixel = x_decode_color (arg, BLACK_PIX_DEFAULT);
if (s->display.x->window_desc != 0)
f->display.x->foreground_pixel = x_decode_color (arg, BLACK_PIX_DEFAULT);
if (f->display.x->window_desc != 0)
{
#ifdef HAVE_X11
BLOCK_INPUT;
XSetForeground (x_current_display, s->display.x->normal_gc,
s->display.x->foreground_pixel);
XSetBackground (x_current_display, s->display.x->reverse_gc,
s->display.x->foreground_pixel);
if (s->display.x->v_scrollbar)
XSetForeground (x_current_display, f->display.x->normal_gc,
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, s->display.x->v_scrollbar,
s->display.x->foreground_pixel);
XSetWindowBorder (x_current_display, f->display.x->v_scrollbar,
f->display.x->foreground_pixel);
slider_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
gray_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
up_arrow_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
up_arrow_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
down_arrow_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
down_arrow_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->v_thumbup,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbup,
up_arrow_pixmap);
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->v_thumbdown,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbdown,
down_arrow_pixmap);
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->v_slider,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_slider,
slider_pixmap);
XClearWindow (XDISPLAY s->display.x->v_thumbup);
XClearWindow (XDISPLAY s->display.x->v_thumbdown);
XClearWindow (XDISPLAY s->display.x->v_slider);
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 (s->display.x->h_scrollbar)
if (f->display.x->h_scrollbar)
{
Pixmap left_arrow_pixmap, right_arrow_pixmap, slider_pixmap;
XSetWindowBorder (x_current_display, s->display.x->h_scrollbar,
s->display.x->foreground_pixel);
XSetWindowBorder (x_current_display, f->display.x->h_scrollbar,
f->display.x->foreground_pixel);
slider_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
gray_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
left_arrow_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
up_arrow_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
right_arrow_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
down_arrow_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->h_slider,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_slider,
slider_pixmap);
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->h_thumbleft,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbleft,
left_arrow_pixmap);
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->h_thumbright,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbright,
right_arrow_pixmap);
XClearWindow (XDISPLAY s->display.x->h_thumbleft);
XClearWindow (XDISPLAY s->display.x->h_thumbright);
XClearWindow (XDISPLAY s->display.x->h_slider);
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);
......@@ -601,150 +601,150 @@ x_set_foreground_color (s, arg, oldval)
}
UNBLOCK_INPUT;
#endif /* HAVE_X11 */
if (s->visible)
redraw_screen (s);
if (f->visible)
redraw_frame (f);
}
}
void
x_set_background_color (s, arg, oldval)
struct screen *s;
x_set_background_color (f, arg, oldval)
struct frame *f;
Lisp_Object arg, oldval;
{
Pixmap temp;
int mask;
s->display.x->background_pixel = x_decode_color (arg, WHITE_PIX_DEFAULT);
f->display.x->background_pixel = x_decode_color (arg, WHITE_PIX_DEFAULT);
if (s->display.x->window_desc != 0)
if (f->display.x->window_desc != 0)
{
BLOCK_INPUT;
#ifdef HAVE_X11
/* The main screen. */
XSetBackground (x_current_display, s->display.x->normal_gc,
s->display.x->background_pixel);
XSetForeground (x_current_display, s->display.x->reverse_gc,
s->display.x->background_pixel);
XSetWindowBackground (x_current_display, s->display.x->window_desc,
s->display.x->background_pixel);
/* The main frame area. */
XSetBackground (x_current_display, f->display.x->normal_gc,
f->display.x->background_pixel);
XSetForeground (x_current_display, f->display.x->reverse_gc,
f->display.x->background_pixel);
XSetWindowBackground (x_current_display, f->display.x->window_desc,
f->display.x->background_pixel);
/* Scroll bars. */
if (s->display.x->v_scrollbar)
if (f->display.x->v_scrollbar)
{
Pixmap up_arrow_pixmap, down_arrow_pixmap, slider_pixmap;
XSetWindowBackground (x_current_display, s->display.x->v_scrollbar,
s->display.x->background_pixel);
XSetWindowBackground (x_current_display, f->display.x->v_scrollbar,
f->display.x->background_pixel);
slider_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
gray_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
up_arrow_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
up_arrow_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
down_arrow_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
down_arrow_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->v_thumbup,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbup,
up_arrow_pixmap);
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->v_thumbdown,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_thumbdown,
down_arrow_pixmap);
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->v_slider,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->v_slider,
slider_pixmap);
XClearWindow (XDISPLAY s->display.x->v_thumbup);
XClearWindow (XDISPLAY s->display.x->v_thumbdown);
XClearWindow (XDISPLAY s->display.x->v_slider);
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 (s->display.x->h_scrollbar)
if (f->display.x->h_scrollbar)
{
Pixmap left_arrow_pixmap, right_arrow_pixmap, slider_pixmap;
XSetWindowBackground (x_current_display, s->display.x->h_scrollbar,
s->display.x->background_pixel);
XSetWindowBackground (x_current_display, f->display.x->h_scrollbar,
f->display.x->background_pixel);
slider_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
gray_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
left_arrow_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
up_arrow_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
right_arrow_pixmap =
XCreatePixmapFromBitmapData (XDISPLAY s->display.x->window_desc,
XCreatePixmapFromBitmapData (XDISPLAY f->display.x->window_desc,
down_arrow_bits, 16, 16,
s->display.x->foreground_pixel,
s->display.x->background_pixel,
f->display.x->foreground_pixel,
f->display.x->background_pixel,
DefaultDepth (x_current_display,
XDefaultScreen (x_current_display)));
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->h_slider,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_slider,
slider_pixmap);
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->h_thumbleft,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbleft,
left_arrow_pixmap);
XSetWindowBackgroundPixmap (XDISPLAY s->display.x->h_thumbright,
XSetWindowBackgroundPixmap (XDISPLAY f->display.x->h_thumbright,