[dev] [dwm] crash on xsetroot emoji character

2016-10-25 Thread Gaetan Bisson
Hi,

I'm running the latest git snapshot of dwm on Arch Linux. It crashes
(and the X server along with it) deterministically when I run:

xsetroot -name $(printf '\xf0\x9f\xa4\x93')

That's an emoji character. It was in some Web page's title and got
picked up by my browser as window title, which got dwm to crash...

Given I'm not really sure what the best approach to fix this would be
(filter such characters out in gettextprop?) I thought I'd just report
this here. Let me know if there's any additional information I can
provide.

Cheers.

-- 
Gaetan



Re: [dev] [dwm] crash on xsetroot emoji character

2016-10-25 Thread Gaetan Bisson
Hi Laslo,

[2016-10-25 12:45:18 +0200] Laslo Hunhold:
> thanks for the report, but it doesn't crash for me. Before beating this
> horse any more, what you should do is use the stock config.def.h and
> see if the problem persists there.

Unfortunately it crashes even with the default config.def.h.

Now from the thread Petr linked, it appears this problem only affects
those of us running Arch Linux, so that's likely an issue with recent
xorg and/or fontconfig releases.

Cheers.

-- 
Gaetan



Re: [dev] [dwm] crash on xsetroot emoji character

2016-10-25 Thread Gaetan Bisson
[2016-10-25 00:09:42 -1000] Gaetan Bisson:
> I'm running the latest git snapshot of dwm on Arch Linux. It crashes
> (and the X server along with it) deterministically when I run:
> 
>   xsetroot -name $(printf '\xf0\x9f\xa4\x93')

This can be "fixed" by changing the return statement in drw.c's
utf8decodebyte() from:

return (unsigned char)c & ~utfmask[*i];

to just:

return (unsigned char)c;

And dwm simply displays little squares in place of the emoji (other UTF8
characters seem to be displayed normally). Don't ask me why, I don't
speak Unicode...

Cheers.

-- 
Gaetan



Re: [dev] [dwm] crash on xsetroot emoji character

2016-10-25 Thread Gaetan Bisson
Hi Martin,

[2016-10-25 12:55:53 +0200] Martin Kühne:
> IIRC there are fonts who claim ridiculously large glyph sizes in some
> circumstances, and yes that wasn't a dwm issue in and on itself.
> Geatan, what font configuration are you using?

I'm using DejaVu Sans Mono (the default "monospace" on my system).

Cheers.

-- 
Gaetan



Re: [dev] [dwm] crash on xsetroot emoji character

2016-10-25 Thread Gaetan Bisson
[2016-10-25 01:51:35 -1000] Gaetan Bisson:
> [2016-10-25 12:55:53 +0200] Martin Kühne:
> > IIRC there are fonts who claim ridiculously large glyph sizes in some
> > circumstances, and yes that wasn't a dwm issue in and on itself.
> > Geatan, what font configuration are you using?
> 
> I'm using DejaVu Sans Mono (the default "monospace" on my system).

The issue is also there with "Fixed".

-- 
Gaetan



[dev] [PATCH] st: fix BORDER after XDBE patch

2012-08-02 Thread Gaetan Bisson
Hi,

The BORDER setting to st has recently been broken by the XDBE patch;
this is fixed by the patch below, which also removes bufh/bufw since
they are now redundant with the w/h members.

Cheers.

-- 
Gaetan


diff -Naur old/st.c new/st.c
--- old/st.c2012-07-28 22:27:26.0 +1000
+++ new/st.c2012-08-03 01:27:50.284714975 +1000
@@ -186,8 +186,6 @@
int scr;
int w;  /* window width */
int h;  /* window height */
-   int bufw; /* pixmap width  */
-   int bufh; /* pixmap height */
int ch; /* char height */
int cw; /* char width  */
char state; /* focus, redraw, visible */
@@ -1621,8 +1619,8 @@
 
 void
 xresize(int col, int row) {
-   xw.bufw = MAX(1, col * xw.cw);
-   xw.bufh = MAX(1, row * xw.ch);
+   xw.w = MAX(1, 2*BORDER + col * xw.cw);
+   xw.h = MAX(1, 2*BORDER + row * xw.ch);
 }
 
 void
@@ -1671,7 +1669,7 @@
 xclear(int x1, int y1, int x2, int y2) {
XSetForeground(xw.dpy, dc.gc, dc.col[IS_SET(MODE_REVERSE) ? DefaultFG : 
DefaultBG]);
XFillRectangle(xw.dpy, xw.buf, dc.gc,
-  x1 * xw.cw, y1 * xw.ch,
+  BORDER + x1 * xw.cw, BORDER + y1 * xw.ch,
   (x2-x1+1) * xw.cw, (y2-y1+1) * xw.ch);
 }
 
@@ -1757,10 +1755,8 @@
xloadcols();
 
/* window - default size */
-   xw.bufh = term.row * xw.ch;
-   xw.bufw = term.col * xw.cw;
-   xw.h = xw.bufh + 2*BORDER;
-   xw.w = xw.bufw + 2*BORDER;
+   xw.h = 2*BORDER + term.row * xw.ch;
+   xw.w = 2*BORDER + term.col * xw.cw;
 
attrs.background_pixel = dc.col[DefaultBG];
attrs.border_pixel = dc.col[DefaultBG];
@@ -1807,7 +1803,7 @@
 void
 xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
int fg = base.fg, bg = base.bg, temp;
-   int winx = x*xw.cw, winy = y*xw.ch + dc.font.ascent, width = 
charlen*xw.cw;
+   int winx = BORDER+x*xw.cw, winy = BORDER+y*xw.ch + dc.font.ascent, 
width = charlen*xw.cw;
XFontSet fontset = dc.font.set;
int i;