* Source/x11/XIMInputServer.m: If the requested XIM style

(the GSXIMInputMethodStyle user default) is not available,
fall back to using a stlye that both the X server and
GNUstep support, if any. Also, add support for NoneStyle, which
is for simple input methods that don't have any visualization.
Problem reported and tested by Riccardo.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@37065 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2013-09-10 20:00:11 +00:00
parent fe626e1e90
commit b56aea123d
2 changed files with 54 additions and 9 deletions

View file

@ -1,3 +1,12 @@
2013-09-10 Eric Wasylishen <ewasylishen@gmail.com>
* Source/x11/XIMInputServer.m: If the requested XIM style
(the GSXIMInputMethodStyle user default) is not available,
fall back to using a stlye that both the X server and
GNUstep support, if any. Also, add support for NoneStyle, which
is for simple input methods that don't have any visualization.
Problem reported and tested by Riccardo.
2013-09-09 Ivan Vucica <ivan@vucica.net>
* Source/opal/OpalFontInfo.m:

View file

@ -39,6 +39,7 @@
#include "x11/XGInputServer.h"
#include <X11/Xlocale.h>
#define NoneStyle (XIMPreeditNone | XIMStatusNone)
#define RootWindowStyle (XIMPreeditNothing | XIMStatusNothing)
#define OffTheSpotStyle (XIMPreeditArea | XIMStatusArea)
#define OverTheSpotStyle (XIMPreeditPosition | XIMStatusArea)
@ -228,6 +229,39 @@
return YES;
}
static XIMStyle
betterStyle(XIMStyle a, XIMStyle b, XIMStyle xim_requested_style)
{
if (a == xim_requested_style)
return a;
if (b == xim_requested_style)
return b;
// N.B. We don't support OnTheSpotStyle so it is omitted here
if (a == OverTheSpotStyle)
return a;
if (b == OverTheSpotStyle)
return b;
if (a == OffTheSpotStyle)
return a;
if (b == OffTheSpotStyle)
return b;
if (a == RootWindowStyle)
return a;
if (b == RootWindowStyle)
return b;
if (a == NoneStyle)
return a;
if (b == NoneStyle)
return b;
return 0;
}
- (int) ximStyleInit
{
NSUserDefaults *uds;
@ -275,16 +309,18 @@
for (i = 0; i < styles->count_styles; i++)
{
if (styles->supported_styles[i] == xim_requested_style)
{
xim_style = xim_requested_style;
XFree(styles);
return 1;
}
xim_style = betterStyle(xim_style, styles->supported_styles[i],
xim_requested_style);
}
NSLog(@"XIM: '%@' is not supported", request);
XFree(styles);
return 0;
if (xim_style == 0)
{
NSLog(@"XIM: no supported styles found");
return 0;
}
return 1;
}
- (void) ximClose
@ -335,7 +371,7 @@
{
XIC xic = NULL;
if (xim_style == RootWindowStyle)
if (xim_style == RootWindowStyle || xim_style == NoneStyle)
{
xic = XCreateIC(xim,
XNInputStyle, xim_style,