Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions devel/222_60.md
Original file line number Diff line number Diff line change
@@ -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 (⌘, ⌥, ⇧).
5 changes: 3 additions & 2 deletions src/Plugins/Qt/qt_ui_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qt_window_widget.hpp"

#include "analyze.hpp"
#include "converter.hpp"
#include "message.hpp"
#include "promise.hpp"
#include "scheme.hpp"
Expand Down Expand Up @@ -513,7 +514,7 @@ qt_ui_element_rep::as_qaction () {
{
typedef quartet<string, int, color, bool> T1;
T1 y= open_box<T1> (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 ()));
Expand Down Expand Up @@ -929,7 +930,7 @@ qt_ui_element_rep::as_qwidget () {
typedef quartet<string, int, color, bool> T1;
T1 y= open_box<T1> (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;

Expand Down
3 changes: 2 additions & 1 deletion src/Texmacs/Server/tm_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading