View Issue Details

IDProjectCategoryView StatusLast Update
0015688LazarusWidgetsetpublic2015-04-27 20:02
ReporterFlávio Etrusco Assigned ToZeljan Rikalo  
Status feedbackResolutionopen 
Product Version0.9.28.3 (SVN) 
Summary0015688: Gtk2 native controls fails to input some chars (dead keys) in Ubuntu Lucid
DescriptionI cannot enter pure accents - like '`^~ - in Gtk2 ComboBoxes and Memos (like in the Evaluate window). I can enter áãâ. SynEdit works fine for all chars.
I'm using the latest Ubuntu (Lucid) and gtk2 (2.19.4-1ubuntu3), with "ev-dev handled" keyboard.
Other gtk2 applications work as expected.
TagsNo tags attached.
Fixed in Revision
LazTargetpost 1.4
WidgetsetGTK 2
Attached Files


has duplicate 0016702 closedJuha Manninen TEdit does not support ^ 
related to 0008855 acknowledged Editor does not support fully international keyboard layout 
related to 0024750 feedbackZeljan Rikalo Accents in GTK2 


Bart Broersma

2010-02-23 00:28

developer   ~0034688

Works perfectly well for me on Suse 10.0

Flávio Etrusco

2010-02-23 01:45

developer   ~0034690

Last edited: 2010-02-23 01:45

This is on GNOME, I'm using default gtk input method and either locale en_US.UTF-8 or pt_BR.UTF-8, and either keyboard layouts Brazil-Brazil or US-intl incur in the same problem.

Edit: I'm setting the keyboard with gnome-keyboard-properties, not in xorg.conf.

Bart Broersma

2010-02-23 12:14

developer   ~0034697

Can you set Keyboard method in xorg.conf (I mean does it have any effect, or does GNOME overrule it?)

You might try something like this in xorg.conf:

Section "InputDevice"
  Driver "kbd"
  Identifier "Keyboard[0]"
  Option "Protocol" "Standard"
  Option "XkbLayout" "us"
  Option "XkbModel" "pc104"
  Option "XkbVariant" "intl"
  Option "XkbRules" "xfree86"

(This is for US-international layout)

or run
setxkbmap -variant intl
from a console?

Can you test what happens in either of these scenario's?

Flávio Etrusco

2010-02-24 04:13

developer   ~0034717

Last edited: 2010-02-24 04:26

"setxkbmap -model pc104 -layout us -variant intl" doesn't work either.
BTW Lazarus version is 0.9.29, if you can fix it please.

OT. Dang Mantis. I so would like to receive email notifications :-/

Edit: Oddly enough, some some accents like ´ can be entered by pressing the char twice (instead of char+spacebar). ^ and ~ still fail, though.


2010-02-24 08:47

reporter   ~0034725

I have exactly the same problem here.
openSUSE 11.1 (i586), KDE: 4.1.3, $LANG: de_CH.UTF-8

So this is not Ubuntu or Gnome specific.

Flávio Etrusco

2010-02-24 20:51

developer   ~0034734

theo, what is your gtk2 and xorg-server version? (You compiled Lazarus with gtk, correct?)


2010-02-24 21:03

reporter   ~0034735

GTK2: 2.14.4
xorg-x11: 7.4

Flávio Etrusco

2010-02-25 04:51

developer   ~0034739

Last edited: 2010-02-25 04:52

Mine is: GTK2 2.19.5
xserver-xorg package is 7.5
X -version returns:
  X.Org X Server 1.7.5
  Release Date: 2010-02-16
What about yours, Bart?


2010-02-25 10:19

reporter   ~0034750

The OnKey.. events of TMemo work correctly.
I put a writeln(Key); in OnKeyDown, OnKeyPress, OnUTF8KeyPress, OnKeyup

Pressing ^:

Pressing Space:

So this is as expected.
But nothing shows in the Memo. I get a beep instead.

Bart Broersma

2010-02-25 15:47

developer   ~0034755

bart@simenon:~/LazarusProjecten/ConsoleProjecten> X -version

X Window System Version 6.8.2
Release Date: 9 February 2005
X Protocol Version 11, Revision 0, Release 6.8.2

bart@simenon:~/LazarusProjecten/ConsoleProjecten> rpm -q gtk2

Flávio Etrusco

2010-02-25 20:55

developer   ~0034764

Last edited: 2010-02-27 15:05

Yeah, weird. I'll debug it, since the the UTF8KeyPress is ok. That's what I get:
KeyDown: 16 (shift)
KeyDown: 147
KeyUp: 147
KeyUp: 16
KeyDown: 32
UTF8KeyPress: "^" (the apostrophes are added by my code)
KeyPress: 94 (ascii for ^)
KeyUp: 32

Do you think running it in your setup is of any use, Bart? If so, I can attach the code to save your time.

Edit: fixed nonsense comment about code 147

Bart Broersma

2010-02-25 23:50

developer   ~0034768

Attach a sample program and I'll run it.
Mind you my Lazarus isn't up-to-date ATM (r22593M / fpc 2.2.4)
(Having trouble updating fpc)

2010-02-26 02:35 (130,059 bytes)

