Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:zhy20120210:home:zhy20120210:SLES-11-SP1-x86-64
gdm
gdm-xkb-us-additional-layout.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gdm-xkb-us-additional-layout.patch of Package gdm
Index: gdm-2.24.0/gui/simple-greeter/gdm-layouts.c =================================================================== --- gdm-2.24.0.orig/gui/simple-greeter/gdm-layouts.c +++ gdm-2.24.0/gui/simple-greeter/gdm-layouts.c @@ -250,6 +250,104 @@ gdm_layout_get_init_layout (void) #endif } +#ifdef HAVE_LIBXKLAVIER +#define GROUP_SWITCH_PREFIX "grp:" +#define GROUP_SWITCH_DEFAULT "grp:shifts_toggle" + +static void +_gdm_layout_activate_maybe_setup_additional_layout (XklConfigRec *config) +{ + char *layout; + + layout = config->layouts[0]; + + /* Add "us" as second layout for some cases. + * Please keep the list of cases in sync with the similar patch + * in gnome-settings-daemon. + * See https://bugzilla.novell.com/show_bug.cgi?id=509920#c13 */ + + if (strcmp (layout, "ara") != 0 && + strcmp (layout, "cz") != 0 && + strcmp (layout, "gr") != 0 && + strcmp (layout, "kh") != 0 && + strcmp (layout, "sk") != 0 && + strcmp (layout, "ru") != 0) { + /* do nothing specific */ + config->options = g_strdupv (initial_config->options); + return; + } + + /* layouts: we want to add "us"; we need a bigger array here */ + g_free (config->layouts); + config->layouts = g_new0 (char *, 3); + config->layouts[0] = layout; + config->layouts[1] = g_strdup ("us"); + + /* variants: no change, we keep what we have */ + + /* options: we need to be sure there's a way to change the layout */ + if (!initial_config->options) { + config->options = g_new0 (char *, 2); + config->options[0] = g_strdup (GROUP_SWITCH_DEFAULT); + } else { + int len; + gboolean found; + + found = FALSE; + + for (len = 0; initial_config->options[len] != NULL; len++) { + if (g_ascii_strncasecmp (initial_config->options[len], + GROUP_SWITCH_PREFIX, + strlen (GROUP_SWITCH_PREFIX)) == 0) { + found = TRUE; + break; + } + } + + if (found) { + config->options = g_strdupv (initial_config->options); + } else { + int i; + + config->options = g_new0 (char *, len + 2); + for (i = 0; i < len; i++) { + config->options[i] = g_strdup (initial_config->options[i]); + } + config->options[len] = g_strdup (GROUP_SWITCH_DEFAULT); + } + } +} + + +static void +_gdm_layout_maybe_reinit_group (XklConfigRec *config) +{ + static char **previous_layouts = NULL; + int i; + + if (previous_layouts == NULL) { + previous_layouts = g_strdupv (initial_config->layouts); + } + + if (!config->layouts || !previous_layouts) + return; + + /* compare the two config and only reinit the group if they are + * different */ + for (i = 0; config->layouts[i] && previous_layouts[i]; i++) { + if (strcmp (config->layouts[i], previous_layouts[i]) !=0) { + break; + } + } + + if (config->layouts[i] || previous_layouts[i]) { + xkl_engine_lock_group (engine, 0); + g_strfreev (previous_layouts); + previous_layouts = g_strdupv (config->layouts); + } +} +#endif + void gdm_layout_activate (const char *layout) { @@ -276,10 +374,14 @@ gdm_layout_activate (const char *layout) config->layouts[0][p - config->layouts[0]] = 0; config->variants[0] = g_strdup (p + 1); } + + _gdm_layout_activate_maybe_setup_additional_layout (config); } xkl_config_rec_activate (config, engine); + _gdm_layout_maybe_reinit_group (config); + g_object_unref (config); #endif }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor