Keyboard AltGr key lazarus / 9-Editor ---------------------------------------------------------------------- MaxCuriosus · 2022-02-04 22:15 Keyboard AltGr key not operational with any second key in Lazarus IDE, with MS Wired Keyboard 600 (model 1576) Lazarus 2.0.10 x86_64-linux-gtk2 Debian 11.2 It works fine with "gedit" editor and the terminal. Is there some kind of related settings in Lazarus IDE I should be aware of? ---------------------------------------------------------------------- Martin_fr · 2022-02-04 23:45 What exactly is "not operational"? And are "any second key" other control keys, or letter/digit keys? Usually the IDE treats AltGr as alt + ctrl. So then it depends, what your typing, and if it conflicts with other key combos. For example alt + ctrl + w opens the watches window. But that means, if your local keyboard has some other "input" assigned to that, that other "input" is blocked. ---------------------------------------------------------------------- MaxCuriosus · 2022-02-05 19:41 By not operational I mean that AltGr plus a second key doesn't yield anything. For example with that particular keyboard I should get certain special characters as follow: AltGr + 2 --> @ AltGr + 3 --> # AltGr + e --> € AltGr + à --> { AltGr + $ --> } AltGr + è --> [ AltGr + ¨ --> ] but I don't. Likewise with Alt + Ctrl + . ---------------------------------------------------------------------- winni · 2022-02-05 21:21 Hi! That depends on the keyboard driver of the OS. For german keyboards you got for example this connection: AltGr q --> @ Test your AltGr key binding in some simple editor like joe. Winni ---------------------------------------------------------------------- MarkMLl · 2022-02-05 22:27 Quote from: MaxCuriosus on February 04, 2022, 11:15:27 pmKeyboard AltGr key not operational with any second key in Lazarus IDE, with This is a bit of a minefield. I've been looking recently at the "compose key" functionality, and it varies enormously over different WMs and apps. MarkMLl ---------------------------------------------------------------------- Martin_fr · 2022-02-05 22:53 Well his key bindings must be set to the correct language, if it works in other apps. Good point about VM, etc.   @MaxCuriosus: Please mention if this is running in a VM, or in via any sort of remote connection. There are known issues with at least one remote tool, where some keycodes are sent in an (according to my research) "undocumented" way. But 99% of apps ignore this, and work. Unfortunately LCL is in the list of those affected. (I don't recall the details...) I don't think the IDE has anything on ctrl+alt+2 (But you can check in the keymapping (tools > options > editor > keymapping). So the IDE should not be "eating" this key stroke. Btw, the key-mapping page also has a "capture key" tool. You could check what the LCL records for your ctrl+alt+2 Beyond this, there may be prior bug reports. You may want to search the issue tracker. In the context of other keyboard issues.... Quote from: Martin_fr on September 14, 2019, 12:07:42 pmI had a look, for more verbose logging, compile the IDE with -dVerboseKeyboard -dVerboseKeys and (if compiles) -dVerboseModifiermap --- There are also alternative implementations, but they are ages old, and likely will not compile / And I have no idea what they do, or if they will affect you (if they still work....) -dUseOwnShiftState and/or -dUse_KeyStateList And then run the IDE from a terminal to see any output (or use --debug-log=filename Though I can't promise that much will come from this. If it reveals an issue, it can at least be reported with some information to it. I wont be able to do much about it myself. ---------------------------------------------------------------------- MaxCuriosus · 2022-02-06 19:49 winni, take a look at the attached keyboard layout as seen by the Debian OS. It does correspond to the physical layout of the keyboard. I can get the special characters in various applications, including nano GNOME Terminal gedit Nautilus (default file manager of the GNOME desktop) LibreOffice etc. The behavior is the same with another similar keyboard (different make and model). The bahavior is also the same regardless of the OS installation language, en-US or otherwise. ---------------------------------------------------------------------- MaxCuriosus · 2022-02-06 19:50 Martin_fr, no VM, no remote connection, it's a plain vanilla system configuration, so to speak. Keymapping doesn't show anything unusual (default installation configuration) and nothing for Alt+Ctrl+2. I've noticed the problem with the Lazarus editor but in a running application, using for instance a component like TEdit, it works fine. ---------------------------------------------------------------------- Martin_fr · 2022-02-06 20:23 TEdit maps directly into a gtk2 widget. TSynEdit, any TCustomControl, any OnKeyPress event, ... they have different key handling. ---------------------------------------------------------------------- dbannon · 2022-02-06 23:46 Now, wild suggestion. I suspect this issue is a about getting the extended characters ?   If not, please stop reading. Does it do the extended characters via the "compose Key" method ? I ask because I have never heard of a AltGr key and I don't use extended characters. This bug https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/38454 points out that Lazarus components don't handle the compose key approach correctly, with each component seeming to deliver its own special error. Its a UTF8 issue I understand. Davo ---------------------------------------------------------------------- Martin_fr · 2022-02-07 00:44 I think the compose issue is likely a different issue (though it could end up being caused by related code, even if maybe just coincidental). The "compose" issue has had various reports. Usually as "dead key" issue. E.g. https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/15688 ---------------------------------------------------------------------- MarkMLl · 2022-02-07 08:10 Quote from: Martin_fr on February 07, 2022, 01:44:00 amI think the compose issue is likely a different issue (though it could end up being caused by related code, even if maybe just coincidental). The "compose" issue has had various reports. Usually as "dead key" issue. E.g. https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/15688 Reading around, it's an interaction of window manager and widget set. It might be possible to "tune" the WM aspect of it by fudges at the X level, but the bottom line is that most people don't and TBH shouldn't have to to get the widget set working properly. With all of these things there's a possibility that it's in the LCL interface code, but TBH I'd be surprised. MarkMLl ---------------------------------------------------------------------- winni · 2022-02-07 09:26 Quote from: dbannon on February 07, 2022, 12:46:28 am Does it do the extended characters via the "compose Key" method ? I ask because I have never heard of a AltGr key and I don't use extended characters. Davo Hi! For your information. AltGr is default on german keyboards It is used for typing @ € µ ² ³ and some others. Winni ---------------------------------------------------------------------- MaxCuriosus · 2022-02-07 14:37 I'm not sure what to conclude. Which one of the following apply: 1) AltGr not planned to be implemented in Lazarus editor 2) The implementation has been overlooked 3) There is an incompatibility with Linux distribution 4) There is a bug 5) or else? Note that with the same Lazarus version and keyboard, AltGr works fine with Debian 10.7! ---------------------------------------------------------------------- dseligo · 2022-02-07 17:17 Quote from: MaxCuriosus on February 07, 2022, 03:37:48 pmNote that with the same Lazarus version and keyboard, AltGr works fine with Debian 10.7! And it works just fine in Windows too. Did you try to capture it with 'capture key' tool, as Martin_fr suggested? Quote from: Martin_fryou can check in the keymapping (tools > options > editor > keymapping). So the IDE should not be "eating" this key stroke. Btw, the key-mapping page also has a "capture key" tool. You could check what the LCL records for your ctrl+alt+2 ---------------------------------------------------------------------- Martin_fr · 2022-02-07 17:21 Quote from: MaxCuriosus on February 07, 2022, 03:37:48 pmI'm not sure what to conclude. Which one of the following apply: 1) AltGr not planned to be implemented in Lazarus editor 2) The implementation has been overlooked 3) There is an incompatibility with Linux distribution 4) There is a bug 5) or else? Note that with the same Lazarus version and keyboard, AltGr works fine with Debian 10.7! Ok to clarify: AltGr should work. If it is not working, then this is a bug. Unless documented as unsupported for specific Linux versions: Maybe specific kernel version, or Gtk version, or IM module.... I am not aware of such docs at current. "An incompatibility" can be a bug too. If it is a bug, it has however to be established if that bug is part of the LCL/Lazarus Code. Or if it is part of some other software/driver on that OS. I.e., just because other apps like GEdit work with a specific setup does not mean that the setup does not have a bug. (It's complicated) If it is a bug in the LCL/Lazarus, then the question is, if it can be reproduced by someone who is also able to write a fix. (And to verify that the fix does not break other conditions. E.g. if gtk doc says "must handle "foo=x" and the current implementation has code like "if foo=x then", then the patch must not remove this without explaining how it is handled in future....) Apropos "IM" Some IM modules have caused other key input issues in the past. Maybe changing the IM setting can work-around (and narrow the issue). Also, one of my above posts linked-to/quoted  un-tested IM related Lazarus code (IFDEF). That code is not currently in use, but can be activated for testing. So who knows.... https://forum.lazarus.freepascal.org/index.php/topic,46731.msg333712.h tml#msg333712 ---------------------------------------------------------------------- Martin_fr · 2022-02-07 17:36 On the "is it a bug" question. If there is no already existing report, then it can certainly be reported to our issue tracker. If it turns out, that it is something else, or somewhere else...., It can still be closed then. However, looking at the related issues, it may still make sense to work out as much extra info as possible. Even though, I do not know if this will in any way affect the outcome. For completeness sake, maybe I should point out: I am not the Gtk-WS maintainer. I will (99.99% likely) not work on the actual fix of the issue. Hence, I can not tell how helpful further info really will be. The above "pointers" towards possible causes or workarounds are purely based, on me following (as observer) prior discussions on related issues. ---------------------------------------------------------------------- MaxCuriosus · 2022-02-08 15:17 Test #1 Tools > Options > Key Mappings > Find key combination > Load a scheme: Lazarus default or Classic > Grab key       AltGr yields Alt OEM_0xE3, it doesn't expect a second key     Other keys or key combinations seem to match exactly the standard en-US keyboard. Test #2 This Debian 11 system is setup with 3 different input sources(keyboards) in this order: English (US) French (Switzerland) Italian With the Gnome settings utility I changed the list order to put the desired French keyboard on top and that eliminates the anomaly, even without restarting Lazarus! The same applies to Debian 10. Is it still a bug, and if so where? Lazarus, Debian, Gnome or else? ---------------------------------------------------------------------- Martin_fr · 2022-02-08 16:40 Quote from: MaxCuriosus on February 08, 2022, 04:17:21 pm> Grab key       AltGr yields Alt OEM_0xE3, it doesn't expect a second key     Other keys or key combinations seem to match exactly the standard en-US keyboard. ok, that is strange... This looks to me (but I may be wrong), as if on your setup "AltGr" produces an actual key. Probably a "dead key" (but that is really a wild guess). "dead keys" are e.g. on some keyboards accents, which you press (and release, you do not hold them) and then the next key will produce an accented char... Obviously from a pure technical point of view, producing such a dead key would work. The next e.g. "q" would give an "@" (ignoring that you still hold the AltGr. If indeed that is the case, well I find it surprising. AltGr is usually meant to act as modifier key (like shift/ctrl) that act as long as they are pressed. Also, if they produce a dead key, what happens if you press "q" several times (and keep AltGr down all the time). That wouldn't work with dead keys. So if that works on your setup, then I have no idea what is going on. Anyway as I said: Wild guesses. No idea. Though if it is a "dead key", then it may be related to the "dead key" bug that I linked earlier (or any of the other bugs in that category).... QuoteIs it still a bug, and if so where? Lazarus, Debian, Gnome or else? Sorry, no idea. If in doubt, report it as a bug. Worst case it gets closed. Link to the "dead key" issue - in case... Despite the above leaving me clueless (i.e. not matching any prior case that I have seen), I do have a gut feeling it is IM related ("IM" => "Input Manager", search the forum or bug tracker / there are several IM that can be installed in Linux). And, if it is IM, look at the defines I pointed out. Some one did contribute some code there, that he said adds some IM handling. This code has not yet been fully reviewed. So it's not active by default. But if compiled with the defines given, then it will be active. Could be a lucky strike, and help with the issue. Or not. I can't test it, since none of my Linux systems has any of those issues. ---------------------------------------------------------------------- winni · 2022-02-08 18:45 Hi! Different values in german surrounding: AltGr returns decimal 235 = $EB A comment in LCLtype says: $E9-$F5 OEM specific (line 608) Tested with TForm1.Keydown and with the keygrabber from the IDE tools. Winni ---------------------------------------------------------------------- MarkMLl · 2022-02-08 19:02 Quote from: Martin_fr on February 08, 2022, 05:40:36 pmProbably a "dead key" (but that is really a wild guess). "dead keys" are e.g. on some keyboards accents, which you press (and release, you do not hold them) and then the next key will produce an accented char... I think it's necessary to distinguish between "dead" in the ASCII (etc.) sense and "dead" in the scancode sense. I looked at this in some detail when doing an APL-capable terminal emulator, and as I've already said the detail varied between widget sets. MarkMLl ---------------------------------------------------------------------- Martin_fr · 2022-02-08 19:20 ok, seems maybe normal for Linux. On my Fedore AltGr 2 give ² (superpositioned 2). This works in the IDE too. And indeed the IDE says, that AltGr is Alt + 0xE3