changeset 4928:ea701c23ed84

change text_width method to take a window, in preparation for unicode-internal changes -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-01-19 Ben Wing <ben@xemacs.org> * console-impl.h (struct console_methods): * console-stream.c (stream_text_width): * redisplay-msw.c (mswindows_output_string): * redisplay-msw.c (mswindows_text_width): * redisplay-tty.c (tty_text_width): * redisplay-xlike-inc.c (XLIKE_text_width): * redisplay-xlike-inc.c (XLIKE_output_string): * redisplay.c: * redisplay.c (redisplay_window_text_width_ichar_string): * redisplay.c (redisplay_text_width_string): Change the text_width method to take a window instead of a frame. Needed for Unicode-internal.
author Ben Wing <ben@xemacs.org>
date Tue, 19 Jan 2010 11:21:34 -0600
parents eab9498ecc0e
children b5ad8cf9f6e4
files src/ChangeLog src/console-impl.h src/console-stream.c src/redisplay-msw.c src/redisplay-tty.c src/redisplay-xlike-inc.c src/redisplay.c
diffstat 7 files changed, 38 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Jan 18 08:44:49 2010 -0600
+++ b/src/ChangeLog	Tue Jan 19 11:21:34 2010 -0600
@@ -1,3 +1,18 @@
+2010-01-19  Ben Wing  <ben@xemacs.org>
+
+	* console-impl.h (struct console_methods):
+	* console-stream.c (stream_text_width):
+	* redisplay-msw.c (mswindows_output_string):
+	* redisplay-msw.c (mswindows_text_width):
+	* redisplay-tty.c (tty_text_width):
+	* redisplay-xlike-inc.c (XLIKE_text_width):
+	* redisplay-xlike-inc.c (XLIKE_output_string):
+	* redisplay.c:
+	* redisplay.c (redisplay_window_text_width_ichar_string):
+	* redisplay.c (redisplay_text_width_string):
+	Change the text_width method to take a window instead of a frame.
+	Needed for Unicode-internal.
+
 2010-01-18  Ben Wing  <ben@xemacs.org>
 
 	* redisplay-gtk.c:
--- a/src/console-impl.h	Mon Jan 18 08:44:49 2010 -0600
+++ b/src/console-impl.h	Tue Jan 19 11:21:34 2010 -0600
@@ -145,7 +145,7 @@
   /* redisplay methods */
   int (*left_margin_width_method) (struct window *);
   int (*right_margin_width_method) (struct window *);
