Re: [dwm] please test hg tip and lemme know any issues

2007-09-19 Thread Anselm R. Garbe
On Wed, Sep 19, 2007 at 12:29:19AM +0200, y i y u s wrote:
> 2007/9/18, Anselm R. Garbe <[EMAIL PROTECTED]>:
> > Hi there,
> >
> >I keep in mind testing the togglemax-patch, but please let me
> >know any issues in hg tip.
> >
> 
> Fallback to fixed font isn't working here. It looks like you are
> checking the error with an or instead of an and, in initfont:
> 
> if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))
> || !(dc.font.xfont = XLoadQueryFont(dpy, "fixed")))
> 
> and imo it should be:
> 
> if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))
> && !(dc.font.xfont = XLoadQueryFont(dpy, "fixed")))

Fixed in hg tip! Thank you!

Regards,
-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361



Re: [dwm] please test hg tip and lemme know any issues

2007-09-19 Thread Anselm R. Garbe
Thanks Peter, I applied your fix.

Regards,
Anselm

On Tue, Sep 18, 2007 at 11:42:55PM +0200, Peter Hartlich wrote:
> Hi,
> 
> I might have added that I've been using the togglemax patch for several
> months now without any issues.
> 
> That aside, there's some code of the form
> 
> | if(!p && !q)
> | x
> | else
> | y
> 
> rewritable as
> 
> | if(p || q)
> | y
> | else
> | x
> 
> and two occurences of "if (" as opposed to "if(" (one of which from my patch,
> sorry). Attached is a trivial patch in case you want to bother.
> 
> Regards,
> Peter

> diff -rup dwm~/dwm.c dwm/dwm.c
> --- dwm~/dwm.c2007-09-18 20:25:23.0 +0200
> +++ dwm/dwm.c 2007-09-18 23:32:23.0 +0200
> @@ -334,10 +334,10 @@ buttonpress(XEvent *e) {
>   if(CLEANMASK(ev->state) != MODKEY)
>   return;
>   if(ev->button == Button1) {
> - if(!isarrange(floating) && !c->isfloating)
> - togglefloating(NULL);
> - else
> + if(isarrange(floating) || c->isfloating)
>   restack();
> + else
> + togglefloating(NULL);
>   movemouse(c);
>   }
>   else if(ev->button == Button2) {
> @@ -347,10 +347,10 @@ buttonpress(XEvent *e) {
>   zoom(NULL);
>   }
>   else if(ev->button == Button3 && !c->isfixed) {
> - if(!isarrange(floating) && !c->isfloating)
> - togglefloating(NULL);
> - else
> + if(isarrange(floating) || c->isfloating)
>   restack();
> + else
> + togglefloating(NULL);
>   resizemouse(c);
>   }
>   }
> @@ -444,7 +444,7 @@ void
>  configurenotify(XEvent *e) {
>   XConfigureEvent *ev = &e->xconfigure;
>  
> - if (ev->window == root && (ev->width != sw || ev->height != sh)) {
> + if(ev->window == root && (ev->width != sw || ev->height != sh)) {
>   sw = ev->width;
>   sh = ev->height;
>   XFreePixmap(dpy, dc.drawable);
> @@ -1404,10 +1404,10 @@ setmwfact(const char *arg) {
>   if(arg == NULL)
>   mwfact = MWFACT;
>   else if(1 == sscanf(arg, "%lf", &delta)) {
> - if(arg[0] != '+' && arg[0] != '-')
> - mwfact = delta;
> - else
> + if(arg[0] == '+' || arg[0] == '-')
>   mwfact += delta;
> + else
> + mwfact = delta;
>   if(mwfact < 0.1)
>   mwfact = 0.1;
>   else if(mwfact > 0.9)
> @@ -1644,7 +1644,7 @@ togglemax(const char *arg) {
>   }
>   else {
>   resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
> - if (!sel->wasfloating)
> + if(!sel->wasfloating)
>   togglefloating(NULL);
>   }
>   drawbar();


-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361



Re: [dwm] please test hg tip and lemme know any issues

2007-09-18 Thread y i y u s
2007/9/18, Anselm R. Garbe <[EMAIL PROTECTED]>:
> Hi there,
>
>I keep in mind testing the togglemax-patch, but please let me
>know any issues in hg tip.
>

Fallback to fixed font isn't working here. It looks like you are
checking the error with an or instead of an and, in initfont:

if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))
|| !(dc.font.xfont = XLoadQueryFont(dpy, "fixed")))

and imo it should be:

if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))
&& !(dc.font.xfont = XLoadQueryFont(dpy, "fixed")))

