changeset 82992:5de4189e659d

Got rid of the rif (window-based redisplay interface) global variable. src/dispextern.h (PRODUCE_GLYPHS): Use the rif in IT->f, not the global rif. (rif): Removed. src/dispnew.c (rif): Removed. (direct_output_for_insert, direct_output_forward_char, update_frame) (redraw_overlapped_rows, redraw_overlapping_rows, update_window) (update_marginal_area, update_text_area, update_window_line) (set_window_cursor_after_update, scrolling_window): Use the rif of the current frame, not the global rif. src/fontset.c: #include termhooks.h, for FRAME_RIF. (Finternal_char_font): Use the rif of the current frame. src/frame.c (x_set_frame_parameters): Use the rif of the current frame. src/keyboard.c (detect_input_pending_run_timers): Use the rif of the current frame. src/minibuf.c: #include termhooks.h, for FRAME_RIF. (read_minibuf): Use the rif of the current frame. src/term.c (update_begin): Removed rif update hack. src/termhooks.h (FRAME_RIF): New macro. src/xdisp.c (init_iterator, expose_frame): Removed rif update hack. (echo_area_display, x_cursor_to, draw_fringe_bitmap) (try_window_reusing_current_matrix, try_window_id) (get_glyph_face_and_encoding, x_get_glyph_overhangs) (get_char_face_and_encoding, compute_overhangs_and_x, draw_glyphs) (x_produce_glyphs, x_insert_glyphs, x_clear_end_of_line) (erase_phys_cursor, display_and_set_cursor, show_mouse_face) (define_frame_cursor1, x_draw_vertical_border): Use the rif of the current frame. src/xfns.c (Fx_create_frame): Removed rif update hack. src/xterm.c (frame_highlight, frame_unhighlight): Ditto. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-32
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 02 Jan 2004 04:22:23 +0000
parents 2b26656ff804
children 0abaf12fa706
files README.multi-tty src/Makefile.in src/dispextern.h src/dispnew.c src/fontset.c src/frame.c src/keyboard.c src/minibuf.c src/term.c src/termhooks.h src/xdisp.c src/xfns.c src/xterm.c
diffstat 13 files changed, 120 insertions(+), 118 deletions(-) [+]
line wrap: on
line diff
--- a/README.multi-tty	Fri Jan 02 02:54:17 2004 +0000
+++ b/README.multi-tty	Fri Jan 02 04:22:23 2004 +0000
@@ -127,9 +127,8 @@
 THINGS TO DO
 ------------
 
-** Fix rif issue with X-tty combo sessions.  IMHO the best thing to do
-   is to get rid of that global variable (and use the value value in
-   display_method, which is guaranteed to be correct).
+** Something with (maybe) multi-keyboard support broke function keys
+   and arrows on ttys during X+tty combo sessions.  Debug this.
 
 ** Fix faces on tty frames during X-tty combo sessions.
 
@@ -430,4 +429,11 @@
    added a kboard member to tty_display_info, and initialized the
    frame's kboard from there.)
 
+-- Fix rif issue with X-tty combo sessions.  IMHO the best thing to do
+   is to get rid of that global variable (and use the value value in
+   display_method, which is guaranteed to be correct).
+
+   (Done, did exactly that.  Core dumps during combo sessions became
+   much rarer.  In fact, I have not yet met a single one.)
+
 ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
--- a/src/Makefile.in	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/Makefile.in	Fri Jan 02 04:22:23 2004 +0000
@@ -1076,7 +1076,7 @@
    blockinput.h systty.h atimer.h systime.h buffer.h charset.h fontset.h \
    msdos.h dosfns.h dispextern.h $(config_h)
 fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h charset.h frame.h \
-   keyboard.h $(config_h)
+   keyboard.h termhooks.h $(config_h)
 getloadavg.o: getloadavg.c $(config_h)
 indent.o: indent.c frame.h window.h systty.h indent.h buffer.h $(config_h) termchar.h \
    termopts.h disptab.h region-cache.h charset.h composite.h dispextern.h \
@@ -1099,7 +1099,7 @@
 marker.o: marker.c buffer.h charset.h $(config_h)
 md5.o: md5.c md5.h $(config_h)
 minibuf.o: minibuf.c syntax.h dispextern.h frame.h window.h keyboard.h \
