changeset 111340:2186ab0af4a5

Start redesigning portable mouse highlight. Not compiled. xdisp.c (get_tool_bar_item, handle_tool_bar_click) (note_tool_bar_highlight, draw_glyphs, erase_phys_cursor) (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) (note_mode_line_or_margin_highlight, note_mouse_highlight) (x_clear_window_mouse_face, cancel_mouse_face, expose_frame): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. frame.h (MOUSE_HL_INFO): New macro. lisp.h (Mouse_HLInfo): New data type. xterm.h (struct x_display_info): w32term.h (struct w32_display_info): nsterm.h (struct ns_display_info): termchar.h (struct tty_display_info): Use it instead of mouse_face_* members. dispextern.h (DPYINFO_DEFINED): Remove definition. (FRAME_X_DISPLAY_INFO): Remove definition. (show_mouse_face, clear_mouse_face): Update type of 1st argument.
author Eli Zaretskii <eliz@gnu.org>
date Sun, 31 Oct 2010 20:50:02 +0200
parents e302712538dc
children f79bd5f589f7
files src/ChangeLog src/dispextern.h src/frame.h src/lisp.h src/nsterm.h src/termchar.h src/w32term.h src/xdisp.c src/xterm.h
diffstat 9 files changed, 297 insertions(+), 322 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Oct 30 15:09:52 2010 +0200
+++ b/src/ChangeLog	Sun Oct 31 20:50:02 2010 +0200
@@ -1,3 +1,27 @@
+2010-10-31  Eli Zaretskii  <eliz@gnu.org>
+
+	* xdisp.c (get_tool_bar_item, handle_tool_bar_click)
+	(note_tool_bar_highlight, draw_glyphs, erase_phys_cursor)
+	(show_mouse_face, clear_mouse_face, coords_in_mouse_face_p)
+	(note_mode_line_or_margin_highlight, note_mouse_highlight)
+	(x_clear_window_mouse_face, cancel_mouse_face, expose_frame):
+	Replace Display_Info with Mouse_HLInfo everywhere where
+	mouse_face_* members were accessed for mouse highlight purposes.
+
+	* frame.h (MOUSE_HL_INFO): New macro.
+
+	* lisp.h (Mouse_HLInfo): New data type.
+
+	* xterm.h (struct x_display_info):
+	* w32term.h (struct w32_display_info):
+	* nsterm.h (struct ns_display_info):
+	* termchar.h (struct tty_display_info): Use it instead of
+	mouse_face_* members.
+
+	* dispextern.h (DPYINFO_DEFINED): Remove definition.
+	(FRAME_X_DISPLAY_INFO): Remove definition.
+	(show_mouse_face, clear_mouse_face): Update type of 1st argument.
+
 2010-10-30  Eli Zaretskii  <eliz@gnu.org>
 
 	* xdisp.c (coords_in_mouse_face_p): Move prototype out of the
--- a/src/dispextern.h	Sat Oct 30 15:09:52 2010 +0200
+++ b/src/dispextern.h	Sun Oct 31 20:50:02 2010 +0200
@@ -43,9 +43,12 @@
 
 #endif /* HAVE_X_WINDOWS */
 
+#ifdef MSDOS
+#include "msdos.h"
+#endif
+
 #ifdef HAVE_X_WINDOWS
 typedef struct x_display_info Display_Info;
-#define DPYINFO_DEFINED 1
 typedef XImage * XImagePtr;
 typedef XImagePtr XImagePtr_or_DC;
 #define NativeRectangle XRectangle
@@ -54,7 +57,6 @@
 #ifdef HAVE_NTGUI
 #include "w32gui.h"
 typedef struct w32_display_info Display_Info;
-#define DPYINFO_DEFINED 1
 typedef XImage *XImagePtr;
 typedef HDC XImagePtr_or_DC;
 #endif
@@ -63,32 +65,15 @@
 #include "nsgui.h"
 /* following typedef needed to accomodate the MSDOS port, believe it or not */
 typedef struct ns_display_info Display_Info;
-#define DPYINFO_DEFINED 1
 typedef Pixmap XImagePtr;
 typedef XImagePtr XImagePtr_or_DC;
 #endif
 
-#ifndef DPYINFO_DEFINED
-typedef struct tty_display_info Display_Info;
+#ifndef HAVE_WINDOW_SYSTEM
 typedef int Cursor;
 #define No_Cursor (0)
 #endif
 
-#undef DPYINFO_DEFINED
-
-#ifdef MSDOS
-/* This defines FRAME_X_DISPLAY_INFO for MSDOS.  */
-#include "msdos.h"
-#endif
-
-#ifdef HAVE_GPM
-#define FRAME_X_DISPLAY_INFO(f) gpm_tty
-#endif
-
-#ifndef FRAME_X_DISPLAY_INFO
-#define FRAME_X_DISPLAY_INFO(f) NULL
-#endif
-
 #ifndef NativeRectangle
 #define NativeRectangle int
 #endif
--- a/src/frame.h	Sat Oct 30 15:09:52 2010 +0200
+++ b/src/frame.h	Sun Oct 31 20:50:02 2010 +0200
@@ -544,6 +544,14 @@
 #define FRAME_WINDOW_P(f) (0)
 #endif
 
+/* Return a pointer to the structure holding information about the
+   region of text, if any, that is currently shown in mouse-face on
+   frame F.  */
+#define MOUSE_HL_INFO(F)				\
+  (FRAME_WINDOW_P(F)					\
+   ? &(FRAME_X_DISPLAY_INFO(F)->mouse_highlight)	\
+   : &(((F)->output_data.tty)->mouse_highlight))
+
 /* Nonzero if frame F is still alive (not deleted).  */
 #define FRAME_LIVE_P(f) ((f)->terminal != 0)
 
--- a/src/lisp.h	Sat Oct 30 15:09:52 2010 +0200
+++ b/src/lisp.h	Sun Oct 31 20:50:02 2010 +0200
@@ -1563,6 +1563,41 @@
 /* The ID of the mode line highlighting face.  */
 #define GLYPH_MODE_LINE_FACE 1
 
