Wed Aug 18 14:58:08 PDT 1999 Michael Jennings <mej@eterm.org>

Cleanups on the automake/libtool stuff in src/.  Thanks to John
	Ellson <ellson@lucent.com> for getting me interested enough to set
	about fixing it. :-)

	Also cleaned up the XIM code to fit with the rest of Eterm.


SVN revision: 54
This commit is contained in:
Michael Jennings 1999-08-18 22:00:59 +00:00
parent d6c5001acc
commit 537433f57a
4 changed files with 105 additions and 146 deletions

View File

@ -2280,3 +2280,12 @@ Tue Aug 17 18:06:01 PDT 1999 Michael Jennings <mej@eterm.org>
code, but it's now 0.9. It also includes a timer subsystem.
-------------------------------------------------------------------------------
Wed Aug 18 14:58:08 PDT 1999 Michael Jennings <mej@eterm.org>
Cleanups on the automake/libtool stuff in src/. Thanks to John
Ellson <ellson@lucent.com> for getting me interested enough to set
about fixing it. :-)
Also cleaned up the XIM code to fit with the rest of Eterm.
-------------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@ AM_INIT_AUTOMAKE(Eterm, 0.9)
dnl# Set some basic variables
DATE="`date '+%d %B %Y'`"
AC_SUBST(DATE)
AUTHORS="Tuomo Venalainen (vendu@cc.hut.fi) and Michael Jennings (mej@eterm.org)"
AUTHORS="Michael Jennings (mej@eterm.org) and Tuomo Venäläinen (vendu@cc.hut.fi) "
AC_SUBST(AUTHORS)
dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'

View File

@ -4,19 +4,16 @@ lib_LTLIBRARIES = libEterm.la
libEterm_la_SOURCES = actions.c command.c e.c events.c graphics.c grkelot.c menus.c misc.c netdisp.c \
options.c pixmap.c screen.c scrollbar.c system.c term.c threads.c timer.c utmp.c windows.c
libEterm_la_DEPENDENCIES = $(DIST_ROOT)/libmej/libmej.la feature.h
libEterm_la_LDFLAGS = -version-info 9:0:9
bin_PROGRAMS = Eterm
Eterm_SOURCES = main.c
Eterm_DEPENDENCIES = libEterm.la ../libmej/libmej.la feature.h
Eterm_DEPENDENCIES = libEterm.la
Eterm_LDFLAGS = -rpath $(libdir):$(pkglibdir) libEterm.la
INCLUDES = -I. -I$(top_srcdir)/libmej -I.. -I$(includedir) -I$(prefix)/include $(X_CFLAGS)
Eterm_LDFLAGS = -rpath $(libdir):$(pkglibdir)
LDADD = -L$(DIST_ROOT)/src/.libs -lEterm -L$(DIST_ROOT)/libmej/.libs -L$(libdir) -L$(prefix)/lib $(LIBS) -lmej $(GRLIBS) $(X_LIBS)
LDADD = $(DIST_ROOT)/libmej/libmej.la -L$(libdir) -L$(prefix)/lib $(LIBS) $(GRLIBS) $(X_LIBS)
EXTRA_DIST = actions.h command.h debug.h e.h eterm_utmp.h events.h feature.h graphics.h grkelot.h grx.h main.h menus.h misc.h \
options.h pixmap.h profile.h screen.h scrollbar.h system.h term.h threads.h timer.h windows.h graphics/Makefile.am \

View File

