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 309445 - In right-to-left locales, the text "username" in the login screen is displayed in the wrong position
In right-to-left locales, the text "username" in the login screen is displaye...
Status: RESOLVED OBSOLETE
Product: gdm
Classification: Core
Component: general
2.6.0.x
Other All
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks: Persian
 
 
Reported: 2005-07-04 12:59 UTC by Farzaneh Sarafraz
Modified: 2009-01-08 21:40 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
a screenshot demonstrating the position of the text "username" (438.24 KB, image/png)
2005-07-04 13:05 UTC, Farzaneh Sarafraz
Details

Description Farzaneh Sarafraz 2005-07-04 12:59:43 UTC
Please describe the problem:
In right-to-left locales, the text "username" in the login screen is displayed
in the left side of the username textbox as in the left-to-right locales.
A screenshot is attached demonstrating this problem.


Steps to reproduce:
1. change the system default locale to a right-to-left one, say, Persian
2. view the login screen



Actual results:
The text "username" is placed to the left side of the textbox in the login screen.


Expected results:
the text should have been placed to the right side of the box.

Does this happen every time?
yes.

Other information:
Comment 1 Farzaneh Sarafraz 2005-07-04 13:05:13 UTC
Created attachment 48626 [details]
a screenshot demonstrating the position of the text "username"
Comment 2 Brian Cameron 2005-07-07 01:13:37 UTC
I would accept a patch to fix this.
Comment 3 Behdad Esfahbod 2005-08-02 20:22:24 UTC
I checked HEAD and it seems to be fixed.  The GUI is quite different though.
Comment 4 Brian Cameron 2005-08-03 01:55:27 UTC
Yes, a number of people have been working to make the GDM GUI's more HIG
compliant.  If you have verified that their work has corrected this problem, can
you close the bug?  Thanks.
Comment 5 Behdad Esfahbod 2005-08-03 02:10:50 UTC
yes, the gdmbinary from HEAD was looking good in right-to-left.  There are only
three GTK_DIRECTION_LEFT in the sources that don't look quite as bad, one of
them may need some work though.  Closing.
Comment 6 Haggai Eran 2009-01-05 13:42:34 UTC
Hi,

I've encountered this bug in Ubuntu 8.10. I'm not sure, but I believe this is a newer version then 2005's HEAD. Could you re-open the bug?
I've tried to create a patch bug I'm not sure exactly how to change the text alignment in the GnomeCanvas's TextItem. If anyone could guide me I would gladly create the patch.

Regards,
Haggai Eran
Comment 7 Brian Cameron 2009-01-05 16:26:39 UTC
Please let us know what version of GDM are you using.  Running "gdmflexiserver 
--command=VERSION" or "gdmflexiserver --version" should let you know which 
version you are using.

If you are using GDM 2.20 or earlier, could you run gdmsetup and let us know whether the "Local" tab has "Themed" or "Plain" selected as the choice for "Style"?  Does switching this choice make a difference?

Thanks.
Comment 8 Haggai Eran 2009-01-06 20:35:17 UTC
I'm running GDM 2.20.8. The Style is set to "Themed". When I switched to "Plain" the text was aligned correctly.

Thanks.
Comment 9 Brian Cameron 2009-01-06 21:11:49 UTC
Haggai, thanks for the update.  What theme are you using?  Do you see the same problem with all themes or particular ones?  I'm guessing with all themes, but it is good to check if possible.

Behdad, I'm guessing you tested with gdmlogin (the Plain greeter), and not gdmgreeter (the Themed one) when you said earlier that this was working.  Would you mind checking this again?  It would be good to get this fixed if we could.
Comment 10 Behdad Esfahbod 2009-01-06 22:13:39 UTC
I'm using Fedora which has the new gdm now.  Is the themed one still relevant there?
Comment 11 Brian Cameron 2009-01-06 22:25:34 UTC
No.  It would be nice to fix the bug in the older GDM 2.20 themed greeter if someone has the time to provide a patch, I'd be happy to apply it and do a release.  In the meantime, I guess a workaround is to use the plain greeter if you need RTL support.
Comment 12 Haggai Eran 2009-01-07 07:37:27 UTC
The problem appeared on all the themes I checked (Human, HumanList, HumanCircle, circles, happygnome), except for one. In happygnome-list the problem did not occur. The username text there isn't left justified but centered, so it seems right for both RTL and LTR languages.
Comment 13 Brian Cameron 2009-01-07 15:35:16 UTC
Thank you again for looking into this.  

