xkeyboard-config has nothing to do with it. neither xorg. The apps/toolkits get notifications about both keycodes and keysyms (and modifiers and groups etc). The rest is up to them. If some key produces letter S with group 1, and some other key produces letter S with group 2 - xkb can do nothing with the app looking for the symbol S but not for the keycodes.
AFAIK gtk does not do any bad hacks - it correctly(!) just looks through all the symbols in all groups of the pressed key.
PS Though, being Russian, I personally really like the way gtk behaves - and sincerely cannot understand users having several latin layouts in one configuration
xkeyboard-config has nothing to do with it. neither xorg. The apps/toolkits get notifications about both keycodes and keysyms (and modifiers and groups etc). The rest is up to them. If some key produces letter S with group 1, and some other key produces letter S with group 2 - xkb can do nothing with the app looking for the symbol S but not for the keycodes.
AFAIK gtk does not do any bad hacks - it correctly(!) just looks through all the symbols in all groups of the pressed key.
PS Though, being Russian, I personally really like the way gtk behaves - and sincerely cannot understand users having several latin layouts in one configuration