Bug 54169 - LibO doesn’t obey Windows OS setting “only show the accelerator underline when the Alt key is being pressed”
Summary: LibO doesn’t obey Windows OS setting “only show the accelerator underline whe...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All Windows (All)
: high normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:5.4.0 target:24.8.0
Keywords:
: 58418 92008 (view as bug list)
Depends on:
Blocks: Shortcuts-Accelerators Desktop-Integration
  Show dependency treegraph
 
Reported: 2012-08-28 21:13 UTC by Samuel Mehrbrodt (allotropia)
Modified: 2024-03-14 07:55 UTC (History)
18 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 Samuel Mehrbrodt (allotropia) 2012-08-28 21:13:18 UTC
On Ubuntu, acceleators (underlined characters to access with the keyboard) on Buttons, checkboxes and in the Menu are only shown when pressing the [ALT] key.

Libreoffice always shows the accelerators and this is inconsistent with the Ubuntu Design.
Comment 1 Jean-Baptiste Faure 2012-08-29 05:45:49 UTC
I do not reproduce with Version 3.7.0.0.alpha0+ (Build ID: 96fb245)
Which build did you use? Your own build or a daily build?
If it is your own build, I suggest you to make a fresh build (make clean the make dev-install) and try again.

Best regards. JBF
Comment 2 Samuel Mehrbrodt (allotropia) 2012-09-03 19:31:48 UTC
It is my own build.

I did a fresh build last night and I still have this behavior.
Comment 3 Michael Meeks 2012-11-01 14:45:51 UTC
I guess we would need to add some VCL support for underline accelerators appearing only on alt keypress. I assume it's fine to continue to write Ctrl+O in the File menu against Open (eg.) ? :-)

I guess that something like:

void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr,
                                 xub_StrLen nIndex, xub_StrLen nLen,
                                 sal_uInt16 nStyle, MetricVector* pVector, String* pDisplayText )

Which has a nStyle that controls whether the mnemonic text is rendered or not would need some hackery - and clearly we'd need to trigger a re-draw of any controls that include such text as/when the user hits the Alt button in various dialogs.

And we'd need a style-setting from the gtk+ backend / theme to detect whether or not to do that. It's quite do-able;

Patches more than welcome :-)
Comment 4 Samuel Mehrbrodt (allotropia) 2013-01-29 07:25:19 UTC
The method mentioned is here:
http://opengrok.libreoffice.org/xref/core/vcl/source/gdi/outdev3.cxx#7088

Marking as ProposedEasyHack.
Comment 5 Samuel Mehrbrodt (allotropia) 2013-02-13 19:51:24 UTC
Here's how GTK did this: https://bugzilla.gnome.org/show_bug.cgi?id=588554
Comment 6 Samuel Mehrbrodt (allotropia) 2013-02-14 08:25:00 UTC
*** Bug 58418 has been marked as a duplicate of this bug. ***
Comment 7 Samuel Mehrbrodt (allotropia) 2013-02-14 08:33:14 UTC
Windows, Mac OS X and Gnome have this setting as default. I have seen only KDE that has the accelerator underline always there.
Comment 8 Björn Michaelsen 2013-10-04 18:47:05 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 9 Robinson Tryon (qubit) 2013-10-19 01:02:13 UTC Comment hidden (obsolete)
Comment 10 Chris Welsh 2015-06-18 03:37:34 UTC
Many applications have a setting in 'view' to disable mnemonics if they do not obey system settings. Mnemonics aren't standard on most platforms and it is a glaring inconsistency to have them always present. Please create a system to either disable them or only show them on 'alt' press.
Comment 11 tommy27 2015-06-18 05:17:45 UTC
@Chris 
please don't change version field.
as indicated it has to show "earliest affected" version.
so reverting to the original value
Comment 12 Adolfo Jayme Barrientos 2015-07-09 18:51:11 UTC
Tentatively fixed with http://cgit.freedesktop.org/libreoffice/core/commit/?id=74407aef94b6d8dfdd69891c4a6e578587ef3e71

