Bug 15900

Summary: Need to create new brazil international variant to handle dead-cedilla
Product: xkeyboard-config Reporter: Eduardo Cereto Carvalho <eduardocereto>
Component: GeneralAssignee: xkb
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: eduardocereto, piterpk, simos.bugzilla
Version: unspecifiedKeywords: NEEDINFO
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: xev output showing '+c giving ccedilla
screenshot showing normal X and GTK+2 applications

Description Eduardo Cereto Carvalho 2008-05-10 20:57:34 UTC
version affected: xkeyboard-config_1.1~cvs.20080104.1-1ubuntu6

A HUGE part of Brazillian users have international keyboards. And to setup these on windows is fairly easy. With xkeyboard-config this is sometimes tricky.

on Windows XP:
1. Control Panel > Regional and Language Options > Languages > detail...
2. Click add...
3. Select Portuguese (Brazil) on input Languages
4. Select United States International under Layout
5. You're done!

on xkeyboard-config:
1. Open xkeyboard-config
2. Select tab Layouts
3. Click Add...
4. Select Layout USA
5. Select International (with dead keys)
6. It's the best you can get, but doesn't work as expected.

The main problem is the ccedilla and Ccedilla keys. On windows you get this with ´+c and ´+C, but on linux it must be typed AltGr+c and AltGr+C.

