I've also encountered this issue with TightVNC and the hardy release. My solution was to capture the xmodmap -pke output as ${HOME}/.Xmodmap at the login screen (DISPLAY=:0 XAUTHORITY=/var/lib/gdm/:0.Xauth sudo xmodmap -pke > ${HOME}/.Xmodmap). When gnome-settings-daemon starts up and finds an .Xmodmap, it asks if it should be loaded -- I answer yes. As a side effect, if gnome-settings-daemon were to be restarted without the .Xmodmap, it'd scramble the keyboard layout again. With an .Xmodmap in place, it'll load the .Xmodmap every time.
Due to another issue (#199245, gnome-settings-daemon crashing with BadWindow every time a window is mapped), I disabled the keyboard plugin using gconf-editor, at /apps/gnome_settings_daemon/plugins/keyboard. Since it's not being loaded, I suspect it might not garble the layout even if I remove the .Xmodmap now.
So maybe disabling the keyboard plugin is a better fix.
I've also encountered this issue with TightVNC and the hardy release. My solution was to capture the xmodmap -pke output as ${HOME}/.Xmodmap at the login screen (DISPLAY=:0 XAUTHORITY= /var/lib/ gdm/:0. Xauth sudo xmodmap -pke > ${HOME}/.Xmodmap). When gnome-settings- daemon starts up and finds an .Xmodmap, it asks if it should be loaded -- I answer yes. As a side effect, if gnome-settings- daemon were to be restarted without the .Xmodmap, it'd scramble the keyboard layout again. With an .Xmodmap in place, it'll load the .Xmodmap every time.
Due to another issue (#199245, gnome-settings- daemon crashing with BadWindow every time a window is mapped), I disabled the keyboard plugin using gconf-editor, at /apps/gnome_ settings_ daemon/ plugins/ keyboard. Since it's not being loaded, I suspect it might not garble the layout even if I remove the .Xmodmap now.
So maybe disabling the keyboard plugin is a better fix.