diff options
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 2019-04-24 12:31:37 +0900 |
---|---|---|
committer | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 2019-04-24 12:31:37 +0900 |
commit | 5f4e8e2e088de9fb76cb631077c6eddd3219f594 (patch) | |
tree | abb80bc8ec36c28d4eef08b92db90a142f641be6 /lwlib/lwlib-Xaw.c | |
parent | 1828e9a9b7481572448284a8e5925bf97f2145f7 (diff) | |
download | emacs-5f4e8e2e088de9fb76cb631077c6eddd3219f594.tar.gz emacs-5f4e8e2e088de9fb76cb631077c6eddd3219f594.tar.bz2 emacs-5f4e8e2e088de9fb76cb631077c6eddd3219f594.zip |
Don't link libXft when using cairo
* configure.ac: Check cairo early. Don't try Xft if cairo is used.
* lwlib/lwlib-utils.h [USE_CAIRO]: Include cairo.h and fontconfig.h.
(XftFont, XftDraw, XftColor, XGlyphInfo) [USE_CAIRO]: New typedefs.
(XftFontOpenName, XftFontClose, XftDrawCreate, XftDrawDestroy)
(XftDrawRect, XftDrawStringUtf8, XftTextExtentsUtf8) [USE_CAIRO]: New macros.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_draw_rect, crxft_draw_string, crxft_text_extents) [USE_CAIRO]: New
externs.
* lwlib/lwlib-utils.c [USE_CAIRO]: Include math.h, cairo-ft.h, and
cairo-xlib.h.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_set_source_color, crxft_draw_rect, crxft_draw_string)
(crxft_text_extents) [USE_CAIRO]: New Xft compatibility functions.
* lwlib/xlwmenuP.h [USE_CAIRO]: Include lwlib-utils.h.
* lwlib/xlwmenu.c (display_menu_item) [USE_CAIRO]: Call
cairo_surface_mark_dirty and cairo_surface_flush.
* lwlib/lwlib-Xaw.c [USE_CAIRO]: Include stdlib.h and lwlib-utils.h.
(draw_text) [USE_CAIRO]: Call cairo_surface_flush.
* src/xsettings.c [USE_CAIRO]: Include fontconfig.h
(apply_xft_settings) [!HAVE_XFT]: Don't call XftDefaultSubstitute or
XftDefaultSet.
* lwlib/lwlib-Xaw.c:
* lwlib/lwlib-int.h:
* lwlib/xlwmenu.c:
* lwlib/xlwmenuP.h:
* src/xrdb.c:
* src/xsettings.c:
* src/xterm.c: Replace all #ifdef HAVE_XFT with #if defined USE_CAIRO ||
defined HAVE_XFT.
* src/xfns.c (x_default_font_parameter): Replace #ifdef HAVE_XFT with #if
defined USE_CAIRO || defined HAVE_XFT.
Diffstat (limited to 'lwlib/lwlib-Xaw.c')
-rw-r--r-- | lwlib/lwlib-Xaw.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c index a00f8aa73f9..0801c944008 100644 --- a/lwlib/lwlib-Xaw.c +++ b/lwlib/lwlib-Xaw.c @@ -50,8 +50,13 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <X11/Xatom.h> -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT +#ifdef USE_CAIRO +#include <stdlib.h> +#include "lwlib-utils.h" +#else /* HAVE_XFT */ #include <X11/Xft/Xft.h> +#endif struct widget_xft_data { @@ -79,7 +84,7 @@ lw_xaw_widget_p (Widget widget) } -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT static void fill_xft_data (struct widget_xft_data *data, Widget widget, XftFont *font) { @@ -210,6 +215,9 @@ draw_text (struct widget_xft_data *data, char *lbl, int inverse) /* 1.2 gives reasonable line spacing. */ y += data->xft_font->height * 1.2; } +#ifdef USE_CAIRO + cairo_surface_flush (cairo_get_target (data->xft_draw)); +#endif } @@ -307,7 +315,7 @@ xaw_update_one_widget (widget_instance *instance, if (XtIsSubclass (widget, dialogWidgetClass)) { -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT if (instance->xft_data && instance->xft_data[0].xft_font) { set_text (&instance->xft_data[0], instance->parent, @@ -339,7 +347,7 @@ xaw_update_one_widget (widget_instance *instance, XtSetArg (al[ac], XtNlabel, val->value);ac++; /* Force centered button text. Se above. */ XtSetArg (al[ac], XtNjustify, XtJustifyCenter);ac++; -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT if (instance->xft_data && instance->xft_data[0].xft_font) { int th; @@ -473,7 +481,7 @@ static XtActionsRec xaw_actions [] = { }; static Boolean actions_initted = False; -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT static XtActionsRec button_actions[] = { { "my_reset", command_reset }, @@ -506,7 +514,7 @@ make_dialog (char* name, Widget dialog; Widget button; XtTranslations override; -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT XftFont *xft_font = 0; XtTranslations button_override; #endif @@ -521,7 +529,7 @@ make_dialog (char* name, XtAppContext app = XtWidgetToApplicationContext (parent); XtAppAddActions (app, xaw_actions, sizeof (xaw_actions) / sizeof (xaw_actions[0])); -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT XtAppAddActions (app, button_actions, sizeof (button_actions) / sizeof (button_actions[0])); #endif @@ -546,7 +554,7 @@ make_dialog (char* name, override = XtParseTranslationTable (dialogOverride); XtOverrideTranslations (dialog, override); -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT { int num; Widget *ch = NULL; @@ -618,7 +626,7 @@ make_dialog (char* name, sprintf (button_name, "button%d", ++bc); button = XtCreateManagedWidget (button_name, commandWidgetClass, dialog, av, ac); -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT if (xft_font) { fill_xft_data (&instance->xft_data[bc], button, xft_font); @@ -651,7 +659,7 @@ make_dialog (char* name, sprintf (button_name, "button%d", ++bc); button = XtCreateManagedWidget (button_name, commandWidgetClass, dialog, av, ac); -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT if (xft_font) { fill_xft_data (&instance->xft_data[bc], button, xft_font); |