*** This bug has been marked as a duplicate of bug 92630 ***
Comment 13 Samuel Mehrbrodt (allotropia) 2015-07-10 07:06:43 UTC
*** Bug 92008 has been marked as a duplicate of this bug. ***
Comment 14 Samuel Mehrbrodt (allotropia) 2015-07-10 07:07:13 UTC
This is still open for Windows and Mac.
Comment 15 tommy27 2015-07-10 07:21:56 UTC
let' put it back to NEW then
Comment 16 How can I remove my account? 2015-07-10 07:34:08 UTC
Is "accelerator" even a thing on OS X? Shortcuts (like ⌘-F for "Find), sure, but I don't think it has accelerators.
Comment 17 Samuel Mehrbrodt (allotropia) 2015-07-10 08:50:18 UTC
http://superuser.com/a/24163 says the same. Then it should be disabled completely in OS X, I guess.
Comment 18 Samuel Mehrbrodt (allotropia) 2015-07-10 09:53:32 UTC
So, on Windows we need to check the registry for HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Preference

If the string value "On = 1", mnemonics should always be shown. Else they should only be shown when the alt key is pressed.

Someone with a Windows build might do this as EasyHack.
This is the place where it should be enabled/disabled: http://opengrok.libreoffice.org/xref/core/vcl/win/source/gdi/salnativewidgets-luna.cxx#193
Look here for how to enable/disable mnemonics: http://opengrok.libreoffice.org/xref/core/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx#569
And check this for how to query the Windows registry: http://opengrok.libreoffice.org/xref/core/vcl/source/window/toolbox.cxx#5649

Should be straight-forward.
Comment 19 Cor Nouws 2015-11-29 14:22:23 UTC
this has changed on Ubuntu. Fixed there. On Win/Mac too?
Comment 20 tommy27 2015-12-01 05:37:14 UTC
it's still reproducible under Win8.1 x64 using LibO 5.0.3.1 and recent LibO 5.1.0.0 daily build.

accelerators underlines are always shown even if the "hide accelerators until Alt key is pressed" option is set.  see: http://bit.ly/1Iyej2O

anyway this has always been like that since I see the same behaviour in LibO 3.3.3, OOo 3.3.0 and AOO 4.1.0

so the bug is inherited from OOo. updating version field.
Comment 21 Robinson Tryon (qubit) 2015-12-14 07:01:59 UTC Comment hidden (obsolete)
Comment 22 Shubham Tibra 2016-01-08 13:25:57 UTC
Hi! I am starting to work on this bug.
Comment 23 How can I remove my account? 2016-01-15 06:53:08 UTC
Shubham, are you still working on the bug? Last night somebody else on IRC also claimed to be working on this, and apparently he/she was too shy to ask here.

Note that to intentionally and knowingly work on a bug that somebody else is already working on does not increase one's chances to qualify for GSoC. This is not some kind of competition. Showing co-operation skills is essential.
Comment 24 Shubham Tibra 2016-01-15 13:06:53 UTC
(In reply to Tor Lillqvist from comment #23)
> Shubham, are you still working on the bug? Last night somebody else on IRC
> also claimed to be working on this, and apparently he/she was too shy to ask
> here.
> 
> Note that to intentionally and knowingly work on a bug that somebody else is
> already working on does not increase one's chances to qualify for GSoC. This
> is not some kind of competition. Showing co-operation skills is essential.

No, currently I am working on another bug.So, anyone else can work on it :)
Comment 25 Pranav Ganorkar 2016-02-13 15:02:02 UTC
Hi, I will be working on this bug...
Comment 26 Pranav Ganorkar 2016-02-13 15:11:27 UTC
As Mentioned by Samuel Mehrbrodt, the following links are not opening..it gives file not found error.

(In reply to Samuel Mehrbrodt (CIB) from comment #18)
> So, on Windows we need to check the registry for HKEY_CURRENT_USER\Control
> Panel\Accessibility\Keyboard Preference
> 
> If the string value "On = 1", mnemonics should always be shown. Else they
> should only be shown when the alt key is pressed.
> 
> Someone with a Windows build might do this as EasyHack.
> This is the place where it should be enabled/disabled:
> http://opengrok.libreoffice.org/xref/core/vcl/win/source/gdi/
> salnativewidgets-luna.cxx#193
> Look here for how to enable/disable mnemonics:
> http://opengrok.libreoffice.org/xref/core/vcl/unx/gtk/gdi/salnativewidgets-
> gtk.cxx#569
> And check this for how to query the Windows registry:
> http://opengrok.libreoffice.org/xref/core/vcl/source/window/toolbox.cxx#5649
> 
> Should be straight-forward.

Hi , Samuel the links are not opening currently....have the files been moved to some other place ?
Comment 27 Cor Nouws 2016-02-13 15:26:44 UTC
(In reply to Pranav Ganorkar from comment #26)
 
> Hi , Samuel the links are not opening currently....have the files been moved
> to some other place ?

Migt be. You can use opengrok.libreoffice.org to search for e.g. "salnativewidgets-gtk.cxx"

Cor (not Samuel, obviously)
Comment 28 Samuel Mehrbrodt (allotropia) 2016-02-16 10:56:08 UTC
(In reply to Pranav Ganorkar from comment #26)
> Hi , Samuel the links are not opening currently....have the files been moved
> to some other place ?

http://opengrok.libreoffice.org/xref/core/vcl/win/gdi/salnativewidgets-luna.cxx
http://opengrok.libreoffice.org/xref/core/vcl/unx/gtk/salnativewidgets-gtk.cxx
Comment 29 Pranav Ganorkar 2016-02-16 11:52:16 UTC
Thanks Samuel and Cor. I got it.
Comment 30 Robinson Tryon (qubit) 2016-02-18 14:52:21 UTC Comment hidden (obsolete)
Comment 31 jani 2016-04-18 07:35:46 UTC
A polite ping, still working on this issue?
Comment 32 jani 2016-06-20 05:39:24 UTC
Unassigning due to lack of work.
Comment 33 Commit Notification 2016-12-08 09:13:43 UTC
Abhilash Singh committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=64889c9fb6c3e8e7b7a7349833f7a10236104168

tdf#54169 Don't show acclerators by default on Windows

It will be available in 5.4.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 34 Luke 2016-12-15 04:52:16 UTC
Some commit in this range
https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=+83c6c871db3eb11e284909902e0dc639e9753136..a238c829b209d0708714aa753fb686525411825f

Has been turned LO into mouse-only application under Windows. All of my muscle memory commands, such as ALT-F,S, ALT-F,X, D. etc do not work anymore. This makes LO unable for keyboard users such as myself.

Abhilash Singh,
Do you understand that hiding the "accelerator underline" does not disable the accelerator itself? It just hides it until the ALT key is pressed. Use any windows app from Notepad to Word and you will see that pressing Alt makes the underline appear and all the shortcuts work even though their "hint" is not displayed until the alt key is pressed. This is how every Windows Application functions.  

The intent of this bug report is to make Windows LOOK like these other applications. Not disable all accelerators. 


Noel, Samuel, or Abhilash
Can you please revert this commit ASAP as 
     a)	it doesn’t actually solve Bug 54169 and 
     b)	it makes LO unusable for keyboard people
Comment 35 abhilash300singh 2016-12-15 07:41:57 UTC
I'm looking back at the issue. Until then, the patch should be reverted or, Luke, you can turn on your "make keyboard easier to use" accessibility option, and LO should show accelerators all the time, which it seems, is the only thing that this patch handles.

Thanks.
Comment 36 Commit Notification 2016-12-15 08:19:13 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

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

Revert "tdf#54169 Don't show acclerators by default on Windows"

It will be available in 5.4.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 37 jani 2017-01-09 09:02:17 UTC
Seems solved, if not it would be nice to read what is still open ?
Comment 38 Dennis Roczek 2017-01-09 09:33:31 UTC
Revert "tdf#54169 Don't show acclerators by default on Windows"
--> we are back to start
Comment 39 jani 2017-02-13 07:14:42 UTC
A polite ping, still working on this patch ?
Comment 40 jani 2017-05-14 07:42:44 UTC Comment hidden (obsolete)
Comment 41 Xisco Faulí 2017-06-14 02:22:27 UTC Comment hidden (obsolete)
Comment 42 Xisco Faulí 2017-07-15 02:31:51 UTC Comment hidden (obsolete)
Comment 43 Xisco Faulí 2017-08-15 02:23:45 UTC Comment hidden (obsolete)
Comment 44 Sourabh 2018-02-22 08:05:11 UTC
i want to work on this issue please help me out
Comment 45 Dennis Roczek 2018-02-22 15:28:57 UTC
@Sourabh: Which information do you need? check the reverted commit and the hints Samuel was giving (opengrok-links).
Comment 46 Sourabh 2018-02-23 10:48:16 UTC
(In reply to Dennis Roczek from comment #45)
> @Sourabh: Which information do you need? check the reverted commit and the
> hints Samuel was giving (opengrok-links).

i did not understand what do you meant by reverted commit
Comment 47 Dennis Roczek 2018-02-23 11:11:09 UTC
(In reply to Sourabh from comment #46)
> (In reply to Dennis Roczek from comment #45)
> > @Sourabh: Which information do you need? check the reverted commit and the
> > hints Samuel was giving (opengrok-links).
> 
> i did not understand what do you meant by reverted commit

see Comment 36
Comment 48 Sourabh 2018-02-23 12:04:35 UTC
(In reply to Sourabh from comment #46)
> (In reply to Dennis Roczek from comment #45)
> > @Sourabh: Which information do you need? check the reverted commit and the
> > hints Samuel was giving (opengrok-links).
>(In reply to Dennis Roczek from comment #47)
> (In reply to Sourabh from comment #46)
> > (In reply to Dennis Roczek from comment #45)
> > > @Sourabh: Which information do you need? check the reverted commit and the
> > > hints Samuel was giving (opengrok-links).
> > 
> > i did not understand what do you meant by reverted commit
> 
> see Comment 36

Actually i mean to say i am not able to understand the large codebase ?should i need to spent time more time in this?
Comment 49 Xisco Faulí 2018-03-26 02:29:48 UTC Comment hidden (obsolete)
Comment 50 Xisco Faulí 2018-04-26 02:36:49 UTC Comment hidden (obsolete)
Comment 51 Xisco Faulí 2018-06-21 02:49:34 UTC Comment hidden (obsolete)
Comment 52 Xisco Faulí 2018-07-22 02:35:48 UTC Comment hidden (obsolete)
Comment 53 Xisco Faulí 2018-08-22 02:33:48 UTC Comment hidden (obsolete)
Comment 54 Julien Nabet 2019-05-27 13:47:59 UTC
Should it still be reserved for those who need to submit fix for easyhacks after all this time or anyone may suggest a patch?
Comment 55 Xisco Faulí 2020-03-09 13:28:40 UTC
Please add keyword 'needsUXEval' and CC 'libreoffice-ux-advise@lists.freedesktop.org' if input from UX is needed.
Comment 56 Mike Kaganski 2021-01-09 09:57:26 UTC
(In reply to Samuel Mehrbrodt (CIB) from comment #18)
> So, on Windows we need to check the registry for HKEY_CURRENT_USER\Control
> Panel\Accessibility\Keyboard Preference
> 
> If the string value "On = 1", mnemonics should always be shown. Else they
> should only be shown when the alt key is pressed.

Just a mention that we should not use a registry read to get the setting. Rather, a call to SystemParametersInfoW [1] is needed to get the value of SPI_GETKEYBOARDCUES, which is the setting we are looking for.

Commit 53df91adab37a65d87a44aa724b28128f32e9de5[2] had removed the mbEnableAccel, which was the thing wrongly handled in the previous commit (see comment 33, reverted in comment 36). So now the change is even easier, only needs to care about mbAutoAccel.

But the task is complicated by strange processing inside MenuBarWindow::HandleKeyEvent. For some reason, it makes the underline depend on pressing Esc key, thus after first show of underline caused by Alt, the underline will correctly hide, but then not shown until Esc is pressed.

Further, the underline should be also shown in menu when F10 is pressed - generally, on any activation of menu on Windows. But it would only blink currently in that case (also only once, and not blink again until Esc is pressed).

[1] https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfow
[2] https://git.libreoffice.org/core/+/53df91adab37a65d87a44aa724b28128f32e9de5
Comment 57 Mike Kaganski 2021-01-09 10:00:21 UTC
... and further, the underline in menu must stay all the time the menu is active, i.e. Alt activates the menu and the underline, then pressing arrow keys should change the active menu item, but keep underline.
Comment 58 Mike Kaganski 2021-01-09 10:11:25 UTC
In short, the problems highlighted in comment 56 and comment 57 may be fixed by replacing the check for KEY_ESCAPE in the code that controls showing accelerators in MenuBarWindow::HandleKeyEvent in vcl/source/window/menubarwindow.cxx with a check if there is an highlighted menu item (i.e., m_nHighlightedItem is not ITEMPOS_INVALID). However, it should be checked if this does not cause unexpected change of behavior in non-Windows environments, where the expected interactions might differ.
Comment 59 Mike Kaganski 2021-01-10 06:55:28 UTC
Dumping here the Windows intended underlining behavior (as one may see e.g. using Notepad.exe, or notepad++).

1. For menus: Entering the menu from keyboard (Alt or F10) starts underline mode; leaving menu (*including by mouse*) stops this mode.
2. For dialogs: Pressing Alt starts underlining mode; it is active until the dialog is closed (per-dialog mode, so if several modeless dialogs are active, only the active one starts underlining when Alt is pressed). One difference between notepad and notepad++ is that in notepad, closing a modeless Find dialog ends the underline mode, while in notepad++, it does not - likely because the latter does not properly reset the mode, only hiding the dialog, not destroying it; I suppose that standard notepad should be considered the reference.
Comment 60 Mike Kaganski 2024-02-10 15:51:11 UTC
Since it was marked an easyhack, things had changed; some functional required to implement this was removed, and now that needed to be reverted. I take this.
Comment 61 Commit Notification 2024-02-10 15:58:43 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f2dfb95258215f90562617823b950c3ed151c1bf

tdf#54169: revert "gtk is the only case auto-accel is true, and the

It will be available in 24.8.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 62 Commit Notification 2024-02-10 15:58:46 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a2dd71feb75d93adf0f0daac899e7476f961ec34

tdf#54169: implement auto-accelerator feature on Windows

It will be available in 24.8.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 63 Commit Notification 2024-02-11 00:43:30 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7d594687216f183a681ecfe7e1d424d8a55422c2

tdf#54169: do not hide mnemonics in menu, when navigating using mouse

It will be available in 24.8.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 64 V Stuart Foote 2024-02-12 15:25:58 UTC
When testing on Windows, be aware that we now follow the os/DE setting of the SPI_GETKEYBOARDCUES flag in configuring the UI. Not from our own Tools -> Options -> Accessibility panel.

The os setting is accessed at Windows 10 via the "Ease of Access Keyboard Settings" dialog, in the stanza "Change how keyboard shortcuts work" with an On--Off slider labeled "Underline access keys when available".

In Windows 11 via Settings -> Accessibility -> Keyboard and the off--on slider for 'Underline access keys'

The implementation at 24.8 follows this setting on relaunch of LO.