comparison lwlib/xlwtabs.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 5460287a3327
children 308d34e9f07d
comparison
equal deleted inserted replaced
4909:87175eb65ff4 4916:a6c778975d7d
150 150
151 res (XtNselectInsensitive, XtCSelectInsensitive, XtRBoolean, Boolean, 151 res (XtNselectInsensitive, XtCSelectInsensitive, XtRBoolean, Boolean,
152 selectInsensitive, XtRImmediate, True), 152 selectInsensitive, XtRImmediate, True),
153 res (XtNfont, XtCFont, XtRFontStruct, XFontStruct *, 153 res (XtNfont, XtCFont, XtRFontStruct, XFontStruct *,
154 font, XtRString, XtDefaultFont), 154 font, XtRString, XtDefaultFont),
155 #ifdef USE_XFT_TABS 155 #ifdef HAVE_XFT_TABS
156 /* #### Maybe use "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1" here? 156 /* #### Maybe use "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1" here?
157 or XtDefaultFont? */ 157 or XtDefaultFont? */
158 res (XtNfcFontName, XtCFcFontName, XtRString, String, 158 res (XtNfcFontName, XtCFcFontName, XtRString, String,
159 fcFontName, XtRString, NULL), 159 fcFontName, XtRString, NULL),
160 /* #### This needs to be fixed to give a proper type and converter for 160 /* #### This needs to be fixed to give a proper type and converter for
428 428
429 429
430 430
431 static int debug_tabs = 0; /* increase for more verbosity */ 431 static int debug_tabs = 0; /* increase for more verbosity */
432 432
433 #ifdef USE_XFT_TABS 433 #ifdef HAVE_XFT_TABS
434 /* #### duplicated from xlwmenu.c -- CLEAN THIS SHIT UP! 434 /* #### duplicated from xlwmenu.c -- CLEAN THIS SHIT UP!
435 Undeclared so define at top. */ 435 Undeclared so define at top. */
436 #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \ 436 #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \
437 ? ((unsigned long) (x)) : ((unsigned long) (y))) 437 ? ((unsigned long) (x)) : ((unsigned long) (y)))
438 438
482 /* height is easy, it's the same for all tabs: 482 /* height is easy, it's the same for all tabs:
483 * TODO: font height + height of tallest bitmap. 483 * TODO: font height + height of tallest bitmap.
484 */ 484 */
485 newTw->tabs.tab_height = 2 * newTw->tabs.internalHeight + SHADWID ; 485 newTw->tabs.tab_height = 2 * newTw->tabs.internalHeight + SHADWID ;
486 486
487 #ifdef USE_XFT_TABS 487 #ifdef HAVE_XFT_TABS
488 /* #### kludge for name change */ 488 /* #### kludge for name change */
489 if (!newTw->tabs.fcFontName) 489 if (!newTw->tabs.fcFontName)
490 newTw->tabs.fcFontName = newTw->tabs.xftFontName; 490 newTw->tabs.fcFontName = newTw->tabs.xftFontName;
491 /* must get font here 491 /* must get font here
492 #### to do this right, we should add a new Xt Resource type + 492 #### to do this right, we should add a new Xt Resource type +
499 newTw->tabs.tab_height += newTw->tabs.renderFont->height; 499 newTw->tabs.tab_height += newTw->tabs.renderFont->height;
500 #else 500 #else
501 newTw->tabs.tab_height += newTw->tabs.renderFont->ascent + 501 newTw->tabs.tab_height += newTw->tabs.renderFont->ascent +
502 newTw->tabs.renderFont->descent; 502 newTw->tabs.renderFont->descent;
503 #endif /* XFT_USE_HEIGHT_NOT_ASCENT_DESCENT */ 503 #endif /* XFT_USE_HEIGHT_NOT_ASCENT_DESCENT */
504 #else /* ! USE_XFT_TABS */ 504 #else /* ! HAVE_XFT_TABS */
505 if (newTw->tabs.font != NULL) 505 if (newTw->tabs.font != NULL)
506 newTw->tabs.tab_height += newTw->tabs.font->max_bounds.ascent + 506 newTw->tabs.tab_height += newTw->tabs.font->max_bounds.ascent +
507 newTw->tabs.font->max_bounds.descent; 507 newTw->tabs.font->max_bounds.descent;
508 #endif /* ! USE_XFT_TABS */ 508 #endif /* ! HAVE_XFT_TABS */
509 509
510 /* if size not explicitly set, set it to our preferred size now. */ 510 /* if size not explicitly set, set it to our preferred size now. */
511 511
512 if( request->core.width == 0 || request->core.height == 0 ) 512 if( request->core.width == 0 || request->core.height == 0 )
513 { 513 {
577 577
578 static void 578 static void
579 TabsDestroy(Widget w) 579 TabsDestroy(Widget w)
580 { 580 {
581 TabsWidget tw = (TabsWidget) w; 581 TabsWidget tw = (TabsWidget) w;
582 #ifdef USE_XFT_TABS 582 #ifdef HAVE_XFT_TABS
583 XftFontClose (XtDisplay (w), tw->tabs.renderFont); 583 XftFontClose (XtDisplay (w), tw->tabs.renderFont);
584 #endif /* ! USE_XFT_TABS */ 584 #endif /* ! HAVE_XFT_TABS */
585 TabsFreeGCs (tw) ; 585 TabsFreeGCs (tw) ;
586 } 586 }
587 587
588 588
589 /* Parent has resized us. This will require that the tabs be 589 /* Parent has resized us. This will require that the tabs be
682 Boolean needRedraw = False ; 682 Boolean needRedraw = False ;
683 Widget *childP ; 683 Widget *childP ;
684 int i ; 684 int i ;
685 685
686 if( 686 if(
687 #ifdef USE_XFT_TABS 687 #ifdef HAVE_XFT_TABS
688 tw->tabs.renderFont != curtw->tabs.renderFont || 688 tw->tabs.renderFont != curtw->tabs.renderFont ||
689 #else 689 #else
690 tw->tabs.font != curtw->tabs.font || 690 tw->tabs.font != curtw->tabs.font ||
691 #endif 691 #endif
692 tw->tabs.internalWidth != curtw->tabs.internalWidth || 692 tw->tabs.internalWidth != curtw->tabs.internalWidth ||
693 tw->tabs.internalHeight != curtw->tabs.internalHeight) 693 tw->tabs.internalHeight != curtw->tabs.internalHeight)
694 { 694 {
695 tw->tabs.tab_height = 2 * tw->tabs.internalHeight + SHADWID; 695 tw->tabs.tab_height = 2 * tw->tabs.internalHeight + SHADWID;
696 696
697 #ifdef USE_XFT_TABS 697 #ifdef HAVE_XFT_TABS
698 if (tw->tabs.renderFont != NULL) 698 if (tw->tabs.renderFont != NULL)
699 #if XFT_USE_HEIGHT_NOT_ASCENT_DESCENT 699 #if XFT_USE_HEIGHT_NOT_ASCENT_DESCENT
700 tw->tabs.tab_height += tw->tabs.renderFont->height; 700 tw->tabs.tab_height += tw->tabs.renderFont->height;
701 #else 701 #else
702 tw->tabs.tab_height += tw->tabs.renderFont->ascent + 702 tw->tabs.tab_height += tw->tabs.renderFont->ascent +
703 tw->tabs.renderFont->descent; 703 tw->tabs.renderFont->descent;
704 #endif /* XFT_USE_HEIGHT_NOT_ASCENT_DESCENT */ 704 #endif /* XFT_USE_HEIGHT_NOT_ASCENT_DESCENT */
705 #else /* ! USE_XFT_TABS */ 705 #else /* ! HAVE_XFT_TABS */
706 if (tw->tabs.font != NULL) 706 if (tw->tabs.font != NULL)
707 tw->tabs.tab_height += tw->tabs.font->max_bounds.ascent + 707 tw->tabs.tab_height += tw->tabs.font->max_bounds.ascent +
708 tw->tabs.font->max_bounds.descent; 708 tw->tabs.font->max_bounds.descent;
709 #endif /* ! USE_XFT_TABS */ 709 #endif /* ! HAVE_XFT_TABS */
710 710
711 /* Tab size has changed. Resize all tabs and request a new size */ 711 /* Tab size has changed. Resize all tabs and request a new size */
712 for(i=0, childP=tw->composite.children; 712 for(i=0, childP=tw->composite.children;
713 i < (int) tw->composite.num_children; 713 i < (int) tw->composite.num_children;
714 ++i, ++childP) 714 ++i, ++childP)
721 721
722 /* TODO: if any color changes, need to recompute GCs and redraw */ 722 /* TODO: if any color changes, need to recompute GCs and redraw */
723 723
724 if( tw->core.background_pixel != curtw->core.background_pixel || 724 if( tw->core.background_pixel != curtw->core.background_pixel ||
725 tw->core.background_pixmap != curtw->core.background_pixmap || 725 tw->core.background_pixmap != curtw->core.background_pixmap ||
726 #ifdef USE_XFT_TABS 726 #ifdef HAVE_XFT_TABS
727 tw->tabs.renderFont != curtw->tabs.renderFont 727 tw->tabs.renderFont != curtw->tabs.renderFont
728 #else 728 #else
729 tw->tabs.font != curtw->tabs.font 729 tw->tabs.font != curtw->tabs.font
730 #endif 730 #endif
731 ) 731 )
1642 TabsConstraints tab = (TabsConstraints)child->core.constraints; 1642 TabsConstraints tab = (TabsConstraints)child->core.constraints;
1643 Display *dpy = XtDisplay((Widget)tw) ; 1643 Display *dpy = XtDisplay((Widget)tw) ;
1644 Window win = XtWindow((Widget)tw) ; 1644 Window win = XtWindow((Widget)tw) ;
1645 String lbl = tab->tabs.label != NULL ? 1645 String lbl = tab->tabs.label != NULL ?
1646 tab->tabs.label : XtName(child) ; 1646 tab->tabs.label : XtName(child) ;
1647 #ifdef USE_XFT_TABS 1647 #ifdef HAVE_XFT_TABS
1648 XftColor color; 1648 XftColor color;
1649 XftColor colorBG; 1649 XftColor colorBG;
1650 Colormap cmap = tw->core.colormap; 1650 Colormap cmap = tw->core.colormap;
1651 Visual *visual; 1651 Visual *visual;
1652 int ignored; 1652 int ignored;
1660 fprintf (stderr, "(Re)drawing labels.\n"); 1660 fprintf (stderr, "(Re)drawing labels.\n");
1661 1661
1662 if (XtIsSensitive(child)) 1662 if (XtIsSensitive(child))
1663 { 1663 {
1664 gc = tw->tabs.foregroundGC; 1664 gc = tw->tabs.foregroundGC;
1665 #ifdef USE_XFT_TABS 1665 #ifdef HAVE_XFT_TABS
1666 color = xft_convert_color (dpy, cmap, visual, 1666 color = xft_convert_color (dpy, cmap, visual,
1667 tab->tabs.foreground, 0); 1667 tab->tabs.foreground, 0);
1668 #else 1668 #else
1669 XSetForeground(dpy, gc, tab->tabs.foreground); 1669 XSetForeground(dpy, gc, tab->tabs.foreground);
1670 #endif 1670 #endif
1682 tw->core.background_pixel, 1682 tw->core.background_pixel,
1683 tw->tabs.insensitive_contrast); 1683 tw->tabs.insensitive_contrast);
1684 tab->tabs.greyAlloc = True; 1684 tab->tabs.greyAlloc = True;
1685 } 1685 }
1686 gc = tw->tabs.greyGC; 1686 gc = tw->tabs.greyGC;
1687 #ifdef USE_XFT_TABS 1687 #ifdef HAVE_XFT_TABS
1688 color = xft_convert_color (dpy, cmap, visual, tab->tabs.grey, 0); 1688 color = xft_convert_color (dpy, cmap, visual, tab->tabs.grey, 0);
1689 #else 1689 #else
1690 XSetForeground(dpy, gc, tab->tabs.grey); 1690 XSetForeground(dpy, gc, tab->tabs.grey);
1691 #endif 1691 #endif
1692 } 1692 }
1707 0,0, tab->tabs.lbm_width, tab->tabs.lbm_height, 1707 0,0, tab->tabs.lbm_width, tab->tabs.lbm_height,
1708 x+tab->tabs.lbm_x, y+tab->tabs.lbm_y); 1708 x+tab->tabs.lbm_x, y+tab->tabs.lbm_y);
1709 } 1709 }
1710 1710
1711 if (lbl != NULL && 1711 if (lbl != NULL &&
1712 #ifdef USE_XFT_TABS 1712 #ifdef HAVE_XFT_TABS
1713 tw->tabs.renderFont != NULL 1713 tw->tabs.renderFont != NULL
1714 #else 1714 #else
1715 tw->tabs.font != NULL 1715 tw->tabs.font != NULL
1716 #endif 1716 #endif
1717 ) 1717 )
1718 { 1718 {
1719 #ifdef USE_XFT_TABS 1719 #ifdef HAVE_XFT_TABS
1720 XftDraw *xftDraw = XftDrawCreate (dpy, win, visual, cmap); 1720 XftDraw *xftDraw = XftDrawCreate (dpy, win, visual, cmap);
1721 XftFont *renderFont = tw->tabs.renderFont; 1721 XftFont *renderFont = tw->tabs.renderFont;
1722 XGlyphInfo glyphinfo; 1722 XGlyphInfo glyphinfo;
1723 XftColor colorDBG; 1723 XftColor colorDBG;
1724 XftColorAllocName (dpy, visual, cmap, "wheat", &colorDBG); 1724 XftColorAllocName (dpy, visual, cmap, "wheat", &colorDBG);
1982 { 1982 {
1983 TabsConstraints tab = (TabsConstraints) w->core.constraints ; 1983 TabsConstraints tab = (TabsConstraints) w->core.constraints ;
1984 TabsWidget tw = (TabsWidget)XtParent(w) ; 1984 TabsWidget tw = (TabsWidget)XtParent(w) ;
1985 String lbl = tab->tabs.label != NULL ? 1985 String lbl = tab->tabs.label != NULL ?
1986 tab->tabs.label : XtName(w); 1986 tab->tabs.label : XtName(w);
1987 #ifdef USE_XFT_TABS 1987 #ifdef HAVE_XFT_TABS
1988 XftFont *font = tw->tabs.renderFont; 1988 XftFont *font = tw->tabs.renderFont;
1989 #else 1989 #else
1990 XFontStruct *font = tw->tabs.font; 1990 XFontStruct *font = tw->tabs.font;
1991 #endif 1991 #endif
1992 int iw = tw->tabs.internalWidth; 1992 int iw = tw->tabs.internalWidth;
2001 tab->tabs.lbm_y = (tw->tabs.tab_height - tab->tabs.lbm_height)/2 ; 2001 tab->tabs.lbm_y = (tw->tabs.tab_height - tab->tabs.lbm_height)/2 ;
2002 } 2002 }
2003 2003
2004 if( lbl != NULL && font != NULL ) 2004 if( lbl != NULL && font != NULL )
2005 { 2005 {
2006 #ifdef USE_XFT_TABS 2006 #ifdef HAVE_XFT_TABS
2007 tab->tabs.width += x_xft_text_width (XtDisplay(tw), font, 2007 tab->tabs.width += x_xft_text_width (XtDisplay(tw), font,
2008 (FcChar8 *) lbl, 2008 (FcChar8 *) lbl,
2009 (int)strlen(lbl)) + iw; 2009 (int)strlen(lbl)) + iw;
2010 tab->tabs.l_y = (tw->tabs.tab_height 2010 tab->tabs.l_y = (tw->tabs.tab_height
2011 + tw->tabs.renderFont->ascent 2011 + tw->tabs.renderFont->ascent
2442 Widget w = (Widget) tw; 2442 Widget w = (Widget) tw;
2443 XGCValues values ; 2443 XGCValues values ;
2444 2444
2445 values.background = tw->core.background_pixel; 2445 values.background = tw->core.background_pixel;
2446 values.font = 2446 values.font =
2447 #ifdef USE_XFT_TABS 2447 #ifdef HAVE_XFT_TABS
2448 None; 2448 None;
2449 #else 2449 #else
2450 tw->tabs.font->fid; 2450 tw->tabs.font->fid;
2451 #endif 2451 #endif
2452 values.line_style = LineOnOffDash; 2452 values.line_style = LineOnOffDash;
2453 values.line_style = LineSolid; 2453 values.line_style = LineSolid;
2454 2454
2455 tw->tabs.foregroundGC = 2455 tw->tabs.foregroundGC =
2456 XtAllocateGC(w, w->core.depth, 2456 XtAllocateGC(w, w->core.depth,
2457 #ifndef USE_XFT_TABS 2457 #ifndef HAVE_XFT_TABS
2458 GCFont| 2458 GCFont|
2459 #endif 2459 #endif
2460 GCBackground|GCLineStyle, 2460 GCBackground|GCLineStyle,
2461 &values, 2461 &values,
2462 GCForeground, 2462 GCForeground,
2463 #ifdef USE_XFT_TABS 2463 #ifdef HAVE_XFT_TABS
2464 GCFont| 2464 GCFont|
2465 #endif 2465 #endif
2466 GCSubwindowMode|GCGraphicsExposures|GCDashOffset| 2466 GCSubwindowMode|GCGraphicsExposures|GCDashOffset|
2467 GCDashList|GCArcMode); 2467 GCDashList|GCArcMode);
2468 } 2468 }
2473 Widget w = (Widget) tw; 2473 Widget w = (Widget) tw;
2474 XGCValues values ; 2474 XGCValues values ;
2475 2475
2476 values.background = tw->core.background_pixel; 2476 values.background = tw->core.background_pixel;
2477 values.font = 2477 values.font =
2478 #ifdef USE_XFT_TABS 2478 #ifdef HAVE_XFT_TABS
2479 None; 2479 None;
2480 #else 2480 #else
2481 tw->tabs.font->fid; 2481 tw->tabs.font->fid;
2482 #endif 2482 #endif
2483 if (tw->tabs.be_nice_to_cmap || w->core.depth == 1) 2483 if (tw->tabs.be_nice_to_cmap || w->core.depth == 1)
2486 tw->tabs.grey50 = 2486 tw->tabs.grey50 =
2487 values.stipple = XmuCreateStippledPixmap(XtScreen(w), 1L, 0L, 1); 2487 values.stipple = XmuCreateStippledPixmap(XtScreen(w), 1L, 0L, 1);
2488 2488
2489 tw->tabs.greyGC = 2489 tw->tabs.greyGC =
2490 XtAllocateGC(w, w->core.depth, 2490 XtAllocateGC(w, w->core.depth,
2491 #ifndef USE_XFT_TABS 2491 #ifndef HAVE_XFT_TABS
2492 GCFont| 2492 GCFont|
2493 #endif 2493 #endif
2494 GCBackground|GCStipple|GCFillStyle, &values, 2494 GCBackground|GCStipple|GCFillStyle, &values,
2495 GCForeground, 2495 GCForeground,
2496 #ifdef USE_XFT_TABS 2496 #ifdef HAVE_XFT_TABS
2497 GCFont| 2497 GCFont|
2498 #endif 2498 #endif
2499 GCSubwindowMode|GCGraphicsExposures|GCDashOffset| 2499 GCSubwindowMode|GCGraphicsExposures|GCDashOffset|
2500 GCDashList|GCArcMode); 2500 GCDashList|GCArcMode);
2501 } 2501 }
2502 else 2502 else
2503 { 2503 {
2504 tw->tabs.greyGC = 2504 tw->tabs.greyGC =
2505 XtAllocateGC(w, w->core.depth, 2505 XtAllocateGC(w, w->core.depth,
2506 #ifdef USE_XFT_TABS 2506 #ifdef HAVE_XFT_TABS
2507 0L, 2507 0L,
2508 #else 2508 #else
2509 GCFont, 2509 GCFont,
2510 #endif 2510 #endif
2511 &values, 2511 &values,
2512 GCForeground, 2512 GCForeground,
2513 #ifdef USE_XFT_TABS 2513 #ifdef HAVE_XFT_TABS
2514 GCFont| 2514 GCFont|
2515 #endif 2515 #endif
2516 GCBackground|GCSubwindowMode|GCGraphicsExposures|GCDashOffset| 2516 GCBackground|GCSubwindowMode|GCGraphicsExposures|GCDashOffset|
2517 GCDashList|GCArcMode); 2517 GCDashList|GCArcMode);
2518 } 2518 }