diff lwlib/xlwmenu.c @ 4916:a6c778975d7d

split USE_XFT into HAVE_XFT/USE_XFT -------------------- ChangeLog entries follow: -------------------- ChangeLog addition: 2010-02-01 Ben Wing <ben@xemacs.org> * configure: * configure.ac (TAB): USE_XFT* -> HAVE_XFT*. lwlib/ChangeLog addition: 2010-02-01 Ben Wing <ben@xemacs.org> * lwlib-colors.c: * lwlib-colors.h: * lwlib-fonts.c: * lwlib-fonts.h: * xlwmenu.c: * xlwmenu.c (xlwMenuResources): * xlwmenu.c (x_xft_text_width): * xlwmenu.c (label_button_draw): * xlwmenu.c (push_button_size): * xlwmenu.c (push_button_draw): * xlwmenu.c (make_drawing_gcs): * xlwmenu.c (extract_font_extents): * xlwmenu.c (default_font_of_font_list): * xlwmenu.c (XlwMenuInitialize): * xlwmenu.c (XlwMenuDestroy): * xlwmenu.c (XlwMenuSetValues): * xlwmenuP.h: * xlwmenuP.h (_XlwMenu_part): * xlwtabs.c: * xlwtabs.c (TabsInit): * xlwtabs.c (TabsDestroy): * xlwtabs.c (TabsSetValues): * xlwtabs.c (DrawTab): * xlwtabs.c (TabWidth): * xlwtabs.c (TabsAllocFgGC): * xlwtabs.c (TabsAllocGreyGC): * xlwtabsP.h: USE_XFT* -> HAVE_XFT*. src/ChangeLog addition: 2010-02-01 Ben Wing <ben@xemacs.org> * Makefile.in.in: * compiler.h: * config.h.in: * console-x-impl.h: * console-x-impl.h (struct x_frame): * console-x-impl.h (FRAME_X_TOTALLY_VISIBLE_P): * console-x.h: * console-xlike-inc.h: * emacs.c (main_1): * faces.c (complex_vars_of_faces): * font-mgr.h: * frame-x.c (x_delete_frame): * frame-x.c (x_update_frame_external_traits): * glyphs-x.c (update_widget_face): * inline.c: * objects-x-impl.h: * objects-x-impl.h (struct x_color_instance_data): * objects-x-impl.h (struct x_font_instance_data): * objects-x.c: * objects-x.c (x_initialize_color_instance): * objects-x.c (x_initialize_font_instance): * objects-x.c (x_print_font_instance): * objects-x.c (x_finalize_font_instance): * objects-x.c (x_font_instance_truename): * objects-x.c (vars_of_objects_x): * objects-x.h: USE_XFT* -> HAVE_XFT*. But in objects-xlike-inc.c and redisplay-xlike-inc.c, continue to use USE_XFT, and define it appropriately in console-xlike-inc.h when both HAVE_XFT and THIS_IS_X -- even if HAVE_XFT, we don't want to enable XFT code when included in a *-gtk.c file.
author Ben Wing <ben@xemacs.org>
date Mon, 01 Feb 2010 22:00:29 -0600
parents 726060ee587c
children ade4c7e2c6cb
line wrap: on
line diff
--- a/lwlib/xlwmenu.c	Mon Feb 01 06:20:05 2010 -0600
+++ b/lwlib/xlwmenu.c	Mon Feb 01 22:00:29 2010 -0600
@@ -46,7 +46,7 @@
 #endif /* XmVersion < 1.2 */
 #endif
 
-/* #### we may want to turn off USE_XFT here if !USE_XFT_MENUBARS
+/* #### we may want to turn off HAVE_XFT here if !HAVE_XFT_MENUBARS
    In fact, maybe that's the right interface overall? */
 #include "lwlib-fonts.h"
 #include "lwlib-colors.h"