I understand that this behavior is needed so the variant is the most international possible and can output ć and Ć (witch doesn't exist on portuguese).

So I propose the creation of a new br(br-intl) variant that is exactly us(intl) but output ç and Ç as expected by the Brazilian users, and like Windows does. Also it would be more natural to choose the Brazil layout, since this type of keyboard is so common around here.

There's a ubuntu bug on LP about this with some information:
https://bugs.launchpad.net/ubuntu/+source/xkeyboard-config/+bug/92652
Comment 1 Eduardo Cereto Carvalho 2008-05-10 21:17:12 UTC
Also I was told that changing the values of LANG and LC_* variables to pt_BR.UTF-8 would solve the issue. I tried that and it didn't work for me.

also I didn't know that these env variables could change characters as they're output by X. 

Anyway I think that it feels like a workaround and it should be better if the keyboard worked as expected even if I leave my LANG and LC_* settings untouched.

Can someone explain this behavior?
Comment 2 Eduardo Cereto Carvalho 2008-05-10 22:26:42 UTC
I can't seem to fix this issue. I'm very new to xkeyboard-config.
Someone please help:

I first tried to create a new variant on symbols/br. here's the problematic key:
key <AC11> { [dead_acute, dead_diaeresis, apostrophe,        quotedbl ] };
dead_acute gives me ć, thi is the same as us(intl)
But if I change it to dead_cedilla cedilla looks great but I ruin all other accented keys (á, é, í, ó, ú, etc), and these are all eqaully important for br.

My second shot was to somehow map ć to ç only on this variant. I tried to check files under types/, keycodes/ and compat/. Most seam to give you options to change behavior based on modifiers. I can't seem to find where exactly ´+c is mapped to ć.

I can't find much documentation on dead keys, and I'm assuming that what I want to be is somewhat unusual. Even so i think this is a very important issue for brazillian users.
Comment 3 Eduardo Cereto Carvalho 2008-05-13 06:34:47 UTC
There was a recent comment [2] that remembers that this behavior is not expected only for Brazilians, but also for Canadians, and possibly French as well.

So maybe instead of creating a br-intl (or br-querty) variant it would be better to create a us-cedilla variant as pointed by [1]. So other users that expect ç can benefit.

Personally I think that br-querty is better and we could create the same variant more times as ca-querty and maybe fr-querty.

br-intl is somewhat weird. Since it's br it's no longer international!

Please be sure to read [1] as it has some good insights. 

[1] https://bugs.launchpad.net/ubuntu/+source/xkeyboard-config/+bug/92652/comments/24
[2] https://bugs.launchpad.net/ubuntu/+source/xkeyboard-config/+bug/92652/comments/33
Comment 4 Eduardo Cereto Carvalho 2008-05-19 09:28:03 UTC
I really think that the creation of Brazil internation is a nice addition. If more countries are affected we could easily create a new one like canadian international.

please note that I'm still struggling with the fact that I'm unable to set a key binding that behaves like dead_accute and dead_cedilla depending on the next pressed key. Guidance is appreciated here.
Comment 5 Sergey V. Udaltsov 2008-05-27 15:20:54 UTC
Eduardo, in order to understand the way dead keys work, you should look into the Compose sequences. On my machine they are in /usr/share/X11/locale . Hopefully you'll find there the answer for your question and hints for further progress.
Comment 6 Simos Xenitellis 2008-11-12 09:05:11 UTC
Eduardo, I am not quite clear what you are trying to achieve.

I would recommend you however to check the 'gb' layout, and how they manage to enable typing áéâêäëãẽàèǎěăĕąę and more. This is the default UK English layout.
Comment 7 Sergey V. Udaltsov 2008-12-28 16:57:25 UTC
Eduardo, any progress?
Comment 8 Eduardo Cereto Carvalho 2008-12-29 06:47:07 UTC
I haven't worked in it for a while now. But this is still an issue
AFAIC. I have to start over and check the ideas posted since the last
time I tried to solve this. The problem is that I'm not a developer,
so the progress is slow.
Comment 9 Piter PUNK 2009-01-05 21:04:19 UTC
This isn't an xkeyboard-config bug.

Using us(intl) or us(alt-intl) and pure X applications (like xterm)
'+c gives ç like expected. The problem is with GTK+2 applications. 
To solve that you can:

1. Export GTK_IM_MODULE=cedilla before start GTK applications (.xinitrc is a
   good place to do that)
2. Use az:ca:co:fr:gv:oc:pt:sq:tr:wa locale
3. Include your current locale to gtk.immodules, under im-cedilla.so

Piter PUNK
Comment 10 Sergey V. Udaltsov 2009-01-06 01:25:29 UTC
Eduardo, could you please check and report?
Comment 11 Simos Xenitellis 2009-01-06 03:34:59 UTC
On Tue, Jan 6, 2009 at 5:04 AM,  <bugzilla-daemon@freedesktop.org> wrote:
> http://bugs.freedesktop.org/show_bug.cgi?id=15900
>
>
> Piter PUNK <piterpk@terra.com.br> changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                 CC|                            |piterpk@terra.com.br
>
>
>
>
> --- Comment #9 from Piter PUNK <piterpk@terra.com.br>  2009-01-05 21:04:19 PST ---
>
> This isn't an xkeyboard-config bug.
>
> Using us(intl) or us(alt-intl) and pure X applications (like xterm)
> '+c gives ç like expected. The problem is with GTK+2 applications.

No, GTK+2 applications are good. The problem is in the Brazilian layout.

If you check in the default Brazilian layout (abnt2), there is an
inclusion of the default 'latin' layout, which mentions

    key <AE12>  { [     equal,       plus, dead_cedilla,  dead_ogonek ] };

which corresponds to the '=' and '+' key. If you press AltGr+=, then
c, you *would* get ç.

However, the default Brazilian layout overrides the settings for the
AE12 key with the following

    key <AE12>  { [     equal,       plus,      section,  dead_ogonek ] };

So, with 'abnt2', if you press AltGr + =, you get the 'section'
character instead of the useful 'dead_cedilla'.

What can you do?

Option 1. Move the 'section' character somewhere else on the keyboard,
so that you can use the default location for dead_cedilla.

Option 2. Assign dead_cedilla to another key.


Background:
    key <AE12>  { [     equal,       plus,      section,  dead_ogonek ] };

For this key, if
  1. you press as is, you get 'equal'
  2. you press with Shift, you get 'plus'
  3. you press with AltGr, you get 'section'
  4. you press with Shift, AltGr, you get 'dead_ogonek'.
Comment 12 Piter PUNK 2009-01-06 04:06:05 UTC
Created attachment 21713 [details]
xev output showing '+c giving ccedilla


In the attachment is the xev output showing what happens pressing 
' and then c. Is very clearly the result is a ç.

I am using us(intl) keyboard in this test.

The problem isn't in xkeyboard-config.

Piter Punk
Comment 13 Piter PUNK 2009-01-06 04:29:30 UTC
Created attachment 21716 [details]
screenshot showing normal X and GTK+2 applications


I know screenshots don't "prove" what I am saying.

But here you can see two X applications (rxvt and xterm)
and the ç (result of '+c). The xfce's run window (GTK+2
application) shows ć as result of the same key combination.

I am using en_US as locale and '+c = ç is the expected behavior
looking iso8859-1 Compose file:

# Useful for portuguese language
<dead_acute> <C>			: "\307"	Ccedilla
<dead_acute> <c>			: "\347"	ccedilla

But, en_US.UTF-8 didn't have those in Compose file. There, <dead_acute> <c>
is:

<dead_acute> <C>                        : "Ć"   U0106 # LATIN CAPITAL LETTER C WITH ACUTE
<Multi_key> <acute> <C>                 : "Ć"   U0106 # LATIN CAPITAL LETTER C WITH ACUTE
<Multi_key> <apostrophe> <C>            : "Ć"   U0106 # LATIN CAPITAL LETTER C WITH ACUTE
<combining_acute> <C>                   : "Ć"   U0106 # LATIN CAPITAL LETTER C WITH ACUTE
<dead_acute> <c>                        : "ć"   U0107 # LATIN SMALL LETTER C WITH ACUTE
<Multi_key> <acute> <c>                 : "ć"   U0107 # LATIN SMALL LETTER C WITH ACUTE
<Multi_key> <apostrophe> <c>            : "ć"   U0107 # LATIN SMALL LETTER C WITH ACUTE
<combining_acute> <c>                   : "ć"   U0107 # LATIN SMALL LETTER C WITH ACUTE

The same to pt_BR.UTF-8.

Piter Punk
Comment 14 Simos Xenitellis 2009-01-06 05:01:47 UTC
(In reply to comment #12)
> Created an attachment (id=21713) [details]
> xev output showing '+c giving ccedilla
> 
> 
> In the attachment is the xev output showing what happens pressing 
> ' and then c. Is very clearly the result is a ç.
> 
> I am using us(intl) keyboard in this test.
> 
> The problem isn't in xkeyboard-config.
> 
> Piter Punk
> 

The attached file has the iso-8859-1 encoding, instead of UTF-8.

Could you please provide some more information on the distribution you use?
As far as I known, all mainstream distributions have switched to UTF-8.

Could you try the same with a UTF-8 locale?
Comment 15 Simos Xenitellis 2009-01-06 05:24:14 UTC
(In reply to comment #13)
> Created an attachment (id=21716) [details]
> screenshot showing normal X and GTK+2 applications

Thanks for the detailed reply.
It looks you are using a customised distribution.

If you notice above, I mistakenly assumed you refer to the default Brazilian layout, while you are referring to "us(intl)".

> 
> I know screenshots don't "prove" what I am saying.
> 
> But here you can see two X applications (rxvt and xterm)
> and the ç (result of '+c). The xfce's run window (GTK+2
> application) shows ć as result of the same key combination.

When you mention '+c, I assume you refer to the line

    key <AC11> { [dead_acute, dead_diaeresis, apostrophe,        quotedbl ] };

(in /usr/share/X11/xkb/symbols/us  section: intl)

Thus, when you mention that you press '+c, the compose sequence is

<dead_acute> <c>

> I am using en_US as locale and '+c = ç is the expected behavior
> looking iso8859-1 Compose file:
> 
> # Useful for portuguese language
> <dead_acute> <C>                        : "\307"        Ccedilla
> <dead_acute> <c>                        : "\347"        ccedilla

I would say that having 'dead_acute' + 'c' to match ccedilla is counterintuitive. Most probably, it was created due to the absence of dead_cedilla. I assume the legacy compose files (iso-8859-x) where created between 10-15 years ago.

> But, en_US.UTF-8 didn't have those in Compose file. There, <dead_acute> <c>
> is:
> 
> <dead_acute> <C>                        : "Ć"   U0106 # LATIN CAPITAL LETTER C
> WITH ACUTE
> <Multi_key> <acute> <C>                 : "Ć"   U0106 # LATIN CAPITAL LETTER C
> WITH ACUTE
> <Multi_key> <apostrophe> <C>            : "Ć"   U0106 # LATIN CAPITAL LETTER C
> WITH ACUTE
> <combining_acute> <C>                   : "Ć"   U0106 # LATIN CAPITAL LETTER C
> WITH ACUTE
> <dead_acute> <c>                        : "ć"   U0107 # LATIN SMALL LETTER C
> WITH ACUTE
> <Multi_key> <acute> <c>                 : "ć"   U0107 # LATIN SMALL LETTER C
> WITH ACUTE
> <Multi_key> <apostrophe> <c>            : "ć"   U0107 # LATIN SMALL LETTER C
> WITH ACUTE
> <combining_acute> <c>                   : "ć"   U0107 # LATIN SMALL LETTER C
> WITH ACUTE
> 
> The same to pt_BR.UTF-8.

Since we now have dead_cedilla, I do no think the solution would be to assign dead_acute to produce characters with cedilla.

Looking into the us file, you can get the proper dead_cedilla if you select the 'alt-intl' layout (the 'intl' layout does not have it).

The relevant line is 

  key <AB08> { [      comma, less,           dead_cedilla,  dead_caron      ] };

so you press AltGr + ',', then c, and you get ç.

To answer your question about GTK+ 2.x, loosely speaking it is hard-coded to the /usr/share/X11/locale/en_US.UTF-8/Compose compose file.
Comment 16 GitLab Migration User 2018-12-28 00:45:04 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/issues/116.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.