Commits

Jeff Sparkes committed 3b7ee20

Move XLIKE_text_width to redisplay-x.c.

Comments (0)

Files changed (3)

src/ChangeLog.GTK

 2012-05-10  Jeff Sparkes  <jsparkes@gmail.com>
 
+	* redisplay-x.c (XLIKE_text_width): Move here.
+
 	* redisplay-gtk.c (XLIKE_output_blank): Copy here, convert to
 	cairo.
 	(XLIKE_output_blank): Fill bar cursor rectangle.  Use

src/redisplay-x.c

 #define THIS_IS_X
 #include "redisplay-xlike-inc.c"
 
+/*
+  XLIKE_text_width
+
+  Given a string and a merged face, return the string's length in pixels
+  when displayed in the fonts associated with the face.
+*/
+
+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;
+
+  nruns = separate_textual_runs (text_storage, runs, str, len, 
+				 cachel);
+
+  for (i = 0; i < nruns; i++)
+    width_so_far += XLIKE_text_width_single_run (f, cachel, runs + i);
+
+  return width_so_far;
+}
+
 static void x_output_shadows (struct frame *f, int x, int y, int width,
 			      int height, GC top_shadow_gc,
 			      GC bottom_shadow_gc, GC background_gc,

src/redisplay-xlike-inc.c

 #define XLIKE_output_eol_cursor XFUN (output_eol_cursor)
 #define XLIKE_clear_frame_window XFUN (clear_frame_window)
 #define XLIKE_clear_frame_windows XFUN (clear_frame_windows)
+#define XLIKE_text_width XFUN (text_width)
 
+static int XLIKE_text_width (struct window *w, struct face_cachel *cachel,
+                             const Ichar *str, Charcount len);
 static void XLIKE_output_vertical_divider (struct window *w, int clear);
 static void XLIKE_output_blank (struct window *w, struct display_line *dl,
 				struct rune *rb, int start_pixpos,
 }
 #endif
 
-#ifndef THIS_IS_GTK
-/*
-   XLIKE_text_width
-
-   Given a string and a merged face, return the string's length in pixels
-   when displayed in the fonts associated with the face.
-   */
-
-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;
-
-  nruns = separate_textual_runs (text_storage, runs, str, len, 
-				 cachel);
-
-  for (i = 0; i < nruns; i++)
-    width_so_far += XLIKE_text_width_single_run (f, cachel, runs + i);
-
-  return width_so_far;
-}
-#else
-static int XLIKE_text_width (struct window *w, struct face_cachel *cachel,
-                             const Ichar *str, Charcount len);
-#endif
-
 /*****************************************************************************
  XLIKE_divider_height