+/* Structure to hold mouse highlight data.  This is here because other
+   header files need it for defining struct x_output etc.  */
+typedef struct {
+  /* These variables describe the range of text currently shown in its
+     mouse-face, together with the window they apply to.  As long as
+     the mouse stays within this range, we need not redraw anything on
+     its account.  Rows and columns are glyph matrix positions in
+     MOUSE_FACE_WINDOW.  */
+  int mouse_face_beg_row, mouse_face_beg_col;
+  int mouse_face_beg_x, mouse_face_beg_y;
+  int mouse_face_end_row, mouse_face_end_col;
+  int mouse_face_end_x, mouse_face_end_y;
+  int mouse_face_past_end;
+  Lisp_Object mouse_face_window;
+  int mouse_face_face_id;
+  Lisp_Object mouse_face_overlay;
+
+  /* 1 if a mouse motion event came and we didn't handle it right away because
+     gc was in progress.  */
+  int mouse_face_deferred_gc;
+
+  /* FRAME and X, Y position of mouse when last checked for
+     highlighting.  X and Y can be negative or out of range for the frame.  */
+  struct frame *mouse_face_mouse_frame;
+  int mouse_face_mouse_x, mouse_face_mouse_y;
+
+  /* Nonzero means defer mouse-motion highlighting.  */
+  int mouse_face_defer;
+
+  /* Nonzero means that the mouse highlight should not be shown.  */
+  int mouse_face_hidden;
+
+  int mouse_face_image_state;
+} Mouse_HLInfo;
+
 /* Data type checking */
 
 #define NILP(x)  EQ (x, Qnil)
--- a/src/nsterm.h	Sat Oct 30 15:09:52 2010 +0200
+++ b/src/nsterm.h	Sun Oct 31 20:50:02 2010 +0200
@@ -492,21 +492,9 @@
   /* The cursor to use for vertical scroll bars. */
   Cursor vertical_scroll_bar_cursor;
 
-  /* most mouse face stuff moved in here as of 21+ (and reasonably so) */
-  int mouse_face_beg_row, mouse_face_beg_col;
-  int mouse_face_end_row, mouse_face_end_col;
-  int mouse_face_beg_x, mouse_face_beg_y;
-  int mouse_face_end_x, mouse_face_end_y;
-  int mouse_face_past_end;
-  Lisp_Object mouse_face_window;
-  int mouse_face_face_id;
-  int mouse_face_deferred_gc;
-  Lisp_Object mouse_face_overlay;
-  FRAME_PTR mouse_face_mouse_frame;
-  int mouse_face_mouse_x, mouse_face_mouse_y;
-  int mouse_face_defer;
-  int mouse_face_hidden;
-  int mouse_face_image_state;
+  /* Information about the range of text currently shown in
+     mouse-face.  */
+  Mouse_HLInfo mouse_highlight;
 
   struct frame *x_highlight_frame;
   struct frame *x_focus_frame;
--- a/src/termchar.h	Sat Oct 30 15:09:52 2010 +0200
+++ b/src/termchar.h	Sun Oct 31 20:50:02 2010 +0200
@@ -70,34 +70,9 @@
   struct frame *previous_frame;
   int previous_color_mode;
 
-  /* These variables describe the range of text currently shown in its
-     mouse-face, together with the window they apply to.  As long as
-     the mouse stays within this range, we need not redraw anything on
-     its account.  Rows and columns are glyph matrix positions in
-     MOUSE_FACE_WINDOW.  */
-  int mouse_face_beg_row, mouse_face_beg_col;
-  int mouse_face_beg_x, mouse_face_beg_y;
-  int mouse_face_end_row, mouse_face_end_col;
-  int mouse_face_end_x, mouse_face_end_y;
-  int mouse_face_past_end;
-  Lisp_Object mouse_face_window;
-  int mouse_face_face_id;
-  Lisp_Object mouse_face_overlay;
-
-  /* 1 if a mouse motion event came and we didn't handle it right away because
-     gc was in progress.  */
-  int mouse_face_deferred_gc;
-
-  /* FRAME and X, Y position of mouse when last checked for
-     highlighting.  X and Y can be negative or out of range for the frame.  */
-  struct frame *mouse_face_mouse_frame;
-  int mouse_face_mouse_x, mouse_face_mouse_y;
-
-  /* Nonzero means defer mouse-motion highlighting.  */
-  int mouse_face_defer;
-
-  /* Nonzero means that the mouse highlight should not be shown.  */
-  int mouse_face_hidden;
+  /* Information about the range of text currently shown in
+     mouse-face.  */
+  Mouse_HLInfo mouse_highlight;
 
   /* Buffer used internally by termcap (see tgetent in the Termcap
      manual).  Only init_tty and delete_tty should change this.  */
--- a/src/w32term.h	Sat Oct 30 15:09:52 2010 +0200
+++ b/src/w32term.h	Sun Oct 31 20:50:02 2010 +0200
@@ -143,36 +143,9 @@
   /* Reusable Graphics Context for drawing a cursor in a non-default face. */
   XGCValues *scratch_cursor_gc;
 
-  /* These variables describe the range of text currently shown in its
-     mouse-face, together with the window they apply to. As long as
-     the mouse stays within this range, we need not redraw anything on
-     its account.  Rows and columns are glyph matrix positions in
-     MOUSE_FACE_WINDOW.  */
-  int mouse_face_beg_row, mouse_face_beg_col;
-  int mouse_face_beg_x, mouse_face_beg_y;
-  int mouse_face_end_row, mouse_face_end_col;
-  int mouse_face_end_x, mouse_face_end_y;
-  int mouse_face_past_end;
-  Lisp_Object mouse_face_window;
-  int mouse_face_face_id;
-  Lisp_Object mouse_face_overlay;
-
-  /* 1 if a mouse motion event came and we didn't handle it right away because
-     gc was in progress.  */
-  int mouse_face_deferred_gc;
-
-  /* FRAME and X, Y position of mouse when last checked for
-     highlighting.  X and Y can be negative or out of range for the frame.  */
-  struct frame *mouse_face_mouse_frame;
-  int mouse_face_mouse_x, mouse_face_mouse_y;
-
-  /* Nonzero means defer mouse-motion highlighting.  */
-  int mouse_face_defer;
-
-  /* Nonzero means that the mouse highlight should not be shown.  */
-  int mouse_face_hidden;
-
-  int mouse_face_image_state;
+  /* Information about the range of text currently shown in
+     mouse-face.  */
+  Mouse_HLInfo mouse_highlight;
 
   char *w32_id_name;
 
