Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Nov 21, 2004
1 parent b5a246c commit 7725c8e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 25 deletions.
62 changes: 37 additions & 25 deletions src/main.C
Expand Up @@ -357,7 +357,7 @@ rxvt_term::init (int argc, const char *const *argv)

scr_reset (); /* initialize screen */

#if 0
#if 1
XSynchronize (display->display, True);
#endif

Expand Down Expand Up @@ -1301,32 +1301,44 @@ rxvt_term::IM_get_IC (const char *modifiers)
return false;
}

p = rs[Rs_preeditType] ? rs[Rs_preeditType] : "OverTheSpot,OffTheSpot,Root,None";
s = rxvt_splitcommastring (p);
const char *pet[] = { rs[Rs_preeditType], "OverTheSpot,OffTheSpot,Root,None" };

for (i = found = 0; !found && s[i]; i++)
for (int pi = 0; pi < 2; pi++)
{
if (!strcmp (s[i], "OverTheSpot"))
input_style = (XIMPreeditPosition | XIMStatusNothing);
else if (!strcmp (s[i], "OffTheSpot"))
input_style = (XIMPreeditArea | XIMStatusArea);
else if (!strcmp (s[i], "Root"))
input_style = (XIMPreeditNothing | XIMStatusNothing);
else if (!strcmp (s[i], "None"))
input_style = (XIMPreeditNone | XIMStatusNone);

for (j = 0; j < xim_styles->count_styles; j++)
if (input_style == xim_styles->supported_styles[j])
{
found = 1;
break;
}
p = pet[pi];

if (!p)
continue;

s = rxvt_splitcommastring (p);

for (i = found = 0; !found && s[i]; i++)
{
if (!strcmp (s[i], "OverTheSpot"))
input_style = (XIMPreeditPosition | XIMStatusNothing);
else if (!strcmp (s[i], "OffTheSpot"))
input_style = (XIMPreeditArea | XIMStatusArea);
else if (!strcmp (s[i], "Root"))
input_style = (XIMPreeditNothing | XIMStatusNothing);
else if (!strcmp (s[i], "None"))
input_style = (XIMPreeditNone | XIMStatusNone);

for (j = 0; j < xim_styles->count_styles; j++)
if (input_style == xim_styles->supported_styles[j])
{
rxvt_freecommastring (s);

found = 1;
goto foundpet;
}

}

rxvt_freecommastring (s);
}

for (i = 0; s[i]; i++)
free (s[i]);
foundpet:

free (s);
XFree (xim_styles);

if (!found)
Expand Down Expand Up @@ -1461,6 +1473,7 @@ rxvt_term::im_cb ()
bool found = false;

s = rxvt_splitcommastring (p);

for (i = 0; s[i]; i++)
{
if (*s[i])
Expand All @@ -1474,9 +1487,8 @@ rxvt_term::im_cb ()
}
}
}
for (i = 0; s[i]; i++)
free (s[i]);
free (s);

rxvt_freecommastring (s);

if (found)
goto done;
Expand Down
9 changes: 9 additions & 0 deletions src/misc.C
Expand Up @@ -322,6 +322,15 @@ rxvt_splitcommastring (const char *cs)
return ret;
}

void
rxvt_freecommastring (char **cs)
{
for (int i = 0; cs[i]; ++i)
free (cs[i]);

free (cs);
}

/*----------------------------------------------------------------------*
* file searching
*/
Expand Down
1 change: 1 addition & 0 deletions src/rxvt.h
Expand Up @@ -101,6 +101,7 @@ const char * rxvt_Str_skip_space (const char *str);
char * rxvt_Str_trim (char *str);
int rxvt_Str_escaped (char *str);
char ** rxvt_splitcommastring (const char *cs);
void rxvt_freecommastring (char **cs);
char * rxvt_File_find (const char *file, const char *ext, const char *path);
void rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h);
void rxvt_Draw_Triangle (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int type);
Expand Down

0 comments on commit 7725c8e

Please sign in to comment.