Author Topic: Keyboard shortcuts disabled for alternate layouts  (Read 2447 times)

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Keyboard shortcuts disabled for alternate layouts
« on: March 23, 2019, 02:58:57 pm »
Hi guys.

When I use C::B for code editing, all keyboard shortcuts work as expected. But when I try to edit documents which require keyboard layouts other than Latin (Cyrillic in my case), the shortcuts are not recognized as such anymore. I made an attempt to just add the Cyrillic variants, such as Ctrl+Я for Ctrl+Z, but also failed: the shortcut plugin doesn`t seem to recognize Cyrillic keystrokes at all.

Please help. Having to switch layouts back and forth while editing happens to be very frustrating.

Build: Dec 16 2018, 16:24:23 - wx3.0.4 (Linux, Unicode) - 64 bit - svn 11530

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #1 on: March 23, 2019, 04:51:58 pm »
What are your locale settings?
What is the exact layout you're using?

Which version of wxgtk do you have the one linking to gtk2 or gtk3?
I'm using Bulgarian phonetic layout and shortcuts work fine when using wxgtk3.0.4 and gtk2.
I've also tested the gtk3 version and it works fine, too.

Does shortcuts work correctly in other gtk2 or gtk3 programs when using the Cyrillic layout?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #2 on: March 23, 2019, 06:31:53 pm »
What are your locale settings?
What is the exact layout you're using?
Code: [Select]
$ locale
LANG=ru_RU.UTF-8
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=
Code: [Select]
$ setxkbmap -query | grep layout
layout:     us,ru

Which version of wxgtk do you have the one linking to gtk2 or gtk3?
I'm using Bulgarian phonetic layout and shortcuts work fine when using wxgtk3.0.4 and gtk2.
I've also tested the gtk3 version and it works fine, too.
Code: [Select]
$ ldd $(which codeblocks) | grep wx
libwx_gtk2u_aui-3.0.so.0 => /usr/lib/libwx_gtk2u_aui-3.0.so.0 (0x00007f7a11c1c000)
libwx_gtk2u_propgrid-3.0.so.0 => /usr/lib/libwx_gtk2u_propgrid-3.0.so.0 (0x00007f7a11b2e000)
libwx_gtk2u_xrc-3.0.so.0 => /usr/lib/libwx_gtk2u_xrc-3.0.so.0 (0x00007f7a11a2b000)
libwx_gtk2u_html-3.0.so.0 => /usr/lib/libwx_gtk2u_html-3.0.so.0 (0x00007f7a11956000)
libwx_gtk2u_qa-3.0.so.0 => /usr/lib/libwx_gtk2u_qa-3.0.so.0 (0x00007f7a11925000)
libwx_gtk2u_adv-3.0.so.0 => /usr/lib/libwx_gtk2u_adv-3.0.so.0 (0x00007f7a11744000)
libwx_gtk2u_core-3.0.so.0 => /usr/lib/libwx_gtk2u_core-3.0.so.0 (0x00007f7a110fe000)
libwx_baseu_net-3.0.so.0 => /usr/lib/libwx_baseu_net-3.0.so.0 (0x00007f7a110b6000)
libwx_baseu-3.0.so.0 => /usr/lib/libwx_baseu-3.0.so.0 (0x00007f7a10e13000)
libwx_gtk2u_richtext-3.0.so.0 => /usr/lib/libwx_gtk2u_richtext-3.0.so.0 (0x00007f7a1073b000)
libwx_baseu_xml-3.0.so.0 => /usr/lib/libwx_baseu_xml-3.0.so.0 (0x00007f7a10728000)
Does shortcuts work correctly in other gtk2 or gtk3 programs when using the Cyrillic layout?
Yup. Both GTK2 and GTK3 handle shortcuts just fine, regardless of the layout — except in C::B, that is.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #3 on: March 23, 2019, 06:47:18 pm »
Do you have the keybinder plugin loaded in C::B? What happens if you unload it?
Does shortcuts work in some other wxgtk programs?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #4 on: March 23, 2019, 07:13:49 pm »
No, unloading the keybinder doesn`t help.
And yes, shortcuts in text fields (e.g. Ctrl+A in the search field of AMule or Ctrl+Z/Ctrl+Y in wxHexEditor) do work.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #5 on: March 23, 2019, 07:29:46 pm »
This is really strange. In theory gtk should be responsible for shortcut handling and then it has to pass them to wx and finally C::B gets events from wx for the particular menu command.

Does shortcuts work in text fields in C::B it might be related to our version of wxScintilla...

