After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 588900 - XKB settings are picked in a wrong way
XKB settings are picked in a wrong way
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
2.26.x
Other All
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2009-07-17 18:06 UTC by Alexey Rusakov
Modified: 2009-12-21 20:39 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
Apply XKB configuration in a proper order (667 bytes, patch)
2009-07-17 18:15 UTC, Alexey Rusakov
none Details | Review
Just take the current XKB configuration instead of messing with the backup (913 bytes, patch)
2009-07-19 11:38 UTC, Alexey Rusakov
committed Details | Review

Description Alexey Rusakov 2009-07-17 18:06: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.
Comment 1 Alexey Rusakov 2009-07-17 18:15:20 UTC
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.
Comment 2 Alexey Rusakov 2009-07-18 14:15:10 UTC
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 :).
Comment 3 Sergey V. Udaltsov 2009-07-18 14:19:44 UTC
Confirming. GDM should not set it. Or at least should clean it up before the session starts.
Comment 4 Alexey Rusakov 2009-07-19 11:38:50 UTC
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 5 Ray Strode [halfline] 2009-12-21 20:39:22 UTC
Comment on attachment 138731 [details] [review]
Just take the current XKB configuration instead of messing with the backup

Thanks, pushed.