From c09bfb2f140b2885af17185634451e2abfd6e91c Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 31 Jul 2012 15:37:38 +0400 Subject: [PATCH] Miscellaneous fixes for non-default X toolkits. * configure.ac (MOTIF): Check for /usr/include/openmotif and /usr/(lib|lib64)/openmotif if --with-x-toolkit=motif. * lwlib/lwlib-Xm.c (make_menu_in_widget): Remove unused variable. * src/xfns.c (Fx_file_dialog): Change to SSDATA to avoid warnings. * src/xterm.c (x_frame_of_widget): Remove redundant prototype. Move under #ifdef USE_LUCID. (x_create_toolkit_scroll_bar): Adjust scroll_bar_name definition and usage to avoid warnings. --- ChangeLog | 6 ++++++ configure.ac | 19 ++++++++++++++++++- lwlib/ChangeLog | 5 +++++ lwlib/lwlib-Xm.c | 3 +-- src/ChangeLog | 9 +++++++++ src/xfns.c | 6 +++--- src/xterm.c | 11 ++++------- 7 files changed, 46 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b1660ef85..698aa4f14d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-07-31 Dmitry Antipov + + Improve OpenMotif detection on GNU/Linux systems. + * configure.ac (MOTIF): Check for /usr/include/openmotif + and /usr/(lib|lib64)/openmotif if --with-x-toolkit=motif. + 2012-07-31 Andreas Schwab * Makefile.in (install-arch-indep): Avoid eval. diff --git a/configure.ac b/configure.ac index 6776c09a8b..1de8766c63 100644 --- a/configure.ac +++ b/configure.ac @@ -2139,7 +2139,21 @@ fi LIBXP= if test "${USE_X_TOOLKIT}" = "MOTIF"; then - AC_CACHE_CHECK(for Motif version 2.1, emacs_cv_motif_version_2_1, + # OpenMotif may be installed in such a way on some GNU/Linux systems. + if test -d /usr/include/openmotif; then + CPPFLAGS="-I/usr/include/openmotif $CPPFLAGS" + emacs_cv_openmotif=yes + case "$canonical" in + x86_64-*-linux-gnu* | powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) + test -d /usr/lib64/openmotif && LDFLAGS="-L/usr/lib64/openmotif $LDFLAGS" + ;; + *) + test -d /usr/lib/openmotif && LDFLAGS="-L/usr/lib/openmotif $LDFLAGS" + esac + else + emacs_cv_openmotif=no + fi + AC_CACHE_CHECK(for (Open)Motif version 2.1, emacs_cv_motif_version_2_1, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1) int x = 5; @@ -2149,6 +2163,9 @@ Motif version prior to 2.1. emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)]) if test $emacs_cv_motif_version_2_1 = yes; then AC_CHECK_LIB(Xp, XpCreateContext, LIBXP=-lXp) + if test x$emacs_cv_openmotif = xyes; then + REAL_CPPFLAGS="-I/usr/include/openmotif $REAL_CPPFLAGS" + fi else AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif, # We put this in CFLAGS temporarily to precede other -I options diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 0c0a88a840..207a120016 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,3 +1,8 @@ +2012-07-31 Dmitry Antipov + + Avoid unused variable warning if --with-x-toolkit=motif. + * lwlib-Xm.c (make_menu_in_widget): Remove unused variable. + 2012-07-06 Paul Eggert Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786). diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index acd11aec6b..eccb4db23a 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -490,7 +490,6 @@ make_menu_in_widget (widget_instance* instance, int child_index; widget_value* cur; Widget button = 0; - Widget title = 0; Widget menu; Arg al [256]; int ac; @@ -554,7 +553,7 @@ make_menu_in_widget (widget_instance* instance, { ac = 0; XtSetArg (al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++; - title = button = XmCreateLabel (widget, cur->name, al, ac); + button = XmCreateLabel (widget, cur->name, al, ac); } else if (lw_separator_p (cur->name, &separator, 1)) { diff --git a/src/ChangeLog b/src/ChangeLog index ac16e529b1..0c791bcd17 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-07-31 Dmitry Antipov + + Miscellaneous fixes for non-default X toolkits. + * xfns.c (Fx_file_dialog): Change to SSDATA to avoid warnings. + * xterm.c (x_frame_of_widget): Remove redundant prototype. + Move under #ifdef USE_LUCID. + (x_create_toolkit_scroll_bar): Adjust scroll_bar_name + definition and usage to avoid warnings. + 2012-07-31 Jan Djärv * nsterm.m (openFiles): Fix previous checkin. diff --git a/src/xfns.c b/src/xfns.c index c8c96b642f..bca43dbd30 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5382,7 +5382,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) /* Create the dialog with PROMPT as title, using DIR as initial directory and using "*" as pattern. */ dir = Fexpand_file_name (dir, Qnil); - dir_xmstring = XmStringCreateLocalized (SDATA (dir)); + dir_xmstring = XmStringCreateLocalized (SSDATA (dir)); pattern_xmstring = XmStringCreateLocalized ("*"); XtSetArg (al[ac], XmNtitle, SDATA (prompt)); ++ac; @@ -5435,12 +5435,12 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) XmTextPosition last_pos = XmTextFieldGetLastPosition (wtext); XmTextFieldReplace (wtext, 0, last_pos, - (SDATA (Ffile_name_nondirectory (default_filename)))); + (SSDATA (Ffile_name_nondirectory (default_filename)))); /* Select DEFAULT_FILENAME in the files list box. DEFAULT_FILENAME must include the path for this to work. */ - default_xmstring = XmStringCreateLocalized (SDATA (default_filename)); + default_xmstring = XmStringCreateLocalized (SSDATA (default_filename)); if (XmListItemExists (list, default_xmstring)) { diff --git a/src/xterm.c b/src/xterm.c index b5c5ce33d6..60f65aa950 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1438,12 +1438,12 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) #ifdef USE_X_TOOLKIT -static struct frame *x_frame_of_widget (Widget); static Boolean cvt_string_to_pixel (Display *, XrmValue *, Cardinal *, XrmValue *, XrmValue *, XtPointer *); static void cvt_pixel_dtor (XtAppContext, XrmValue *, XtPointer, XrmValue *, Cardinal *); +#ifdef USE_LUCID /* Return the frame on which widget WIDGET is used.. Abort if frame cannot be determined. */ @@ -1478,9 +1478,6 @@ x_frame_of_widget (Widget widget) abort (); } - -#ifdef USE_LUCID - /* Allocate a color which is lighter or darker than *PIXEL by FACTOR or DELTA. Try a color with RGB values multiplied by FACTOR first. If this produces the same color as PIXEL, try a color where all RGB @@ -1496,7 +1493,7 @@ x_alloc_lighter_color_for_widget (Widget widget, Display *display, Colormap cmap return x_alloc_lighter_color (f, display, cmap, pixel, factor, delta); } -#endif +#endif /* USE_LUCID */ /* Structure specifying which arguments should be passed by Xt to @@ -4635,7 +4632,7 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) Widget widget; Arg av[20]; int ac = 0; - char const *scroll_bar_name = SCROLL_BAR_NAME; + const char *scroll_bar_name = SCROLL_BAR_NAME; unsigned long pixel; BLOCK_INPUT; @@ -4665,7 +4662,7 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) } widget = XmCreateScrollBar (f->output_data.x->edit_widget, - scroll_bar_name, av, ac); + (char *) scroll_bar_name, av, ac); /* Add one callback for everything that can happen. */ XtAddCallback (widget, XmNdecrementCallback, xm_scroll_callback, -- 2.20.1