Commit 334208b7 authored by Richard M. Stallman's avatar Richard M. Stallman

Use FRAME_X_DISPLAY instead of x_current_display and XDISPLAY.

(x_make_frame_visible, x_make_frame_invisible):
Pass a frame ptr to x_sync.

(x_term_init): Init all the components of dpyinfo.

(x_display_info_for_display): New function.

(x_*_mod_mask): Variables deleted.
(x_x_to_emacs_modifiers, x_emacs_to_x_modifiers):
New arg dpyinfo; all callers changed.
Store the masks in that structure.

(icon_bitmap): Variable deleted.
(x_bitmap_icon): Use icon_bitmap_id in x_display_info.

(icon_font_info): Variable deleted.

(x_term_init): Set up `connection' field.

(x_find_modifier_meanings):
Arg is now struct x_display_info *.
(x_term_init): Return an x_display_info *.
Store all the data in it, including X atoms and xrdb.
Put the x_display_info structure on x_display_list.
Pass name as Lisp_Object.
(the_x_screen): Variable moved here.
(syms_of_xterm): Staticpro parts of the_x_screen.

(windowinfo): Variable deleted.

(Xatom_*): Variables deleted.
(x_iconify_frame, XTread_socket): Get atoms from the x_display_info,

(XTread_socket): Don't update Vmouse_depressed.

(x_mouse_grabbed): Variable deleted.
(note_mouse_highlight): Use grabbed field instead.
(XTmouse_position, XTread_socket): Likewise.

(x_calc_absolute_position, x_wm_set_size_hint):
Get screen height, width from the x_display_info structure.
parent b9dc4443
......@@ -144,16 +144,6 @@ static int expose_all_icons;
int BLOCK_INPUT_mask;
#endif /* ! defined (SIGIO) && defined (FIONREAD) */
/* The id of a bitmap used for icon windows, in frames
for which no specific bitmap was specified.
This is 0 if we have not yet had a need to create the bitmap. */
static int icon_bitmap;
/* Font used for text icons. */
static FONT_TYPE *icon_font_info;
/* Stuff for dealing with the main icon title. */
extern Lisp_Object Vcommand_line_args, Vsystem_name;
......@@ -163,9 +153,12 @@ char *x_id_name;
extern char **initial_argv;
extern int initial_argc;
/* This is the X connection that we are using. */
/* For now, we have just one x_display structure since we only support
one X display. */
static struct x_display_info the_x_screen;
Display *x_current_display;
/* This is a chain of structures for all the X displays currently in use. */
struct x_display_info *x_display_list;
/* The cursor to use for vertical scroll bars on x_current_display. */
static Cursor x_vertical_scroll_bar_cursor;
......@@ -255,9 +248,6 @@ static XRectangle last_mouse_glyph;
to Qnil, to tell XTmouse_position to return an ordinary motion event. */
static Lisp_Object last_mouse_scroll_bar;
/* Record which buttons are currently pressed. */
unsigned int x_mouse_grabbed;
/* This is a hack. We would really prefer that XTmouse_position would
return the time associated with the position it returns, but there
doesn't seem to be any way to wrest the timestamp from the server
......@@ -295,10 +285,6 @@ static int volatile input_signal_count;
static int input_signal_count;
#endif
/* `t' if a mouse button is depressed. */
extern Lisp_Object Vmouse_depressed;
/* Tells if a window manager is present or not. */
extern Lisp_Object Vx_no_window_manager;
......@@ -316,11 +302,6 @@ extern Lisp_Object Qface, Qmouse_face;
static int x_noop_count;
/* From time to time we get info on an Emacs window, here. */
static WINDOWINFO_TYPE windowinfo;
extern int errno;
/* A mask of extra modifier bits to put into every keyboard char. */
......@@ -330,7 +311,8 @@ extern Display *XOpenDisplay ();
extern Window XCreateWindow ();
extern Cursor XCreateCursor ();
extern FONT_TYPE *XOpenFont ();
extern XFontStruct *XOpenFont ();
extern XrmDatabase x_load_resources ();
static void flashback ();
static void redraw_previous_char ();
......@@ -346,7 +328,21 @@ static void do_line_dance ();
void dumpborder ();
static int XTcursor_to ();
static int XTclear_end_of_line ();
/* Return the struct x_display_info corresponding to DPY. */
struct x_display_info *
x_display_info_for_display (dpy)
Display *dpy;
{
struct x_display_info *dpyinfo;
for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
if (dpyinfo->display == dpy)
return dpyinfo;
return 0;
}
/* Starting and ending updates.
......@@ -432,7 +428,7 @@ XTupdate_end (f)
note_mouse_highlight (f, mouse_face_mouse_x, mouse_face_mouse_y);
#endif
XFlushQueue ();
XFlush (FRAME_X_DISPLAY (f));
UNBLOCK_INPUT;
}
......@@ -509,7 +505,7 @@ XTcursor_to (row, col)
{
BLOCK_INPUT;
x_display_cursor (selected_frame, 1);
XFlushQueue ();
XFlush (FRAME_X_DISPLAY (selected_frame));
UNBLOCK_INPUT;
}
}
......@@ -581,7 +577,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
determined by the face code CF. */
{
struct face *face = FRAME_DEFAULT_FACE (f);
FONT_TYPE *font = FACE_FONT (face);
XFontStruct *font = FACE_FONT (face);
GC gc = FACE_GC (face);
int stippled = 0;
......@@ -663,16 +659,16 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
xgcv.graphics_exposures = 0;
mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
if (scratch_cursor_gc)
XChangeGC (x_current_display, scratch_cursor_gc, mask, &xgcv);
XChangeGC (FRAME_X_DISPLAY (f), scratch_cursor_gc, mask, &xgcv);
else
scratch_cursor_gc
= XCreateGC (x_current_display, window, mask, &xgcv);
= XCreateGC (FRAME_X_DISPLAY (f), window, mask, &xgcv);
gc = scratch_cursor_gc;
#if 0
/* If this code is restored, it must also reset to the default stipple
if necessary. */
if (face->stipple && face->stipple != FACE_DEFAULT)
XSetStipple (x_current_display, gc, face->stipple);
XSetStipple (FRAME_X_DISPLAY (f), gc, face->stipple);
#endif
}
}
......@@ -681,7 +677,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
font = f->display.x->font;
if (just_foreground)
XDrawString (x_current_display, window, gc,
XDrawString (FRAME_X_DISPLAY (f), window, gc,
left, top + FONT_BASE (font), buf, len);
else
{
......@@ -691,7 +687,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
XSetFillStyle (FRAME_X_DISPLAY (f), gc, FillOpaqueStippled);
/* Draw stipple on background. */
XFillRectangle (x_current_display, window, gc,
XFillRectangle (FRAME_X_DISPLAY (f), window, gc,
left, top,
FONT_WIDTH (font) * len,
FONT_HEIGHT (font));
......@@ -700,16 +696,16 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
XSetFillStyle (FRAME_X_DISPLAY (f), gc, FillSolid);
/* Draw the text, solidly, onto the stipple pattern. */
XDrawString (x_current_display, window, gc,
XDrawString (FRAME_X_DISPLAY (f), window, gc,
left, top + FONT_BASE (font), buf, len);
}
else
XDrawImageString (x_current_display, window, gc,
XDrawImageString (FRAME_X_DISPLAY (f), window, gc,
left, top + FONT_BASE (font), buf, len);
/* Clear the rest of the line's height. */
if (f->display.x->line_height != FONT_HEIGHT (font))
XClearArea (x_current_display, window, left,
XClearArea (FRAME_X_DISPLAY (f), window, left,
top + FONT_HEIGHT (font),
FONT_WIDTH (font) * len,
/* This is how many pixels of height
......@@ -741,7 +737,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
underline_position = font->descent - 1;
if (face->underline)
XFillRectangle (x_current_display, FRAME_X_WINDOW (f),
XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
FACE_GC (face),
left, (top
+ FONT_BASE (font)
......@@ -765,7 +761,7 @@ dumpglyphs (f, left, top, gp, n, hl, font)
register GLYPH *gp; /* Points to first GLYPH. */
register int n; /* Number of glyphs to display. */
int hl;
FONT_TYPE *font;
XFontStruct *font;
{
register int len;
Window window = FRAME_X_WINDOW (f);
......@@ -774,10 +770,10 @@ dumpglyphs (f, left, top, gp, n, hl, font)
: f->display.x->normal_gc));
if (sizeof (GLYPH) == sizeof (XChar2b))
XDrawImageString16 (x_current_display, window, drawing_gc,
XDrawImageString16 (FRAME_X_DISPLAY (f), window, drawing_gc,
left, top + FONT_BASE (font), (XChar2b *) gp, n);
else if (sizeof (GLYPH) == sizeof (unsigned char))
XDrawImageString (x_current_display, window, drawing_gc,
XDrawImageString (FRAME_X_DISPLAY (f), window, drawing_gc,
left, top + FONT_BASE (font), (char *) gp, n);
else
/* What size of glyph ARE you using? And does X have a function to
......@@ -869,7 +865,7 @@ XTclear_end_of_line (first_unused)
&& f->phys_cursor_x < first_unused)
f->phys_cursor_x = -1;
XClearArea (x_current_display, FRAME_X_WINDOW (f),
XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
CHAR_TO_PIXEL_COL (f, curs_x),
CHAR_TO_PIXEL_ROW (f, curs_y),
FONT_WIDTH (f->display.x->font) * (first_unused - curs_x),
......@@ -896,13 +892,13 @@ XTclear_frame ()
BLOCK_INPUT;
XClear (FRAME_X_WINDOW (f));
XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
/* We have to clear the scroll bars, too. If we have changed
colors or something like that, then they should be notified. */
x_scroll_bar_clear (f);
XFlushQueue ();
XFlush (FRAME_X_DISPLAY (f));
UNBLOCK_INPUT;
}
......@@ -936,7 +932,7 @@ redraw_previous_char (f, x, y, highlight_flag)
int start_x = x - 2;
if (start_x < 0)
start_x = 0;
XClearArea (x_current_display, FRAME_X_WINDOW (f),
XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
CHAR_TO_PIXEL_COL (f, x - 1),
CHAR_TO_PIXEL_ROW (f, y),
FONT_WIDTH (f->display.x->font),
......@@ -972,7 +968,7 @@ redraw_following_char (f, x, y, highlight_flag)
int end_x = x + 2;
if (end_x > limit)
end_x = limit;
XClearArea (x_current_display, FRAME_X_WINDOW (f),
XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
CHAR_TO_PIXEL_COL (f, x),
CHAR_TO_PIXEL_ROW (f, y),
FONT_WIDTH (f->display.x->font),
......@@ -1134,7 +1130,7 @@ XTflash (f)
values.foreground = (f->display.x->foreground_pixel
^ f->display.x->background_pixel);
gc = XCreateGC (x_current_display, FRAME_X_WINDOW (f),
gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
GCFunction | GCForeground, &values);
}
......@@ -1142,9 +1138,9 @@ XTflash (f)
int width = PIXEL_WIDTH (f);
int height = PIXEL_HEIGHT (f);
XFillRectangle (x_current_display, FRAME_X_WINDOW (f), gc,
XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
width/4, height/4, width/2, height/2);
XFlush (x_current_display);
XFlush (FRAME_X_DISPLAY (f));
{
struct timeval wakeup, now;
......@@ -1173,10 +1169,10 @@ XTflash (f)
}
}
XFillRectangle (x_current_display, FRAME_X_WINDOW (f), gc,
XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
width/4, height/4, width/2, height/2);
XFreeGC (x_current_display, gc);
XFlush (x_current_display);
XFreeGC (FRAME_X_DISPLAY (f), gc);
XFlush (FRAME_X_DISPLAY (f));
}
}
......@@ -1188,11 +1184,11 @@ XTflash (f)
/* Make audible bell. */
#define XRINGBELL XBell (x_current_display, 0)
#define XRINGBELL XBell (FRAME_X_DISPLAY (selected_frame), 0)
XTring_bell ()
{
if (x_current_display == 0)
if (FRAME_X_DISPLAY (selected_frame) == 0)
return;
#if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT)
......@@ -1203,7 +1199,7 @@ XTring_bell ()
{
BLOCK_INPUT;
XRINGBELL;
XFlushQueue ();
XFlush (FRAME_X_DISPLAY (selected_frame));
UNBLOCK_INPUT;
}
}
......@@ -1330,7 +1326,7 @@ do_line_dance ()
for (j = i; (j < ht && line_dance[j] != -1
&& line_dance[j]-j == distance); ++j);
/* Copy [i,j) upward from [i+distance,j+distance) */
XCopyArea (x_current_display, FRAME_X_WINDOW (f),
XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
FRAME_X_WINDOW (f), f->display.x->normal_gc,
intborder, CHAR_TO_PIXEL_ROW (f, i+distance),
f->width * FONT_WIDTH (f->display.x->font),
......@@ -1345,7 +1341,7 @@ do_line_dance ()
for (j = i; (--j >= 0 && line_dance[j] != -1
&& line_dance[j]-j == distance););
/* Copy (j,i] downward from (j+distance, i+distance] */
XCopyArea (x_current_display, FRAME_X_WINDOW (f),
XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
FRAME_X_WINDOW (f), f->display.x->normal_gc,
intborder, CHAR_TO_PIXEL_ROW (f, j+1+distance),
f->width * FONT_WIDTH (f->display.x->font),
......@@ -1359,7 +1355,7 @@ do_line_dance ()
{
for (j = i; j < ht && line_dance[j] == -1; ++j);
/* Clear [i,j) */
XClearArea (x_current_display, FRAME_X_WINDOW (f),
XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
intborder, CHAR_TO_PIXEL_ROW (f, i),
f->width * FONT_WIDTH (f->display.x->font),
(j-i) * f->display.x->line_height, False);
......@@ -1453,33 +1449,33 @@ dumprectangle (f, left, top, cols, rows)
}
static void
frame_highlight (frame)
struct frame *frame;
frame_highlight (f)
struct frame *f;
{
/* We used to only do this if Vx_no_window_manager was non-nil, but
the ICCCM (section 4.1.6) says that the window's border pixmap
and border pixel are window attributes which are "private to the
client", so we can always change it to whatever we want. */
BLOCK_INPUT;
XSetWindowBorder (x_current_display, FRAME_X_WINDOW (frame),
frame->display.x->border_pixel);
XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
f->display.x->border_pixel);
UNBLOCK_INPUT;
x_display_cursor (frame, 1);
x_display_cursor (f, 1);
}
static void
frame_unhighlight (frame)
struct frame *frame;
frame_unhighlight (f)
struct frame *f;
{
/* We used to only do this if Vx_no_window_manager was non-nil, but
the ICCCM (section 4.1.6) says that the window's border pixmap
and border pixel are window attributes which are "private to the
client", so we can always change it to whatever we want. */
BLOCK_INPUT;
XSetWindowBorderPixmap (x_current_display, FRAME_X_WINDOW (frame),
frame->display.x->border_tile);
XSetWindowBorderPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
f->display.x->border_tile);
UNBLOCK_INPUT;
x_display_cursor (frame, 1);
x_display_cursor (f, 1);
}
static void XTframe_rehighlight ();
......@@ -1558,56 +1554,33 @@ XTframe_rehighlight ()
/* Keyboard processing - modifier keys, vendor-specific keysyms, etc. */
/* Which modifier keys are on which modifier bits?
With each keystroke, X returns eight bits indicating which modifier
keys were held down when the key was pressed. The interpretation
of the top five modifier bits depends on what keys are attached
to them. If the Meta_L and Meta_R keysyms are on mod5, then mod5
is the meta bit.
x_meta_mod_mask is a mask containing the bits used for the meta key.
It may have more than one bit set, if more than one modifier bit
has meta keys on it. Basically, if EVENT is a KeyPress event,
the meta key is pressed if (EVENT.state & x_meta_mod_mask) != 0.
x_shift_lock_mask is LockMask if the XK_Shift_Lock keysym is on the
lock modifier bit, or zero otherwise. Non-alphabetic keys should
only be affected by the lock modifier bit if XK_Shift_Lock is in
use; XK_Caps_Lock should only affect alphabetic keys. With this
arrangement, the lock modifier should shift the character if
(EVENT.state & x_shift_lock_mask) != 0. */
static int x_meta_mod_mask, x_shift_lock_mask;
/* These are like x_meta_mod_mask, but for different modifiers. */
static int x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask;
/* Initialize mode_switch_bit and modifier_meaning. */
static void
x_find_modifier_meanings ()
x_find_modifier_meanings (dpyinfo)
struct x_display_info *dpyinfo;
{
int min_code, max_code;
KeySym *syms;
int syms_per_code;
XModifierKeymap *mods;
x_meta_mod_mask = 0;
x_shift_lock_mask = 0;
x_alt_mod_mask = 0;
x_super_mod_mask = 0;
x_hyper_mod_mask = 0;
dpyinfo->meta_mod_mask = 0;
dpyinfo->shift_lock_mask = 0;
dpyinfo->alt_mod_mask = 0;
dpyinfo->super_mod_mask = 0;
dpyinfo->hyper_mod_mask = 0;
#ifdef HAVE_X11R4
XDisplayKeycodes (x_current_display, &min_code, &max_code);
XDisplayKeycodes (dpyinfo->display, &min_code, &max_code);
#else
min_code = x_current_display->min_keycode;
max_code = x_current_display->max_keycode;
min_code = display->min_keycode;
max_code = display->max_keycode;
#endif
syms = XGetKeyboardMapping (x_current_display,
syms = XGetKeyboardMapping (dpyinfo->display,
min_code, max_code - min_code + 1,
&syms_per_code);
mods = XGetModifierMapping (x_current_display);
mods = XGetModifierMapping (dpyinfo->display);
/* Scan the modifier table to see which modifier bits the Meta and
Alt keysyms are on. */
......@@ -1636,28 +1609,28 @@ x_find_modifier_meanings ()
{
case XK_Meta_L:
case XK_Meta_R:
x_meta_mod_mask |= (1 << row);
dpyinfo->meta_mod_mask |= (1 << row);
break;
case XK_Alt_L:
case XK_Alt_R:
x_alt_mod_mask |= (1 << row);
dpyinfo->alt_mod_mask |= (1 << row);
break;
case XK_Hyper_L:
case XK_Hyper_R:
x_hyper_mod_mask |= (1 << row);
dpyinfo->hyper_mod_mask |= (1 << row);
break;
case XK_Super_L:
case XK_Super_R:
x_super_mod_mask |= (1 << row);
dpyinfo->super_mod_mask |= (1 << row);
break;
case XK_Shift_Lock:
/* Ignore this if it's not on the lock modifier. */
if ((1 << row) == LockMask)
x_shift_lock_mask = LockMask;
dpyinfo->shift_lock_mask = LockMask;
break;
}
}
......@@ -1666,17 +1639,17 @@ x_find_modifier_meanings ()
}
/* If we couldn't find any meta keys, accept any alt keys as meta keys. */
if (! x_meta_mod_mask)
if (! dpyinfo->meta_mod_mask)
{
x_meta_mod_mask = x_alt_mod_mask;
x_alt_mod_mask = 0;
dpyinfo->meta_mod_mask = dpyinfo->alt_mod_mask;
dpyinfo->alt_mod_mask = 0;
}
/* If some keys are both alt and meta,
make them just meta, not alt. */
if (x_alt_mod_mask & x_meta_mod_mask)
if (dpyinfo->alt_mod_mask & dpyinfo->meta_mod_mask)
{
x_alt_mod_mask &= ~x_meta_mod_mask;
dpyinfo->alt_mod_mask &= ~dpyinfo->meta_mod_mask;
}
XFree ((char *) syms);
......@@ -1686,27 +1659,29 @@ x_find_modifier_meanings ()
/* Convert between the modifier bits X uses and the modifier bits
Emacs uses. */
static unsigned int
x_x_to_emacs_modifiers (state)
x_x_to_emacs_modifiers (dpyinfo, state)
struct x_display_info *dpyinfo;
unsigned int state;
{
return ( ((state & (ShiftMask | x_shift_lock_mask)) ? shift_modifier : 0)
| ((state & ControlMask) ? ctrl_modifier : 0)
| ((state & x_meta_mod_mask) ? meta_modifier : 0)
| ((state & x_alt_mod_mask) ? alt_modifier : 0)
| ((state & x_super_mod_mask) ? super_modifier : 0)
| ((state & x_hyper_mod_mask) ? hyper_modifier : 0));
return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0)
| ((state & ControlMask) ? ctrl_modifier : 0)
| ((state & dpyinfo->meta_mod_mask) ? meta_modifier : 0)
| ((state & dpyinfo->alt_mod_mask) ? alt_modifier : 0)
| ((state & dpyinfo->super_mod_mask) ? super_modifier : 0)
| ((state & dpyinfo->hyper_mod_mask) ? hyper_modifier : 0));
}
static unsigned int
x_emacs_to_x_modifiers (state)
x_emacs_to_x_modifiers (dpyinfo, state)
struct x_display_info *dpyinfo;
unsigned int state;
{
return ( ((state & alt_modifier) ? x_alt_mod_mask : 0)
| ((state & super_modifier) ? x_super_mod_mask : 0)
| ((state & hyper_modifier) ? x_hyper_mod_mask : 0)
| ((state & shift_modifier) ? ShiftMask : 0)
| ((state & ctrl_modifier) ? ControlMask : 0)
| ((state & meta_modifier) ? x_meta_mod_mask : 0));
return ( ((state & alt_modifier) ? dpyinfo->alt_mod_mask : 0)
| ((state & super_modifier) ? dpyinfo->super_mod_mask : 0)
| ((state & hyper_modifier) ? dpyinfo->hyper_mod_mask : 0)
| ((state & shift_modifier) ? ShiftMask : 0)
| ((state & ctrl_modifier) ? ControlMask : 0)
| ((state & meta_modifier) ? dpyinfo->meta_mod_mask : 0));
}
/* Mouse clicks and mouse movement. Rah. */
......@@ -1785,7 +1760,8 @@ construct_mouse_click (result, event, f)
result->kind = mouse_click;
result->code = event->button - Button1;
result->timestamp = event->time;
result->modifiers = (x_x_to_emacs_modifiers (event->state)
result->modifiers = (x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f),
event->state)
| (event->type == ButtonRelease
? up_modifier
: down_modifier));
......@@ -1817,7 +1793,8 @@ construct_menu_click (result, event, f)
result->kind = mouse_click;
XSETINT (result->code, event->button - Button1);
result->timestamp = event->time;
result->modifiers = (x_x_to_emacs_modifiers (event->state)
result->modifiers = (x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f),
event->state)
| (event->type == ButtonRelease
? up_modifier
: down_modifier));
......@@ -1934,7 +1911,7 @@ note_mouse_highlight (f, x, y)
/* Find out which glyph the mouse is on. */
pixel_to_glyph_coords (f, x, y, &column, &row,
&new_glyph, x_mouse_grabbed);
&new_glyph, FRAME_X_DISPLAY_INFO (f)->grabbed);
/* Which window is that in? */
window = window_from_coordinates (f, column, row, &portion);
......@@ -2195,9 +2172,11 @@ show_mouse_face (hl)
/* Change the mouse cursor according to the value of HL. */
if (hl > 0)
XDefineCursor (XDISPLAY FRAME_X_WINDOW (f), f->display.x->cross_cursor);
XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
f->display.x->cross_cursor);
else
XDefineCursor (XDISPLAY FRAME_X_WINDOW (f), f->display.x->text_cursor);
XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
f->display.x->text_cursor);
}
/* Clear out the mouse-highlighted active region.
......@@ -2239,8 +2218,8 @@ static void x_scroll_bar_report_motion ();
again. */
static void
XTmouse_position (f, bar_window, part, x, y, time)
FRAME_PTR *f;
XTmouse_position (fp, bar_window, part, x, y, time)
FRAME_PTR *fp;
Lisp_Object *bar_window;
enum scroll_bar_part *part;
Lisp_Object *x, *y;
......@@ -2251,7 +2230,7 @@ XTmouse_position (f, bar_window, part, x, y, time)
BLOCK_INPUT;
if (! NILP (last_mouse_scroll_bar))
x_scroll_bar_report_motion (f, bar_window, part, x, y, time);
x_scroll_bar_report_motion (fp, bar_window, part, x, y, time);
else
{
Window root;
......@@ -2264,8 +2243,8 @@ XTmouse_position (f, bar_window, part, x, y, time)
last_mouse_scroll_bar = Qnil;
/* Figure out which root window we're on. */
XQueryPointer (x_current_display,
DefaultRootWindow (x_current_display),
XQueryPointer (FRAME_X_DISPLAY (*fp),
DefaultRootWindow (FRAME_X_DISPLAY (*fp)),
/* The root window which contains the pointer. */
&root,
......@@ -2293,12 +2272,12 @@ XTmouse_position (f, bar_window, part, x, y, time)
win = root;
if (x_mouse_grabbed && last_mouse_frame
if (FRAME_X_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame
&& FRAME_LIVE_P (last_mouse_frame))
{
/* If mouse was grabbed on a frame, give coords for that frame
even if the mouse is now outside it. */
XTranslateCoordinates (x_current_display,
XTranslateCoordinates (FRAME_X_DISPLAY (*fp),
/* From-window, to-window. */
root, FRAME_X_WINDOW (last_mouse_frame),
......@@ -2314,7 +2293,7 @@ XTmouse_position (f, bar_window, part, x, y, time)
{
while (1)
{
XTranslateCoordinates (x_current_display,
XTranslateCoordinates (FRAME_X_DISPLAY (*fp),
/* From-window, to-window. */
root, win,
......@@ -2368,11 +2347,12 @@ XTmouse_position (f, bar_window, part, x, y, time)
/* Ok, we found a frame. Store all the values. */
pixel_to_glyph_coords (f1, win_x, win_y, &ignore1, &ignore2,
&last_mouse_glyph, x_mouse_grabbed);
&last_mouse_glyph,
FRAME_X_DISPLAY_INFO (f1)->grabbed);
*bar_window = Qnil;
*part = 0;
*f = f1;
*fp = f1;
XSETINT (*x, win_x);
XSETINT (*y, win_y);
*time = last_mouse_movement_time;
......@@ -2429,16 +2409,16 @@ x_scroll_bar_create (window, top, left, width, height)
struct window *window;
int top, left, width, height;
{
FRAME_PTR frame = XFRAME (WINDOW_FRAME (window));
struct scroll_bar *bar =
XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil));
FRAME_PTR f = XFRAME (WINDOW_FRAME (window));
struct scroll_bar *bar
= XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil));
BLOCK_INPUT;
{