changeset 5627:37fb945697f5

text_width_single_run cleanup. -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2011-12-28 Didier Verna <didier@xemacs.org> * redisplay-xlike-inc.c (XLIKE_text_width_single_run): Get only what's needed as argument: an XLIKE_DISPLAY instead of a frame pointer. * redisplay-xlike-inc.c (XLIKE_text_width): * redisplay-xlike-inc.c (XLIKE_output_string): Update accordingly. Use the generic XLIKE_ name instead of the specific x_ one.
author Didier Verna <didier@xemacs.org>
date Wed, 28 Dec 2011 10:53:38 +0100
parents eb41da9b4469
children 81fee4aee9b6
files src/ChangeLog src/redisplay-xlike-inc.c
diffstat 2 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Dec 27 21:59:03 2011 +0100
+++ b/src/ChangeLog	Wed Dec 28 10:53:38 2011 +0100
@@ -1,3 +1,12 @@
+2011-12-28  Didier Verna  <didier@xemacs.org>
+
+	* redisplay-xlike-inc.c (XLIKE_text_width_single_run): Get only
+	what's needed as argument: an XLIKE_DISPLAY instead of a frame
+	pointer.
+	* redisplay-xlike-inc.c (XLIKE_text_width):
+	* redisplay-xlike-inc.c (XLIKE_output_string): Update accordingly.
+	Use the generic XLIKE_ name instead of the specific x_ one.
+
 2011-12-27  Didier Verna  <didier@xemacs.org>
 
 	* glyphs.c (update_image_instance):
--- a/src/redisplay-xlike-inc.c	Tue Dec 27 21:59:03 2011 +0100
+++ b/src/redisplay-xlike-inc.c	Wed Dec 28 10:53:38 2011 +0100
@@ -459,7 +459,7 @@
 /****************************************************************************/
 
 static int
-XLIKE_text_width_single_run (struct frame * USED_IF_XFT (f),
+XLIKE_text_width_single_run (XLIKE_DISPLAY USED_IF_XFT (dpy),
 			     struct face_cachel *cachel,
 			     struct textual_run *run)
 {
@@ -472,8 +472,6 @@
   else if (FONT_INSTANCE_X_XFTFONT (fi))
     {
       static XGlyphInfo glyphinfo;
-      struct device *d = XDEVICE (f->device);
-      Display *dpy = DEVICE_X_DISPLAY (d);
 
       if (run->dimension == 2)
 	{
@@ -526,7 +524,9 @@
   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);
+  struct frame *f = XFRAME (w->frame);
+  struct device *d = XDEVICE (f->device);
+  XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
   int nruns;
   int i;
 
@@ -534,7 +534,7 @@
 				 cachel);
 
   for (i = 0; i < nruns; i++)
-    width_so_far += XLIKE_text_width_single_run (f, cachel, runs + i);
+    width_so_far += XLIKE_text_width_single_run (dpy, cachel, runs + i);
 
   return width_so_far;
 }
@@ -1118,7 +1118,7 @@
       if (EQ (font, Vthe_null_font_instance))
 	continue;
 
-      this_width = XLIKE_text_width_single_run (f, cachel, runs + i);
+      this_width = XLIKE_text_width_single_run (dpy, cachel, runs + i);
       need_clipping = (dl->clip || clip_start > xpos ||
 		       clip_end < xpos + this_width);
 
@@ -1245,7 +1245,8 @@
 		   OK, unconditionally redraw the bevel, and increment
 		   rect_height by 1.  See x_output_display_block. -- sjt */
 		struct textual_run *run = &runs[i];
-		int rect_width = x_text_width_single_run (f, cachel, run);
+		int rect_width
+		  = XLIKE_text_width_single_run (dpy, cachel, run);
 #ifndef USE_XFTTEXTENTS_TO_AVOID_FONT_DROPPINGS
 		int rect_height = FONT_INSTANCE_ASCENT (fi)
 				  + FONT_INSTANCE_DESCENT (fi) + 1;
@@ -1458,7 +1459,8 @@
 	      { /* draw background rectangle & draw text */
 		int rect_height = FONT_INSTANCE_ASCENT (fi)
 				  + FONT_INSTANCE_DESCENT (fi);
-		int rect_width = x_text_width_single_run (f, cachel, &runs[i]);
+		int rect_width
+		  = XLIKE_text_width_single_run (dpy, cachel, &runs[i]);
 		XftColor xft_color;
 
 		xft_color = XFT_FROB_LISP_COLOR (cursor_cachel->background, 0);