--- mono-2.0/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Keyboard.cs 2008-08-12 17:12:15.000000000 +0100
+++ mono-2.0/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Keyboard-new.cs 2008-08-22 16:47:01.000000000 +0100
@@ -105,13 +105,26 @@
KeyboardLayout layout = DetectLayout (layouts);
lcid = layout.Lcid;
CreateConversionArray (layouts, layout);
+ SetupXIM ();
+ initialized = true;
+ }
+
+ private void SetupXIM ()
+ {
+ xim = IntPtr.Zero;
if (!XSupportsLocale ()) {
Console.Error.WriteLine ("X does not support your locale");
+ return;
}
if (!XSetLocaleModifiers (String.Empty)) {
Console.Error.WriteLine ("Could not set X locale modifiers");
+ return;
+ }
+
+ if (Environment.GetEnvironmentVariable (ENV_NAME_XIM_STYLE) == "disabled") {
+ return;
}
xim = XOpenIM (display, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
@@ -119,6 +132,7 @@
Console.Error.WriteLine ("Could not get XIM");
else
utf8_buffer = new byte [100];
+
initialized = true;
}
@@ -905,7 +919,7 @@
xic = CreateOverTheSpotXic (window, xim);
if (xic != IntPtr.Zero)
break;
- Console.WriteLine ("failed to create XIC in over-the-spot mode.");
+ //Console.WriteLine ("failed to create XIC in over-the-spot mode.");
continue;
case styleOnTheSpot:
// Since .NET/Winforms seems to support only over-the-spot mode,,
@@ -914,7 +928,7 @@
xic = CreateOnTheSpotXic (window, xim);
if (xic != IntPtr.Zero)
break;
- Console.WriteLine ("failed to create XIC in on-the-spot mode.");
+ //Console.WriteLine ("failed to create XIC in on-the-spot mode.");
continue;
case styleRoot:
xic = XCreateIC (xim,
@@ -1148,6 +1162,7 @@
keysym = (XKeySym) keysym_res.ToInt32 ();
return s.Length;
} else {
+ lookup_buffer.Length = 0;
res = XLookupString (ref xevent, lookup_buffer, len, out keysym_res, IntPtr.Zero);
keysym = (XKeySym) keysym_res.ToInt32 ();
return res;