aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Colascione2014-03-23 03:57:25 -0700
committerDaniel Colascione2014-03-23 03:57:25 -0700
commit4b0c9ad43c0f64d7dc120e2f24afed6488c78997 (patch)
treed07b2f29d808d97657513754dd268c8469e84282 /src
parent599d37a180b23c8c41ca81f2f3ae3f01197a9a2c (diff)
parentdf3964ce56e2ceb4aa528098db5dada1a9222954 (diff)
downloademacs-4b0c9ad43c0f64d7dc120e2f24afed6488c78997.tar.gz
emacs-4b0c9ad43c0f64d7dc120e2f24afed6488c78997.zip
Make Emacs work with ibus
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/xfns.c92
2 files changed, 68 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1cce3b5c48e..509875d87ea 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
12014-03-23 Daniel Colascione <dancol@dancol.org> 12014-03-23 Daniel Colascione <dancol@dancol.org>
2 2
3 * xfns.c (create_frame_xic): Pass XNStatusAttributes to XCreateIC
4 only if xic_style calls for it. This change allows Emacs to work
5 with ibus. Also, don't leak resources if create_frame_xic fails.
6
72014-03-23 Daniel Colascione <dancol@dancol.org>
8
3 * term.c (init_tty): Rearrange condition for clarity; print 9 * term.c (init_tty): Rearrange condition for clarity; print
4 appropriate diagnostic. 10 appropriate diagnostic.
5 11
diff --git a/src/xfns.c b/src/xfns.c
index 5dbc7053fd9..7f4fc365833 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1964,27 +1964,27 @@ create_frame_xic (struct frame *f)
1964 XIM xim; 1964 XIM xim;
1965 XIC xic = NULL; 1965 XIC xic = NULL;
1966 XFontSet xfs = NULL; 1966 XFontSet xfs = NULL;
1967 XVaNestedList status_attr = NULL;
1968 XVaNestedList preedit_attr = NULL;
1969 XRectangle s_area;
1970 XPoint spot;
1971 XIMStyles supported_list;
1967 1972
1968 if (FRAME_XIC (f)) 1973 if (FRAME_XIC (f))
1969 return; 1974 return;
1970 1975
1971 /* Create X fontset. */ 1976 /* Create X fontset. */
1972 xfs = xic_create_xfontset (f); 1977 xfs = xic_create_xfontset (f);
1978 FRAME_XIC_FONTSET (f) = xfs;
1979
1973 xim = FRAME_X_XIM (f); 1980 xim = FRAME_X_XIM (f);
1974 if (xim) 1981 if (xim)
1975 { 1982 {
1976 XRectangle s_area;
1977 XPoint spot;
1978 XVaNestedList preedit_attr;
1979 XVaNestedList status_attr;
1980
1981 s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
1982 spot.x = 0; spot.y = 1; 1983 spot.x = 0; spot.y = 1;
1983 1984
1984 /* Determine XIC style. */ 1985 /* Determine XIC style. */
1985 if (xic_style == 0) 1986 if (xic_style == 0)
1986 { 1987 {
1987 XIMStyles supported_list;
1988 supported_list.count_styles = (sizeof supported_xim_styles 1988 supported_list.count_styles = (sizeof supported_xim_styles
1989 / sizeof supported_xim_styles[0]); 1989 / sizeof supported_xim_styles[0]);
1990 supported_list.supported_styles = supported_xim_styles; 1990 supported_list.supported_styles = supported_xim_styles;
@@ -2003,31 +2003,63 @@ create_frame_xic (struct frame *f)
2003 : NULL), 2003 : NULL),
2004 &spot, 2004 &spot,
2005 NULL); 2005 NULL);
2006 status_attr = XVaCreateNestedList (0, 2006
2007 XNArea, 2007 if (!preedit_attr)
2008 &s_area, 2008 goto out;
2009 XNFontSet, 2009
2010 xfs, 2010 if (xic_style & XIMStatusArea)
2011 XNForeground, 2011 {
2012 FRAME_FOREGROUND_PIXEL (f), 2012 s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
2013 XNBackground, 2013 status_attr = XVaCreateNestedList (0,
2014 FRAME_BACKGROUND_PIXEL (f), 2014 XNArea,
2015 NULL); 2015 &s_area,
2016 2016 XNFontSet,
2017 xic = XCreateIC (xim, 2017 xfs,
2018 XNInputStyle, xic_style, 2018 XNForeground,
2019 XNClientWindow, FRAME_X_WINDOW (f), 2019 FRAME_FOREGROUND_PIXEL (f),
2020 XNFocusWindow, FRAME_X_WINDOW (f), 2020 XNBackground,
2021 XNStatusAttributes, status_attr, 2021 FRAME_BACKGROUND_PIXEL (f),
2022 XNPreeditAttributes, preedit_attr, 2022 NULL);
2023 NULL); 2023
2024 XFree (preedit_attr); 2024 if (!status_attr)
2025 XFree (status_attr); 2025 goto out;
2026
2027 xic = XCreateIC (xim,
2028 XNInputStyle, xic_style,
2029 XNClientWindow, FRAME_X_WINDOW (f),
2030 XNFocusWindow, FRAME_X_WINDOW (f),
2031 XNStatusAttributes, status_attr,
2032 XNPreeditAttributes, preedit_attr,
2033 NULL);
2034 }
2035 else
2036 {
2037 xic = XCreateIC (xim,
2038 XNInputStyle, xic_style,
2039 XNClientWindow, FRAME_X_WINDOW (f),
2040 XNFocusWindow, FRAME_X_WINDOW (f),
2041 XNPreeditAttributes, preedit_attr,
2042 NULL);
2043 }
2044
2045 if (!xic)
2046 goto out;
2047
2048 FRAME_XIC (f) = xic;
2049 FRAME_XIC_STYLE (f) = xic_style;
2050 xfs = NULL; /* Don't free below. */
2026 } 2051 }
2027 2052
2028 FRAME_XIC (f) = xic; 2053 out:
2029 FRAME_XIC_STYLE (f) = xic_style; 2054
2030 FRAME_XIC_FONTSET (f) = xfs; 2055 if (xfs)
2056 free_frame_xic (f);
2057
2058 if (preedit_attr)
2059 XFree (preedit_attr);
2060
2061 if (status_attr)
2062 XFree (status_attr);
2031} 2063}
2032 2064
2033 2065