It works ok with this little change.
and btw, I find more natural that tiled windows become floating just
when you move them over the SNAP value, but I suppose it depends on
how you use this feature. Anyway atm i will be maintaining the
offscreen windows patch which included this functionality. I would
like to know if anybody have tested this patch, I know it is not for
main dwm, but I find very useful the autohidding windows and if more
people is interested I will write a wiki page.

greets,


-- 


- yiyus || JGL .



Re: [dwm] please test hg tip and lemme know any issues

2007-09-18 Thread Peter Hartlich
Hi,

I might have added that I've been using the togglemax patch for several
months now without any issues.

That aside, there's some code of the form

| if(!p && !q)
|   x
| else
|   y

rewritable as

| if(p || q)
|   y
| else
|   x

and two occurences of "if (" as opposed to "if(" (one of which from my patch,
sorry). Attached is a trivial patch in case you want to bother.

Regards,
Peter
diff -rup dwm~/dwm.c dwm/dwm.c
--- dwm~/dwm.c  2007-09-18 20:25:23.0 +0200
+++ dwm/dwm.c   2007-09-18 23:32:23.0 +0200
@@ -334,10 +334,10 @@ buttonpress(XEvent *e) {
if(CLEANMASK(ev->state) != MODKEY)
return;
if(ev->button == Button1) {
-   if(!isarrange(floating) && !c->isfloating)
-   togglefloating(NULL);
-   else
+   if(isarrange(floating) || c->isfloating)
restack();
+   else
+   togglefloating(NULL);
movemouse(c);
}
else if(ev->button == Button2) {
@@ -347,10 +347,10 @@ buttonpress(XEvent *e) {
zoom(NULL);
}
else if(ev->button == Button3 && !c->isfixed) {
-   if(!isarrange(floating) && !c->isfloating)
-   togglefloating(NULL);
-   else
+   if(isarrange(floating) || c->isfloating)
restack();
+   else
+   togglefloating(NULL);
resizemouse(c);
}
}
@@ -444,7 +444,7 @@ void
 configurenotify(XEvent *e) {
XConfigureEvent *ev = &e->xconfigure;
 
-   if (ev->window == root && (ev->width != sw || ev->height != sh)) {
+   if(ev->window == root && (ev->width != sw || ev->height != sh)) {
sw = ev->width;
sh = ev->height;
XFreePixmap(dpy, dc.drawable);
@@ -1404,10 +1404,10 @@ setmwfact(const char *arg) {
if(arg == NULL)
mwfact = MWFACT;
else if(1 == sscanf(arg, "%lf", &delta)) {
-   if(arg[0] != '+' && arg[0] != '-')
-   mwfact = delta;
-   else
+   if(arg[0] == '+' || arg[0] == '-')
mwfact += delta;
+   else
+   mwfact = delta;
if(mwfact < 0.1)
mwfact = 0.1;
else if(mwfact > 0.9)
@@ -1644,7 +1644,7 @@ togglemax(const char *arg) {
}
else {
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
-   if (!sel->wasfloating)
+   if(!sel->wasfloating)
togglefloating(NULL);
}
drawbar();


[dwm] please test hg tip and lemme know any issues

2007-09-18 Thread Anselm R. Garbe
Hi there,

   I keep in mind testing the togglemax-patch, but please let me
   know any issues in hg tip.

Regards,
-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361