Summary: | Does not render non-BMP characters in window titles | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | Christoph Feck <cfeck> |
Component: | core | Assignee: | Christoph Feck <cfeck> |
Status: | RESOLVED FIXED | ||
Severity: | minor | CC: | bobbywibowo, epost.kde, karl, nate |
Priority: | NOR | Flags: | mgraesslin:
Wayland-
mgraesslin: X11+ cfeck: ReviewRequest+ |
Version: | git master | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
URL: | https://phabricator.kde.org/D19052 | ||
Latest Commit: | https://commits.kde.org/kwin/57440d1d6b490cdad51266977d0269a08918b82f | Version Fixed In: | 5.15.5 |
Sentry Crash Report: | |||
Attachments: | Works fine on Wayland |
Description
Christoph Feck
2017-02-22 17:09:49 UTC
ouch, replace "mkdir" with "touch". I tested both files as well as dirs for Konsole/Dolphin. Created attachment 104176 [details]
Works fine on Wayland
For X11 windows I can confirm. For further investigation xprop output: _NET_WM_USER_TIME(CARDINAL) = 5889445 _NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE _KDE_NET_WM_FRAME_STRUT(CARDINAL) = 4, 4, 29, 4 _NET_FRAME_EXTENTS(CARDINAL) = 4, 4, 29, 4 _NET_WM_DESKTOP(CARDINAL) = 0 _KDE_NET_WM_ACTIVITIES(STRING) = "24635a97-5872-486c-a356-f3951f014844" WM_STATE(WM_STATE): window state: Normal icon window: 0x0 _NET_WM_STATE(ATOM) = WM_WINDOW_ROLE(STRING) = "MainWindow#1" _KDE_NET_WM_APPMENU_OBJECT_PATH(STRING) = "/MenuBar/1" _KDE_NET_WM_APPMENU_SERVICE_NAME(STRING) = ":1.57" _NET_WM_ICON_NAME(UTF8_STRING) = _KDE_NET_WM_DESKTOP_FILE(UTF8_STRING) = "org.kde.kwrite" _NET_WM_ICON(CARDINAL) = Icon (16 x 16): β β β β β β β β β β β β β β β β ββββββββββββ Icon (22 x 22): β β β β β β β β β β β β β β β β β β β β β β β ββββββββββββββ Icon (32 x 32): β β βββββ ββββ β β βββββββ ββ β β ββββββββ βββββ β β ββββββ βββββββ β β ββββ ββββ β β β β ββββββββββ βββ β β β β ββββ ββββββββ β β β β βββββββ β β β β β β β β β β β ββββββββββββββββββββββ ββββββββββββββββββββ Icon (48 x 48): β ββ ββ βββββ ββββ βββββ ββ ββ βββββββ βββ ββββ ββ ββ ββββββββ βββββ ββββ ββ ββ ββββββ βββ ββββ βββ ββ ββ ββββ βββββββ ββ ββ ββ ββ ββββββββββ βββββ ββ ββ ββ ββββ ββββββββ ββββ ββ ββ βββββββ βββ ββ ββ ββ ββ ββ ββ ββ ββββββββββ ββββ βββ ββ ββ ββ ββ βββββββ ββββ ββββββ ββ ββ ββ ββ ββββ ββββββββ ββ ββ ββ ββ βββββββ βββββββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββ Icon (64 x 64): β ββ βββββ ββββ ββββββ ββββ ββ ββ βββββββ βββ βββββββ ββ ββ ββ ββββββββ βββββ βββββββ ββ ββ ββββββ βββ ββββ ββββββ ββ ββ ββββ βββββββ ββ ββ ββ ββ ββββββββββ βββββ ββ βββββ ββ ββ ββ ββββ ββββββββ βββββ ββββββββ ββ ββ βββββββ βββ ββ ββ ββ ββ ββββββββββ ββββ βββββ ββββββ ββ ββ βββββββ ββββ ββββββ βββββ ββ ββ ββ ββββ ββββββββ ββββ βββββββββ ββ ββ βββββββ βββββββ ββ ββ ββ ββ ββββββββββ βββββ ββ βββββ ββ ββ ββ ββ ββ ββββ ββββββββ βββββ ββββββββ ββ ββ ββ ββ βββββββ ββββ ββββββ βββββ ββ ββ ββ ββ ββ ββββ ββββββββ ββββ βββββββββ ββ ββ ββ ββ βββββββ βββββββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββ Icon (128 x 128): β ββ βββ ββββ ββββ ββββββββββ ββββββββ ββββββββββββ ββββββββ ββββ ββββββββββ ββββββββ ββββββββββββ ββββββββ ββββ ββββ ββββ ββββββββββββββ ββββββ ββββββββββββββ ββββ ββββ ββββββββββββββ ββββββ ββββββββββββββ ββββ ββββ ββββ ββββ ββββββββββββββββ ββββββββββ ββββββββββββββ ββββ ββββββββββββββββ ββββββββββ ββββββββββββββ ββββ ββββ ββββ ββββββββββββ ββββββ ββββββββ ββββββββββββ ββββ ββββββββββββ ββββββ ββββββββ ββββββββββββ ββββ ββββ ββββ ββββββββ ββββββββββββββ ββββ ββββββββ ββββββββββββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββββββββββββββββββ ββββββββββ ββββ ββββββββββ ββββ ββββ ββββββββββββββββββββ ββββββββββ ββββ ββββββββββ ββββ ββββ ββββ ββββ ββββββββ ββββββββββββββββ ββββββββββ ββββββββββββββββ ββββ ββββββββ ββββββββββββββββ ββββββββββ ββββββββββββββββ ββββ ββββ ββββ ββββββββββββββ ββββββ ββββ ββββββββββββββ ββββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββββββββββββββββββ ββββββββ ββββββββββ ββββββββββββ ββββ ββββββββββββββββββββ ββββββββ ββββββββββ ββββββββββββ ββββ ββββ ββββ ββββββββββββββ ββββββββ ββββββββββββ ββββββββββ ββββ ββββ ββββββββββββββ ββββββββ ββββββββββββ ββββββββββ ββββ ββββ ββββ ββββ ββββββββ ββββββββββββββββ ββββββββ ββββββββββββββββββ ββββ ββββββββ ββββββββββββββββ ββββββββ ββββββββββββββββββ ββββ ββββ ββββ ββββββββββββββ ββββββββββββββ ββββ ββββββββββββββ ββββββββββββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββββββββββββββββββ ββββββββββ ββββ ββββββββββ ββββ ββββ ββββββββββββββββββββ ββββββββββ ββββ ββββββββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββββββ ββββββββββββββββ ββββββββββ ββββββββββββββββ ββββ ββββ ββββββββ ββββββββββββββββ ββββββββββ ββββββββββββββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββββββββββββ ββββββββ ββββββββββββ ββββββββββ ββββ ββββ ββββ ββββββββββββββ ββββββββ ββββββββββββ ββββββββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββββββ ββββββββββββββββ ββββββββ ββββββββββββββββββ ββββ ββββ ββββββββ ββββββββββββββββ ββββββββ ββββββββββββββββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββββββββββββ ββββββββββββββ ββββ ββββ ββββββββββββββ ββββββββββββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββ ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ XdndAware(ATOM) = BITMAP WM_NAME(COMPOUND_TEXT) = "Testπ£.txt " _NET_WM_NAME(UTF8_STRING) = "Testπ£.txt β KWrite" _KDE_NET_WM_USER_CREATION_TIME(CARDINAL) = 5881197 _MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0 _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL _XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1 WM_CLIENT_LEADER(WINDOW): window id # 0x1400007 WM_HINTS(WM_HINTS): Client accepts input or input focus: True Initial state is Normal State. _NET_WM_PID(CARDINAL) = 3175 _NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 20971526 WM_CLASS(STRING) = "kwrite", "kwrite" WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST WM_NORMAL_HINTS(WM_SIZE_HINTS): user specified size: 1193 by 924 program specified minimum size: 484 by 116 window gravity: Static I understand why it is happening (after working on caption support for wayland): on X11 bin printable characters are replaced by spaces. Relevant code is client.cpp line 1445. Now I have two questions: what was the idea behind the string replacement and why is an emoticon not considered as a printable character? The code mentioned in comment #4 does not handle surrogate pairs correctly. A QString is UTF-16 encoded, so the U+1F623 code point for the π£ character appears as 0xD83D 0xDE23, and both are non-printable surrogate code points. There is a QChar::isPrint(uint) static method that works on full 32 bit code points. Untested. If this does not work, I will try a tested patch later. for (int i = 0; i < s.length(); ++i) if (!s[i].isPrint()) { if (s[i].isHighSurrogate() && i + 1 < s.length() && s[i + 1].isLowSurrogate()) { uint uc = QChar::surrogateToUcs4(s[i], s[i + 1]); if (QChar::isPrint(uc)) { // also skip low surrogate ++i; continue; } } s[i] = QChar(u' '); } This only replaces wrong surrogates (not paired), and unprintable paired surrogates with spaces. *** Bug 393740 has been marked as a duplicate of this bug. *** Bug #393740 was marked as duplicate of this bug. That that bug was about soft hyphens being rendered as spaces. But note that soft hyphens are not non-BMP characters; theyβre even part of ISO 8859-1. Is the problem with rendering soft hyphens that theyβre defined as βnon-printableβ? *** Bug 399510 has been marked as a duplicate of this bug. *** Patch from comment would not fix bug 393740. I plan to change it to simply omit unprintable characters. Git commit 57440d1d6b490cdad51266977d0269a08918b82f by Christoph Feck. Committed on 26/04/2019 at 08:52. Pushed by cfeck into branch 'Plasma/5.15'. Fix captions with non-BMP characters KWin replaces any non-printable character with a space. This check does not handle surrogate pairs correctly. Additionally, translators sometimes insert non-printable soft-hyphens into titles, which also cause KWin to display a space instead. This code adds the missing surrogate handling, and (to fix both issues), also removes non-printable characters instead of replacing them with a space. Also moved the changed test after these changes, so that changes in non- printable characters do not cause unneeded redraws. Unit tests adapted by Vlad Zagorodniy. Test Plan: kwrite /tmp/Testπ£.txt shows correct title. I also tested actual non-printable characters, such as 0x1A, and these are correctly omitted. FIXED-IN: 5.15.5 Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: zzag, grasslin, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D19052 M +20 -9 autotests/integration/x11_client_test.cpp M +19 -5 client.cpp https://commits.kde.org/kwin/57440d1d6b490cdad51266977d0269a08918b82f |