-   buffer.h commands.h charset.h msdos.h $(config_h)
+   buffer.h commands.h charset.h msdos.h termhooks.h $(config_h)
 mktime.o: mktime.c $(config_h)
 msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
    termopts.h termchar.h charset.h coding.h ccl.h disptab.h window.h \
--- a/src/dispextern.h	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/dispextern.h	Fri Jan 02 04:22:23 2004 +0000
@@ -2011,16 +2011,16 @@
 /* Call produce_glyphs or produce_glyphs_hook, if set.  Shortcut to
    avoid the function call overhead.  */
 
-#define PRODUCE_GLYPHS(IT) 			\
-     do {					\
-       extern int inhibit_free_realized_faces;	\
-       if (rif != NULL)				\
-	 rif->produce_glyphs ((IT));		\
-       else					\
-	 produce_glyphs ((IT));			\
-       if ((IT)->glyph_row != NULL)		\
-	 inhibit_free_realized_faces = 1;	\
-     } while (0)
+#define PRODUCE_GLYPHS(IT)                              \
+  do {                                                  \
+    extern int inhibit_free_realized_faces;             \
+    if (FRAME_RIF ((IT)->f) != NULL)                    \
+      FRAME_RIF ((IT)->f)->produce_glyphs ((IT));       \
+    else                                                \
+      produce_glyphs ((IT));                            \
+    if ((IT)->glyph_row != NULL)                        \
+      inhibit_free_realized_faces = 1;                  \
+  } while (0)
 
 /* Bit-flags indicating what operation move_it_to should perform.  */
 
@@ -2189,10 +2189,6 @@
 #endif /* HAVE_WINDOW_SYSTEM */
 };
 
-/* The current interface for window-based redisplay.  */
-
-extern struct redisplay_interface *rif;
-
 
 /***********************************************************************
 				Images
--- a/src/dispnew.c	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/dispnew.c	Fri Jan 02 04:22:23 2004 +0000
@@ -297,13 +297,6 @@
 
 static struct frame *frame_matrix_frame;
 
-/* Current interface for window-based redisplay.  Set from
-   update_begin.  A null value means we are not using window-based
-   redisplay.  */
-/* XXX this variable causes frequent coredumps */
-
-struct redisplay_interface *rif;
-
 /* Non-zero means that fonts have been loaded since the last glyph
    matrix adjustments.  Redisplay must stop, and glyph matrices must
    be adjusted when this flag becomes non-zero during display.  The
@@ -3610,17 +3603,17 @@
   updated_row = glyph_row;
   updated_area = TEXT_AREA;
   update_begin (f);
-  if (rif)
+  if (FRAME_RIF (f))
     {
-      rif->update_window_begin_hook (w);
+      FRAME_RIF (f)->update_window_begin_hook (w);
 
       if (glyphs == end - n
 	  /* In front of a space added by append_space.  */
 	  || (glyphs == end - n - 1
 	      && (end - n)->charpos <= 0))
-	rif->write_glyphs (glyphs, n);
+	FRAME_RIF (f)->write_glyphs (glyphs, n);
       else
-	rif->insert_glyphs (glyphs, n);
+	FRAME_RIF (f)->insert_glyphs (glyphs, n);
     }
   else
     {
@@ -3640,8 +3633,8 @@
      a frame matrix is used, cursor_to expects frame coordinates,
      and the X and Y parameters are not used.  */
   if (window_redisplay_p)
-    rif->cursor_to (w->cursor.vpos, w->cursor.hpos,
-		    w->cursor.y, w->cursor.x);
+    FRAME_RIF (f)->cursor_to (w->cursor.vpos, w->cursor.hpos,
+                              w->cursor.y, w->cursor.x);
   else
     {
       int x, y;
@@ -3653,8 +3646,8 @@
       cursor_to (y, x);
     }
 
-  if (rif)
-    rif->update_window_end_hook (w, 1, 0);
+  if (FRAME_RIF (f))
+    FRAME_RIF (f)->update_window_end_hook (w, 1, 0);
   update_end (f);
   updated_row = NULL;
   if (FRAME_TERMCAP_P (f))
@@ -3736,8 +3729,8 @@
 	   && w->cursor.hpos < w->desired_matrix->matrix_w);
 
   if (FRAME_WINDOW_P (f))
