GNOME Bugzilla – Bug 588900
XKB settings are picked in a wrong way
Last modified: 2009-12-21 20:39:33 UTC
Please describe the problem: When a GNOME session is started from GDM, any default XKB settings that are applied before starting gnome-settings-daemon (e.g., from .xinitrc) are then overwritten by gnome-settings-daemon (even if XKB configuration in GConf is empty). When the same session is started by means of startx, everything gets applied as expected. Steps to reproduce: 0. Pre-requisite: empty GConf configuration in /desktop/gnome/peripherals/keyboard/kbd 1. Write a script that involves setxkbmap with some parameters, and put it in a user's .xinitrc (e.g., add a 2. Login into the user's session from GDM. Observe that XKB configuration is not the one that was set by setxkbmap. 3. Login into the same user in a text console and run the same session by means of startx. Observe that keyboard is correctly configured by setxkbmap. Actual results: Expected results: XKB configuration can be set from session startup scripts and it is applied unless XKB is additionally configured in GConf. Does this happen every time? Yes. Other information: The search for a cause of the problem has brought me to the following difference in the root window properties: when I run the session from GDM, both _XKB_RULES_NAMES and _XKB_RULES_NAMES_BACKUP are set. At the moment of session startup scripts running (before gnome-settings-daemon is started) _XKB_RULES_NAMES corresponds to the configuration set by setxkbmap in the script, and _XKB_RULES_NAMES_BACKUP seems to contain the configuration set by GDM. Then gnome-settings-daemon starts, and _XKB_RULES_NAMES gets overwritten with the data from _XKB_RULES_NAMES_BACKUP. Looking into the code, I see that the configuration from _XKB_RULES_NAMES is loaded, but it the config from _XKB_RULES_NAMES_BACKUP gets a preference. From the talk with svu I suppose that the correct is never apply the configuration stored in _XKB_RULES_NAMES_BACKUP at all. The patch that follows fixes gnome-settings-daemon behaviour.
Created attachment 138629 [details] [review] Apply XKB configuration in a proper order This patch makes gnome-settings-daemon apply first a configuration from GConf, and if one's missing, apply a configuration stored in _XKB_RULES_NAMES, rather than in _XKB_RULES_NAMES_BACKUP.
The patch is irrelevant; actually, the problem is on GDM side - _XKB_RULES_NAMES_BACKUP should not be set by GDM (at least, svu says so :).
Confirming. GDM should not set it. Or at least should clean it up before the session starts.
Created attachment 138731 [details] [review] Just take the current XKB configuration instead of messing with the backup There might have been some reason for GDM to backup the XKB configuration and to read it immediately afterwards. However, this behaviour looks to bring problems, since xkl_engine_backup_names_prop() only makes a backup if it does not exist, and never updates the existing backup. The result is a total disorder whenever gnome-control-center or gnome-settings-daemon try to check out the "default XKB configuration". E.g., when a user presses 'Reset to defaults' button in gnome-keyboard-properties he/she gets a configuration that was actual before GDM started; any XKB settings that were made in session startup scripts are lost. The patch makes GDM just read the current XKB configuration without ever making a backup.
Comment on attachment 138731 [details] [review] Just take the current XKB configuration instead of messing with the backup Thanks, pushed.