[dev] dwm 5.9 small patch for non xinerama users

2011-07-22 Thread mauro tonon
Hi.

I noted that if i disable Xinerama, i don't use also the following
functions: dirtomon, focusmon, tagmon.
So, i think it is possible to hold all these functions between #ifdef
XINERAMA ... #endif.
The difference in the final binary file size is very little but...
A possible patch is attached...

Bye,
 Mauro.


dwm-5.9-patch_xine.diff
Description: Binary data


[dev][dmenu] loadfont() segmentation fault patch

2011-07-22 Thread lolilolicon
To reproduce the segmentation fault:

dmenu -fn 
-windows-montecarlo-medium-r-normal--11-110-72-72-c-60-microsoft-cp1252
 hello

The culprit is loadfont(). This font[1] triggers XLoadQueryFont(), and
loadfont()
fails in the for loop. At least that's what my quick debug indicated.

I did a diff between dmenu 4.3.1 and 4.4.
Do we really want this twisted pretentious piece of code inside loadfont()?
I for one like the 4.3.1 code better. And it worked.

Patch attached inline. I do it the humble way.

[1] The font is MonteCarlo:
http://bok.net/MonteCarlo/downloads/MonteCarlo-PCF.tgz

--- dmenu-4.4-a/draw.c  2011-07-19 20:31:28.0 +
+++ dmenu-4.4-b/draw.c  2011-07-22 12:34:35.026736893 +
@@ -121,23 +121,25 @@ initfont(DC *dc, const char *fontstr) {
 Bool
 loadfont(DC *dc, const char *fontstr) {
char *def, **missing, **names;
-   int i, n = 1;
+   int i, n;
XFontStruct **xfonts;

if(!*fontstr)
return False;
-   if((dc-font.set = XCreateFontSet(dc-dpy, fontstr, missing, n, 
def)))
+   if((dc-font.set = XCreateFontSet(dc-dpy, fontstr, missing, n, 
def))) {
n = XFontsOfFontSet(dc-font.set, xfonts, names);
-   else if((dc-font.xfont = XLoadQueryFont(dc-dpy, fontstr)))
-   xfonts = dc-font.xfont;
-   else
-   n = 0;
-
-   for(i = 0; i  n; i++) {
-   dc-font.ascent  = MAX(dc-font.ascent,  xfonts[i]-ascent);
-   dc-font.descent = MAX(dc-font.descent, xfonts[i]-descent);
-   dc-font.width   = MAX(dc-font.width,   
xfonts[i]-max_bounds.width);
+   for(i = 0; i  n; i++) {
+   dc-font.ascent  = MAX(dc-font.ascent,  
xfonts[i]-ascent);
+   dc-font.descent = MAX(dc-font.descent, 
xfonts[i]-descent);
+   dc-font.width   = MAX(dc-font.width,   
xfonts[i]-max_bounds.width);
+   }
+   }
+   else if((dc-font.xfont = XLoadQueryFont(dc-dpy, fontstr))) {
+   dc-font.ascent  = dc-font.xfont-ascent;
+   dc-font.descent = dc-font.xfont-descent;
+   dc-font.width   = dc-font.xfont-max_bounds.width;
}
+
if(missing)
XFreeStringList(missing);
return (dc-font.set || dc-font.xfont);



Re: [dev][dmenu] loadfont() segmentation fault patch

2011-07-22 Thread Connor Lane Smith
Hey,

On 22 July 2011 14:14, lolilolicon loliloli...@gmail.com wrote:
 I for one like the 4.3.1 code better. And it worked.

 Patch attached inline. I do it the humble way.

I agree, actually. Pushed to tip.

Thanks,
cls