--- a/src/xdisp.c	Sat Oct 30 15:09:52 2010 +0200
+++ b/src/xdisp.c	Sun Oct 31 20:50:02 2010 +0200
@@ -10738,7 +10738,7 @@
 get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph,
 		   int *hpos, int *vpos, int *prop_idx)
 {
-  Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
   struct window *w = XWINDOW (f->tool_bar_window);
   int area;
 
@@ -10753,14 +10753,14 @@
     return -1;
 
   /* Is mouse on the highlighted item?  */
-  if (EQ (f->tool_bar_window, dpyinfo->mouse_face_window)
-      && *vpos >= dpyinfo->mouse_face_beg_row
-      && *vpos <= dpyinfo->mouse_face_end_row
-      && (*vpos > dpyinfo->mouse_face_beg_row
-	  || *hpos >= dpyinfo->mouse_face_beg_col)
-      && (*vpos < dpyinfo->mouse_face_end_row
-	  || *hpos < dpyinfo->mouse_face_end_col
-	  || dpyinfo->mouse_face_past_end))
+  if (EQ (f->tool_bar_window, hlinfo->mouse_face_window)
+      && *vpos >= hlinfo->mouse_face_beg_row
+      && *vpos <= hlinfo->mouse_face_end_row
+      && (*vpos > hlinfo->mouse_face_beg_row
+	  || *hpos >= hlinfo->mouse_face_beg_col)
+      && (*vpos < hlinfo->mouse_face_end_row
+	  || *hpos < hlinfo->mouse_face_end_col
+	  || hlinfo->mouse_face_past_end))
     return 0;
 
   return 1;
@@ -10777,7 +10777,7 @@
 handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
 		       unsigned int modifiers)
 {
-  Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
   struct window *w = XWINDOW (f->tool_bar_window);
   int hpos, vpos, prop_idx;
   struct glyph *glyph;
@@ -10796,8 +10796,8 @@
   if (down_p)
     {
       /* Show item in pressed state.  */
-      show_mouse_face (dpyinfo, DRAW_IMAGE_SUNKEN);
-      dpyinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN;
+      show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN);
+      hlinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN;
       last_tool_bar_item = prop_idx;
     }
   else
@@ -10807,8 +10807,8 @@
       EVENT_INIT (event);
 
       /* Show item in released state.  */
-      show_mouse_face (dpyinfo, DRAW_IMAGE_RAISED);
-      dpyinfo->mouse_face_image_state = DRAW_IMAGE_RAISED;
+      show_mouse_face (hlinfo, DRAW_IMAGE_RAISED);
+      hlinfo->mouse_face_image_state = DRAW_IMAGE_RAISED;
 
       key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY);
 
@@ -10838,6 +10838,7 @@
   Lisp_Object window = f->tool_bar_window;
   struct window *w = XWINDOW (window);
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
   int hpos, vpos;
   struct glyph *glyph;
   struct glyph_row *row;
@@ -10851,7 +10852,7 @@
      values when mouse moves outside of the frame.  */
   if (x <= 0 || y <= 0)
     {
-      clear_mouse_face (dpyinfo);
+      clear_mouse_face (hlinfo);
       return;
     }
 
@@ -10859,14 +10860,14 @@
   if (rc < 0)
     {
       /* Not on tool-bar item.  */
-      clear_mouse_face (dpyinfo);
+      clear_mouse_face (hlinfo);
       return;
     }
   else if (rc == 0)
     /* On same tool-bar item as before.  */
     goto set_help_echo;
 
-  clear_mouse_face (dpyinfo);
+  clear_mouse_face (hlinfo);
 
   /* Mouse is down, but on different tool-bar item?  */
   mouse_down_p = (dpyinfo->grabbed
@@ -10876,7 +10877,7 @@
       && last_tool_bar_item != prop_idx)
     return;
 
-  dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT;
+  hlinfo->mouse_face_image_state = DRAW_NORMAL_TEXT;
   draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED;
 
   /* If tool-bar item is not enabled, don't highlight it.  */
@@ -10890,22 +10891,22 @@
 	x += row->glyphs[TEXT_AREA][i].pixel_width;
 
       /* Record this as the current active region.  */
-      dpyinfo->mouse_face_beg_col = hpos;
-      dpyinfo->mouse_face_beg_row = vpos;
-      dpyinfo->mouse_face_beg_x = x;
-      dpyinfo->mouse_face_beg_y = row->y;
-      dpyinfo->mouse_face_past_end = 0;
-
-      dpyinfo->mouse_face_end_col = hpos + 1;
-      dpyinfo->mouse_face_end_row = vpos;
-      dpyinfo->mouse_face_end_x = x + glyph->pixel_width;
-      dpyinfo->mouse_face_end_y = row->y;
-      dpyinfo->mouse_face_window = window;
-      dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID;
+      hlinfo->mouse_face_beg_col = hpos;
+      hlinfo->mouse_face_beg_row = vpos;
+      hlinfo->mouse_face_beg_x = x;
+      hlinfo->mouse_face_beg_y = row->y;
+      hlinfo->mouse_face_past_end = 0;
+
+      hlinfo->mouse_face_end_col = hpos + 1;
+      hlinfo->mouse_face_end_row = vpos;
+      hlinfo->mouse_face_end_x = x + glyph->pixel_width;
+      hlinfo->mouse_face_end_y = row->y;
+      hlinfo->mouse_face_window = window;
+      hlinfo->mouse_face_face_id = TOOL_BAR_FACE_ID;
 
       /* Display it as active.  */
-      show_mouse_face (dpyinfo, draw);
-      dpyinfo->mouse_face_image_state = draw;
+      show_mouse_face (hlinfo, draw);
+      hlinfo->mouse_face_image_state = draw;
     }
 
  set_help_echo:
