diff --git a/devel/222_60.md b/devel/222_60.md new file mode 100644 index 0000000000..97b2550380 --- /dev/null +++ b/devel/222_60.md @@ -0,0 +1,17 @@ +# #2962 There is a problem with the display of accent shortcut keys on macOS + +## Problem +On macOS, modifier keys in accent shortcut tooltips (e.g., in the math toolbar) were displayed incorrectly instead of the corresponding macOS modifier symbols (⌘, ⌥, ⇧) + +## Solution + +This patch ensures that modifier symbols are correctly rendered in Qt tooltips on macOS through two small adjustments: + +### 1. Tooltip UTF-8 Conversion +In `src/Plugins/Qt/qt_ui_element.cpp`, tooltip text is now passed through `cork_to_utf8()` before being converted to a Qt string. This converts TeXmacs character references into their proper Unicode symbols so that Qt displays them correctly. + +### 2. macOS Shortcut Rendering Condition +In `src/Texmacs/Server/tm_config.cpp`, the `kbd_system_prevails` condition was refined to avoid applying legacy modifier substitutions when macOS fonts are already being used. This prevents conflicts with the font-based rendering of macOS modifier symbols. + +## Result +Accent shortcut tooltips on macOS now correctly display modifier keys using the expected symbols (⌘, ⌥, ⇧). diff --git a/src/Plugins/Qt/qt_ui_element.cpp b/src/Plugins/Qt/qt_ui_element.cpp index 9fce616b0e..1eb883063d 100644 --- a/src/Plugins/Qt/qt_ui_element.cpp +++ b/src/Plugins/Qt/qt_ui_element.cpp @@ -19,6 +19,7 @@ #include "qt_window_widget.hpp" #include "analyze.hpp" +#include "converter.hpp" #include "message.hpp" #include "promise.hpp" #include "scheme.hpp" @@ -513,7 +514,7 @@ qt_ui_element_rep::as_qaction () { { typedef quartet T1; T1 y= open_box (get_payload (help, text_widget)); - act->setToolTip (to_qstring (y.x1)); + act->setToolTip (to_qstring (cork_to_utf8 (y.x1))); // HACK: force displaying of the tooltip (needed for items in the // QMenuBar) QObject::connect (act, SIGNAL (hovered ()), act, SLOT (showToolTip ())); @@ -929,7 +930,7 @@ qt_ui_element_rep::as_qwidget () { typedef quartet T1; T1 y= open_box (get_payload (help, text_widget)); QWidget* w= qtw->as_qwidget (); - w->setToolTip (to_qstring (y.x1)); + w->setToolTip (to_qstring (cork_to_utf8 (y.x1))); qwid= w; } break; diff --git a/src/Texmacs/Server/tm_config.cpp b/src/Texmacs/Server/tm_config.cpp index 9310799e05..4a75977f19 100644 --- a/src/Texmacs/Server/tm_config.cpp +++ b/src/Texmacs/Server/tm_config.cpp @@ -328,7 +328,8 @@ kbd_render (tree t) { static string kbd_system_prevails (string s) { string laf= get_preference ("look and feel"); - bool mac= os_macos () && (laf == "default" || laf == "macos"); + bool mac= os_macos () && (laf == "default" || laf == "macos") && + !use_macos_fonts (); if (mac && starts (s, "A-")) { string ss= s (2, N (s)); string r = "escape " * ss;