Bug 726885 - Keyboard layout indicator of unlock screen dialog shows wrong value sometimes
Keyboard layout indicator of unlock screen dialog shows wrong value sometimes
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libxklavier (Show other bugs)
6.2
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Ray Strode [halfline]
Desktop QE
:
Depends On:
Blocks: 756082 761042
  Show dependency treegraph
 
Reported: 2011-07-30 06:15 EDT by David Jaša
Modified: 2012-06-20 10:28 EDT (History)
3 users (show)

See Also:
Fixed In Version: libxklavier-4.0-9.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 10:28:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
potential patch (719 bytes, patch)
2011-10-26 01:51 EDT, Ray Strode [halfline]
no flags Details | Diff

  None (edit)
Description David Jaša 2011-07-30 06:15:21 EDT
Description of problem:
SSIA. When the layout is switched for the first time, the indicator remains the same, showing now correct layout. The bug is very inconvenient for user who is not aware of it, because he cannot log in despite the layout is "correct" and so is his password.

Version-Release number of selected component (if applicable):
gnome-screensaver-2.28.3-10.el6.x86_64

How reproducible:
often

Steps to Reproduce:
1. 
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Ray Strode [halfline] 2011-08-01 14:43:59 EDT
i can't reproduce, can you give more detailed reproduction instructions?

If i set my layout to say USA + Español then it also reflects the same state as the keyboard layout indicator in the panel before locking. furthermore, a password with "-" in it works when in USA layout, but not with the other layout as expected.
Comment 2 David Jaša 2011-08-02 04:15:58 EDT
It's non-deterministic, now I was't able to reproduce again in some 5 tries, but sometimes the bug occurs much more often. I even encountered it in older versions of gnome screensaver in Ubuntu before I switched to RHEL. Currently, I'm using this configuration:

gconftool-2 -R /desktop/gnome/peripherals/keyboard/kbd
 layouts = [us,cz]
 options = [grp	grp:shift_caps_toggle]
 model = 

It happened to me also when I used different toggle key combo.
Comment 3 David Jaša 2011-08-02 06:46:33 EDT
(In reply to comment #1)
> i can't reproduce, can you give more detailed reproduction instructions?
> 

One more observation: the bug is more likely to occur if the computer is locked for some time e.g. when I go to make myself a tea or when I go to have a lunch.
Comment 4 Ray Strode [halfline] 2011-08-02 10:36:21 EDT
are you switching layout by clicking the indicator or using shift-capslock ?
Comment 5 Suzanne Yeghiayan 2011-10-06 14:51:10 EDT
Since RHEL 6.2 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.
               
Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.
Comment 6 Ray Strode [halfline] 2011-10-13 14:46:55 EDT
in order to get the gnome-shell login screen keyboard layout selector to work in GNOME 3.2, we needed to add the following code to gdm:

http://git.gnome.org/browse/gdm/commit/?id=7c210e29cc4fd2f2a63900d825e451f63a0d9d0d

for RHEL 6.2, we also changed out how the keyboard layout selector worked, and needed to add a similar patch as the above link (for bug 628462)

I suspect it's the same underlying problem here.  If it is the problem, though, then that problem would not show up as long as the user logs in with a gdm greater than or equal to gdm-2.30.4-25

of course there are other valid ways to log in than with recent builds of gdm, so we should figure out a more general solution.

That may involve changing gnome-settings-daemon or somehow fixing libgnomekbd.
Comment 7 Ray Strode [halfline] 2011-10-17 01:35:24 EDT
So after quite some effort Jiri was able to reproduce the problem David mentioned in comment 0 and got me access to a machine exhibiting the issue.  I poked around a little and discovered that adding a call to 

xkl_engine_resume_listen() 

was enough to make clicking the indicator become reactive. 

xkl_engine_resume_listen calls xkl_xkb_get_server_state which updates the curr_state variable.  This variable is used for deciding what layout to show in the indicator.

Normally, the curr_state variable is updated by the xkl_xkb_process_x_event function in response to X events that are supposed to be generated from clicking the indicator.  Those events weren't initially getting sent though.  The events are subscribed to with the XkbSelectEventDetails call during initialization.

I got pulled away at this point, and when I sat down to work on it again later the machine was offline.  I suspect the event details mask is somehow getting corrupted or otherwise restricted, but won't be able to give more details until I can investigate further.
Comment 8 Ray Strode [halfline] 2011-10-26 01:26:41 EDT
I was able to reproduce this in the panel (not gnome-screensaver though) by:

1) Adding a keyboard layout indicator to the panel
2) Right clicking on it and opening keyboard properties
3) Adding another layout (I picked Afghanistan)
4) Clicking Separate layout for each window
5) Changing the default layout to Afghanistan
6) Clicking off Separate layout for each window
7) Logging out
8) Logging back in
Comment 9 Ray Strode [halfline] 2011-10-26 01:51:52 EDT
Created attachment 530223 [details]
potential patch

When the default group is set in the capplet, gnome-settings-daemon sets the XKLAVIER_STATE property on each new window created to point to whatever that default is set to.

The indicator applet looks at the property on the focused window at start up and makes the indicator display match that value.  It doesn't actually set the current layout to match though.

This patch makes everything sync up.
Comment 13 Jiri Koten 2012-04-20 10:47:55 EDT
I can confirm that the problem with wrong indicator and stuck/not clickable indicator in unlock dialog is fixed. 
Indicator shows current layout and is clickable - you can change the layout. Though there is a new issue where the layout is switched when screen is locked - see bug 814636.

Also I'm not 100% sure about the reproducer from comment 8. What is the expected right behavior? 
When I login back (step 8), the indicator shows "en", and the layout is en.
When I leave the "Separate layout for each window" checked, indicator shows "en" right after I login and is changed to "fa" only after I open some window. I would expect that the default (fa) layout shows right after I login.
Comment 14 errata-xmlrpc 2012-06-20 10:28:12 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0923.html

Note You need to log in before you can comment on or make changes to this bug.