internal static void AddKeyboardForLayout(IDictionary<string, XkbKeyboardDescription> curKeyboards, XklConfigRegistry.LayoutDescription layout, uint iGroup, IKeyboardSwitchingAdaptor engine) { string description = GetDescription(layout); CultureInfo culture = null; try { culture = new CultureInfo(layout.LocaleId); } catch (ArgumentException) { // This can happen if the locale is not supported. // TODO: fix mono's list of supported locales. Doesn't support e.g. de-BE. // See mono/tools/locale-builder. } string id = string.Format("{0}_{1}", layout.LocaleId, layout.LayoutId); var inputLanguage = new InputLanguageWrapper(culture, IntPtr.Zero, layout.Language); XkbKeyboardDescription existingKeyboard; if (curKeyboards.TryGetValue(id, out existingKeyboard)) { if (!existingKeyboard.IsAvailable) { existingKeyboard.SetIsAvailable(true); existingKeyboard.SetName(description); existingKeyboard.SetInputLanguage(inputLanguage); existingKeyboard.GroupIndex = (int) iGroup; } curKeyboards.Remove(id); } else { var keyboard = new XkbKeyboardDescription(id, description, layout.LayoutId, layout.LocaleId, true, inputLanguage, engine, (int) iGroup); KeyboardController.Instance.Keyboards.Add(keyboard); } }
private static string GetDescription(XklConfigRegistry.LayoutDescription layout) { return string.Format("{0} - {1} ({2})", layout.Description, layout.Language, layout.Country); }
internal void AddKeyboardForLayout(XklConfigRegistry.LayoutDescription layout, uint iGroup, IKeyboardSwitchingAdaptor engine) { var description = GetDescription(layout); CultureInfo culture = null; try { culture = new CultureInfo(layout.LocaleId); } catch (ArgumentException) { // This can happen if the locale is not supported. // TODO: fix mono's list of supported locales. Doesn't support e.g. de-BE. // See mono/tools/locale-builder. } var inputLanguage = new InputLanguageWrapper(culture, IntPtr.Zero, layout.Language); var keyboard = new XkbKeyboardDescription(description, layout.LayoutId, layout.LocaleId, inputLanguage, engine, (int)iGroup); KeyboardController.Manager.RegisterKeyboard(keyboard); }
private void AddKeyboardForLayout(XklConfigRegistry.LayoutDescription layout, uint iGroup) { AddKeyboardForLayout(layout, iGroup, _adaptor); }