Bug 88882

Summary: keyboard layout switching fails after a while
Product: kxkb Reporter: Toby Dickenson <toby>
Component: generalAssignee: Andriy Rysin <arysin>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: patch to kxkb.cpp to recover gracefully if precompiled layout cache file does not work

Description Toby Dickenson 2004-09-05 13:36:34 UTC
Version:            (using KDE KDE 3.3.0)
Installed from:    Gentoo Packages

layout switching work great for a while. I can click on the system tray button to switch between qwerty and dvorak.

After a while it stops working. clicking the button changes it to indicate "err", and the layout does not change. I can make it start working again by changing the keyboard layout configuration.

I note that KXKBApp::precompileLayouts is caching some information in /tmp/. I can provoke identical symptoms by manually deleting /tmp/kde-toby/dvorak.xkm. I suspect this file is getting deleted after a while as part of normal /tmp/ maintenance.
Comment 1 Toby Dickenson 2004-09-05 16:05:50 UTC
Created attachment 7417 [details]
patch to kxkb.cpp to recover gracefully if precompiled layout cache file does not work

Patch to change the behaviour for setting layouts. If using a precompiled
layout fails for any reason, it falls back to using the original method as if
there are no precompiled layouts. It then updates the precompiled layout file
ready for next time.

This certainly fixes the symptoms if I manually delete the cache files from
/tmp/..... I will report back in a few weeks whether it fixes the original
symptoms too.

Thinking aloud: Does it make sense to still precompute all layouts? or would it
be better to use this same mechanism to store them lazily on first use?
Comment 2 Toby Dickenson 2004-09-21 08:56:56 UTC
This patch is working great so far
Comment 3 Andriy Rysin 2004-10-11 01:37:09 UTC
thanks for the patch, I've applied it with some tweaks so kxkb now also have lazy layouts compilation