@ -1690,13 +1690,10 @@ create_fontset(const char *font1, const char *font2)
#ifdef USE_XIM
static int xim_real_init(void);
# ifdef USE_X11R6_XIM
static void xim_destroy_cb(XIM xim, XPointer client_data,
XPointer call_data);
static void xim_instantiate_cb(Display *display, XPointer client_data,
XPointer call_data);
static void xim_destroy_cb(XIM xim, XPointer client_data, XPointer call_data);
static void xim_instantiate_cb(Display *display, XPointer client_data, XPointer call_data);
# endif
#endif
void
init_locale(void)
{
@ -1704,9 +1701,9 @@ init_locale(void)
locale = setlocale(LC_CTYPE, "");
TermWin.fontset = (XFontSet) -1;
if (locale == NULL)
if (locale == NULL) {
print_error("Setting locale failed.");
else {
} else {
#ifdef MULTI_CHARSET
TermWin.fontset = create_fontset(rs_font[0], rs_mfont[0]);
#else
@ -1717,12 +1714,12 @@ init_locale(void)
if (strcmp(locale, "C"))
# endif
{
if (xim_real_init() != -1)
if (xim_real_init() != -1) {
return;
}
# ifdef USE_X11R6_XIM
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL,
xim_instantiate_cb, NULL);
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
# endif
}
#endif
@ -1731,7 +1728,6 @@ init_locale(void)
#endif /* USE_XIM || MULTI_CHARSET */
#ifdef USE_XIM
static void
xim_set_size(XRectangle * size)
{
@ -1755,15 +1751,15 @@ xim_send_spot(void)
XVaNestedList preedit_attr;
XIMStyle input_style;
if (Input_Context == NULL)
if (Input_Context == NULL) {
return;
else {
} else {
XGetICValues(Input_Context, XNInputStyle, &input_style, NULL);
if (!(input_style & XIMPreeditPosition))
if (!(input_style & XIMPreeditPosition)) {
return;
}
}
xim_get_position(&spot);
preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, NULL);
XFree(preedit_attr);
@ -1773,22 +1769,16 @@ static void
xim_get_area(XRectangle *preedit_rect, XRectangle *status_rect,
XRectangle *needed_rect)
{
preedit_rect->x = needed_rect->width
+ (scrollbar_visible() && !(Options & Opt_scrollBar_right)
? (SB_WIDTH) : 0);
preedit_rect->x = needed_rect->width + (scrollbar_visible() && !(Options & Opt_scrollBar_right) ? (scrollBar.width) : 0);
preedit_rect->y = Height2Pixel(TermWin.nrow - 1);
preedit_rect->width = Width2Pixel(TermWin.ncol + 1) - needed_rect->width
+ (!(Options & Opt_scrollBar_right)
? (SB_WIDTH) : 0);
preedit_rect->width = Width2Pixel(TermWin.ncol + 1) - needed_rect->width + (!(Options & Opt_scrollBar_right) ? (scrollBar.width) : 0);
preedit_rect->height = Height2Pixel(1);
status_rect->x = (scrollbar_visible() && !(Options & Opt_scrollBar_right))
? (SB_WIDTH) : 0;
status_rect->x = (scrollbar_visible() && !(Options & Opt_scrollBar_right)) ? (scrollBar.width) : 0;
status_rect->y = Height2Pixel(TermWin.nrow - 1);
status_rect->width = needed_rect->width ? needed_rect->width
: Width2Pixel(TermWin.ncol + 1);
status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(TermWin.ncol + 1);
status_rect->height = Height2Pixel(1);
}
@ -1797,18 +1787,16 @@ static void
xim_destroy_cb(XIM xim, XPointer client_data, XPointer call_data)
{
Input_Context = NULL;
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL,
xim_instantiate_cb, NULL);
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
}
static void
xim_instantiate_cb(Display *display, XPointer client_data,
XPointer call_data)
xim_instantiate_cb(Display *display, XPointer client_data, XPointer call_data)
{
xim_real_init();
if (Input_Context)
XUnregisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL,
xim_instantiate_cb, NULL);
if (Input_Context) {
XUnregisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
}
}
#endif
@ -1827,45 +1815,49 @@ xim_real_init(void)
XVaNestedList preedit_attr = NULL;
XVaNestedList status_attr = NULL;
if (Input_Context)
return 0;
REQUIRE(Input_Context != NULL);
if (rs_inputMethod && *rs_inputMethod) {
strncpy(tmp, rs_inputMethod, sizeof(tmp) - 1);
for (s = tmp; *s; s = next_s + 1) {
for (; *s && isspace(*s); s++);
if (!*s)
if (!*s) {
break;
}
for (end = s; (*end && (*end != ',')); end++);
for (next_s = end--; ((end >= s) && isspace(*end)); end--);
*(end + 1) = '\0';
if (*s) {
snprintf(buf, sizeof(buf), "@im=%s", s);
if ((p = XSetLocaleModifiers(buf)) != NULL && *p
&& (xim = XOpenIM(Xdisplay, NULL, NULL, NULL)) != NULL)
if (((p = XSetLocaleModifiers(buf)) != NULL) && (*p) && ((xim = XOpenIM(Xdisplay, NULL, NULL, NULL)) != NULL)) {
break;
}
if (!*next_s)
}
if (!*next_s) {
break;
}
}
}
/* try with XMODIFIERS env. var. */
if (xim == NULL && (p = XSetLocaleModifiers("")) != NULL && *p)
if (xim == NULL && (p = XSetLocaleModifiers("")) != NULL && *p) {
xim = XOpenIM(Xdisplay, NULL, NULL, NULL);
}
#ifndef USE_X11R6_XIM
/* try with no modifiers base */
if (xim == NULL && (p = XSetLocaleModifiers("@im=none")) != NULL && *p)
if (xim == NULL && (p = XSetLocaleModifiers("@im=none")) != NULL && *p) {
xim = XOpenIM(Xdisplay, NULL, NULL, NULL);
}
#endif
if (xim == NULL)
if (xim == NULL) {
xim = XOpenIM(Xdisplay, NULL, NULL, NULL);
}
if (xim == NULL)
if (xim == NULL) {
return -1;
}
#ifdef USE_X11R6_XIM
{
@ -1873,36 +1865,36 @@ xim_real_init(void)
destroy_cb.callback = xim_destroy_cb;
destroy_cb.client_data = NULL;
if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL))
if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL)) {
print_error("Could not set destroy callback to IM");
}
}
#endif
if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL)
|| !xim_styles) {
if ((XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL)) || (!xim_styles)) {
print_error("input method doesn't support any style");
XCloseIM(xim);
return -1;
}
strncpy(tmp, (rs_preeditType ? rs_preeditType
: "OverTheSpot,OffTheSpot,Root"),
sizeof(tmp) - 1);
strncpy(tmp, (rs_preeditType ? rs_preeditType : "OverTheSpot,OffTheSpot,Root"), sizeof(tmp) - 1);
for (found = 0, s = tmp; *s && !found; s = next_s + 1) {
unsigned short i;
for (; *s && isspace(*s); s++);
if (!*s)
if (!*s) {
break;
}
for (end = s; (*end && (*end != ',')); end++);
for (next_s = end--; ((end >= s) && isspace(*end)); end--);
*(end + 1) = '\0';
if (!strcmp(s, "OverTheSpot"))
if (!strcmp(s, "OverTheSpot")) {
input_style = (XIMPreeditPosition | XIMStatusNothing);
else if (!strcmp(s, "OffTheSpot"))
} else if (!strcmp(s, "OffTheSpot")) {
input_style = (XIMPreeditArea | XIMStatusArea);
else if (!strcmp(s, "Root"))
} else if (!strcmp(s, "Root")) {
input_style = (XIMPreeditNothing | XIMStatusNothing);
}
for (i = 0; i < xim_styles->count_styles; i++) {
if (input_style == xim_styles->supported_styles[i]) {
@ -1918,8 +1910,7 @@ xim_real_init(void)
XCloseIM(xim);
return -1;
}
if ((input_style != (XIMPreeditNothing | XIMStatusNothing))
&& (input_style != (XIMPreeditArea | XIMStatusArea))
if ((input_style != (XIMPreeditNothing | XIMStatusNothing)) && (input_style != (XIMPreeditArea | XIMStatusArea))
&& (input_style != (XIMPreeditPosition | XIMStatusNothing))) {
print_error("This program does not support the preedit type");
XCloseIM(xim);
@ -1929,44 +1920,17 @@ xim_real_init(void)
xim_set_size(&rect);
xim_get_position(&spot);
xim_set_color(&fg, &bg);
preedit_attr = XVaCreateNestedList(0, XNArea, &rect,
XNSpotLocation, &spot,
XNForeground, fg,
XNBackground, bg,
XNFontSet, TermWin.fontset,
NULL);
preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNSpotLocation, &spot, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
} else if (input_style & XIMPreeditArea) {
xim_set_color(&fg, &bg);
/*
* The necessary width of preedit area is unknown
* until create input context.
*/
/* The necessary width of preedit area is unknown until create input context. */
needed_rect.width = 0;
xim_get_area(&rect, &status_rect, &needed_rect);
preedit_attr = XVaCreateNestedList(0, XNArea, &rect,
XNForeground, fg,
XNBackground, bg,
XNFontSet, TermWin.fontset,
NULL);
status_attr = XVaCreateNestedList(0, XNArea, &status_rect,
XNForeground, fg,
XNBackground, bg,
XNFontSet, TermWin.fontset,
NULL);
preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
status_attr = XVaCreateNestedList(0, XNArea, &status_rect, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
}
Input_Context = XCreateIC(xim, XNInputStyle, input_style,
XNClientWindow, TermWin.parent,
XNFocusWindow, TermWin.parent,
preedit_attr ? XNPreeditAttributes : NULL,
preedit_attr,
status_attr ? XNStatusAttributes : NULL,
status_attr,
NULL);
Input_Context = XCreateIC(xim, XNInputStyle, input_style, XNClientWindow, TermWin.parent, XNFocusWindow, TermWin.parent,
preedit_attr ? XNPreeditAttributes : NULL, preedit_attr, status_attr ? XNStatusAttributes : NULL, status_attr, NULL);
XFree(preedit_attr);
XFree(status_attr);
if (Input_Context == NULL) {
@ -1974,7 +1938,6 @@ xim_real_init(void)
XCloseIM(xim);
return -1;
}
if (input_style & XIMPreeditArea)
xim_set_status_position();
return 0;
@ -1987,8 +1950,7 @@ xim_set_status_position(void)
XRectangle preedit_rect, status_rect, *needed_rect;
XVaNestedList preedit_attr, status_attr;
if (Input_Context == NULL)
return;
REQUIRE(Input_Context != NULL);
XGetICValues(Input_Context, XNInputStyle, &input_style, NULL);
@ -2002,11 +1964,7 @@ xim_set_status_position(void)
preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL);
status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL);
XSetICValues(Input_Context,
XNPreeditAttributes, preedit_attr,
XNStatusAttributes, status_attr, NULL);
XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, XNStatusAttributes, status_attr, NULL);
XFree(preedit_attr);
XFree(status_attr);
}
@ -2018,19 +1976,14 @@ void xim_set_fontset(void)
XVaNestedList preedit_attr;
XVaNestedList status_attr;
if (Input_Context == NULL)
return;
REQUIRE(Input_Context != NULL);
XGetICValues(Input_Context, XNInputStyle, &input_style, NULL);
if (input_style & (XIMPreeditArea | XIMPreeditPosition)) {
preedit_attr = XVaCreateNestedList(0, XNFontSet, TermWin.fontset, NULL);
status_attr = XVaCreateNestedList(0, XNFontSet, TermWin.fontset, NULL);
XSetICValues(Input_Context,
XNPreeditAttributes, preedit_attr,
XNStatusAttributes, status_attr, NULL);
XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, XNStatusAttributes, status_attr, NULL);
XFree(preedit_attr);
XFree(status_attr);
}