Merge lp:~friedman-a/ctwm/fix-utf8 into lp:ctwm

Proposed by Noah Friedman on 2018-05-04
Status: Rejected
Rejected by: Matthew Fuller on 2019-07-07
Proposed branch: lp:~friedman-a/ctwm/fix-utf8
Merge into: lp:ctwm
Diff against target: 40 lines (+18/-0)
1 file modified
win_utils.c (+18/-0)
To merge this branch: bzr merge lp:~friedman-a/ctwm/fix-utf8
Reviewer Review Type Date Requested Status
Matthew Fuller 2018-05-04 Disapprove on 2018-08-25
Review via email: mp+345111@code.launchpad.net

Commit message

win_utils.c: Include ewmh_atoms.h if EWMH defined.
(GetWMPropertyString): decode properties with encoding UTF8_STRING.

Description of the change

Add support for UTF8-encoded window manager properties.

To post a comment you must log in.
Matthew Fuller (fullermd) wrote :

Hey Noah,

Sorry for the delayed response. Technically speaking, a UTF8_STRING WM_NAME isn't really valid, so in a strict sense we're "right" in not handling it. In most cases (outstanding(?) example: chrome) a window that's doing that is really setting the EWMH _NET_WM_NAME property (which _is_ defined as UTF8_STRING) and just blobbing it on to WM_NAME too without thinking.

So, the Rightest(tm) thing to do is support the EWMH props. It's probably reasonable in a Postelian sense to take UTF8_STRING WM_NAME's as long as we're at it, even though that likely gets subsumed by the EWMH stuff in practice anyway.

I've made the larger changes to handle those EWMH props for the window and icon names, and some closely related stuff in <lp:~fullermd/ctwm/winnames>. I'll probably be landing it in trunk in a week or so unless it crashes on me (hasn't yet, in a week+ of running various revisions of it). Feel free to give it a whirl and check that it resolves the situation that led you to this; positive or negative results are definitely appreciated.

Matthew Fuller (fullermd) wrote :

> I've made the larger changes to handle those EWMH props for the window and
> icon names, and some closely related stuff in <lp:~fullermd/ctwm/winnames>.
> I'll probably be landing it in trunk in a week or so [...]

Landed in trunk now.

Matthew Fuller (fullermd) wrote :

OBE: x-ref <email address hidden> in trunk.

review: Disapprove
Noah Friedman (friedman-a) wrote :

Sorry for _my_ late acknowledgement. I've been in the process of moving.

I double checked the application I was trying to accomodate and you're right, it was also setting _NET_WM_NAME. So I completely concur with your assessment and alternate change. Thanks for looking into it.

Unmerged revisions

613. By Noah Friedman on 2018-03-03

* win_utils.c: Include ewmh_atoms.h if EWMH defined.
(GetWMPropertyString): decode properties with encoding UTF8_STRING.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'win_utils.c'
2--- win_utils.c 2017-01-27 07:04:42 +0000
3+++ win_utils.c 2018-05-04 18:36:52 +0000
4@@ -11,6 +11,9 @@
5
6 #include "add_window.h" // NoName
7 #include "ctwm_atoms.h"
8+#ifdef EWMH
9+#include "ewmh_atoms.h"
10+#endif
11 #include "drawing.h"
12 #include "events.h"
13 #include "icons.h"
14@@ -219,11 +222,26 @@
15 char **text_list;
16 int text_list_count;
17
18+#ifdef XA_UTF8_STRING
19+ if(text_prop.encoding == XA_STRING
20+ || text_prop.encoding == XA_UTF8_STRING
21+ || text_prop.encoding == XA_COMPOUND_TEXT) {
22+ int status;
23+ if (text_prop.encoding == XA_UTF8_STRING) {
24+ status = Xutf8TextPropertyToTextList(dpy, &text_prop, &text_list,
25+ &text_list_count);
26+ }
27+ else {
28+ status = XmbTextPropertyToTextList(dpy, &text_prop, &text_list,
29+ &text_list_count);
30+ }
31+#else
32 if(text_prop.encoding == XA_STRING
33 || text_prop.encoding == XA_COMPOUND_TEXT) {
34 /* property is encoded as compound text - convert to locale string */
35 int status = XmbTextPropertyToTextList(dpy, &text_prop, &text_list,
36 &text_list_count);
37+#endif
38 if(text_list_count == 0) {
39 stringptr = NULL;
40 }

Subscribers

People subscribed via source and target branches