Re: [dev] [dwm] Crash with emojis on title bar

From: Igor Fontana <rogi_AT_skylittlesystem.org>
Date: Mon, 12 Feb 2018 15:03:40 -0200

>>> >> Pango is a much heavier library than Xft, so I would be surprised if
>>> >> Hiltjo was suggesting that was use Pango.
>>> > I'll give Hiltjo the freedom to share as much as he desires about what
>>> > he's doing, but "maybe" he was talking about a solution that is
>>> > developed in-house.
>>>
>>> Or maybe the solution is to not use any of these font rendering
>>> libraries, as it was some years ago before the Xft patch was merged?
>>>
>>
>> There is no pleasing everyone.
>
> i guess i can live without color emojis lol
>
> really, i dont care about displaying emojis at all, i just wanted dwm
> not crashing because of some :).
>
> i agree that having dwm depend on some huge graphics lib is not desirable.
>
> can anyone think of a way to catch and ignore teh error at least? i
> managed to catch it on xerror(), and it prevented dwm from exiting,
> but it remained unusable.
>
> or perhaps substitute color emojis with black and white ones on teh fly?
>
> <3
>
> PS: im X11 noob

oh yea, and this is wat i did:

diff --git a/dwm.c b/dwm.c
index ec6a27c..da05680 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -2081,6 +2081,13 @@ wintomon(Window w)
 int
 xerror(Display *dpy, XErrorEvent *ee)
 {
+ /* FIXME: avoid crashing because of big glyphs (emojis) that dont fit
+ * title bar */
+ int opcode, event, error;
+ if (XQueryExtension(dpy, "RENDER", &opcode, &event, &error)
+ || (ee->request_code == opcode && ee->error_code == BadLength))
+ return 0;
+
     if (ee->error_code == BadWindow
     || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch)
     || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable)

-- 
Igor
Received on Mon Feb 12 2018 - 18:03:40 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 12 2018 - 18:12:19 CET