-    rif->cursor_to (w->cursor.vpos, w->cursor.hpos,
-		    w->cursor.y, w->cursor.x);
+    FRAME_RIF (f)->cursor_to (w->cursor.vpos, w->cursor.hpos,
+                              w->cursor.y, w->cursor.x);
   else
     {
       int x, y;
@@ -3824,7 +3817,7 @@
 
 #if 0 /* This flush is a performance bottleneck under X,
 	 and it doesn't seem to be necessary anyway.  */
-      rif->flush_display (f);
+      FRAME_RIF (f)->flush_display (f);
 #endif
     }
   else
@@ -3926,7 +3919,8 @@
      int yb;
 {
   int i;
-
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  
   /* If rows overlapping others have been changed, the rows being
      overlapped have to be redrawn.  This won't draw lines that have
      already been drawn in update_window_line because overlapped_p in
@@ -3949,10 +3943,12 @@
 	    {
 	      updated_row = row;
 	      updated_area = area;
-	      rif->cursor_to (i, 0, row->y, area == TEXT_AREA ? row->x : 0);
+	      FRAME_RIF (f)->cursor_to (i, 0, row->y,
+                                        area == TEXT_AREA ? row->x : 0);
 	      if (row->used[area])
-		rif->write_glyphs (row->glyphs[area], row->used[area]);
-	      rif->clear_end_of_line (-1);
+		FRAME_RIF (f)->write_glyphs (row->glyphs[area],
+                                             row->used[area]);
+	      FRAME_RIF (f)->clear_end_of_line (-1);
 	    }
 
 	  row->overlapped_p = 0;
@@ -3974,7 +3970,8 @@
 {
   int i, bottom_y;
   struct glyph_row *row;
-
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
+  
   for (i = 0; i < w->current_matrix->nrows; ++i)
     {
       row = w->current_matrix->rows + i;
@@ -4054,6 +4051,7 @@
 #if GLYPH_DEBUG
   struct frame *f = XFRAME (WINDOW_FRAME (w));
 #endif
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 
   /* Check that W's frame doesn't have glyph matrices.  */
   xassert (FRAME_WINDOW_P (f));
@@ -4221,6 +4219,7 @@
      int area, vpos;
 {
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 
   /* Let functions in xterm.c know what area subsequent X positions
      will be relative to.  */
@@ -4246,6 +4245,7 @@
 {
   struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
   int changed_p = 0;
 
   /* Let functions in xterm.c know what area subsequent X positions
@@ -4467,6 +4467,7 @@
 {
   struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
   int changed_p = 0;
 
   /* Set the row being updated.  This is important to let xterm.c
@@ -4537,6 +4538,7 @@
      struct window *w;
 {
   struct frame *f = XFRAME (w->frame);
+  struct redisplay_interface *rif = FRAME_RIF (f);
   int cx, cy, vpos, hpos;
 
   /* Not intended for frame matrix updates.  */
@@ -4760,6 +4762,7 @@
   int i, j, first_old, first_new, last_old, last_new;
   int nruns, nbytes, n, run_idx;
   struct row_entry *entry;
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 
   /* Skip over rows equal at the start.  */
   for (i = header_line_p ? 1 : 0; i < current_matrix->nrows - 1; ++i)
--- a/src/fontset.c	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/fontset.c	Fri Jan 02 04:22:23 2004 +0000
@@ -45,6 +45,7 @@
 #ifdef MAC_OS
 #include "macterm.h"
 #endif
+#include "termhooks.h"
 
 #ifdef FONTSET_DEBUG
 #undef xassert
@@ -1279,7 +1280,7 @@
       STORE_XCHAR2B (&char2b, c1, c2);
     else
       STORE_XCHAR2B (&char2b, 0, c1);
-    rif->encode_char (c, &char2b, fontp, NULL);
+    FRAME_RIF (f)->encode_char (c, &char2b, fontp, NULL);
     code = (XCHAR2B_BYTE1 (&char2b) << 8) | XCHAR2B_BYTE2 (&char2b);
   }
   return Fcons (build_string (face->font_name), make_number (code));
--- a/src/frame.c	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/frame.c	Fri Jan 02 04:22:23 2004 +0000
@@ -2807,8 +2807,8 @@
 	      if (NATNUMP (param_index)
 		  && (XFASTINT (param_index)
 		      < sizeof (frame_parms)/sizeof (frame_parms[0]))
-		  && rif->frame_parm_handlers[XINT (param_index)])
-		(*(rif->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
+                  && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])
+                (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
 	    }
 	}
     }