@@ -98,7 +98,7 @@
 #define pmres(name,cls,member) \
   Xt_RESOURCE (name, cls, XtRPixmap, Pixmap, offset(member), XtRImmediate, None)
 
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   /* There are three font list resources, so that we can accept either of
      the resources *fontList: or *font:, and so that we can tell the
      difference between them being specified, and being defaulted to a
@@ -113,7 +113,7 @@
 #else
   fontres (XtNfont, XtCFont, XtRFontStruct, XFontStruct *, font,
 	   "XtDefaultFont"),
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   fontres (XtNfcFontName, XtCFcFontName, XtRString, String, fcFontName,
 	   "sans-serif-12:bold"),
   /* #### This needs to be fixed to give a proper type and converter for
@@ -191,7 +191,7 @@
 static void Drag  (Widget w, XEvent *ev, String *params, Cardinal *num_params);
 static void Select(Widget w, XEvent *ev, String *params, Cardinal *num_params);
 
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
 static XFontStruct *default_font_of_font_list (XmFontList);
 #endif
 
@@ -330,14 +330,14 @@
 /* Size code */
 static int
 string_width (XlwMenuWidget mw,
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
 	      XmString s
 #else
 	      char *s
 #endif
 	      )
 {
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   Dimension width, height;
   XmStringExtent (mw->menu.font_list, s, &width, &height);
   return width;
@@ -347,7 +347,7 @@
   XmbTextExtents (mw->menu.font_set, s, strlen (s), &ri, &rl);
   return rl.width;
 # else
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   XGlyphInfo glyphinfo;
   XftTextExtents8 (XtDisplay (mw), mw->menu.renderFont, (FcChar8 *) s,
 		   strlen (s), &glyphinfo);
@@ -384,21 +384,21 @@
 
 static int
 string_width_u (XlwMenuWidget mw,
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
 	      XmString string
 #else
 	      char *string
 #endif
 	      )
 {
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   Dimension width, height;
   XmString newstring;
 #else
 # ifdef USE_XFONTSET
   XRectangle ri, rl;
 # else /* ! USE_XFONTSET */
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   XGlyphInfo glyphinfo;
 #else
   XCharStruct xcs;
@@ -411,7 +411,7 @@
   char *chars;
   int i, j;
 
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   chars = "";
   if (!XmStringGetLtoR (string, XmFONTLIST_DEFAULT_TAG, &chars))
     chars = "";
@@ -428,7 +428,7 @@
 	    newchars[j++] = chars[i];
   newchars[j] = '\0';
 
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   newstring = XmStringLtoRCreate (newchars, XmFONTLIST_DEFAULT_TAG);
   XmStringExtent (mw->menu.font_list, newstring, &width, &height);
   XmStringFree (newstring);
@@ -439,7 +439,7 @@
   XmbTextExtents (mw->menu.font_set, newchars, j, &ri, &rl);
   return rl.width;
 # else /* ! USE_XFONTSET */
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   XftTextExtents8 (XtDisplay (mw), mw->menu.renderFont, (FcChar8 *) newchars,
 		   j, &glyphinfo);
   return glyphinfo.xOff;
@@ -613,7 +613,7 @@
   return result;
 }
 
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
 
 static XmString
 resource_widget_value (XlwMenuWidget mw, widget_value *val)
@@ -764,7 +764,7 @@
 #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \
 		   ? ((unsigned long) (x)) : ((unsigned long) (y)))
 
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 static int
 x_xft_text_width (Display *dpy, XftFont *xft_font, char *run, int len)
 {
@@ -782,20 +782,20 @@
 string_draw (XlwMenuWidget mw,
 	     Window window,
 	     int x, int y,
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 	     XftColor *color,
 	     XftColor *colorBg,
 #else
 	     GC gc,
 #endif
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
 	     XmString string
 #else
 	     char *string
 #endif
 )
 {
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   XmStringDraw (XtDisplay (mw), window,
 		mw->menu.font_list,
 		string, gc,
@@ -805,7 +805,7 @@
 		0, /* ???? layout_direction */
 		0);
 #else
-# ifdef USE_XFT_MENUBARS
+# ifdef HAVE_XFT_MENUBARS
   Display *display = XtDisplay (mw);
   Visual *visual = DefaultVisualOfScreen (XtScreen (mw));
   Colormap cmap = mw->core.colormap;
@@ -828,7 +828,7 @@
   XDrawString (XtDisplay (mw), window, gc,
 	       x, y + mw->menu.font_ascent, string, strlen (string));
 #  endif /* USE_XFONTSET */
-# endif /* USE_XFT_MENUBARS */
+# endif /* HAVE_XFT_MENUBARS */
 #endif /* NEED_MOTIF */
 }
 
@@ -837,7 +837,7 @@
 	XlwMenuWidget mw,
 	Window window,
 	int x, int y,
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 	XftColor *color,
 	XftColor *colorBg,
 #else
@@ -848,7 +848,7 @@
 	int end
 )
 {
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
 	Dimension width, height;
 	XmString newstring;
 	int c;
@@ -885,7 +885,7 @@
 		mw->menu.font_set, &string[start], end - start, &ri, &rl);
 	return rl.width;
 # else
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 	if (end <= start)
 		return 0;
 	else