@@ -21300,7 +21301,7 @@
   if (head && !overlaps && row->contains_overlapping_glyphs_p)
     {
       struct glyph_string *h, *t;
-      Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+      Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
       int mouse_beg_col, mouse_end_col, check_mouse_face = 0;
       int dummy_x = 0;
 
@@ -21310,16 +21311,16 @@
 	{
 	  struct glyph_row *mouse_beg_row, *mouse_end_row;
 
-	  mouse_beg_row = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row);
-	  mouse_end_row = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row);
+	  mouse_beg_row = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row);
+	  mouse_end_row = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_end_row);
 
 	  if (row >= mouse_beg_row && row <= mouse_end_row)
 	    {
 	      check_mouse_face = 1;
 	      mouse_beg_col = (row == mouse_beg_row)
-		? dpyinfo->mouse_face_beg_col : 0;
+		? hlinfo->mouse_face_beg_col : 0;
 	      mouse_end_col = (row == mouse_end_row)
-		? dpyinfo->mouse_face_end_col
+		? hlinfo->mouse_face_end_col
 		: row->used[TEXT_AREA];
 	    }
 	}
@@ -23363,7 +23364,7 @@
 erase_phys_cursor (struct window *w)
 {
   struct frame *f = XFRAME (w->frame);
-  Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
   int hpos = w->phys_cursor.hpos;
   int vpos = w->phys_cursor.vpos;
   int mouse_face_here_p = 0;
@@ -23419,7 +23420,7 @@
 
   /* If the cursor is in the mouse face area, redisplay that when
      we clear the cursor.  */
-  if (! NILP (dpyinfo->mouse_face_window)
+  if (! NILP (hlinfo->mouse_face_window)
       && coords_in_mouse_face_p (w, hpos, vpos)
       /* Don't redraw the cursor's spot in mouse face if it is at the
 	 end of a line (on a newline).  The cursor appears there, but
@@ -23611,40 +23612,52 @@
     update_window_cursor (w, 0);
 }
 
-void
-draw_row_with_mouse_face (struct frame *w, int start_x, struct glyph_row *row,
+#endif /* HAVE_WINDOW_SYSTEM */
+
+/* Implementation of draw_row_with_mouse_face for GUI sessions and
+   GPM.  MSDOS has its own implementation on msdos.c.  */
+#ifndef MSDOS
+void
+draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row,
 			  int start_hpos, int end_hpos,
 			  enum draw_glyphs_face draw)
 {
-  draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0);
-}
-
-
-#endif /* HAVE_WINDOW_SYSTEM */
+#ifdef HAVE_WINDOW_SYSTEM
+  if (FRAME_WINDOW_P (XFRAME (w->frame)))
+    {
+      draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0);
+      return;
+    }
+#endif
+#ifdef HAVE_GPM
+  tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw);
+#endif
+}
+#endif	/* not MSDOS */
 
 /* EXPORT:
    Display the active region described by mouse_face_* according to DRAW.  */
 
 void