@@ -2851,8 +2851,8 @@
 	  if (NATNUMP (param_index)
 	      && (XFASTINT (param_index)
 		  < sizeof (frame_parms)/sizeof (frame_parms[0]))
-	      && rif->frame_parm_handlers[XINT (param_index)])
-	    (*(rif->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
+	      && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])
+	    (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
 	}
     }
 
--- a/src/keyboard.c	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/keyboard.c	Fri Jan 02 04:22:23 2004 +0000
@@ -9874,8 +9874,12 @@
 	 from an idle timer function.  The symptom of the bug is that
 	 the cursor sometimes doesn't become visible until the next X
 	 event is processed.  --gerd.  */
-      if (rif)
-	rif->flush_display (NULL);
+      {
+        Lisp_Object tail, frame;
+        FOR_EACH_FRAME (tail, frame)
+          if (FRAME_RIF (XFRAME (frame)))
+            FRAME_RIF (XFRAME (frame))->flush_display (XFRAME (frame));
+      }
     }
 
   return input_pending;
--- a/src/minibuf.c	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/minibuf.c	Fri Jan 02 04:22:23 2004 +0000
@@ -34,6 +34,7 @@
 #include "syntax.h"
 #include "intervals.h"
 #include "keymap.h"
+#include "termhooks.h"
 
 extern int quit_char;
 
@@ -692,8 +693,12 @@
       XWINDOW (minibuf_window)->cursor.x = 0;
       XWINDOW (minibuf_window)->must_be_updated_p = 1;
       update_frame (XFRAME (selected_frame), 1, 1);
-      if (rif && rif->flush_display)
-	rif->flush_display (XFRAME (XWINDOW (minibuf_window)->frame));
+      {
+        struct frame *f = XFRAME (XWINDOW (minibuf_window)->frame);
+        struct redisplay_interface *rif = FRAME_RIF (f);
+        if (rif && rif->flush_display)
+          rif->flush_display (f);
+      }
     }
 
   /* Make minibuffer contents into a string.  */
--- a/src/term.c	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/term.c	Fri Jan 02 04:22:23 2004 +0000
@@ -374,8 +374,6 @@
      struct frame *f;
 {
   updating_frame = f;
-  /* XXX rif hack */
-  rif = f->display_method->rif;
   if (!FRAME_TERMCAP_P (f))
     update_begin_hook (f);
 }
--- a/src/termhooks.h	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/termhooks.h	Fri Jan 02 04:22:23 2004 +0000
@@ -71,6 +71,8 @@
 #define FRAME_SCROLL_REGION_COST(f) ((f)->display_method->scroll_region_cost)
 #define FRAME_MEMORY_BELOW_FRAME(f) ((f)->display_method->memory_below_frame)
 
+#define FRAME_RIF(f) ((f)->display_method->rif)
+
 /* Text display hooks.  */
 
 extern void (*cursor_to_hook) P_ ((int vpos, int hpos));
--- a/src/xdisp.c	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/xdisp.c	Fri Jan 02 04:22:23 2004 +0000
@@ -2009,9 +2009,6 @@
   it->w = w;
   it->f = XFRAME (w->frame);
   
-  /* XXX rif hack: Make sure the redisplay interface is correctly set. */
-  rif = it->f->display_method->rif;
-
   /* Extra space between lines (on window systems only).  */
   if (base_face_id == DEFAULT_FACE_ID
       && FRAME_WINDOW_P (it->f))
@@ -7674,7 +7671,7 @@
 		 Can do with a display update of the echo area,
 		 unless we displayed some mode lines.  */
 	      update_single_window (w, 1);
-	      rif->flush_display (f);
+	      FRAME_RIF (f)->flush_display (f);
 	    }
 	  else
 	    update_frame (f, 1, 1);