@@ -937,12 +937,12 @@
 string_draw_u (XlwMenuWidget mw,
 	       Window window,
 	       int x, int y,
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 	       XftColor *color, XftColor *colorBg, GC gc,
 #else
 	       GC gc,
 #endif
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
 	       XmString string
 #else
 	       char *string
@@ -952,7 +952,7 @@
   int i, s = 0;
   char *chars;
 
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   chars = "";
   if (!XmStringGetLtoR (string, XmFONTLIST_DEFAULT_TAG, &chars))
     chars = "";
@@ -963,7 +963,7 @@
       if (chars[i] == '%' && chars[i+1] == '_') {
 	  int w;
 
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 	  x += string_draw_range (mw, window, x, y, color, colorBg, chars, s, i);
 	  w = string_draw_range (mw, window, x, y, color, colorBg, chars, i+2, i+3);
 #else
@@ -980,19 +980,19 @@
 	  i += 2;
       }
   }
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   x += string_draw_range (mw, window, x, y, color, colorBg, chars, s, i);
 #else
   x += string_draw_range (mw, window, x, y, gc, chars, s, i);
 #endif
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   XtFree (chars);
 #endif
 }
 
 static void /* XXX */
 binding_draw (XlwMenuWidget mw, Window w, int x, int y,
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 	      XftColor *color,
 	      XftColor *colorBg,
 #else
@@ -1000,12 +1000,12 @@
 #endif
 	      char *value)
 {
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   XmString xm_value = XmStringCreateLtoR(value, XmSTRING_DEFAULT_CHARSET);
   string_draw (mw, w, x, y, gc, xm_value);
   XmStringFree (xm_value);
 #else
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   string_draw (mw, w, x, y, color, colorBg, value);
 #else
   string_draw (mw, w, x, y, gc, value);
@@ -1652,7 +1652,7 @@
   int y_offset = mw->menu.shadow_thickness + mw->menu.vertical_margin;
   GC gc;
 
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   XftColor color, colorBg;
   Display *display = XtDisplay (mw);
   Colormap cmap = mw->core.colormap;
@@ -1667,7 +1667,7 @@
 
   if (highlighted && (in_menubar || val->contents)) 
     {
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
       pixel = mw->menu.highlight_foreground;
       pixelBg = mw->core.background_pixel;
 #endif
@@ -1675,7 +1675,7 @@
     }
   else if (in_menubar || val->contents)
     {
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
       pixel = mw->menu.foreground;
       pixelBg = mw->core.background_pixel;
 #endif
@@ -1683,13 +1683,13 @@
     }
   else
     {
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
       pixel = mw->menu.title_foreground;
       pixelBg = mw->core.background_pixel;
 #endif
       gc = mw->menu.title_gc;
     }
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   color = xft_convert_color (display, cmap, visual, pixel, 0);
   colorBg = xft_convert_color (display, cmap, visual, pixelBg, 0);
 #endif
@@ -1698,7 +1698,7 @@
   string_draw_u (mw,    /* XXX */
 		 window,
 		 x + label_offset, y + y_offset,
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 		 &color, &colorBg, gc,
 #else
 	       gc,
@@ -1724,7 +1724,7 @@
   if (!in_menubar && val->key)
     {
       int w;
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
       XmString key = XmStringCreateLtoR (val->key, XmSTRING_DEFAULT_CHARSET);
       w = string_width (mw, key);
       XmStringFree (key);
@@ -1753,7 +1753,7 @@
   shadow_type type;
   Boolean menu_pb = in_menubar && (menu_item_type (val) == BUTTON_TYPE);
 
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   XftColor color, colorBg;
   Display *display = XtDisplay (mw);
   Colormap cmap = mw->core.colormap;
@@ -1771,7 +1771,7 @@
     {
       if (val->enabled)
     {
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
       pixel = mw->menu.highlight_foreground;
       pixelBg = mw->core.background_pixel;
 #endif
@@ -1779,7 +1779,7 @@
     }
       else
     {
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
       dim = 1;
       pixel = mw->menu.foreground;
       pixelBg = mw->core.background_pixel;
@@ -1791,7 +1791,7 @@
     {
       if (val->enabled)
 	{
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 	  pixel = mw->menu.button_foreground;
 	  pixelBg = mw->core.background_pixel;
 #endif
@@ -1799,7 +1799,7 @@
 	}
       else
 	{
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 	  dim = 1;
 	  pixel = mw->menu.button_foreground;
 	  pixelBg = mw->core.background_pixel;
@@ -1811,7 +1811,7 @@
     {
       if (val->enabled)
 	{
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 	  pixel = mw->menu.foreground;
 	  pixelBg = mw->core.background_pixel;
 #endif
@@ -1819,7 +1819,7 @@
 	}
       else
 	{
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 	  dim = 1;
 	  pixel = mw->menu.foreground;
 	  pixelBg = mw->core.background_pixel;
@@ -1828,7 +1828,7 @@
 	}
     }
 
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   color = xft_convert_color (display, cmap, visual, pixel, dim);
   colorBg = xft_convert_color (display, cmap, visual, pixelBg, 0);
 #endif
@@ -1836,7 +1836,7 @@
   string_draw_u (mw,
 		 window,
 		 x + label_offset, y + y_offset,
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 		 &color, &colorBg, gc,
 #else
 		 gc,
@@ -1855,7 +1855,7 @@
       binding_draw (mw, window,
 		    x + binding_offset + mw->menu.column_spacing,
 		    y + y_offset, 
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
 		    &color, &colorBg,
 #else
 		    gc,
@@ -2806,16 +2806,16 @@
 make_drawing_gcs (XlwMenuWidget mw)
 {
   XGCValues xgcv;
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   unsigned long flags = (GCForeground | GCBackground);
 #else
   unsigned long flags = (GCFont | GCForeground | GCBackground);
 #endif
 
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   xgcv.font = default_font_of_font_list (mw->menu.font_list)->fid;
 #else
-#ifndef USE_XFT_MENUBARS
+#ifndef HAVE_XFT_MENUBARS
   xgcv.font = mw->menu.font->fid;
 #endif
 #endif
@@ -3064,7 +3064,7 @@
 static void
 extract_font_extents (XlwMenuWidget mw)
 {
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   /* Find the maximal ascent/descent of the fonts in the font list
      so that all menu items can be the same height... */
   mw->menu.font_ascent  = 0;
@@ -3149,7 +3149,7 @@
           mw->menu.font_descent = font->descent;
   }
 # else /* ! USE_XFONTSET */
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   mw->menu.font_ascent  = mw->menu.renderFont->ascent;
   mw->menu.font_descent = mw->menu.renderFont->descent;
 #else
@@ -3160,7 +3160,7 @@
 #endif /* NEED_MOTIF */
 }
 
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
 static XFontStruct *
 default_font_of_font_list (XmFontList font_list)
 {
@@ -3230,7 +3230,7 @@
     XCreatePixmapFromBitmapData (display, window, (char *) gray_bits,
 				 gray_width, gray_height, 1, 0, 1);
 
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
   /* #### Even if it's a kludge!!!, we should consider doing the same for
      X Font Sets. */
   /* The menu.font_list slot came from the *fontList resource (Motif standard.)
@@ -3252,7 +3252,7 @@
     mw->menu.font_list = mw->menu.fallback_font_list;
 #endif
 
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   /* #### kludge for name change */
   if (!mw->menu.fcFontName)
     mw->menu.fcFontName = mw->menu.xftFontName;
@@ -3363,7 +3363,7 @@
   XFreePixmap (XtDisplay (mw), mw->menu.gray_pixmap);
   mw->menu.gray_pixmap = (Pixmap) -1;
 
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
   XftFontClose (XtDisplay (mw), mw->menu.renderFont);
 #endif
 
@@ -3409,12 +3409,12 @@
   if (newmw->core.background_pixel != oldmw->core.background_pixel
       || newmw->menu.foreground != oldmw->menu.foreground
       /* For the XEditResource protocol, which may want to change the font. */
-#if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS)
+#if defined(NEED_MOTIF) && !defined(HAVE_XFT_MENUBARS)
       || newmw->menu.font_list          != oldmw->menu.font_list
       || newmw->menu.font_list_2        != oldmw->menu.font_list_2
       || newmw->menu.fallback_font_list != oldmw->menu.fallback_font_list
 #else
-#ifdef USE_XFT_MENUBARS
+#ifdef HAVE_XFT_MENUBARS
       || newmw->menu.renderFont != oldmw->menu.renderFont
 #else
       || newmw->menu.font != oldmw->menu.font