-  int (*text_width_method) (struct frame *f, struct face_cachel *cachel,
+  int (*text_width_method) (struct window *w, struct face_cachel *cachel,
 			    const Ichar *str, Charcount len);
   void (*output_display_block_method) (struct window *, struct display_line *,
 				       int, int, int, int, int, int, int);
--- a/src/console-stream.c	Mon Jan 18 08:44:49 2010 -0600
+++ b/src/console-stream.c	Tue Jan 19 11:21:34 2010 -0600
@@ -202,7 +202,7 @@
 
 
 static int
-stream_text_width (struct frame *UNUSED (f),
+stream_text_width (struct window *UNUSED (w),
 		   struct face_cachel *UNUSED (cachel),
 		   const Ichar *UNUSED (str), Charcount len)
 {
--- a/src/redisplay-msw.c	Mon Jan 18 08:44:49 2010 -0600
+++ b/src/redisplay-msw.c	Tue Jan 19 11:21:34 2010 -0600
@@ -469,9 +469,10 @@
 #if 0	/* #### FIXME? */
   /* We can't work out the width before we've set the font in the DC */
   if (width < 0)
-    width = mswindows_text_width (cachel, Dynarr_atp (buf, 0), Dynarr_length (buf));
+    width = mswindows_text_width (w, cachel, Dynarr_atp (buf, 0),
+				  Dynarr_length (buf));
 #else
-  assert(width>=0);
+  assert (width >= 0);
 #endif
 
   /* Regularize the variables passed in. */
@@ -1181,9 +1182,10 @@
  displayed in the font associated with the face.
  ****************************************************************************/
 static int
-mswindows_text_width (struct frame *f, struct face_cachel *cachel,
+mswindows_text_width (struct window *w, struct face_cachel *cachel,
 		      const Ichar *str, Charcount len)
 {
+  struct frame *f = WINDOW_XFRAME (w);
   HDC hdc = get_frame_dc (f, 0);
   int width_so_far = 0;
   textual_run *runs;
--- a/src/redisplay-tty.c	Mon Jan 18 08:44:49 2010 -0600
+++ b/src/redisplay-tty.c	Tue Jan 19 11:21:34 2010 -0600
@@ -106,10 +106,10 @@
  column, so we use ichar_string_displayed_columns().
  ****************************************************************************/
 static int
-tty_text_width (struct frame *f, struct face_cachel *UNUSED (cachel),
+tty_text_width (struct window *w, struct face_cachel *UNUSED (cachel),
 		const Ichar *str, Charcount len)
 {
-  struct console *c = XCONSOLE(FRAME_CONSOLE (f));
+  struct console *c = WINDOW_XCONSOLE (w);
 
   if (CONSOLE_TTY_MULTIPLE_WIDTH (c))
     {
--- a/src/redisplay-xlike-inc.c	Mon Jan 18 08:44:49 2010 -0600
+++ b/src/redisplay-xlike-inc.c	Tue Jan 19 11:21:34 2010 -0600
@@ -767,17 +767,15 @@
    when displayed in the fonts associated with the face.
    */
 
-/* #### Break me out into a separate header */
-int XLIKE_text_width (struct frame *USED_IF_X (f), struct face_cachel *cachel,
-		      const Ichar *str, Charcount len);
-int
-XLIKE_text_width (struct frame *USED_IF_X (f), struct face_cachel *cachel,
+static int
+XLIKE_text_width (struct window *w, struct face_cachel *cachel,
 		  const Ichar *str, Charcount len)
 {
   /* !!#### Needs review */
   int width_so_far = 0;
   unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len);
   struct textual_run *runs = alloca_array (struct textual_run, len);
+  struct frame *f = WINDOW_XFRAME (w);
   int nruns;
   int i;
 
@@ -1271,7 +1269,7 @@
 #endif /* USE_XFT */
 
   if (width < 0)
-    width = XLIKE_text_width (f, cachel, Dynarr_atp (buf, 0),
+    width = XLIKE_text_width (w, cachel, Dynarr_atp (buf, 0),
 			      Dynarr_length (buf));
 
   /* Regularize the variables passed in. */
--- a/src/redisplay.c	Mon Jan 18 08:44:49 2010 -0600
+++ b/src/redisplay.c	Tue Jan 19 11:21:34 2010 -0600
@@ -1,7 +1,7 @@
 /* Display generation from window structure and buffer text.
    Copyright (C) 1994, 1995, 1996 Board of Trustees, University of Illinois.
    Copyright (C) 1995 Free Software Foundation, Inc.
-   Copyright (C) 1995, 1996, 2000, 2001, 2002, 2003, 2005 Ben Wing.
+   Copyright (C) 1995, 1996, 2000, 2001, 2002, 2003, 2005, 2010 Ben Wing.
    Copyright (C) 1995 Sun Microsystems, Inc.
    Copyright (C) 1996 Chuck Thompson.
 
@@ -640,9 +640,9 @@
   window = wrap_window (w);
   ensure_face_cachel_complete (WINDOW_FACE_CACHEL (w, findex), window,
 			       charsets);
-  return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (WINDOW_FRAME (w)))),
-		  text_width, (XFRAME (WINDOW_FRAME (w)),
-			       WINDOW_FACE_CACHEL (w, findex), str, len));
+  return DEVMETH (WINDOW_XDEVICE (w),
+		  text_width, (w, WINDOW_FACE_CACHEL (w, findex), str,
+			       len));
 }
 
 static Ichar_dynarr *rtw_ichar_dynarr;
@@ -690,7 +690,12 @@
 			       NILP (window) ? frame : window,
 			       charsets);
   return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (frame))),
-		  text_width, (XFRAME (frame),
+		  /* #### Not clear if we're always passed a window, but
+		     I think so.  If not, we will get an abort here,
+		     and then we need to either fix the callers to pass in
+		     a window, or change *text_width() to take a domain
+		     argument. */
+		  text_width, (XWINDOW (window),
 			       &cachel,
 			       Dynarr_atp (rtw_ichar_dynarr, 0),
 			       Dynarr_length (rtw_ichar_dynarr)));