@@ -8135,8 +8132,8 @@
     {
       BLOCK_INPUT;
       display_and_set_cursor (w, 1, hpos, vpos, x, y);
-      if (rif->flush_display_optional)
-	rif->flush_display_optional (SELECTED_FRAME ());
+      if (FRAME_RIF (SELECTED_FRAME ())->flush_display_optional)
+	FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (SELECTED_FRAME ());
       UNBLOCK_INPUT;
     }
 }
@@ -9029,7 +9026,7 @@
   /* Adjust y to the offset in the row to start drawing the bitmap.  */
   p.y += (row->height - p.h) / 2;
 
-  rif->draw_fringe_bitmap (w, row, &p);
+  FRAME_RIF (f)->draw_fringe_bitmap (w, row, &p);
 }
 
 /* Draw fringe bitmaps for glyph row ROW on window W.  Call this
@@ -12303,10 +12300,10 @@
 	  if (run.height > 0 && run.current_y != run.desired_y)
 	    {
 	      update_begin (f);
-	      rif->update_window_begin_hook (w);
-	      rif->clear_window_mouse_face (w);
-	      rif->scroll_run_hook (w, &run);
-	      rif->update_window_end_hook (w, 0, 0);
+	      FRAME_RIF (f)->update_window_begin_hook (w);
+	      FRAME_RIF (f)->clear_window_mouse_face (w);
+	      FRAME_RIF (f)->scroll_run_hook (w, &run);
+	      FRAME_RIF (f)->update_window_end_hook (w, 0, 0);
 	      update_end (f);
 	    }
 
@@ -12476,10 +12473,10 @@
 	{
 	  struct frame *f = XFRAME (WINDOW_FRAME (w));
 	  update_begin (f);
-	  rif->update_window_begin_hook (w);
-	  rif->clear_window_mouse_face (w);
-	  rif->scroll_run_hook (w, &run);
-	  rif->update_window_end_hook (w, 0, 0);
+	  FRAME_RIF (f)->update_window_begin_hook (w);
+	  FRAME_RIF (f)->clear_window_mouse_face (w);
+	  FRAME_RIF (f)->scroll_run_hook (w, &run);
+	  FRAME_RIF (f)->update_window_end_hook (w, 0, 0);
 	  update_end (f);
 	}
 
@@ -13310,10 +13307,10 @@
 
       if (FRAME_WINDOW_P (f))
 	{
-	  rif->update_window_begin_hook (w);
-	  rif->clear_window_mouse_face (w);
-	  rif->scroll_run_hook (w, &run);
-	  rif->update_window_end_hook (w, 0, 0);
+	  FRAME_RIF (f)->update_window_begin_hook (w);
+	  FRAME_RIF (f)->clear_window_mouse_face (w);
+	  FRAME_RIF (f)->scroll_run_hook (w, &run);
+	  FRAME_RIF (f)->update_window_end_hook (w, 0, 0);
 	}
       else
 	{
@@ -16818,7 +16815,7 @@
 	    = FONT_INFO_FROM_ID (f, face->font_info_id);
 	  if (font_info)
 	    glyph->font_type
-	      = rif->encode_char (glyph->u.ch, char2b, font_info, two_byte_p);
+	      = FRAME_RIF (f)->encode_char (glyph->u.ch, char2b, font_info, two_byte_p);
 	}
     }
 
@@ -17048,7 +17045,7 @@
       font = face->font;
       font_info = FONT_INFO_FROM_ID (f, face->font_info_id);
       if (font  /* ++KFS: Should this be font_info ?  */
-	  && (pcm = rif->per_char_metric (font, &char2b, glyph->font_type)))
+	  && (pcm = FRAME_RIF (f)->per_char_metric (font, &char2b, glyph->font_type)))
 	{
 	  if (pcm->rbearing > pcm->width)
 	    *right = pcm->rbearing - pcm->width;
@@ -17216,7 +17213,7 @@
 	  struct font_info *font_info
 	    = FONT_INFO_FROM_ID (f, face->font_info_id);
 	  if (font_info)
-	    rif->encode_char (c, char2b, font_info, 0);
+	    FRAME_RIF (f)->encode_char (c, char2b, font_info, 0);
 	}
     }
 