Note that the theme files are XML format and specified in /usr/share/gdm/themes/(theme_name)/*.xml.  The Username label is specified by the item with id of "pam-prompt" and the entry field is "user-pw-entry".

      <item type="label" id="pam-prompt">
        <pos anchor="nw" x="10%"/>
        <normal color="#000000" font="Sans 12"/>
        <!-- Stock label for: Username: -->
        <stock type="username-label"/>
      </item>
      <item type="rect">
        <normal color="#000000"/>
        <pos anchor="n" x="50%" height="24" width="80%"/>
        <fixed>
          <item type="entry" id="user-pw-entry">
            <normal color="#000000" font="Sans 12"/>
            <pos anchor="nw" x="1" y="1" height="-2" width="-2"/>
          </item>
        </fixed>
      </item>

It shouldn't be hard to modify the "pos anchor=...x=...width=" values to fix it 
to look the way you want.  However, if we wanted to fix the themes so that they look right "out-of-the-box", then we might need to modify the themes to use the approach used in happygnome-list.   If someone wanted to patch the default themes (circles and happygnome) to fix this, I'd be happy to patch the 2.20 branch with the fix.  However, to fix the Human or Fedora themes, you'll need to work with the upstream distros who provide those themes.

Make sense?
Comment 14 Haggai Eran 2009-01-07 16:40:59 UTC
Making all the labels centered is a solution, but I think it limits theme designers too much. It would be better to find a way to make the anchor change according to the language selected, similar to how the plain style greeter works. 
Comment 15 Brian Cameron 2009-01-07 17:19:25 UTC
That would be better, yes.  But since people who write themes are free to set up
their theme in lots of different ways, it would be hard to programmatically manage this in a way that would always work.  You can't really make assumptions that the label and the entry field are in the same container rectangle, or that they the items in the container rectangle are always the same, or that
container rectangles are even being used at all, for example.  If these assumptions were not true, then just changing the anchors wouldn't make the expected difference.  You can, for example, create a theme where nothing is
in a unique container rectangle and everything is just hardcoded to particular 
places on the screen, not using anchors at all.

To fix this the way you suggest, it would probably be necessary to enhance the XML format so that you could define the label and the entry field as a single item that would be managed together by gdmgreeter.  Then GDM could manage this single item in the way you suggest, moving the label as needed.  However, only themes that made use of this new item (rather than the old approach of using two items) would work properly.  Though it wouldn't be hard to enhance a given theme to use the new approach.

This wouldn't be a huge effort to add to the gui/greeter/greeter_parser.c code if someone wants to do the work.  On the other hand, just centering the labels is a fairly straightforward solution that is easier to implement.
Comment 16 Haggai Eran 2009-01-07 20:53:25 UTC
Wouldn't it be better to make it so that labels always have their own container rectangle? If they had a bounding rectangle with them, the program could change the anchor to the left and to the right according to the selected language.

Another solution might be having the entire canvas reversed. Perhaps this can be done with a transformation matrix - I'm not sure, since I haven't used gnome canvas yet. This method has the advantage that themes will look more natural in right to left languages - and similar to how the entire gnome desktop changes when using a right to left language.

I can volunteer to do the coding, or at least try...
Comment 17 Brian Cameron 2009-01-07 21:20:45 UTC
My suggestion in comment #15 is basically the same as making sure that the password entry and label are always in the same container.  As I said, you would need to add a new item type to the XML format to support this, and also modify
the various themes to then use this instead of specifying them separately as they
currently do.

Reversing the entire canvas would also be an interesting way to solve the problem, if it can be done, and works.  I'm not sure about that, but I'm sure someone with the time to investigate how libgnomecanvas works could figure that out.
Comment 18 Farzaneh Sarafraz 2009-01-08 11:04:39 UTC
Making the text centred is not a solution. The bug is about text *direction* rather than *justification*. Right-to-left text can be aligned to right, left, or centred, as well as left-to-right text.

Specifically, centring the "Username:" and "Password:" will make the colons appear to the right (i.e. beginning) of the word in right-to-left scripts which is obviously wrong.
Comment 19 Haggai Eran 2009-01-08 11:57:35 UTC
Perhaps asking to re-opening this bug was a mistake, since I thought it did talk about justification. In any case I haven't had problems with directionality on gdm 2.20.8, and the colon appears at the right place on my computer. I was in fact talking about justification. Should I open a new bug for this?
Comment 20 Brian Cameron 2009-01-08 21:33:15 UTC
Isn't the position of the colon something that is managed in the translation po files?  If so, then this is probably two bugs.

One, perhaps in certain RTL locales, the colon isn't being put in the right place.  What specific locales have this issue.

The other issue is that the Username prompt is appearing on the wrong side of the entry field.

Is this a correct understanding?
Comment 21 Behdad Esfahbod 2009-01-08 21:40:45 UTC
No Brian.  The translation is definitely correct.  The colon will jump to the wrong position if text is rendered LTR instead of RTL.  However, pango defaults to automatic direction detection.  So, unless gdm is getting out of its way to get it wrong, that shouldn't happen.