-show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw)
-{
-  struct window *w = XWINDOW (dpyinfo->mouse_face_window);
+show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
+{
+  struct window *w = XWINDOW (hlinfo->mouse_face_window);
   struct frame *f = XFRAME (WINDOW_FRAME (w));
 
   if (/* If window is in the process of being destroyed, don't bother
 	 to do anything.  */
       w->current_matrix != NULL
       /* Don't update mouse highlight if hidden */
-      && (draw != DRAW_MOUSE_FACE || !dpyinfo->mouse_face_hidden)
+      && (draw != DRAW_MOUSE_FACE || !hlinfo->mouse_face_hidden)
       /* Recognize when we are called to operate on rows that don't exist
 	 anymore.  This can happen when a window is split.  */
-      && dpyinfo->mouse_face_end_row < w->current_matrix->nrows)
+      && hlinfo->mouse_face_end_row < w->current_matrix->nrows)
     {
       int phys_cursor_on_p = w->phys_cursor_on_p;
       struct glyph_row *row, *first, *last;
 
-      first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row);
-      last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row);
+      first = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row);
+      last = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_end_row);
 
       for (row = first; row <= last && row->enabled_p; ++row)
 	{
@@ -23659,13 +23672,13 @@
 		 highlighted area in R2L rows.  */
 	      if (!row->reversed_p)
 		{
-		  start_hpos = dpyinfo->mouse_face_beg_col;
-		  start_x = dpyinfo->mouse_face_beg_x;
+		  start_hpos = hlinfo->mouse_face_beg_col;
+		  start_x = hlinfo->mouse_face_beg_x;
 		}
 	      else if (row == last)
 		{
-		  start_hpos = dpyinfo->mouse_face_end_col;
-		  start_x = dpyinfo->mouse_face_end_x;
+		  start_hpos = hlinfo->mouse_face_end_col;
+		  start_x = hlinfo->mouse_face_end_x;
 		}
 	      else
 		{
@@ -23675,8 +23688,8 @@
 	    }
 	  else if (row->reversed_p && row == last)
 	    {
-	      start_hpos = dpyinfo->mouse_face_end_col;
-	      start_x = dpyinfo->mouse_face_end_x;
+	      start_hpos = hlinfo->mouse_face_end_col;
+	      start_x = hlinfo->mouse_face_end_x;
 	    }
 	  else
 	    {
@@ -23687,9 +23700,9 @@
 	  if (row == last)
 	    {
 	      if (!row->reversed_p)
-		end_hpos = dpyinfo->mouse_face_end_col;
+		end_hpos = hlinfo->mouse_face_end_col;
 	      else if (row == first)
-		end_hpos = dpyinfo->mouse_face_beg_col;
+		end_hpos = hlinfo->mouse_face_beg_col;
 	      else
 		{
 		  end_hpos = row->used[TEXT_AREA];
@@ -23698,7 +23711,7 @@
 		}
 	    }
 	  else if (row->reversed_p && row == first)
-	    end_hpos = dpyinfo->mouse_face_beg_col;
+	    end_hpos = hlinfo->mouse_face_beg_col;
 	  else
 	    {
 	      end_hpos = row->used[TEXT_AREA];
@@ -23732,7 +23745,7 @@
 
 #ifdef HAVE_WINDOW_SYSTEM
   /* Change the mouse cursor.  */
-  if (draw == DRAW_NORMAL_TEXT && !EQ (dpyinfo->mouse_face_window, f->tool_bar_window))
+  if (draw == DRAW_NORMAL_TEXT && !EQ (hlinfo->mouse_face_window, f->tool_bar_window))
     FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
   else if (draw == DRAW_MOUSE_FACE)
     FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
@@ -23748,20 +23761,20 @@
    face was actually drawn unhighlighted.  */
 
 int
-clear_mouse_face (Display_Info *dpyinfo)
+clear_mouse_face (Mouse_HLInfo *hlinfo)
 {
   int cleared = 0;
 
-  if (!dpyinfo->mouse_face_hidden && !NILP (dpyinfo->mouse_face_window))
-    {
-      show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT);
+  if (!hlinfo->mouse_face_hidden && !NILP (hlinfo->mouse_face_window))
+    {
+      show_mouse_face (hlinfo, DRAW_NORMAL_TEXT);
       cleared = 1;
     }
 
-  dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
-  dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
-  dpyinfo->mouse_face_window = Qnil;
-  dpyinfo->mouse_face_overlay = Qnil;
+  hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
+  hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
+  hlinfo->mouse_face_window = Qnil;
+  hlinfo->mouse_face_overlay = Qnil;
   return cleared;
 }
 
@@ -23770,43 +23783,43 @@
 static int
 coords_in_mouse_face_p (struct window *w, int hpos, int vpos)
 {
-  Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame));
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
 
   /* Quickly resolve the easy cases.  */
-  if (!(WINDOWP (dpyinfo->mouse_face_window)
-	&& XWINDOW (dpyinfo->mouse_face_window) == w))
+  if (!(WINDOWP (hlinfo->mouse_face_window)
+	&& XWINDOW (hlinfo->mouse_face_window) == w))
     return 0;
-  if (vpos < dpyinfo->mouse_face_beg_row
-      || vpos > dpyinfo->mouse_face_end_row)
+  if (vpos < hlinfo->mouse_face_beg_row
+      || vpos > hlinfo->mouse_face_end_row)
     return 0;
-  if (vpos > dpyinfo->mouse_face_beg_row
-      && vpos < dpyinfo->mouse_face_end_row)
+  if (vpos > hlinfo->mouse_face_beg_row
+      && vpos < hlinfo->mouse_face_end_row)
     return 1;
 
   if (!MATRIX_ROW (w->current_matrix, vpos)->reversed_p)
     {
-      if (dpyinfo->mouse_face_beg_row == dpyinfo->mouse_face_end_row)
-	{
-	  if (dpyinfo->mouse_face_beg_col <= hpos && hpos < dpyinfo->mouse_face_end_col)
+      if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row)
+	{
+	  if (hlinfo->mouse_face_beg_col <= hpos && hpos < hlinfo->mouse_face_end_col)
 	    return 1;
 	}
-      else if ((vpos == dpyinfo->mouse_face_beg_row
-		&& hpos >= dpyinfo->mouse_face_beg_col)
-	       || (vpos == dpyinfo->mouse_face_end_row
-		   && hpos < dpyinfo->mouse_face_end_col))
+      else if ((vpos == hlinfo->mouse_face_beg_row
+		&& hpos >= hlinfo->mouse_face_beg_col)
+	       || (vpos == hlinfo->mouse_face_end_row
+		   && hpos < hlinfo->mouse_face_end_col))
 	return 1;
     }
   else
     {
-       if (dpyinfo->mouse_face_beg_row == dpyinfo->mouse_face_end_row)
-	{
-	  if (dpyinfo->mouse_face_end_col < hpos && hpos <= dpyinfo->mouse_face_beg_col)
+       if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row)
+	{
+	  if (hlinfo->mouse_face_end_col < hpos && hpos <= hlinfo->mouse_face_beg_col)
 	    return 1;
 	}
-      else if ((vpos == dpyinfo->mouse_face_beg_row
-		&& hpos <= dpyinfo->mouse_face_beg_col)
-	       || (vpos == dpyinfo->mouse_face_end_row
-		   && hpos > dpyinfo->mouse_face_end_col))
+      else if ((vpos == hlinfo->mouse_face_beg_row
+		&& hpos <= hlinfo->mouse_face_beg_col)
+	       || (vpos == hlinfo->mouse_face_end_row
+		   && hpos > hlinfo->mouse_face_end_col))
 	return 1;
     }
   return 0;
@@ -23947,7 +23960,7 @@
     }
 }
 
-/* This function sets the mouse_face_* elements of DPYINFO, assuming
+/* This function sets the mouse_face_* elements of HLINFO, assuming
    the mouse cursor is on a glyph with buffer charpos MOUSE_CHARPOS in
    window WINDOW.  START_CHARPOS and END_CHARPOS are buffer positions
    for the overlay or run of text properties specifying the mouse
@@ -23958,7 +23971,7 @@
 
 static void
 mouse_face_from_buffer_pos (Lisp_Object window,
-			    Display_Info *dpyinfo,
+			    Mouse_HLInfo *hlinfo,
 			    EMACS_INT mouse_charpos,
 			    EMACS_INT start_charpos,
 			    EMACS_INT end_charpos,
@@ -24003,7 +24016,7 @@
   if (r2 == NULL)
     {
       r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
-      dpyinfo->mouse_face_past_end = 1;
+      hlinfo->mouse_face_past_end = 1;
     }
   else if (!NILP (after_string))
     {
@@ -24032,10 +24045,10 @@
       r1 = tem;
     }
 
-  dpyinfo->mouse_face_beg_y = r1->y;
-  dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (r1, w->current_matrix);
-  dpyinfo->mouse_face_end_y = r2->y;
-  dpyinfo->mouse_face_end_row = MATRIX_ROW_VPOS (r2, w->current_matrix);
+  hlinfo->mouse_face_beg_y = r1->y;
+  hlinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (r1, w->current_matrix);
+  hlinfo->mouse_face_end_y = r2->y;
+  hlinfo->mouse_face_end_row = MATRIX_ROW_VPOS (r2, w->current_matrix);
 
   /* For a bidi-reordered row, the positions of BEFORE_STRING,
      AFTER_STRING, DISPLAY_STRING, START_CHARPOS, and END_CHARPOS
@@ -24094,8 +24107,8 @@
 	    }
 	  x += glyph->pixel_width;
 	}
-      dpyinfo->mouse_face_beg_x = x;
-      dpyinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA];
+      hlinfo->mouse_face_beg_x = x;
+      hlinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA];
     }
   else
     {
@@ -24147,8 +24160,8 @@
       glyph++; /* first glyph to the right of the highlighted area */
       for (g = r1->glyphs[TEXT_AREA], x = r1->x; g < glyph; g++)
 	x += g->pixel_width;
