Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
d2933655
Commit
d2933655
authored
Mar 23, 2014
by
Daniel Colascione
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further improve create_frame_xic patch
parent
df3964ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
59 deletions
+75
-59
src/ChangeLog
src/ChangeLog
+2
-1
src/xfns.c
src/xfns.c
+73
-58
No files found.
src/ChangeLog
View file @
d2933655
...
@@ -2,7 +2,8 @@
...
@@ -2,7 +2,8 @@
* xfns.c (create_frame_xic): Pass XNStatusAttributes to XCreateIC
* xfns.c (create_frame_xic): Pass XNStatusAttributes to XCreateIC
only if xic_style calls for it. This change allows Emacs to work
only if xic_style calls for it. This change allows Emacs to work
with ibus. Also, don't leak resources if create_frame_xic fails.
with ibus. Also, don't leak resources if create_frame_xic fails,
and stop caching xic_style across different displays.
2014-03-23 Daniel Colascione <dancol@dancol.org>
2014-03-23 Daniel Colascione <dancol@dancol.org>
...
...
src/xfns.c
View file @
d2933655
...
@@ -1956,8 +1956,6 @@ best_xim_style (XIMStyles *user, XIMStyles *xim)
...
@@ -1956,8 +1956,6 @@ best_xim_style (XIMStyles *user, XIMStyles *xim)
/* Create XIC for frame F. */
/* Create XIC for frame F. */
static XIMStyle xic_style;
void
void
create_frame_xic (struct frame *f)
create_frame_xic (struct frame *f)
{
{
...
@@ -1969,29 +1967,34 @@ create_frame_xic (struct frame *f)
...
@@ -1969,29 +1967,34 @@ create_frame_xic (struct frame *f)
XRectangle s_area;
XRectangle s_area;
XPoint spot;
XPoint spot;
XIMStyles supported_list;
XIMStyles supported_list;
XIMStyle xic_style;
if (FRAME_XIC (f))
if (FRAME_XIC (f))
return;
goto out;
/* Create X fontset. */
xfs = xic_create_xfontset (f);
FRAME_XIC_FONTSET (f) = xfs;
xim = FRAME_X_XIM (f);
xim = FRAME_X_XIM (f);
if (xim)
if (!xim)
goto out;
/* Determine XIC style. */
supported_list.count_styles = (sizeof supported_xim_styles
/ sizeof supported_xim_styles[0]);
supported_list.supported_styles = supported_xim_styles;
xic_style = best_xim_style (&supported_list, FRAME_X_XIM_STYLES (f));
/* Create X fontset. */
if (xic_style & (XIMPreeditPosition | XIMStatusArea))
{
{
spot.x = 0; spot.y = 1;
xfs = xic_create_xfontset (f);
if (!xfs)
goto out;
/* Determine XIC style. */
FRAME_XIC_FONTSET (f) = xfs;
if (xic_style == 0)
}
{
supported_list.count_styles = (sizeof supported_xim_styles
/ sizeof supported_xim_styles[0]);
supported_list.supported_styles = supported_xim_styles;
xic_style = best_xim_style (&supported_list,
FRAME_X_XIM_STYLES (f));
}
if (xic_style & XIMPreeditPosition)
{
spot.x = 0; spot.y = 1;
preedit_attr = XVaCreateNestedList (0,
preedit_attr = XVaCreateNestedList (0,
XNFontSet, xfs,
XNFontSet, xfs,
XNForeground,
XNForeground,
...
@@ -2006,50 +2009,62 @@ create_frame_xic (struct frame *f)
...
@@ -2006,50 +2009,62 @@ create_frame_xic (struct frame *f)
if (!preedit_attr)
if (!preedit_attr)
goto out;
goto out;
}
if (xic_style & XIMStatusArea)
if (xic_style & XIMStatusArea)
{
{
s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
status_attr = XVaCreateNestedList (0,
status_attr = XVaCreateNestedList (0,
XNArea,
XNArea,
&s_area,
&s_area,
XNFontSet,
XNFontSet,
xfs,
xfs,
XNForeground,
XNForeground,
FRAME_FOREGROUND_PIXEL (f),
FRAME_FOREGROUND_PIXEL (f),
XNBackground,
XNBackground,
FRAME_BACKGROUND_PIXEL (f),
FRAME_BACKGROUND_PIXEL (f),
NULL);
NULL);
if (!status_attr)
if (!status_attr)
goto out;
xic = XCreateIC (xim,
XNInputStyle, xic_style,
XNClientWindow, FRAME_X_WINDOW (f),
XNFocusWindow, FRAME_X_WINDOW (f),
XNStatusAttributes, status_attr,
XNPreeditAttributes, preedit_attr,
NULL);
}
else
{
xic = XCreateIC (xim,
XNInputStyle, xic_style,
XNClientWindow, FRAME_X_WINDOW (f),
XNFocusWindow, FRAME_X_WINDOW (f),
XNPreeditAttributes, preedit_attr,
NULL);
}
if (!xic)
goto out;
goto out;
FRAME_XIC (f) = xic;
FRAME_XIC_STYLE (f) = xic_style;
xfs = NULL; /* Don't free below. */
}
}
if (preedit_attr && status_attr)
xic = XCreateIC (xim,
XNInputStyle, xic_style,
XNClientWindow, FRAME_X_WINDOW (f),
XNFocusWindow, FRAME_X_WINDOW (f),
XNStatusAttributes, status_attr,
XNPreeditAttributes, preedit_attr,
NULL);
else if (preedit_attr)
xic = XCreateIC (xim,
XNInputStyle, xic_style,
XNClientWindow, FRAME_X_WINDOW (f),
XNFocusWindow, FRAME_X_WINDOW (f),
XNPreeditAttributes, preedit_attr,
NULL);
else if (status_attr)
xic = XCreateIC (xim,
XNInputStyle, xic_style,
XNClientWindow, FRAME_X_WINDOW (f),
XNFocusWindow, FRAME_X_WINDOW (f),
XNStatusAttributes, status_attr,
NULL);
else
xic = XCreateIC (xim,
XNInputStyle, xic_style,
XNClientWindow, FRAME_X_WINDOW (f),
XNFocusWindow, FRAME_X_WINDOW (f),
NULL);
if (!xic)
goto out;
FRAME_XIC (f) = xic;
FRAME_XIC_STYLE (f) = xic_style;
xfs = NULL; /* Don't free below. */
out:
out:
if (xfs)
if (xfs)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment