Bug 95635 - Decrease / Increase font size shortcut doesn't work CTRL + ] and CTRL + [ on Windows and german keyboard
Summary: Decrease / Increase font size shortcut doesn't work CTRL + ] and CTRL + [ on ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.6.2 release
Hardware: Other Windows (All)
: medium normal
Assignee: manfred.blume
URL:
Whiteboard: target:6.0.0
Keywords:
Depends on: 36187 51716
Blocks: Shortcuts-Accelerators Shortcuts-AltGR
  Show dependency treegraph
 
Reported: 2015-11-06 14:49 UTC by Jan-Marek Glogowski
Modified: 2018-09-14 13:07 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan-Marek Glogowski 2015-11-06 14:49:39 UTC
Bug 51716 is probably not related, as the shortcuts are registered in officecfg/registry/data/org/openoffice/Office/Accelerators.xcu and work on Linux as expected.

We tested our LO 4.1 and 5.0 Windows builds. Mapping it to some other key, i.e. Ctrl + w, works as expected. Changing the keyboard mapping from German to English doesn't help.
Comment 1 Thorsten Behrens (allotropia) 2015-11-06 14:56:51 UTC
Confirmed, master build from yesterday
Comment 2 Jan-Marek Glogowski 2015-11-09 16:19:00 UTC
There seems a lot of confusion, if AltGr can actually be used correctly on Windows:

 http://superuser.com/questions/592970/can-i-make-ctrlalt-not-act-like-altgr-on-windows

Then there is the GetKeyState function, which is also used by LibreOffice, which retrieves the status of the specified virtual key:

 https://msdn.microsoft.com/de-de/library/windows/desktop/ms646301%28v=vs.85%29.aspx

Finally I found a question in comp.os.ms-windows.programmer.win32: "Alt Gr key and left Ctrl":

 https://groups.google.com/forum/#!topic/comp.os.ms-windows.programmer.win32/3FEE49WzO3E

which suggests, that Windows handles 
 AltGR = GetKeyState(VK_RMENU) < 0 && GetKeyState(VK_LCONTROL) < 0

So in case of VK_RMENU the meaning of VK_LCONTROL is supposed to be inverted?!
Comment 3 Juergen Funk (CIB) 2015-11-12 14:03:06 UTC
The main problem is Windows send automatically, when press ALTGR, the left CTRL-Key (with German-Keyboard-Language). It is not possible to diffrent, is the CTRL-Key pressed or not.
The other problem is always filtering the kombination STRG+ALT that can be ALTGR or STRG+ALT, this i have fixed ,look to tdf#95761

I have made test with MS-Word 2013 with the same kombination "CTRL+]", under Word you set the key-strokes, and then it display "CTRL+ALT+9" and that works but not with the ALTGR-Key.

The other problem is the init in startphase here http://opengrok.libreoffice.org/xref/core/vcl/win/source/app/salinst.cxx#333 in windows you can switch the keyboard-language per application, but the application must be run, the start  of LO is german, then when you switch to english, it doesn't work, the english keys not match with german VirtualKeys. It only works when you change the keyboard-language for the whole system, then when you start LO it works with "CTRL+ALTGR+]". It exist a static table too here http://opengrok.libreoffice.org/xref/core/vcl/win/source/window/salframe.cxx#526 and here http://opengrok.libreoffice.org/xref/core/vcl/win/source/window/salframe.cxx#3279 the function to choose what for table to use.

The next problem is the character-codes the GetMessage-function (GM) here in wParam http://opengrok.libreoffice.org/xref/core/vcl/win/source/window/salframe.cxx#3550
give only the blank key back (without Shift, ALT, ALTGR, STRG) and the PeekMessage (PM) here http://opengrok.libreoffice.org/xref/core/vcl/win/source/window/salframe.cxx#3558 give the converted character back.
e.g.
 * "ALTGR + ]" , GM = 0x39 Zeichen: 9 , PM = 0x5d Zeichen: ]
 * " STRG + I" , GM = 0x49 Zeichen: I , PM = 0x09 Zeichen: tab 
 * " STRG + +" , GM = 0xBB Zeichen: (not in the following table), PM = 0x1d  
 * look https://msdn.microsoft.com/en-us/library/aa299374%28v=vs.60%29.aspx
When CTRL is pressed should us GM but when using ALTGR it need to use PM in depend with the funktion VkKeyScan, this must be the same as in the init of the startphase, look above.
A other side effect of the VkKeyScan is for e.g. the + in the table is that the Virtual-Key-Code 0xBB but when you press "CTRL+ +" then it is the code 0x1BB and then no match, in this case it needed the GM.

I think the best solution is we change the German-Hotkeys without ALTGR-Character. And change the Customise-Keyboard to let set the key-stroke from user, then we not need the init of the virtualkey in the startphase.

A other problem i see is, when change the "CTRL+[" in "CTRL+8" then after the change ist works, but the tooltip for the toolbar-buttons show the old "CTRL+[" that is confusing.
Comment 4 Juergen Funk (CIB) 2015-11-30 07:37:16 UTC
I have made a patch to solve the problem here: https://gerrit.libreoffice.org/#/c/20228/

This fix and that https://bugs.documentfoundation.org/show_bug.cgi?id=95761 solved a lot of hotkey problems under windows.

It exist two other problems:
First here: https://bugs.documentfoundation.org/show_bug.cgi?id=95936
The second:
 Under windows you can change the keyboard layout per application, when run the application, for LO it is possible but the hotkey would be init in the start phase http://opengrok.libreoffice.org/xref/core/vcl/win/source/app/salinst.cxx#333, and when change the keyboard, in this case we must Register the windows message for the keyboard and reinit the hotkey again, otherwise this windows-feature not work correctly for the hotkeys. 

We need this patch in libreoffice 5.0 too
Comment 5 Juergen Funk (CIB) 2015-12-16 10:21:37 UTC
This patch https://gerrit.libreoffice.org/#/c/20228/ solve the problem under Windows but under Linux it has the same problem, and need a other Patch, get no timeslot for that, now
Comment 6 QA Administrators 2017-05-22 13:19:08 UTC Comment hidden (obsolete)
Comment 7 Commit Notification 2017-11-10 15:26:38 UTC
Manfred Blume committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4c9349aef26499b9d80a4d6354680b688a95fb0b

tdf#95635 use different font size keyboard shortcuts

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 manfred.blume 2017-11-16 13:23:41 UTC
IMHO the bug itself is buggy ;)

My point of view:
Using the german keyboard layout (on Windows) the shortcuts CTRL+] and CTRL+[ will not work because there are *no* keys which returns the characters [ or ] without any modifier key.

Only the "shortcut" CTRL+ALT+8 returns the character [.

As long as the set of available characters is keyboard layout dependent, so the available shortcuts ModifierKey1+[ModifierKey2+---]+"Character" should language and/or keyboard layout dependent.