-      dpyinfo->mouse_face_beg_x = x;
-      dpyinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA];
+      hlinfo->mouse_face_beg_x = x;
+      hlinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA];
     }
 
   /* If the highlight ends in a different row, compute GLYPH and END
@@ -24211,8 +24224,8 @@
       for (; glyph <= end; ++glyph)
 	x += glyph->pixel_width;
 
-      dpyinfo->mouse_face_end_x = x;
-      dpyinfo->mouse_face_end_col = glyph - r2->glyphs[TEXT_AREA];
+      hlinfo->mouse_face_end_x = x;
+      hlinfo->mouse_face_end_col = glyph - r2->glyphs[TEXT_AREA];
     }
   else
     {
@@ -24258,16 +24271,16 @@
 	    }
 	  x += end->pixel_width;
 	}
-      dpyinfo->mouse_face_end_x = x;
-      dpyinfo->mouse_face_end_col = end - r2->glyphs[TEXT_AREA];
-    }
-
-  dpyinfo->mouse_face_window = window;
-  dpyinfo->mouse_face_face_id
+      hlinfo->mouse_face_end_x = x;
+      hlinfo->mouse_face_end_col = end - r2->glyphs[TEXT_AREA];
+    }
+
+  hlinfo->mouse_face_window = window;
+  hlinfo->mouse_face_face_id
     = face_at_buffer_position (w, mouse_charpos, 0, 0, &ignore,
 			       mouse_charpos + 1,
-			       !dpyinfo->mouse_face_hidden, -1);
-  show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
+			       !hlinfo->mouse_face_hidden, -1);
+  show_mouse_face (hlinfo, DRAW_MOUSE_FACE);
 }
 
 /* The following function is not used anymore (replaced with
@@ -24356,11 +24369,11 @@
 
 /* Find the positions of the first and the last glyphs in window W's
    current matrix that occlude positions [STARTPOS..ENDPOS] in OBJECT
-   (assumed to be a string), and return in DPYINFO's mouse_face
+   (assumed to be a string), and return in HLINFO's mouse_face_*
    members the pixel and column/row coordinates of those glyphs.  */
 
 static void
-mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo,
+mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo,
 			    Lisp_Object object,
 			    EMACS_INT startpos, EMACS_INT endpos)
 {
@@ -24385,10 +24398,10 @@
 	    if (EQ (g->object, object)
 		&& startpos <= g->charpos && g->charpos <= endpos)
 	      {
-		dpyinfo->mouse_face_beg_row = r - w->current_matrix->rows;
-		dpyinfo->mouse_face_beg_y = r->y;
-		dpyinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA];
-		dpyinfo->mouse_face_beg_x = gx;
+		hlinfo->mouse_face_beg_row = r - w->current_matrix->rows;
+		hlinfo->mouse_face_beg_y = r->y;
+		hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA];
+		hlinfo->mouse_face_beg_x = gx;
 		found = 1;
 		break;
 	      }
@@ -24403,12 +24416,12 @@
 	    if (EQ ((g-1)->object, object)
 		&& startpos <= (g-1)->charpos && (g-1)->charpos <= endpos)
 	      {
-		dpyinfo->mouse_face_beg_row = r - w->current_matrix->rows;
-		dpyinfo->mouse_face_beg_y = r->y;
-		dpyinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA];
+		hlinfo->mouse_face_beg_row = r - w->current_matrix->rows;
+		hlinfo->mouse_face_beg_y = r->y;
+		hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA];
 		for (gx = r->x, g1 = r->glyphs[TEXT_AREA]; g1 < g; ++g1)
 		  gx += g1->pixel_width;
-		dpyinfo->mouse_face_beg_x = gx;
+		hlinfo->mouse_face_beg_x = gx;
 		found = 1;
 		break;
 	      }
@@ -24442,8 +24455,8 @@
   r--;
 
   /* Set the end row and its vertical pixel coordinate.  */
-  dpyinfo->mouse_face_end_row = r - w->current_matrix->rows;
-  dpyinfo->mouse_face_end_y = r->y;
+  hlinfo->mouse_face_end_row = r - w->current_matrix->rows;
+  hlinfo->mouse_face_end_y = r->y;
 
   /* Compute and set the end column and the end column's horizontal
      pixel coordinate.  */
@@ -24455,11 +24468,11 @@
 	if (EQ ((e-1)->object, object)
 	    && startpos <= (e-1)->charpos && (e-1)->charpos <= endpos)
 	  break;
-      dpyinfo->mouse_face_end_col = e - g;
+      hlinfo->mouse_face_end_col = e - g;
 
       for (gx = r->x; g < e; ++g)
 	gx += g->pixel_width;
-      dpyinfo->mouse_face_end_x = gx;
+      hlinfo->mouse_face_end_x = gx;
     }
   else
     {
@@ -24472,8 +24485,8 @@
 	    break;
 	  gx += e->pixel_width;
 	}
-      dpyinfo->mouse_face_end_col = e - r->glyphs[TEXT_AREA];
-      dpyinfo->mouse_face_end_x = gx;
+      hlinfo->mouse_face_end_col = e - r->glyphs[TEXT_AREA];
+      hlinfo->mouse_face_end_x = gx;
     }
 }
 
