--- rxvt-unicode/src/main.C 2003/12/02 21:49:46 1.9 +++ rxvt-unicode/src/main.C 2003/12/18 00:29:29 1.14 @@ -1,7 +1,7 @@ /*--------------------------------*-C-*---------------------------------* * File: main.c *----------------------------------------------------------------------* - * $Id: main.C,v 1.9 2003/12/02 21:49:46 pcg Exp $ + * $Id: main.C,v 1.14 2003/12/18 00:29:29 pcg Exp $ * * All portions of code are copyright by their respective author/s. * Copyright (c) 1992 John Bovey, University of Kent at Canterbury @@ -69,15 +69,19 @@ #endif x_ev (this, &rxvt_term::x_cb), destroy_ev (this, &rxvt_term::destroy_cb), - check_ev (this, &rxvt_term::check_cb) + check_ev (this, &rxvt_term::check_cb), + incr_ev (this, &rxvt_term::incr_cb) { cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; } rxvt_term::~rxvt_term () { - rxvt_scr_release (this); + scr_release (); +#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) + free (locale); +#endif #ifndef NO_SETOWNER_TTYDEV rxvt_privileged_ttydev (this, RESTORE); #endif @@ -204,7 +208,7 @@ rxvt_init_xlocale (this); - rxvt_scr_reset (this); /* initialize screen */ + scr_reset (); /* initialize screen */ #ifdef RXVT_GRAPHICS rxvt_Gr_reset (this); /* reset graphics */ #endif @@ -241,6 +245,8 @@ check_ev.start (); + process_x_events (); + return true; } @@ -939,7 +945,9 @@ /* scr_reset only works on the primary screen */ if (R->old_height) /* this is not the first time through */ curr_screen = rxvt_scr_change_screen(aR_ PRIMARY); - rxvt_scr_reset(aR); + + R->scr_reset(); + if (curr_screen >= 0) { /* this is not the first time through */ rxvt_scr_change_screen(aR_ curr_screen); rxvt_selection_check(aR_(old_ncol != R->TermWin.ncol ? 4 : 0)); @@ -1118,49 +1126,64 @@ __attribute__ ((unused)), XPointer call_data __attribute__ ((unused))) { - dR; - int i, found, had_im; - const char *p; - char **s; - char buf[IMBUFSIZ]; + dR; + int i, found, had_im; + const char *p; + char **s; + char buf[IMBUFSIZ]; - D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); - if (R->Input_Context) - return; + D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); + if (R->Input_Context) + return; + +#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) + if (R->rs[Rs_imLocale]) + setlocale (LC_CTYPE, R->rs[Rs_imLocale]); +#endif - found = had_im = 0; - p = R->rs[Rs_inputMethod]; - if (p && *p) { - had_im = 1; - s = rxvt_splitcommastring(p); - for (i = 0; s[i]; i++) { - if (*s[i]) { - STRCPY(buf, "@im="); - STRNCAT(buf, s[i], IMBUFSIZ - 5); - if ((p = XSetLocaleModifiers(buf)) != NULL && *p - && (rxvt_IM_get_IC(aR) == True)) { - found = 1; - break; + p = R->rs[Rs_inputMethod]; + if (p && *p) + { + bool found = false; + + s = rxvt_splitcommastring (p); + for (i = 0; s[i]; i++) + { + if (*s[i]) + { + STRCPY (buf, "@im="); + STRNCAT (buf, s[i], IMBUFSIZ - 5); + if ((p = XSetLocaleModifiers (buf)) && *p + && rxvt_IM_get_IC (aR)) + { + found = true; + break; } } } - for (i = 0; s[i]; i++) - free(s[i]); - free(s); + for (i = 0; s[i]; i++) + free(s[i]); + free(s); + + if (found) + goto done; } - if (found) - return; /* try with XMODIFIERS env. var. */ - if ((p = XSetLocaleModifiers("")) != NULL && *p) { - rxvt_IM_get_IC(aR); - return; - } + if ((p = XSetLocaleModifiers ("")) && *p + && rxvt_IM_get_IC (aR)) + goto done; /* try with no modifiers base IF the user didn't specify an IM */ - if (!had_im && (p = XSetLocaleModifiers("@im=none")) != NULL && *p - && rxvt_IM_get_IC(aR) == True) - return; + if ((p = XSetLocaleModifiers ("@im=none")) && *p + && rxvt_IM_get_IC (aR) == True) + goto done; + +done: +#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) + if (R->rs[Rs_imLocale]) + setlocale (LC_CTYPE, R->locale); +#endif } /*