Bug 168375 - LibreOffice Calc hijacks command-option-space on Mac
Summary: LibreOffice Calc hijacks command-option-space on Mac
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
25.2.4.3 release
Hardware: All macOS (All)
: medium normal
Assignee: Patrick (volunteer)
URL:
Whiteboard: target:26.2.0 target:25.8.3 target:25...
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-12 15:23 UTC by documentfoundation.gutter281
Modified: 2025-09-29 14:37 UTC (History)
1 user (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 documentfoundation.gutter281 2025-09-12 15:23:08 UTC
Description:
On my mac, I often used the keyboard shortcut command-option-space to trigger a certain OS operation (change input source). It works everywhere except LibreOffice Calc. When LibreOffice Calc is in the foreground, it intercepts this key combo and treats it as if I had typed a regular space.

I checked under LibreOffice Calc Tools > Customize > Keyboard, and no keyboard shortcut is assigned for command-option-space.

Steps to Reproduce:
1. In Mac System Settings, under Keyboard > Keyboard Shortcuts, assign command-option-space to Input Sources > Select next source in input menu.
2. In LibreOffice Calc, click on any cell.
3. Press the key combination command-option-space.

Actual Results:
A space character is entered into the cell.

Expected Results:
The key combination should be passed up to the OS and the "change input source" operation should happen.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 25.2.4.3 (AARCH64) / LibreOffice Community
Build ID: 33e196637044ead23f5c3226cde09b47731f7e27
CPU threads: 8; OS: macOS 14.7.4; UI render: Skia/Raster; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 1 Patrick (volunteer) 2025-09-13 19:38:50 UTC
I can also reproduce this bug on macOS Tahoe:

Version: 25.8.1.1 (AARCH64)
Build ID: 54047653041915e595ad4e45cccea684809c77b5
CPU threads: 8; OS: macOS 26.0; UI render: Skia/Metal; VCL: osx
Locale: en-CA (en_CA.UTF-8); UI: en-US
Calc: threaded

Note: on macOS Tahoe, the Command-Option-Space key shortcut is assigned by default so I also had to uncheck the Spotlight > Show Finder search window key shortcut in Keyboard > Keyboard Shortcuts.
Comment 2 Patrick (volunteer) 2025-09-13 20:25:12 UTC
Interestingly, the Command-Option-Space key shortcut actually works in an empty Writer document but not in Calc or Impress. Not sure how to debug that though.
Comment 3 Patrick (volunteer) 2025-09-14 00:39:40 UTC
Below is a debug patch that stops the bug from occurring. It isn't a fix but I think the next step would be to follow pChild->KeyInput( aKeyEvt ); in a debugger to see where it ends up converting Command-Option-Space to a Space event:

diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index a75eb6ada250..1d4d3d421f20 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1232,8 +1232,10 @@ static bool ImplHandleKey( vcl::Window* pWindow, NotifyEventType nSVEvent,
         if ( nSVEvent == NotifyEventType::KEYINPUT )
         {
             UITestLogger::getInstance().logKeyInput(pChild, aKeyEvt);
-            pChild->ImplGetWindowImpl()->mbKeyInput = false;
-            pChild->KeyInput( aKeyEvt );
+            // Commenting out the following stops Command-Option-Space
+            // from inserting a space in Calc and Impress
+            // pChild->ImplGetWindowImpl()->mbKeyInput = false;
+            // pChild->KeyInput( aKeyEvt );
         }
         else
         {
@@ -1314,6 +1316,10 @@ static bool ImplHandleKey( vcl::Window* pWindow, NotifyEventType nSVEvent,
             else
                 bRet = false;
         }
+        // Adding the following makes Command-Option-Space change the
+        // current input source in Calc and Impress
+        else
+            bRet = false;
     }
     else
     {
Comment 4 Commit Notification 2025-09-19 18:08:49 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

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

tdf#168375 return false if both KEY_MOD1 and KEY_MOD2 are pressed

It will be available in 26.2.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 5 Patrick (volunteer) 2025-09-19 19:16:17 UTC
I have committed a fix for this bug and the fix should be in tomorrow's (20 September 2025) nightly master builds:

https://dev-builds.libreoffice.org/daily/master/current.html

Note for macOS testers: the nightly master build installer does not overwrite any LibreOffice official versions. Instead, it will be installed as a separate application called "LibreOfficeDev" in the /Applications folder.

Because this is a "test" build, you will need to do the following steps before you launch the LibreOfficeDev application:

1. Go to the Finder and navigate to the /Applications/Utilities folder
2. Launch the "Terminal" application
3. Paste the following command in the Terminal application window and press the Return key to execute the command:

   xattr -d com.apple.quarantine /Applications/LibreOfficeDev.app
Comment 6 Commit Notification 2025-09-21 17:49:27 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-25-8":

https://git.libreoffice.org/core/commit/2dc604d5dc088dd80c8254bf5e2bddd5acac3bf7

tdf#168375 return false if both KEY_MOD1 and KEY_MOD2 are pressed

It will be available in 25.8.3.

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 7 documentfoundation.gutter281 2025-09-26 22:04:42 UTC
Tested the nightly master build and the bug is fixed. Thank you!
Comment 8 Commit Notification 2025-09-29 14:37:51 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-25-8-2":

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

tdf#168375 return false if both KEY_MOD1 and KEY_MOD2 are pressed

It will be available in 25.8.2.

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.