@@ -24663,8 +24676,9 @@
 {
   struct window *w = XWINDOW (window);
   struct frame *f = XFRAME (w->frame);
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+#ifdef HAVE_WINDOW_SYSTEM
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
-#ifdef HAVE_WINDOW_SYSTEM
   Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
 #else
   Cursor cursor = No_Cursor;
@@ -24871,58 +24885,58 @@
 
 	  /* If GLYPH's position is included in the region that is
 	     already drawn in mouse face, we have nothing to do.  */
-	  if ( EQ (window, dpyinfo->mouse_face_window)
+	  if ( EQ (window, hlinfo->mouse_face_window)
 	       && (!row->reversed_p
-		   ? (dpyinfo->mouse_face_beg_col <= hpos
-		      && hpos < dpyinfo->mouse_face_end_col)
+		   ? (hlinfo->mouse_face_beg_col <= hpos
+		      && hpos < hlinfo->mouse_face_end_col)
 		   /* In R2L rows we swap BEG and END, see below.  */
-		   : (dpyinfo->mouse_face_end_col <= hpos
-		      && hpos < dpyinfo->mouse_face_beg_col))
-	       && dpyinfo->mouse_face_beg_row == vpos )
+		   : (hlinfo->mouse_face_end_col <= hpos
+		      && hpos < hlinfo->mouse_face_beg_col))
+	       && hlinfo->mouse_face_beg_row == vpos )
 	    return;
 
-	  if (clear_mouse_face (dpyinfo))
+	  if (clear_mouse_face (hlinfo))
 	    cursor = No_Cursor;
 
 	  if (!row->reversed_p)
 	    {
-	      dpyinfo->mouse_face_beg_col = hpos;
-	      dpyinfo->mouse_face_beg_x   = original_x_pixel
+	      hlinfo->mouse_face_beg_col = hpos;
+	      hlinfo->mouse_face_beg_x   = original_x_pixel
 					    - (total_pixel_width + dx);
-	      dpyinfo->mouse_face_end_col = hpos + gseq_length;
-	      dpyinfo->mouse_face_end_x   = 0;
+	      hlinfo->mouse_face_end_col = hpos + gseq_length;
+	      hlinfo->mouse_face_end_x   = 0;
 	    }
 	  else
 	    {
 	      /* In R2L rows, show_mouse_face expects BEG and END
 		 coordinates to be swapped.  */
-	      dpyinfo->mouse_face_end_col = hpos;
-	      dpyinfo->mouse_face_end_x   = original_x_pixel
+	      hlinfo->mouse_face_end_col = hpos;
+	      hlinfo->mouse_face_end_x   = original_x_pixel
 					    - (total_pixel_width + dx);
-	      dpyinfo->mouse_face_beg_col = hpos + gseq_length;
-	      dpyinfo->mouse_face_beg_x   = 0;
-	    }
-
-	  dpyinfo->mouse_face_beg_row  = vpos;
-	  dpyinfo->mouse_face_end_row  = dpyinfo->mouse_face_beg_row;
-	  dpyinfo->mouse_face_beg_y    = 0;
-	  dpyinfo->mouse_face_end_y    = 0;
-	  dpyinfo->mouse_face_past_end = 0;
-	  dpyinfo->mouse_face_window   = window;
-
-	  dpyinfo->mouse_face_face_id = face_at_string_position (w, string,
-								 charpos,
-								 0, 0, 0,
-								 &ignore,
-								 glyph->face_id,
-								 1);
-	  show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
+	      hlinfo->mouse_face_beg_col = hpos + gseq_length;
+	      hlinfo->mouse_face_beg_x   = 0;
+	    }
+
+	  hlinfo->mouse_face_beg_row  = vpos;
+	  hlinfo->mouse_face_end_row  = hlinfo->mouse_face_beg_row;
+	  hlinfo->mouse_face_beg_y    = 0;
+	  hlinfo->mouse_face_end_y    = 0;
+	  hlinfo->mouse_face_past_end = 0;
+	  hlinfo->mouse_face_window   = window;
+
+	  hlinfo->mouse_face_face_id = face_at_string_position (w, string,
+								charpos,
+								0, 0, 0,
+								&ignore,
+								glyph->face_id,
+								1);
+	  show_mouse_face (hlinfo, DRAW_MOUSE_FACE);
 
 	  if (NILP (pointer))
 	    pointer = Qhand;
 	}
       else if ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))
-	clear_mouse_face (dpyinfo);
+	clear_mouse_face (hlinfo);
     }
 #ifdef HAVE_WINDOW_SYSTEM
   define_frame_cursor1 (f, cursor, pointer);
@@ -24939,7 +24953,7 @@
 void
 note_mouse_highlight (struct frame *f, int x, int y)
 {
-  Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
   enum window_part part;
   Lisp_Object window;
   struct window *w;
@@ -24958,16 +24972,16 @@
       || f->pointer_invisible)
     return;
 
-  dpyinfo->mouse_face_mouse_x = x;
-  dpyinfo->mouse_face_mouse_y = y;
-  dpyinfo->mouse_face_mouse_frame = f;
-
-  if (dpyinfo->mouse_face_defer)
+  hlinfo->mouse_face_mouse_x = x;
+  hlinfo->mouse_face_mouse_y = y;
+  hlinfo->mouse_face_mouse_frame = f;
+
+  if (hlinfo->mouse_face_defer)
     return;
 
   if (gc_in_progress)
     {
-      dpyinfo->mouse_face_deferred_gc = 1;
+      hlinfo->mouse_face_deferred_gc = 1;
       return;
     }
 
@@ -24976,10 +24990,10 @@
 
   /* If we were displaying active text in another window, clear that.
      Also clear if we move out of text area in same window.  */
-  if (! EQ (window, dpyinfo->mouse_face_window)
+  if (! EQ (window, hlinfo->mouse_face_window)
       || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE
-	  && !NILP (dpyinfo->mouse_face_window)))
-    clear_mouse_face (dpyinfo);
+	  && !NILP (hlinfo->mouse_face_window)))
+    clear_mouse_face (hlinfo);
 
   /* Not on a window -> return.  */
   if (!WINDOWP (window))