Flávio Etrusco

2010-02-26 02:44

developer   ~0034774

Of course you'll need to run it in a terminal or enable the "Use launching application" in the "Run Parameters" dialog.

Bart Broersma

2010-02-26 14:01

developer   ~0034801

(Had to fiddle a bit with the program, it would not compile with fpc 2.2.4 due to new resource system)

Pressing ~ (tilde) followed by space:
KeyDown: 16
KeyDown: 192
KeyUp: 192
KeyUp: 16
KeyDown: 32
UTF8KeyPress: "~" (Length=1, Ord[1]=~)
KeyPress: 126
KeyUp: 32

Pressing ^ (caret) followed by space:
KeyDown: 16
KeyDown: 54
KeyUp: 54
KeyUp: 16
KeyDown: 32
UTF8KeyPress: "^" (Length=1, Ord[1]=^)
KeyPress: 94
KeyUp: 32

Pressing ' (single quote) followed by space:
KeyDown: 222
KeyUp: 222
KeyDown: 32
UTF8KeyPress: "'" (Length=1, Ord[1]=')
KeyPress: 39
KeyUp: 32

All characters show up (after pressing space) in Memo1 as expected.

I seem to get another KeyDown for ^ (me: 54, Flavio: 147) (may be due to other keyboard layout??)

Flávio Etrusco

2010-02-26 14:54

developer   ~0034804

Last edited: 2010-02-26 15:01

> I seem to get another KeyDown for ^ (me: 54, Flavio: 147)
> (may be due to other keyboard layout??)
Yes, I guess so. Theo's are different from ours too.

Apart from the bug, am I the only one that find it odd that UTF8KeyPress pass an ASCII/ANSI string instead of UTF-8? O_o (Man, debugging strings will get messy if gdb doesn't get support to call pascal functions...)


2010-02-26 14:58

reporter   ~0034805

Yes, an I don't need shift to reach '^'.

But what did we learn now?

Is the problem in the keyboard layout or GTK version?

Flávio Etrusco

2010-02-26 15:19

developer   ~0034806

Last edited: 2010-02-26 15:25

I'd speculate it's GTK, but it's just it: speculation. I couldn't get to debug the FCL/RTL and GTK code yet, and AFAICS the data we collected doesn't prove anything.
(And I learned I forgot to add a "Ord" call in the UTF8KeyPress debug :-/ )
Maybe GTK now expects a UTF-8 value (or some other value) somewhere where the LCL pass the ASCII value...

(OT: are both of you receiving email notifications upon changes?)


2010-02-26 15:30

reporter   ~0034808

> Maybe GTK now expects a UTF-8 value (or some other value) somewhere where the LCL pass the ASCII value...

^ is in the ASCII range, so It's the same value for UTF-8: $5E

OT: are both of you receiving email notifications upon changes?

Trying to fix something that works for some is probably not the best idea until we know what makes the difference.

Flávio Etrusco

2010-02-26 15:35

developer   ~0034809

Last edited: 2010-02-26 15:38

> ^ is in the ASCII range, so It's the same value for UTF-8: $5E

Yeah, but maybe it says something that the first KeyDown triggers the UTF-8 value for ^...

> Trying to fix something that works for some is probably not
> the best idea until we know what makes the difference.

Of course. But I'm thinking of something that worked because of some earlier gtk quirky that got removed. And anyway eventually most users will upgrade to newer versions of gtk...

Flávio Etrusco

2010-02-27 14:51

developer   ~0034833

Last edited: 2010-02-27 19:02

Edit: Scrap everything bellow. This works. It must have been some other issue at the time...

Seeing a post in the mailing list I "remembered" another thing: Ctrl+C, Ctrl+V, etc aren't working, too.


2010-02-27 15:08

reporter   ~0034834

Ctrl+C, Ctrl+V work here.

I had a look at yesterday.
I suspect the problem to be somewhere in the area of im_context / gtk_im_context_filter_keypress but I'm lost.
This is one of the more complicated parts of the LCL.
I give up.

Flávio Etrusco

2010-03-01 08:21

developer   ~0034868

Commenting out CheckDeadKey in fixes the issue O_o
Actually, removing gtk_im_context_filter_keypress is what does the job. What's this method supposed to do?
BTW handling of ResetDefaultIMContext is incorrect since it doesn't reset the "buffer" if im_context_widget is nil, which allow you start a composition, move away from the control and continue the composite key (e.g. press ^, move focus away then back, press space, it works!).


2010-03-01 09:19

reporter   ~0034872

> Commenting out CheckDeadKey in fixes the issue

I've tried that, the char appears in the control but the problem is: You don't get correct OnKey events at the same time.

Flávio Etrusco

2010-03-01 19:01

developer   ~0034884

Last edited: 2010-03-01 19:06

theo: Yeah, and menu handling and other stuff go bogus. Sorry, I didn't meant it was a real fix, it was just comment...


2010-03-01 21:56

reporter   ~0034887

This simply disables the LCL to control what's happening.
Still I have a certain feeling ;-) that this the key point.
Maybe it's the sequence in which things happen that has changed.
Or it's necessary to sort of "tell" the control again to enter a character after the LCL has done its work.
But I really don't know. Who has written this part of the LCL?

Zeljan Rikalo

2012-02-04 12:27

developer   ~0056391

Not blocker so postponed.

Zeljan Rikalo

2014-04-12 10:06

developer   ~0074347

@Flavio if you're using scim-bridge then you should test with laz 1.3 r44697.
if not what's im context method in your case ?

Zeljan Rikalo

2014-09-11 06:10

developer   ~0077077

LazTarget moved to post 1.4 since there's no feedback from reporter.

Issue History

Date Modified Username Field Change
2010-02-05 16:14 Flávio Etrusco New Issue
2010-02-05 16:14 Flávio Etrusco Widgetset => GTK 2
2010-02-23 00:28 Bart Broersma Note Added: 0034688
2010-02-23 00:32 Bart Broersma Relationship added related to 0008855
2010-02-23 01:45 Flávio Etrusco Note Added: 0034690
2010-02-23 01:45 Flávio Etrusco Note Edited: 0034690
2010-02-23 12:14 Bart Broersma Note Added: 0034697
2010-02-24 04:13 Flávio Etrusco Note Added: 0034717
2010-02-24 04:26 Flávio Etrusco Note Edited: 0034717
2010-02-24 08:47 theo Note Added: 0034725
2010-02-24 20:51 Flávio Etrusco Note Added: 0034734
2010-02-24 21:03 theo Note Added: 0034735
2010-02-25 04:51 Flávio Etrusco Note Added: 0034739
2010-02-25 04:52 Flávio Etrusco Note Edited: 0034739
2010-02-25 10:19 theo Note Added: 0034750
2010-02-25 15:47 Bart Broersma Note Added: 0034755
2010-02-25 20:55 Flávio Etrusco Note Added: 0034764
2010-02-25 23:50 Bart Broersma Note Added: 0034768
2010-02-26 02:35 Flávio Etrusco File Added:
2010-02-26 02:44 Flávio Etrusco Note Added: 0034774
2010-02-26 14:01 Bart Broersma Note Added: 0034801
2010-02-26 14:54 Flávio Etrusco Note Added: 0034804
2010-02-26 14:58 theo Note Added: 0034805
2010-02-26 15:01 Flávio Etrusco Note Edited: 0034804
2010-02-26 15:19 Flávio Etrusco Note Added: 0034806
2010-02-26 15:25 Flávio Etrusco Note Edited: 0034806
2010-02-26 15:30 theo Note Added: 0034808
2010-02-26 15:35 Flávio Etrusco Note Added: 0034809
2010-02-26 15:38 Flávio Etrusco Note Edited: 0034809
2010-02-27 14:51 Flávio Etrusco Note Added: 0034833
2010-02-27 15:03 Flávio Etrusco Note Edited: 0034764
2010-02-27 15:05 Flávio Etrusco Note Edited: 0034764
2010-02-27 15:08 theo Note Added: 0034834
2010-02-27 19:02 Flávio Etrusco Note Edited: 0034833
2010-03-01 08:21 Flávio Etrusco Note Added: 0034868
2010-03-01 09:19 theo Note Added: 0034872
2010-03-01 19:01 Flávio Etrusco Note Added: 0034884
2010-03-01 19:06 Flávio Etrusco Note Edited: 0034884
2010-03-01 21:56 theo Note Added: 0034887
2010-03-12 14:47 Vincent Snijders LazTarget => 1.0
2010-03-12 14:47 Vincent Snijders Status new => acknowledged
2010-03-12 14:47 Vincent Snijders Target Version => 1.0.0
2010-05-08 03:32 Flávio Etrusco Summary Gtk2 native controls fails to input some chars in Ubuntu Lucid => Gtk2 native controls fails to input some chars (dead chars) in Ubuntu Lucid
2010-05-18 19:49 Flávio Etrusco Summary Gtk2 native controls fails to input some chars (dead chars) in Ubuntu Lucid => Gtk2 native controls fails to input some chars (dead keys) in Ubuntu Lucid
2010-06-13 09:16 Bart Broersma Relationship added has duplicate 0016702
2012-02-04 12:27 Zeljan Rikalo LazTarget 1.0 => 1.2
2012-02-04 12:27 Zeljan Rikalo Note Added: 0056391
2012-03-13 06:50 Vincent Snijders Target Version 1.0.0 => 1.2.0
2013-07-16 06:51 Juha Manninen Relationship added related to 0024750
2014-01-20 12:36 Martin Friebe Target Version 1.2.0 => 1.4
2014-01-20 12:37 Martin Friebe LazTarget 1.2 => 1.4
2014-04-12 10:06 Zeljan Rikalo Note Added: 0074347
2014-04-12 10:06 Zeljan Rikalo Assigned To => Zeljan Rikalo
2014-04-12 10:06 Zeljan Rikalo Status acknowledged => feedback
2014-09-11 06:10 Zeljan Rikalo LazTarget 1.4 => post 1.4
2014-09-11 06:10 Zeljan Rikalo Note Added: 0077077
2015-04-27 20:02 Juha Manninen Target Version 1.4 =>