@@ -17283,8 +17280,8 @@
     {
       while (s)
 	{
-	  if (rif->compute_glyph_string_overhangs)
-	    rif->compute_glyph_string_overhangs (s);
+	  if (FRAME_RIF (s->f)->compute_glyph_string_overhangs)
+	    FRAME_RIF (s->f)->compute_glyph_string_overhangs (s);
 	  x -= s->width;
 	  s->x = x;
 	  s = s->prev;
@@ -17294,8 +17291,8 @@
     {
       while (s)
 	{
-	  if (rif->compute_glyph_string_overhangs)
-	    rif->compute_glyph_string_overhangs (s);
+	  if (FRAME_RIF (s->f)->compute_glyph_string_overhangs)
+	    FRAME_RIF (s->f)->compute_glyph_string_overhangs (s);
 	  s->x = x;
 	  x += s->width;
 	  s = s->next;
@@ -17576,9 +17573,9 @@
       struct glyph_string *h, *t;
 
       /* Compute overhangs for all glyph strings.  */
-      if (rif->compute_glyph_string_overhangs)
+      if (FRAME_RIF (f)->compute_glyph_string_overhangs)
 	for (s = head; s; s = s->next)
-	  rif->compute_glyph_string_overhangs (s);
+	  FRAME_RIF (f)->compute_glyph_string_overhangs (s);
 
       /* Prepend glyph strings for glyphs in front of the first glyph
 	 string that are overwritten because of the first glyph
@@ -17646,7 +17643,7 @@
 
   /* Draw all strings.  */
   for (s = head; s; s = s->next)
-    rif->draw_glyph_string (s);
+    FRAME_RIF (f)->draw_glyph_string (s);
 
   if (area == TEXT_AREA
       && !row->full_width_p
@@ -18334,8 +18331,8 @@
 
 	  it->nglyphs = 1;
 
-	  pcm = rif->per_char_metric (font, &char2b,
-				      FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display));
+	  pcm = FRAME_RIF (it->f)->per_char_metric (font, &char2b,
+                                                    FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display));
 	  it->ascent = FONT_BASE (font) + boff;
 	  it->descent = FONT_DESCENT (font) - boff;
 
@@ -18459,8 +18456,8 @@
 	     from the charset width; this is what old redisplay code
 	     did.  */
 
-	  pcm = rif->per_char_metric (font, &char2b,
-				      FONT_TYPE_FOR_MULTIBYTE (font, it->c));
+	  pcm = FRAME_RIF (it->f)->per_char_metric (font, &char2b,
+                                                    FONT_TYPE_FOR_MULTIBYTE (font, it->c));
 
 	  if (font_not_found_p || !pcm)
 	    {
@@ -18591,8 +18588,8 @@
 
 	  /* Initialize the bounding box.  */
 	  if (font_info
-	      && (pcm = rif->per_char_metric (font, &char2b,
-					      FONT_TYPE_FOR_MULTIBYTE (font, it->c))))
+	      && (pcm = FRAME_RIF (it->f)->per_char_metric (font, &char2b,
+                                                            FONT_TYPE_FOR_MULTIBYTE (font, it->c))))
 	    {
 	      width = pcm->width;
 	      ascent = pcm->ascent;
@@ -18650,8 +18647,8 @@
 		}
 
 	      if (font_info
-		  && (pcm = rif->per_char_metric (font, &char2b,
-						  FONT_TYPE_FOR_MULTIBYTE (font, ch))))
+		  && (pcm = FRAME_RIF (it->f)->per_char_metric (font, &char2b,
+                                                                FONT_TYPE_FOR_MULTIBYTE (font, ch))))
 		{
 		  width = pcm->width;
 		  ascent = pcm->ascent;
@@ -18886,8 +18883,8 @@
   frame_x = window_box_left (w, updated_area) + output_cursor.x;
   frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, output_cursor.y);
 
-  rif->shift_glyphs_for_insert (f, frame_x, frame_y, shifted_region_width,
-				line_height, shift_by_width);
+  FRAME_RIF (f)->shift_glyphs_for_insert (f, frame_x, frame_y, shifted_region_width,
+                                          line_height, shift_by_width);
 
   /* Write the glyphs.  */
   hpos = start - row->glyphs[updated_area];
@@ -18969,8 +18966,8 @@
   if (to_x > from_x && to_y > from_y)
     {
       BLOCK_INPUT;
-      rif->clear_frame_area (f, from_x, from_y,
-			     to_x - from_x, to_y - from_y);
+      FRAME_RIF (f)->clear_frame_area (f, from_x, from_y,
+                                       to_x - from_x, to_y - from_y);
       UNBLOCK_INPUT;
     }
 }
@@ -19407,8 +19404,8 @@
       x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
       y = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, cursor_row->y));
 