@@ -25108,7 +25122,7 @@
 	      && glyph->type == STRETCH_GLYPH
 	      && glyph->avoid_cursor_p))
 	{
-	  if (clear_mouse_face (dpyinfo))
+	  if (clear_mouse_face (hlinfo))
 	    cursor = No_Cursor;
 #ifdef HAVE_WINDOW_SYSTEM
 	  if (NILP (pointer))
@@ -25164,8 +25178,8 @@
 	     the one we are currently highlighting, we have to
 	     check if we enter the overlapping overlay, and then
 	     highlight only that.  */
-	  || (OVERLAYP (dpyinfo->mouse_face_overlay)
-	      && mouse_face_overlay_overlaps (dpyinfo->mouse_face_overlay)))
+	  || (OVERLAYP (hlinfo->mouse_face_overlay)
+	      && mouse_face_overlay_overlaps (hlinfo->mouse_face_overlay)))
 	{
 	  /* Find the highest priority overlay with a mouse-face.  */
 	  overlay = Qnil;
@@ -25178,12 +25192,12 @@
 
 	  /* If we're highlighting the same overlay as before, there's
 	     no need to do that again.  */
-	  if (!NILP (overlay) && EQ (overlay, dpyinfo->mouse_face_overlay))
+	  if (!NILP (overlay) && EQ (overlay, hlinfo->mouse_face_overlay))
 	    goto check_help_echo;
-	  dpyinfo->mouse_face_overlay = overlay;
+	  hlinfo->mouse_face_overlay = overlay;
 
 	  /* Clear the display of the old active region, if any.  */
-	  if (clear_mouse_face (dpyinfo))
+	  if (clear_mouse_face (hlinfo))
 	    cursor = No_Cursor;
 
 	  /* If no overlay applies, get a text property.  */
@@ -25207,14 +25221,14 @@
 		b = make_number (0);
 	      if (NILP (e))
 		e = make_number (SCHARS (object) - 1);
-	      mouse_face_from_string_pos (w, dpyinfo, object,
+	      mouse_face_from_string_pos (w, hlinfo, object,
 					  XINT (b), XINT (e));
-	      dpyinfo->mouse_face_past_end = 0;
-	      dpyinfo->mouse_face_window = window;
-	      dpyinfo->mouse_face_face_id
+	      hlinfo->mouse_face_past_end = 0;
+	      hlinfo->mouse_face_window = window;
+	      hlinfo->mouse_face_face_id
 		= face_at_string_position (w, object, pos, 0, 0, 0, &ignore,
 					   glyph->face_id, 1);
-	      show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
+	      show_mouse_face (hlinfo, DRAW_MOUSE_FACE);
 	      cursor = No_Cursor;
 	    }
 	  else
@@ -25289,7 +25303,7 @@
 		      if (!STRINGP (after_string))  after_string = Qnil;
 		    }
 
-		  mouse_face_from_buffer_pos (window, dpyinfo, pos,
+		  mouse_face_from_buffer_pos (window, hlinfo, pos,
 					      XFASTINT (before),
 					      XFASTINT (after),
 					      before_string, after_string,
@@ -25436,13 +25450,13 @@
 void
 x_clear_window_mouse_face (struct window *w)
 {
-  Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame));
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
   Lisp_Object window;
 
   BLOCK_INPUT;
   XSETWINDOW (window, w);
-  if (EQ (window, dpyinfo->mouse_face_window))
-    clear_mouse_face (dpyinfo);
+  if (EQ (window, hlinfo->mouse_face_window))
+    clear_mouse_face (hlinfo);
   UNBLOCK_INPUT;
 }
 
@@ -25455,14 +25469,14 @@
 cancel_mouse_face (struct frame *f)
 {
   Lisp_Object window;
-  Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
-
-  window = dpyinfo->mouse_face_window;
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+
+  window = hlinfo->mouse_face_window;
   if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f)
     {
-      dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
-      dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
-      dpyinfo->mouse_face_window = Qnil;
+      hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
+      hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
+      hlinfo->mouse_face_window = Qnil;
     }
 }
 
@@ -25923,12 +25937,12 @@
      focus-follows-mouse with delayed raise.  --jason 2001-10-12  */
   if (mouse_face_overwritten_p && !FRAME_GARBAGED_P (f))
     {
-      Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
-      if (f == dpyinfo->mouse_face_mouse_frame)
-	{
-	  int x = dpyinfo->mouse_face_mouse_x;
-	  int y = dpyinfo->mouse_face_mouse_y;
-	  clear_mouse_face (dpyinfo);
+      Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+      if (f == hlinfo->mouse_face_mouse_frame)
+	{
+	  int x = hlinfo->mouse_face_mouse_x;
+	  int y = hlinfo->mouse_face_mouse_y;
+	  clear_mouse_face (hlinfo);
 	  note_mouse_highlight (f, x, y);
 	}
     }
--- a/src/xterm.h	Sat Oct 30 15:09:52 2010 +0200
+++ b/src/xterm.h	Sun Oct 31 20:50:02 2010 +0200
@@ -190,36 +190,9 @@
   /* Reusable Graphics Context for drawing a cursor in a non-default face. */
   GC scratch_cursor_gc;
 
-  /* These variables describe the range of text currently shown in its
-     mouse-face, together with the window they apply to.  As long as
-     the mouse stays within this range, we need not redraw anything on
-     its account.  Rows and columns are glyph matrix positions in
-     MOUSE_FACE_WINDOW.  */
-  int mouse_face_beg_row, mouse_face_beg_col;
-  int mouse_face_beg_x, mouse_face_beg_y;
-  int mouse_face_end_row, mouse_face_end_col;
-  int mouse_face_end_x, mouse_face_end_y;
-  int mouse_face_past_end;
-  Lisp_Object mouse_face_window;
-  int mouse_face_face_id;
-  Lisp_Object mouse_face_overlay;
-
-  /* 1 if a mouse motion event came and we didn't handle it right away because
-     gc was in progress.  */
-  int mouse_face_deferred_gc;
-
-  /* FRAME and X, Y position of mouse when last checked for
-     highlighting.  X and Y can be negative or out of range for the frame.  */
-  struct frame *mouse_face_mouse_frame;
-  int mouse_face_mouse_x, mouse_face_mouse_y;
-
-  /* Nonzero means defer mouse-motion highlighting.  */
-  int mouse_face_defer;
-
-  /* Nonzero means that the mouse highlight should not be shown.  */
-  int mouse_face_hidden;
-
-  int mouse_face_image_state;
+  /* Information about the range of text currently shown in
+     mouse-face.  */
+  Mouse_HLInfo mouse_highlight;
 
   char *x_id_name;