Can you try to reset the locale locally to en_US.UTF8 and see if this fixes it?
For example start cb from a terminal where you've modified the locale.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #6 on: March 23, 2019, 07:31:54 pm »
Would it be possible to try 17.12 or 16.01?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #7 on: March 23, 2019, 09:34:04 pm »
Can you try to reset the locale locally to en_US.UTF8 and see if this fixes it?
After a system-wide locale reset the problem is still here. Tested on both my SVN build and the stock 17.12.

Does shortcuts work in text fields in C::B
Yes! IncrementalSearch accepts Ctrl+A even when the layout is Cyrillic.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #8 on: March 23, 2019, 10:56:53 pm »
Hm, I can reproduce ctrl-a not working in the editor when in bg layout, so I guess the problem is only with shortcuts created inside scintilla...
Can you confirm? Does ctrl-z, ctrl-o or ctrl-s work for you? They work for me. Only ctrl-a doesn't.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #9 on: March 23, 2019, 11:42:56 pm »
Yes, all three. But e.g. Ctrl+Y, Ctrl+C, Ctrl+V do not.
Is there some quick fix for that?

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #10 on: March 24, 2019, 12:14:42 am »
No idea, I have to inspect the wxSTC/wxscintilla code to find out if is getting the proper codes.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #11 on: March 24, 2019, 12:15:55 am »
You can try the stc sample in wx and if it reproduces you can report a bug in the wxwidgets project. There might be someone which could look at the problem faster.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #12 on: March 24, 2019, 01:02:28 am »
Cloned the latest revision of wxWidgets from Github, built the STC sample.
Behaves as expected — all shortcuts work, regardless of the layout.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #13 on: March 24, 2019, 10:50:34 am »
This is not true. the stcedit has the same problem.
You think it works because more shortcuts are specified for menus for the stcedit sample.

Try ctrl-shift-u and ctrl-u and you'll see they don't work. These two make the selection all upper case and all lower case.

Please log an issue for wxwidgets and give me the link. I'll either follow it and if I find time I'll try to fix it.

An easy workaround/fix for some commands: is to specify a menu short cut using the keybinder plugin.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #14 on: March 24, 2019, 03:27:30 pm »
OK, I can confirm that Ctrl+U / Ctrl+Shift+U shortcuts do not work in Cyrillic layout.
Unfortunately I cannot register in wxWidgets` TRAC to create a ticket =(
For the fourth time I`m told that "a notification email has been resent" but nothing appears in my inbox.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #15 on: March 24, 2019, 03:37:34 pm »
OK, I'll try to log the issue on your behalf...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #16 on: March 24, 2019, 05:21:45 pm »
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #17 on: April 22, 2019, 12:33:53 am »
Heads up, I`ve got news!

This is where the error seems to happen:

Code: C++
  1. int  ScintillaWX::DoKeyDown(const wxKeyEvent& evt, bool* consumed)
  2. {
  3.     int key = evt.GetKeyCode();
  4.     if (key == WXK_NONE) {
  5.         // This is a Unicode character not representable in Latin-1 or some key
  6.         // without key code at all (e.g. dead key or VK_PROCESSKEY under MSW).
  7.         if ( consumed )
  8.             *consumed = false;
  9.         return 0;
  10.     }
  11.  
  12.     ...

WxWidgets Scintilla implementation processes shortcuts not by the keyboard scancode as it needs to be, but by the actual character typed!
Do you guys know how to retrieve scancodes from a wxKeyEvent ?

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #18 on: April 22, 2019, 12:47:10 am »
Update: found it! It`s called wxKeyEvent::GetRawKeyCode(), but its results are platform dependent. Okay that`s fine, I`ve already collected the scancode tables for Windows, Linux and MacOS =)

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #19 on: April 22, 2019, 01:10:14 am »
Please post any of these in the wx's trac...
Here they would get lost...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #20 on: April 22, 2019, 01:12:26 am »
Can I just post a .DIFF patch to wxTRAC?
Something tells me I`m capable of fixing that problem all by myself.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #21 on: April 22, 2019, 08:36:43 am »
Yes, you can.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #22 on: April 22, 2019, 06:00:47 pm »
Done! PR #1305.

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #23 on: April 27, 2019, 02:15:44 pm »
…Guys, would it be too much if I asked you to apply that patch to C::B ahead of the WXW trunk?
Granted, I can just take the source and do that myself, but it`d be way cool if that bugfix made it to C::B, for I doubt I`m the only one experiencing that problem.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #24 on: April 27, 2019, 04:34:44 pm »
I'm hesitant to do it, because syncing the source is already hard and applying this patch it will make it harder.
I guess New Pagodi could help test the patch?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 43

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #26 on: May 24, 2019, 08:14:12 pm »
I'll pick the change next time I update wxscintilla...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Keyboard shortcuts disabled for alternate layouts
« Reply #27 on: August 02, 2019, 11:58:02 am »
In svn...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]