-      rif->clear_frame_area (f, x, y,
-			     cursor_glyph->pixel_width, cursor_row->visible_height);
+      FRAME_RIF (f)->clear_frame_area (f, x, y,
+                                       cursor_glyph->pixel_width, cursor_row->visible_height);
     }
 
   /* Erase the cursor by redrawing the character underneath it.  */
@@ -19504,9 +19501,9 @@
       w->phys_cursor.vpos = vpos;
     }
 
-  rif->draw_window_cursor (w, glyph_row, x, y,
-			   new_cursor_type, new_cursor_width,
-			   on, active_cursor);
+  FRAME_RIF (f)->draw_window_cursor (w, glyph_row, x, y,
+                                     new_cursor_type, new_cursor_width,
+                                     on, active_cursor);
 }
 
 
@@ -19651,11 +19648,11 @@
 
   /* Change the mouse cursor.  */
   if (draw == DRAW_NORMAL_TEXT)
-    rif->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
+    FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
   else if (draw == DRAW_MOUSE_FACE)
-    rif->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
-  else
-    rif->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
+    FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
+  else
+    FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
 }
 
 /* EXPORT:
@@ -20152,7 +20149,7 @@
 #else
   if (bcmp (&cursor, &No_Cursor, sizeof (Cursor)))
 #endif
-    rif->define_frame_cursor (f, cursor);
+    FRAME_RIF (f)->define_frame_cursor (f, cursor);
 }
 
 /* Take proper action when mouse has moved to the mode or header line
@@ -20987,6 +20984,8 @@
 x_draw_vertical_border (w)
      struct window *w;
 {
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  
   /* We could do better, if we knew what type of scroll-bar the adjacent
      windows (on either side) have...  But we don't :-( 
      However, I think this works ok.  ++KFS 2003-04-25 */
@@ -21003,7 +21002,7 @@
       window_box_edges (w, -1, &x0, &y0, &x1, &y1);
       y1 -= 1;
 
-      rif->draw_vertical_window_border (w, x1, y0, y1);
+      FRAME_RIF (f)->draw_vertical_window_border (w, x1, y0, y1);
     }
   else if (!WINDOW_LEFTMOST_P (w)
 	   && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
@@ -21013,7 +21012,7 @@
       window_box_edges (w, -1, &x0, &y0, &x1, &y1);
       y1 -= 1;
 
-      rif->draw_vertical_window_border (w, x0, y0, y1);
+      FRAME_RIF (f)->draw_vertical_window_border (w, x0, y0, y1);
     }
 }
 
@@ -21197,9 +21196,6 @@
 
   TRACE ((stderr, "expose_frame "));
 
-  /* XXX rif hack: Make sure redisplay interface is updated. */
-  rif = f->display_method->rif;
-  
   /* No need to redraw if frame will be redrawn soon.  */
   if (FRAME_GARBAGED_P (f))
     {
--- a/src/xfns.c	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/xfns.c	Fri Jan 02 04:22:23 2004 +0000
@@ -3191,9 +3191,6 @@
 
   check_x ();
 
-  /* XXX rif hack:Make sure rif is set to the right value. */
-  rif = x_display_method.rif;
-  
   /* Use this general default value to start with
      until we know if this frame has a specified name.  */
   Vx_resource_name = Vinvocation_name;
--- a/src/xterm.c	Fri Jan 02 02:54:17 2004 +0000
+++ b/src/xterm.c	Fri Jan 02 04:22:23 2004 +0000
@@ -3062,9 +3062,6 @@
 frame_highlight (f)
      struct frame *f;
 {
-  /* XXX hack: make sure rif is right. */
-  rif = f->display_method->rif;
-  
   /* 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
@@ -3080,9 +3077,6 @@
 frame_unhighlight (f)
      struct frame *f;
 {
-  /* XXX hack: make sure rif is right. */
-  rif = f->display_method->rif;
-  
   /* 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