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. 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 dnl# Set some basic variables
DATE="`date '+%d %B %Y'`" DATE="`date '+%d %B %Y'`"
AC_SUBST(DATE) 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) AC_SUBST(AUTHORS)
dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure' 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 \ 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 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 libEterm_la_LDFLAGS = -version-info 9:0:9
bin_PROGRAMS = Eterm bin_PROGRAMS = Eterm
Eterm_SOURCES = main.c Eterm_SOURCES = main.c
Eterm_DEPENDENCIES = libEterm.la
Eterm_DEPENDENCIES = libEterm.la ../libmej/libmej.la feature.h Eterm_LDFLAGS = -rpath $(libdir):$(pkglibdir) libEterm.la
INCLUDES = -I. -I$(top_srcdir)/libmej -I.. -I$(includedir) -I$(prefix)/include $(X_CFLAGS) INCLUDES = -I. -I$(top_srcdir)/libmej -I.. -I$(includedir) -I$(prefix)/include $(X_CFLAGS)
LDADD = $(DIST_ROOT)/libmej/libmej.la -L$(libdir) -L$(prefix)/lib $(LIBS) $(GRLIBS) $(X_LIBS)
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)
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 \ 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 \ 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,48 +1690,44 @@ create_fontset(const char *font1, const char *font2)
#ifdef USE_XIM #ifdef USE_XIM
static int xim_real_init(void); static int xim_real_init(void);
# ifdef USE_X11R6_XIM # ifdef USE_X11R6_XIM
static void xim_destroy_cb(XIM xim, XPointer client_data, static void xim_destroy_cb(XIM xim, XPointer client_data, XPointer call_data);
XPointer call_data); static void xim_instantiate_cb(Display *display, XPointer client_data, XPointer call_data);
static void xim_instantiate_cb(Display *display, XPointer client_data,
XPointer call_data);
# endif # endif
#endif #endif
void void
init_locale(void) init_locale(void)
{ {
char *locale = NULL; char *locale = NULL;
locale = setlocale(LC_CTYPE, ""); locale = setlocale(LC_CTYPE, "");
TermWin.fontset = (XFontSet) -1; TermWin.fontset = (XFontSet) -1;
if (locale == NULL) if (locale == NULL) {
print_error("Setting locale failed."); print_error("Setting locale failed.");
else { } else {
#ifdef MULTI_CHARSET #ifdef MULTI_CHARSET
TermWin.fontset = create_fontset(rs_font[0], rs_mfont[0]); TermWin.fontset = create_fontset(rs_font[0], rs_mfont[0]);
#else #else
TermWin.fontset = create_fontset(rs_font[0], (const char *) NULL); TermWin.fontset = create_fontset(rs_font[0], (const char *) NULL);
#endif #endif
#ifdef USE_XIM #ifdef USE_XIM
# ifdef MULTI_CHARSET # ifdef MULTI_CHARSET
if (strcmp(locale, "C")) if (strcmp(locale, "C"))
# endif # endif
{ {
if (xim_real_init() != -1) if (xim_real_init() != -1) {
return; return;
}
# ifdef USE_X11R6_XIM # ifdef USE_X11R6_XIM
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
xim_instantiate_cb, NULL);
# endif # endif
} }
#endif #endif
} }
} }
#endif /* USE_XIM || MULTI_CHARSET */ #endif /* USE_XIM || MULTI_CHARSET */
#ifdef USE_XIM #ifdef USE_XIM
static void static void
xim_set_size(XRectangle * size) xim_set_size(XRectangle * size)
{ {
@ -1751,19 +1747,19 @@ xim_set_color(unsigned long *fg, unsigned long *bg)
static void static void
xim_send_spot(void) xim_send_spot(void)
{ {
XPoint spot; XPoint spot;
XVaNestedList preedit_attr; XVaNestedList preedit_attr;
XIMStyle input_style; XIMStyle input_style;
if (Input_Context == NULL) if (Input_Context == NULL) {
return; return;
else { } else {
XGetICValues(Input_Context, XNInputStyle, &input_style, NULL); XGetICValues(Input_Context, XNInputStyle, &input_style, NULL);
if (!(input_style & XIMPreeditPosition)) if (!(input_style & XIMPreeditPosition)) {
return; return;
}
} }
xim_get_position(&spot); xim_get_position(&spot);
preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, NULL); XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, NULL);
XFree(preedit_attr); XFree(preedit_attr);
@ -1773,22 +1769,16 @@ static void
xim_get_area(XRectangle *preedit_rect, XRectangle *status_rect, xim_get_area(XRectangle *preedit_rect, XRectangle *status_rect,
XRectangle *needed_rect) XRectangle *needed_rect)
{ {
preedit_rect->x = needed_rect->width preedit_rect->x = needed_rect->width + (scrollbar_visible() && !(Options & Opt_scrollBar_right) ? (scrollBar.width) : 0);
+ (scrollbar_visible() && !(Options & Opt_scrollBar_right)
? (SB_WIDTH) : 0);
preedit_rect->y = Height2Pixel(TermWin.nrow - 1); preedit_rect->y = Height2Pixel(TermWin.nrow - 1);
preedit_rect->width = Width2Pixel(TermWin.ncol + 1) - needed_rect->width preedit_rect->width = Width2Pixel(TermWin.ncol + 1) - needed_rect->width + (!(Options & Opt_scrollBar_right) ? (scrollBar.width) : 0);
+ (!(Options & Opt_scrollBar_right)
? (SB_WIDTH) : 0);
preedit_rect->height = Height2Pixel(1); preedit_rect->height = Height2Pixel(1);
status_rect->x = (scrollbar_visible() && !(Options & Opt_scrollBar_right)) status_rect->x = (scrollbar_visible() && !(Options & Opt_scrollBar_right)) ? (scrollBar.width) : 0;
? (SB_WIDTH) : 0;
status_rect->y = Height2Pixel(TermWin.nrow - 1); status_rect->y = Height2Pixel(TermWin.nrow - 1);
status_rect->width = needed_rect->width ? needed_rect->width status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(TermWin.ncol + 1);
: Width2Pixel(TermWin.ncol + 1);
status_rect->height = Height2Pixel(1); status_rect->height = Height2Pixel(1);
} }
@ -1797,75 +1787,77 @@ static void
xim_destroy_cb(XIM xim, XPointer client_data, XPointer call_data) xim_destroy_cb(XIM xim, XPointer client_data, XPointer call_data)
{ {
Input_Context = NULL; Input_Context = NULL;
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
xim_instantiate_cb, NULL);
} }
static void static void
xim_instantiate_cb(Display *display, XPointer client_data, xim_instantiate_cb(Display *display, XPointer client_data, XPointer call_data)
XPointer call_data)
{ {
xim_real_init(); xim_real_init();
if (Input_Context) if (Input_Context) {
XUnregisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, XUnregisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
xim_instantiate_cb, NULL); }
} }
#endif #endif
static int static int
xim_real_init(void) xim_real_init(void)
{ {
char *p, *s, buf[64], tmp[1024]; char *p, *s, buf[64], tmp[1024];
char *end, *next_s; char *end, *next_s;
XIM xim = NULL; XIM xim = NULL;
XIMStyle input_style = 0; XIMStyle input_style = 0;
XIMStyles *xim_styles = NULL; XIMStyles *xim_styles = NULL;
int found; int found;
XPoint spot; XPoint spot;
XRectangle rect, status_rect, needed_rect; XRectangle rect, status_rect, needed_rect;
unsigned long fg, bg; unsigned long fg, bg;
XVaNestedList preedit_attr = NULL; XVaNestedList preedit_attr = NULL;
XVaNestedList status_attr = NULL; XVaNestedList status_attr = NULL;
if (Input_Context) REQUIRE(Input_Context != NULL);
return 0;
if (rs_inputMethod && *rs_inputMethod) { if (rs_inputMethod && *rs_inputMethod) {
strncpy(tmp, rs_inputMethod, sizeof(tmp) - 1); strncpy(tmp, rs_inputMethod, sizeof(tmp) - 1);
for (s = tmp; *s; s = next_s + 1) { for (s = tmp; *s; s = next_s + 1) {
for (; *s && isspace(*s); s++) ; for (; *s && isspace(*s); s++);
if (!*s) if (!*s) {
break; break;
for (end = s; (*end && (*end != ',')); end++) ; }
for (next_s = end--; ((end >= s) && isspace(*end)); end--) ; for (end = s; (*end && (*end != ',')); end++);
for (next_s = end--; ((end >= s) && isspace(*end)); end--);
*(end + 1) = '\0'; *(end + 1) = '\0';
if (*s) { if (*s) {
snprintf(buf, sizeof(buf), "@im=%s", s); snprintf(buf, sizeof(buf), "@im=%s", s);
if ((p = XSetLocaleModifiers(buf)) != NULL && *p if (((p = XSetLocaleModifiers(buf)) != NULL) && (*p) && ((xim = XOpenIM(Xdisplay, NULL, NULL, NULL)) != NULL)) {
&& (xim = XOpenIM(Xdisplay, NULL, NULL, NULL)) != NULL)
break; break;
}
} }
if (!*next_s) if (!*next_s) {
break; break;
}
} }
} }
/* try with XMODIFIERS env. var. */ /* 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); xim = XOpenIM(Xdisplay, NULL, NULL, NULL);
}
#ifndef USE_X11R6_XIM #ifndef USE_X11R6_XIM
/* try with no modifiers base */ /* 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); xim = XOpenIM(Xdisplay, NULL, NULL, NULL);
}
#endif #endif
if (xim == NULL) if (xim == NULL) {
xim = XOpenIM(Xdisplay, NULL, NULL, NULL); xim = XOpenIM(Xdisplay, NULL, NULL, NULL);
}
if (xim == NULL) if (xim == NULL) {
return -1; return -1;
}
#ifdef USE_X11R6_XIM #ifdef USE_X11R6_XIM
{ {
@ -1873,36 +1865,36 @@ xim_real_init(void)
destroy_cb.callback = xim_destroy_cb; destroy_cb.callback = xim_destroy_cb;
destroy_cb.client_data = NULL; 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"); print_error("Could not set destroy callback to IM");
}
} }
#endif #endif
if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) if ((XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL)) || (!xim_styles)) {
|| !xim_styles) {
print_error("input method doesn't support any style"); print_error("input method doesn't support any style");
XCloseIM(xim); XCloseIM(xim);
return -1; return -1;
} }
strncpy(tmp, (rs_preeditType ? rs_preeditType strncpy(tmp, (rs_preeditType ? rs_preeditType : "OverTheSpot,OffTheSpot,Root"), sizeof(tmp) - 1);
: "OverTheSpot,OffTheSpot,Root"),
sizeof(tmp) - 1);
for (found = 0, s = tmp; *s && !found; s = next_s + 1) { for (found = 0, s = tmp; *s && !found; s = next_s + 1) {
unsigned short i; unsigned short i;
for (; *s && isspace(*s); s++) ; for (; *s && isspace(*s); s++);
if (!*s) if (!*s) {
break; break;
for (end = s; (*end && (*end != ',')); end++) ; }
for (next_s = end--; ((end >= s) && isspace(*end)); end--) ; for (end = s; (*end && (*end != ',')); end++);
for (next_s = end--; ((end >= s) && isspace(*end)); end--);
*(end + 1) = '\0'; *(end + 1) = '\0';
if (!strcmp(s, "OverTheSpot")) if (!strcmp(s, "OverTheSpot")) {
input_style = (XIMPreeditPosition | XIMStatusNothing); input_style = (XIMPreeditPosition | XIMStatusNothing);
else if (!strcmp(s, "OffTheSpot")) } else if (!strcmp(s, "OffTheSpot")) {
input_style = (XIMPreeditArea | XIMStatusArea); input_style = (XIMPreeditArea | XIMStatusArea);
else if (!strcmp(s, "Root")) } else if (!strcmp(s, "Root")) {
input_style = (XIMPreeditNothing | XIMStatusNothing); input_style = (XIMPreeditNothing | XIMStatusNothing);
}
for (i = 0; i < xim_styles->count_styles; i++) { for (i = 0; i < xim_styles->count_styles; i++) {
if (input_style == xim_styles->supported_styles[i]) { if (input_style == xim_styles->supported_styles[i]) {
@ -1918,8 +1910,7 @@ xim_real_init(void)
XCloseIM(xim); XCloseIM(xim);
return -1; return -1;
} }
if ((input_style != (XIMPreeditNothing | XIMStatusNothing)) if ((input_style != (XIMPreeditNothing | XIMStatusNothing)) && (input_style != (XIMPreeditArea | XIMStatusArea))
&& (input_style != (XIMPreeditArea | XIMStatusArea))
&& (input_style != (XIMPreeditPosition | XIMStatusNothing))) { && (input_style != (XIMPreeditPosition | XIMStatusNothing))) {
print_error("This program does not support the preedit type"); print_error("This program does not support the preedit type");
XCloseIM(xim); XCloseIM(xim);
@ -1929,44 +1920,17 @@ xim_real_init(void)
xim_set_size(&rect); xim_set_size(&rect);
xim_get_position(&spot); xim_get_position(&spot);
xim_set_color(&fg, &bg); 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) { } else if (input_style & XIMPreeditArea) {
xim_set_color(&fg, &bg); 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; needed_rect.width = 0;
xim_get_area(&rect, &status_rect, &needed_rect); xim_get_area(&rect, &status_rect, &needed_rect);
preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
preedit_attr = XVaCreateNestedList(0, XNArea, &rect, status_attr = XVaCreateNestedList(0, XNArea, &status_rect, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
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,
Input_Context = XCreateIC(xim, XNInputStyle, input_style, preedit_attr ? XNPreeditAttributes : NULL, preedit_attr, status_attr ? XNStatusAttributes : NULL, status_attr, NULL);
XNClientWindow, TermWin.parent,
XNFocusWindow, TermWin.parent,
preedit_attr ? XNPreeditAttributes : NULL,
preedit_attr,
status_attr ? XNStatusAttributes : NULL,
status_attr,
NULL);
XFree(preedit_attr); XFree(preedit_attr);
XFree(status_attr); XFree(status_attr);
if (Input_Context == NULL) { if (Input_Context == NULL) {
@ -1974,7 +1938,6 @@ xim_real_init(void)
XCloseIM(xim); XCloseIM(xim);
return -1; return -1;
} }
if (input_style & XIMPreeditArea) if (input_style & XIMPreeditArea)
xim_set_status_position(); xim_set_status_position();
return 0; return 0;
@ -1983,12 +1946,11 @@ xim_real_init(void)
void void
xim_set_status_position(void) xim_set_status_position(void)
{ {
XIMStyle input_style; XIMStyle input_style;
XRectangle preedit_rect, status_rect, *needed_rect; XRectangle preedit_rect, status_rect, *needed_rect;
XVaNestedList preedit_attr, status_attr; XVaNestedList preedit_attr, status_attr;
if (Input_Context == NULL) REQUIRE(Input_Context != NULL);
return;
XGetICValues(Input_Context, XNInputStyle, &input_style, 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); preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL);
status_attr = XVaCreateNestedList(0, XNArea, &status_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(preedit_attr);
XFree(status_attr); XFree(status_attr);
} }
@ -2014,23 +1972,18 @@ xim_set_status_position(void)
void xim_set_fontset(void) void xim_set_fontset(void)
{ {
XIMStyle input_style; XIMStyle input_style;
XVaNestedList preedit_attr; XVaNestedList preedit_attr;
XVaNestedList status_attr; XVaNestedList status_attr;
if (Input_Context == NULL) REQUIRE(Input_Context != NULL);
return;
XGetICValues(Input_Context, XNInputStyle, &input_style, NULL); XGetICValues(Input_Context, XNInputStyle, &input_style, NULL);
if (input_style & (XIMPreeditArea | XIMPreeditPosition)) { if (input_style & (XIMPreeditArea | XIMPreeditPosition)) {
preedit_attr = XVaCreateNestedList(0, XNFontSet, TermWin.fontset, NULL); preedit_attr = XVaCreateNestedList(0, XNFontSet, TermWin.fontset, NULL);
status_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(preedit_attr);
XFree(status_attr); XFree(status_attr);
} }